Skip to content
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

fix(rpc): address slowness in validator rpc #3960

Merged
merged 6 commits into from
Mar 5, 2021
Merged

Conversation

bowenwang1996
Copy link
Collaborator

@bowenwang1996 bowenwang1996 commented Feb 15, 2021

Fix #3614 by disallowing querying the validator rpc endpoint through block hash. Instead, valid queries are either for an epoch or for latest data. Inside epoch manager, validator info for past epochs are stored when we finalize an epoch to ensure that queries will not cause recomputation, which can potentially block the client actor.

Test plan

  • test_get_validator_info
  • test_get_validator_info_rpc

chain/epoch_manager/src/lib.rs Outdated Show resolved Hide resolved
chain/epoch_manager/src/lib.rs Outdated Show resolved Hide resolved
chain/epoch_manager/src/lib.rs Show resolved Hide resolved
bowenwang1996 and others added 2 commits February 16, 2021 17:02
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
chain/chain/src/types.rs Outdated Show resolved Hide resolved
chain/client/src/view_client.rs Outdated Show resolved Hide resolved
chain/jsonrpc-primitives/src/types/validator.rs Outdated Show resolved Hide resolved
chain/jsonrpc/src/lib.rs Show resolved Hide resolved
Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve to unblock this PR. We discussed it offline, and it seems there is a clear path to implement it in a backward-compatible way ([null], ["block-hash"], [block-height-u64] should keep working fine, though the latter two will resolve to the next_epoch_id of the given block, representing the validators stats for the whole epoch, but that is fine)

@near-bulldozer near-bulldozer bot merged commit 272b314 into master Mar 5, 2021
@near-bulldozer near-bulldozer bot deleted the fix-validator-rpc branch March 5, 2021 04:08
bowenwang1996 added a commit that referenced this pull request Mar 11, 2021
Fix #3614 by disallowing querying the validator rpc endpoint through block hash. Instead, valid queries are either for an epoch or for latest data. Inside epoch manager, validator info for past epochs are stored when we finalize an epoch to ensure that queries will not cause recomputation, which can potentially block the client actor.

Test plan
---------
* `test_get_validator_info`
* `test_get_validator_info_rpc`
near-bulldozer bot pushed a commit that referenced this pull request Apr 17, 2021
After #3960 archival nodes are not able to serve validator information for historical data since `ColEpochValidatorInfo` was not populated. This PR does the migration for archival nodes. Fixes #4197.

Test plan
---------
Tested with an archival node on mainnet. It works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Address slowness in validator rpc endpoint
4 participants