Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Issue tenure extend if incoming miner fails to mine #5805
base: develop
Are you sure you want to change the base?
Issue tenure extend if incoming miner fails to mine #5805
Changes from 1 commit
2f4f2dd
8029fea
11316ea
71eadc4
fb682c3
677fc8a
b2db43b
0463c7b
c0cf545
1dcd321
4f5ecd9
3469c50
9eb307b
dbf0bd9
3144969
0e694a5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I think a lot of the new/changed functions in this file can be tested with unit tests, so we can at least verify that they make the right decisions on whether or not to allow a BlockFound, a late BlockFound, or an Extension. Can you give that a try?
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.
Will give it a go!
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.
Okay, so I think what's happening here is the following:
canonical_stacks_snapshot
is the bitcoin block that elected the current highest stacks block (which could be the prior tenure, or maybe an earlier tenure if the prior tenure wasn't active)canonical_stacks_snapshot
was also mined by this miner.find_highest_valid_sortition
will only return a sortition strictly aftercanonical_stacks_snapshot.consensus_hash
which tries to build on top of it. This sortition can't have blocks in it yet (because of the first point above).if let Some()
case, that means that there's a new tenure, that new tenure doesn't have blocks yet, and its trying to build off of this miner's view of the stacks tip.sort_tip
is the actual last processed bitcoin block. if the highest valid sortition isn't the last processed bitcoin block, it means that someone had an empty tenure (maybe due to a flash block), but it also means that the miner is unlikely to be able to even communicate over.miners
anyways (because they are "2 miners behind").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.
I, personally, find all that reasoning above very confusing (and it may not be accurate), so I think I'd be supportive of some factoring of this function if there's some clearer way to do this.
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.
Yeah will take a look through it again. I had a really hard time following our current tenure_extend logic but Brice helped me reason it out to a point that maybe I can refactor now.
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.
K I got a first pass that I think works...CI pending...but locally the tests that were causing me issues before are resolved. Looking into cleanup phase now.