-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Uses AccountHash in StorableAccountsWithHashesAndWriteVersions #33751
Uses AccountHash in StorableAccountsWithHashesAndWriteVersions #33751
Conversation
9e5d2a2
to
e2f6683
Compare
@@ -30,7 +31,7 @@ pub struct StorableAccountsWithHashesAndWriteVersions< | |||
'b, | |||
T: ReadableAccount + Sync + 'b, | |||
U: StorableAccounts<'a, T>, | |||
V: Borrow<Hash>, |
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 the main change.
pub fn hash(&self) -> &'storage AccountHash { | ||
let hash = match self { | ||
Self::AppendVec(av) => av.hash(), | ||
Self::Hot(hot) => hot.hash().unwrap_or(&DEFAULT_ACCOUNT_HASH), | ||
} | ||
Self::Hot(hot) => hot.hash().unwrap_or(&DEFAULT_ACCOUNT_HASH.0), | ||
}; | ||
bytemuck::cast_ref(hash) |
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.
Subsequent PRs will handle returning AccountHash
from the underlying AppendVec and TieredStorage. For now, it's safe to cast them.
@@ -6612,7 +6612,7 @@ impl AccountsDb { | |||
let pubkeys = self.get_filler_account_pubkeys(filler_accounts as usize); | |||
pubkeys.iter().for_each(|key| { | |||
accounts.push((key, &account)); | |||
hashes.push(hash); | |||
hashes.push(AccountHash(hash)); |
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 will be fixed up (i.e. go away) once a subsequent PR changes get_filler_account_pubkeys()
to return an AccountHash
instead of a bare Hash
.
c5370a5
to
6f0056d
Compare
6f0056d
to
2a62ecd
Compare
Rebased and force-pushed to address a merge conflict. No new changes were made. |
Codecov Report
@@ Coverage Diff @@
## master #33751 +/- ##
=======================================
Coverage 81.8% 81.8%
=======================================
Files 806 806
Lines 217908 217911 +3
=======================================
+ Hits 178270 178297 +27
+ Misses 39638 39614 -24 |
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.
LG!
Problem
Now that we added
AccountHash
in #33597, we can use it in places where we were previously using a bareHash
. One of those places is inStorableAccountsWithHashesAndWriteVersions
.Summary of Changes
Use
AccountHash
instead of bareHash
inStorableAccountsWithHashesAndWriteVersions
.