-
Notifications
You must be signed in to change notification settings - Fork 697
Fix: tenure downloader reward set error #6234 #6276
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
base: develop
Are you sure you want to change the base?
Conversation
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.
Looks good. Thanks for the clear comments!
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.
👍
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.
lgtm! The comment made it way clearer :) I just left a couple of comments that you can feel free to just close them and merge
Co-authored-by: Francesco <2530388+Jiloc@users.noreply.github.com>
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.
LGTM!
This PR refactors the reward cycle fetching logic in the tenure downloader and fixes the #6234 bug.
First -- I moved the
downloader_block_height_to_reward_cycle
method into a newly named (and commented) method thats a static method of the NakamotoDownloadStateMachine struct. The logic of that calculation is: given a block commit at burn height X, what is the latest possible reward cycle for a tenure the commit confirms?I think that the only places we want to use this calculation are in
WantedTenures
request generation -- basically, given a sortition tip, what tenures could we download and confirm?The bug in #6234 was caused by the fact that this calculation was also used for the reward set caching logic of the (unconfirmed) tenure downloader. This meant that for the first two tenures of a new reward cycle, the wrong reward sets would be used for download validation. The fix for this was to simply use the normal reward set calculation in those instances.
This PR adds an integration test for this behavior: basically, perform signer-set rollover with 2 active nodes. Importantly, in order for the test to actually cover the behavior, the nodes need to refuse block pushes (otherwise, they never need to use the TenureDownloader at all).