-
Notifications
You must be signed in to change notification settings - Fork 677
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
Tenure extend when the previous tenure is bad #5452
Conversation
Ok, the case where the winning miner has committed to the wrong parent tenure is complete. Now I just need to figure out a clean way to attempt a tenure extend after some time has passed and the new miner has not mined a block. |
There is a problem that I discovered which is unrelated to these changes, but becomes a challenge due to these changes. stacks-core/testnet/stacks-node/src/event_dispatcher.rs Lines 110 to 123 in 6e0bd5a
This global becomes a problem when we have tests that run multiple miners. If multiple miners attempt to propose a block at the same time, then we end up having problems. |
The only clear option to me is to make this a Arc+Mutex an instance variable in the |
This PR handles the tenure extend for the case where the next miner has committed to the wrong parent tenure. The other case mentioned in #5361, where a tenure extend is allowed after some time limit has passed with no blocks from the new miner, will be completed in a separate PR. The test for that behavior is already in this PR, but it is not enabled yet. |
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.
Overall LGTM! Mainly requesting a change in the SignerDB migration and then a few extra assertions in your test.
Next step will be to remove the tenure extend disable flag and instead update those forking tests to expect this new behavior. This will be lower priority though as I pivot to the design for #5434 before coming back to this. |
@obycode this was the PR where it was discussed that I could help out on the integration tests, right? |
Yes, see my last comment. I had previously adjusted some tests to disable this feature, but then @kantai suggested (and I agree) that it would be better to instead adjust those forking tests to expect this behavior. |
With this change, the signer will accept a tenure extend from miner N-1 when miner N wins a sortition but commits to the wrong parent tenure.
Thanks for addressing those remaining items for me @hstove! 🙌 Looks good! |
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.
Really just the one nit about combining the schemas to reduce the number of unnecessary versions. :)
This is safe because schema 4 has not yet been released
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Updates the miner to attempt to continue its tenure if the winner of the next tenure commits to the wrong block or if it mines no blocks within some grace period.
Applicable issues
Additional info (benefits, drawbacks, caveats)
Checklist
docs/rpc/openapi.yaml
andrpc-endpoints.md
for v2 endpoints,event-dispatcher.md
for new events)clarity-benchmarking
repobitcoin-tests.yml