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

Fix bank new_from_field for epoch reward status #34992

Merged
merged 2 commits into from
Jan 29, 2024

Conversation

HaoranYi
Copy link
Contributor

@HaoranYi HaoranYi commented Jan 28, 2024

Problem

We have a bug when reconstruct the reward_status on the bank from deserialized field.

Bank new_from_field is not using deserialized epoch reward status from field to reconstruct the bank.

This should have been caught by our tests. But unfortunately, there is a typo in the test, which didn't catch the bug.

Summary of Changes

  • fix bank new_from_field to reconstruct epoch reward status.
  • fix bank serde test assert for epoch reward status

Fixes #

Copy link
Contributor

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

Lgtm, thanks for fixing. I think we'll want to backport this to v1.18 too.

@HaoranYi HaoranYi requested a review from jstarry January 28, 2024 22:04
@HaoranYi HaoranYi added the v1.18 PRs that should be backported to v1.18 label Jan 28, 2024
Copy link
Contributor

mergify bot commented Jan 28, 2024

Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis.

Copy link

codecov bot commented Jan 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (52d3c02) 81.6% compared to head (923c8d1) 81.6%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #34992   +/-   ##
=======================================
  Coverage    81.6%    81.6%           
=======================================
  Files         830      830           
  Lines      224897   224897           
=======================================
+ Hits       183563   183576   +13     
+ Misses      41334    41321   -13     

@HaoranYi HaoranYi merged commit b1f8a89 into solana-labs:master Jan 29, 2024
36 checks passed
@HaoranYi HaoranYi deleted the 2024_jan_28 branch January 29, 2024 15:00
mergify bot pushed a commit that referenced this pull request Jan 29, 2024
* fix bank new_from_field for epoch reward status

* fix bank serde test assert for epoch reward status

---------

Co-authored-by: HaoranYi <[email protected]>
(cherry picked from commit b1f8a89)
willhickey pushed a commit that referenced this pull request Jan 31, 2024
…34992) (#35002)

Fix bank new_from_field for epoch reward status (#34992)

* fix bank new_from_field for epoch reward status

* fix bank serde test assert for epoch reward status

---------

Co-authored-by: HaoranYi <[email protected]>
(cherry picked from commit b1f8a89)

Co-authored-by: HaoranYi <[email protected]>
@t-nelson
Copy link
Contributor

isn't this tens of mb of duplicative data that could be trivially recovered upon snapshot load?

@HaoranYi
Copy link
Contributor Author

HaoranYi commented Jan 31, 2024

isn't this tens of mb of duplicative data that could be trivially recovered upon snapshot load?

Yes, if the snapshot is taken during a rewarding period. All rewards are serialized to the snapshot and deserialized into the bank upon loading.

@t-nelson
Copy link
Contributor

yes but what this is change is introducing, is totally duplicative of data that's already stored in a snapshot. we can just recover it at snapshot load. it's less than a slot's worth of work

@HaoranYi
Copy link
Contributor Author

By recover do you mean recompute them?
AFAIK, current reward compute code doesn't support back computing the epoch reward at the epoch boundary. Vote states, which were used to compute the stake reward before at the epoch boundary, have already changed.

@jstarry
Copy link
Member

jstarry commented Jan 31, 2024

I think we can discuss in solana-foundation/solana-improvement-documents#116 instead, this PR is just for a bugfix.

@t-nelson
Copy link
Contributor

t-nelson commented Feb 1, 2024

I think we can discuss in solana-foundation/solana-improvement-documents#116 instead, this PR is just for a bugfix.

this pr should be reverted before we forget and ship it to some public cluster

@HaoranYi
Copy link
Contributor Author

HaoranYi commented Feb 1, 2024

I don't understand why we can't ship this PR to public cluster.
If we don't enable the partition reward feature, the reward status will just be empty, same as what we have now.
If we enable the partition reward feature, without this bugfix the cluster may diverge.
In both cases, we want to have this bug fix.

@jstarry
Copy link
Member

jstarry commented Feb 1, 2024

This should definitely not be reverted. It's a bugfix regardless of whether we ship snapshot changes or not. We only include epoch rewards status in the snapshot if the partitioned rewards feature is activated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.18 PRs that should be backported to v1.18
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants