Skip to content
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

StorableAccounts::hash() returns &AccountHash #33748

Conversation

brooksprumo
Copy link
Contributor

Problem

Now that we added AccountHash in #33597, we can use it in places where we were previously using a bare Hash. One of those places is the return type of StorableAccounts::hash().

Summary of Changes

Return AccountHash instead.

@brooksprumo brooksprumo self-assigned this Oct 18, 2023
fn hash(&self, index: usize) -> &Hash {
self.account(index).hash()
fn hash(&self, index: usize) -> &AccountHash {
bytemuck::cast_ref(self.account(index).hash())
Copy link
Contributor Author

@brooksprumo brooksprumo Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A subsequent PR will handle returning AccountHash from this account's hash() function. Until then, we can safely cast it.

@brooksprumo brooksprumo marked this pull request as ready for review October 18, 2023 01:36
@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Merging #33748 (f16d46a) into master (d948e5b) will increase coverage by 0.0%.
Report is 14 commits behind head on master.
The diff coverage is 91.6%.

@@           Coverage Diff           @@
##           master   #33748   +/-   ##
=======================================
  Coverage    81.8%    81.8%           
=======================================
  Files         806      806           
  Lines      217851   217852    +1     
=======================================
+ Hits       178204   178242   +38     
+ Misses      39647    39610   -37     

Copy link
Contributor

@yhchiang-sol yhchiang-sol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good given subsequent PRs will handle returning AccountHash.

@brooksprumo brooksprumo merged commit 3a580f4 into solana-labs:master Oct 18, 2023
16 checks passed
@brooksprumo brooksprumo deleted the account-hash/storable-accounts-hash branch October 18, 2023 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants