-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Make StakeHistory clone-on-write #21573
Conversation
/// The SDK's stake history with clone-on-write semantics | ||
#[derive(Default, Clone, PartialEq, Debug, Deserialize, Serialize, AbiExample)] | ||
pub struct StakeHistory(Arc<StakeHistoryInner>); |
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.
Similar to StageDelegations
in #21542, we need an Arc
here since banks are sent across threads (i.e. the accounts background services).
runtime/src/serde_snapshot/tests.rs
Outdated
@@ -312,7 +312,7 @@ mod test_bank_serialize { | |||
|
|||
// This some what long test harness is required to freeze the ABI of | |||
// Bank's serialization due to versioned nature | |||
#[frozen_abi(digest = "5vYNtKztrNKfb6TtRktXdLCbU73rJSWhLwguCHLvFujZ")] | |||
#[frozen_abi(digest = "BJQdQMuXV3349GUWo9Gq3wqxbxV1hJ1jjq9JmXBY3zRV")] |
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.
Assuming #21542 gets merged first, this digest will need to change again.
@@ -14,7 +17,6 @@ use { | |||
self, | |||
state::{Delegation, StakeActivationStatus, StakeState}, | |||
}, | |||
stake_history::StakeHistory, |
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.
Pretty nice! The only visible change to stakes.rs is where to get StakeHistory
from.
Codecov Report
@@ Coverage Diff @@
## master #21573 +/- ##
=======================================
Coverage 81.6% 81.6%
=======================================
Files 508 509 +1
Lines 142340 142380 +40
=======================================
+ Hits 116155 116243 +88
+ Misses 26185 26137 -48 |
Problem
Stake history is cloned into every bank, regardless if is is changed or not.
Summary of Changes
Implement clone-on-write semantics for stake history.