-
Notifications
You must be signed in to change notification settings - Fork 221
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
Supports accounts lt hash in snapshots #3096
Conversation
runtime/src/bank/serde_snapshot.rs
Outdated
@@ -546,7 +578,7 @@ mod tests { | |||
#[cfg_attr( | |||
feature = "frozen-abi", | |||
derive(AbiExample), | |||
frozen_abi(digest = "8hwm4YsQXJWGZdp762SkJnDok29LXKwFtmW9oQ2KSzrN") | |||
frozen_abi(digest = "CKb4Lp4AEJKBCLqHCFSSsntQU3MpcphA38RcAXASeDuG") |
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.
The digest changed here because we've added the accounts lt hash to the snapshot.
Here's a diff from the ABI export files:
[snipped; above is all the same]
field accounts_lt_hash: core::option::Option<solana_runtime::serde_snapshot::types::SerdeAccountsLtHash>
enum Option (variants = 2)
variant(0) None (unit)
variant(1) Some(solana_runtime::serde_snapshot::types::SerdeAccountsLtHash) (newtype)
struct SerdeAccountsLtHash(solana_runtime::serde_snapshot::types::_::<impl serde::ser::Serialize for solana_runtime::serde_snapshot::types::SerdeAccountsLtHash>::serialize::__SerializeWith) (newtype)
tuple (elements = 1024)
element serde_with::ser::SerializeAsWrap<u16, serde_with::Same>
primitive u16
[snipped; this is repeated for all 1024 elements]
(Note: The digest in the PR now is different because the original/master digest has also changed. The changes in the ABI are still the same as described in this comment though.)
frozen abi diff ``` field accounts_lt_hash: core::option::Option<solana_runtime::serde_snapshot::types::SerdeAccountsLtHash> enum Option (variants = 2) variant(0) None (unit) variant(1) Some(solana_runtime::serde_snapshot::types::SerdeAccountsLtHash) (newtype) struct SerdeAccountsLtHash(solana_runtime::serde_snapshot::types::_::<impl serde::ser::Serialize for solana_runtime::serde_snapshot::types::SerdeAccountsLtHash>::serialize::__SerializeWith) (newtype) tuple (elements = 1024) element serde_with::ser::SerializeAsWrap<u16, serde_with::Same> primitive u16 ```
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.
lgtm
@@ -662,6 +666,7 @@ impl BankFieldsToSerialize { | |||
is_delta: bool::default(), | |||
accounts_data_len: u64::default(), | |||
versioned_epoch_stakes: HashMap::default(), | |||
accounts_lt_hash: Some(AccountsLtHash(LtHash([0x7E57; LtHash::NUM_ELEMENTS]))), |
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.
does it have any special meaning for 7e57?
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.
This is my approximation for "TEST" 😸
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.
so, the plan is to include lt hash in snapshot when the feature is enabled?
Yes, the lt hash will go in the snapshot. Both when the feature is enabled, or if the cli arg is set. |
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.
lgtm
Problem
The accounts lt hash is not in snapshots, so it must always be regenerated. While testing, this is kinda OK, but when the real feature is enabled, that won't be sufficient.
Summary of Changes
Serialize and deserialize the accounts lt hash from snapshots. But only if the CLI arg is passed in (as there's not a feature-gate yet). This let's us get testing/runtime on startup asap.