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 fee resulted bank hash mismatch #35012

Closed

Conversation

tao-stones
Copy link
Contributor

Problem

New bank not created from parent has its fee_structure.lamports_per_signature initialized by genesis_config.fee_rate_governor, which should not be the case if bank is created from snapshot where fee_rate_governor is deserialized.

Summary of Changes

For a backport-able fix:

  • undo the link between fee_structure and fee_rate_governor for now
  • clarify the calculate_fee() parameter that is used for testing only (that doesn't support fee)

Fixes #35008

@tao-stones tao-stones added the v1.18 PRs that should be backported to v1.18 label Jan 30, 2024
Copy link
Contributor

mergify bot commented Jan 30, 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.

if for_test_only == 0 {
return 0;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the parameter's original function - to set entire fee to zero if it is zero

Copy link
Contributor

Choose a reason for hiding this comment

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

this looks extremely hacky. can we just revert and try again, only correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was exactly what it did originally - read lamports_per_signature from blockhash_queue or nonce, if it is zero, the multiple 0 to calculated fee (for test); otherwise multiple 1 to calculated fee.

I was trying to get ride of this "for test only" parameter by initializing fee_structure from fee_rate_governor, which seems to not as reliable approach.

I'll revert the chain of PRs first. Then look for a better way to fix that weird parameter.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll revert the chain of PRs first. Then look for a better way to fix that weird parameter.

Are you planning to revert #34970 and #34865 or stick with this PR? I'm fine with either approach. If possible I'd like to release v1.18.1 today.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If revert, also need to revert #34757, but I really want/need to keep its function. I am thinking either keep this PR (cause it's essentially what the reverted code does), or I can combine reverting #34865, #34757 and #34970, then an additional PR to do what #34757 on reverted codebase. @t-nelson are you have strong opinions on not to use this PR (even changing the var name to test_fee_rate, which is really what it is in current code base)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#35016 reverts 3 PRs. imo, less better than this PR 😜

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer this PR too... the new arg name and early return improve readability.

@tao-stones
Copy link
Contributor Author

confirmed bankhash matches with testnet ledger.

Going to confirm it does the same with mainnet ledger.

@tao-stones tao-stones mentioned this pull request Jan 30, 2024
Copy link

codecov bot commented Jan 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c8cdd00) 81.6% compared to head (f6d7f19) 81.6%.
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #35012   +/-   ##
=======================================
  Coverage    81.6%    81.6%           
=======================================
  Files         830      830           
  Lines      224836   224835    -1     
=======================================
+ Hits       183512   183533   +21     
+ Misses      41324    41302   -22     

Copy link
Contributor

@willhickey willhickey left a comment

Choose a reason for hiding this comment

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

LGTM

@tao-stones
Copy link
Contributor Author

close, in fav of #35018

@tao-stones tao-stones closed this Jan 30, 2024
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.

v1.18 hash mismatch
3 participants