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

Use parent blockhash to seed EpochRewardsHasher #34744

Merged

Conversation

CriesofCarrots
Copy link
Contributor

Problem

Partitioned rewards code requires exposing the parent bank's hash to clients trying to find stake rewards, because that is the seed used for the partition hasher:

&self.parent_hash(),

The EpochRewardsHasher calls this the parent_block_hash

parent_block_hash: &Hash,
, so it's unclear which hash was intended.

Either way, it will certainly be easier for clients if we use the blockhash, since this is already stored in block metadata (and can be easily looked up).

Summary of Changes

Update Bank::calculate_rewards_for_partitioning() to pass the parent blockhash to EpochRewardsHasher::calculate_rewards_for_partitioning()

Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (166be29) 81.7% compared to head (39e87e2) 81.8%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #34744   +/-   ##
=======================================
  Coverage    81.7%    81.8%           
=======================================
  Files         823      823           
  Lines      222865   222865           
=======================================
+ Hits       182262   182319   +57     
+ Misses      40603    40546   -57     

Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

lgtm!

cc/ @HaoranYi for viz

@CriesofCarrots CriesofCarrots merged commit 8e29436 into solana-labs:master Jan 11, 2024
35 checks passed
@HaoranYi
Copy link
Contributor

yes. lgtm!

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.

3 participants