-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPC: rewards, return error if epoch_boundary_block is a lie #2758
RPC: rewards, return error if epoch_boundary_block is a lie #2758
Conversation
If this PR represents a change to the public RPC API:
Thank you for keeping the RPC clients in sync with the server API @CriesofCarrots. |
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic lgtm. left one error message clarifying nit that you can take or leave
Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com>
* Return error if epoch_boundary_block is not actually the epoch boundary block * Update rpc-client-api/src/custom_error.rs Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com> --------- Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com> (cherry picked from commit 9a4b094)
Backports to the stable branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. |
* Return error if epoch_boundary_block is not actually the epoch boundary block * Update rpc-client-api/src/custom_error.rs Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com> --------- Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com> (cherry picked from commit 9a4b094) # Conflicts: # rpc-client-api/src/custom_error.rs # rpc/src/rpc.rs
…ckport of #2758) (#2767) RPC: rewards, return error if epoch_boundary_block is a lie (#2758) * Return error if epoch_boundary_block is not actually the epoch boundary block * Update rpc-client-api/src/custom_error.rs Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com> --------- Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com> (cherry picked from commit 9a4b094) Co-authored-by: Tyera <tyera@anza.xyz>
…ackport of #2758) (#2781) * RPC: rewards, return error if epoch_boundary_block is a lie (#2758) * Return error if epoch_boundary_block is not actually the epoch boundary block * Update rpc-client-api/src/custom_error.rs Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com> --------- Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com> (cherry picked from commit 9a4b094) # Conflicts: # rpc-client-api/src/custom_error.rs # rpc/src/rpc.rs * Fix conflicts --------- Co-authored-by: Tyera <tyera@anza.xyz>
Problem
In
getInflationReward
, theepoch_boundary_block
determined here may not actually be the epoch boundary block. This can happen if there is a gap in the ledger or long-term storage followed by finalized blocks.In such a case, it will be impossible to find any rewards.
Summary of Changes
Check the parent slot of
epoch_boundary_block
; if it is not smaller than the knownfirst_slot_in_epoch
,epoch_boundary_block
is a lie. Return a custom RPC error in this case, pointing to server-side issues.