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

Feat: wait for outstanding proposals #5284

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open

Conversation

kantai
Copy link
Member

@kantai kantai commented Oct 8, 2024

Description

This PR adds a new heuristic to the nakamoto miner: on the first block of their tenure, if it sees an outstanding proposal from the parent tenure, it will wait a configurable amount of time for the signer set to confirm that proposal and process it. This check occurs before the miner begins block assembly.

* adds new config option `miner.wait_for_proposals_secs: Option<u64>` to control the maximum time that a miner will wait for any of its parent's outstanding block proposals to be confirmed. Default value is 10 seconds.
@kantai kantai requested review from a team as code owners October 8, 2024 14:11
@kantai kantai marked this pull request as draft October 8, 2024 14:11
@kantai
Copy link
Member Author

kantai commented Oct 8, 2024

Marking as a draft for now while I try to figure out the best way to test this!

@hstove
Copy link
Contributor

hstove commented Oct 16, 2024

@kantai I think the main "blocker" here is that the previous miner is going to hit the BurnchainTipChanged error, and thus abort trying to complete the final block in its tenure. So... should the previous tenure's miner use the same "timeout" to try finishing its block?

@kantai
Copy link
Member Author

kantai commented Oct 17, 2024

@kantai I think the main "blocker" here is that the previous miner is going to hit the BurnchainTipChanged error, and thus abort trying to complete the final block in its tenure. So... should the previous tenure's miner use the same "timeout" to try finishing its block?

Hmm -- in the normal mining behavior, whether or not the previous miner hits the BurnchainTipChanged error shouldn't matter. The way that this patch works is that the current miner just checks if there's an outstanding proposal already in the stackerdb with a block height >= their current block height. If the current miner doesn't see such a proposal, they'll just start mining. If such a proposal exists, the prior miner may have indeed interrupted from their signature gathering, but the signer set may still be in the process of approving it. If the signer set approves it, they'll broadcast it themselves anyways.

Copy link
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

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

This approach looks good to me!

@hstove hstove marked this pull request as ready for review October 20, 2024 21:48
@hstove
Copy link
Contributor

hstove commented Oct 20, 2024

Ok, I've got a new signer test that verifies this behavior as working! Ready for review

@hstove hstove requested a review from obycode October 20, 2024 21:49
jferrant
jferrant previously approved these changes Oct 21, 2024
jcnelson
jcnelson previously approved these changes Oct 21, 2024
@hstove hstove removed their request for review October 22, 2024 17:50
Copy link
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

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

🙌

Copy link
Collaborator

@jferrant jferrant left a comment

Choose a reason for hiding this comment

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

No issues with the code, but if you could run clippy on the stacks-node and on libsigner would be awesome.
Also some conflicts need to be addressed.

for e.g. cargo clippy -p stacks-node --no-deps --tests --all-features

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants