-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Promotes accounts hash to a strong type #28930
Conversation
@@ -684,7 +685,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 = "B9ui5cFeJ5NGtXAVFXRCSX4GJ77yLc3izv1E8QE34TdQ")] | |||
#[frozen_abi(digest = "464v92sAyLDZWCXjH6cuQfgrSNuB3PY8cmoVu2dciXvV")] |
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.
ABI digest changed due to giving the accounts hash a type.
diff serde_snapshot__tests__test_bank_serialize__BankAbiTestWrapperNewer_frozen_abi__test_abi_digest_* -bc
--- 1702,1708 ----
! field accounts_hash: solana_program::hash::Hash
struct Hash([u8; 32]) (newtype)
tuple (elements = 32)
element u8
*** 1702,1709 ****
! field accounts_hash: solana_runtime::accounts_hash::AccountsHash
! struct AccountsHash(solana_program::hash::Hash) (newtype)
struct Hash([u8; 32]) (newtype)
tuple (elements = 32)
element u8
@@ -1152,7 +1152,7 @@ impl BankHashStats { | |||
#[derive(Clone, Default, Debug, Serialize, Deserialize, PartialEq, Eq, AbiExample)] | |||
pub struct BankHashInfo { | |||
pub accounts_delta_hash: Hash, | |||
pub accounts_hash: Hash, | |||
pub accounts_hash: AccountsHash, |
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 heart of the change.
1da7740
to
ea548fb
Compare
ea548fb
to
d7eb953
Compare
@@ -141,7 +141,7 @@ fn main() { | |||
} | |||
println!( | |||
"hash,{},{},{},{}%", | |||
results.0, | |||
results.0 .0, |
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.
fmt here? Not sure what formatter is doing.
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.
Yah, fmt adds a space when there are multiple tuple indirections. Always makes me look twice...
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. I love the idea. It will eliminate errors.
Problem
The accounts hash is used as a plain
Hash
in the code base. To add support for Incremental Accounts Hash, we'll need to distinguish between different flavors of accounts hashes. Without any type information, this will be error-prone.Summary of Changes
Promote accounts hash to a strong type:
AccountsHash
.(Future work for Incremental Accounts Hash will expand/alter this type)