-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
feat: support fetching historical proposer duties #7130
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #7130 +/- ##
============================================
- Coverage 49.12% 49.12% -0.01%
============================================
Files 597 597
Lines 39718 39721 +3
Branches 2085 2085
============================================
- Hits 19512 19511 -1
- Misses 20165 20168 +3
- Partials 41 42 +1 |
Performance Report✔️ no performance regression detected Full benchmark results
|
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.
historical state regen is not efficient until state diff strategy is implemented, even for state has just finalized
in the worse case we may have to reprocess 31 epochs which could be up to 3 minutes just to regen given 120ms to process a block and 2s to process an epoch, which could be too much (I'm not sure the performance of other clients)
instead of that we can think about a caching strategy similar to our balances cache:
processState(blockRootHex: RootHex, state: CachedBeaconStateAllForks): void { |
this shares the same proposers
memory with CachedBeaconState
so does not cost us much
I was looking at extending the caches and storing proposers by epoch in
For the most common case, i.e. querying the finalized state we don't even need to trigger historical regen and it only takes around 2 seconds. For earlier states, you are right it takes a bit but at least we can serve this data, so depending on the use case it might be fine to wait 2 minutes for the response, we have the same limitation currently when serving the state via Imo we should use the same pattern everywhere to serve historical data and once we have #7005 it solves all the limitations. |
* feat: support fetching historical proposer duties * Clone state before creating cached beacon state * Fix error message * Update test cases * Skip syncing pubkeys and sync committe cache * Update proposers tests epoch * Use switch/case instead of if/else * Add comment to clarify when head state can be used * Use loadState instead of creating a separate ViewDU * Clarify not yet initialized error for prev proposer duties * Assert loaded state epoch matches requested
Motivation
Fetching historical (mostly finalized) proposer duties has been a requirement by smoothing pools in the past. In addition, dappnode is building a staking rewards dashboard which also requires to pull finalized proposer duties from the node of the staker. Right now, Lodestar is the only beacon node that does not support serving this data.
Description
This change adds supports to fetch historical proposer duties by utilizing historical state regen added in #6033.
This has it's known limitations of being rather slow for far back epochs but for the most common use case which is fetching proposer duties for the finalized epoch it takes around 2 seconds to fetch duties which seems acceptable.
TODO