This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
deserialize StakeHistory incrementally #35252
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2501babe
commented
Feb 20, 2024
2501babe
commented
Feb 20, 2024
2501babe
commented
Feb 20, 2024
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #35252 +/- ##
=========================================
- Coverage 81.6% 81.6% -0.1%
=========================================
Files 833 833
Lines 224761 224820 +59
=========================================
+ Hits 183481 183501 +20
- Misses 41280 41319 +39 |
This repository is no longer in use. Please re-open this pull request in the agave repo: https://github.com/anza-xyz/agave |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
with 512 maximum entries, each of which is four u64, stake history can be as large as 16kb. the current stake program makes the data structure available as part of the transaction context, but in moving to bpf, we don't want to have to deserialize the entire thing and use half our heap, since stake history is used in the stake program typically (perhaps exclusively) to locate only one 32 byte entry for a given epoch
Summary of Changes
this adds a new struct
StakeHistoryData
, which is a newtype wrapper over the raw account data. it also adds a traitStakeHistoryGetEntry
, which provides a function equivalent toStakeHistory::get()
, and changes some key consumers ofStakeHistory
to acceptT: StakeHistoryGetEntry
instead. this allows existing functionality to (NOTE: mostly, see comments) remain unchanged, while also permitting new functionality for the bpf stake programthe impl for
StakeHistoryData
does the same thing asStakeHistory::get()
: search for an entry matching a given epoch and return it, parsing only as much of the data is needed to locate the relevant entry