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

Miner changes for time-based tenure extends #5493

Merged
merged 51 commits into from
Dec 3, 2024

Conversation

obycode
Copy link
Contributor

@obycode obycode commented Nov 21, 2024

See #5468

This currently also includes #5452, since it has changes that would conflict. Once that is merged into develop, I will merge develop into feat/time-based-tenure-extend and then clean this branch up.

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.
The previous design using a global singleton causes trouble in testing,
when we have multiple miners running in different threads of the same
process.
This is useful when checking the behavior during forking.
`SignerDBListener` struct is for a new thread that is always processing
StackerDB messages from the signers during a mining tenure.

`SignerCoordinator` is the interface that the miner uses with the
`SignerDBListener`, to propose a block and wait for signatures.
@hstove
Copy link
Contributor

hstove commented Nov 22, 2024

Should the signerdb_listener module be called stackerdb_listener instead?

@obycode
Copy link
Contributor Author

obycode commented Nov 22, 2024

Should the signerdb_listener module be called stackerdb_listener instead?

Oh, right. It's signer messages in the stacker db. I guess the signerdb is another thing. Oops. Thanks!

Copy link
Member

@jcnelson jcnelson left a comment

Choose a reason for hiding this comment

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

My biggest feedback here is that the code mixes a lot of low-level thread synchronization code into the business logic, which I think is something we should strive to avoid. The synchronization logic may change down the road depending on what other threads need to interact with signature-gathering, so we should do what we do elsewhere and wrap all of the thread synchronization / state-sharing behind a "Comms" struct, and provide methods there that better reflect the business logic's needs.

@obycode
Copy link
Contributor Author

obycode commented Nov 27, 2024

Thanks for that suggestion @jcnelson. I did that refactoring in cef0dd4. Let me know if that seems like the right level of abstraction now.

@obycode
Copy link
Contributor Author

obycode commented Nov 27, 2024

Note to reviewers - there is an integration test for this behavior in #5471.

Copy link
Contributor

@hstove hstove left a comment

Choose a reason for hiding this comment

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

Mainly requesting changes about not reloading the reward_set when we don't need to. Otherwise, looks great! Nice refactor and smartly implemented.

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.

Noice! LGTM but CI test cache is failing.

Will reapprove once addressed.

@obycode
Copy link
Contributor Author

obycode commented Dec 3, 2024

Noice! LGTM but CI test cache is failing.

Will reapprove once addressed.

Fixed. I previously failed to commit one of the changes for one of those refactorings.

Copy link
Contributor

@hstove hstove left a comment

Choose a reason for hiding this comment

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

LGTM!

@obycode obycode merged commit 061da00 into feat/time-based-tenure-extend Dec 3, 2024
148 of 155 checks passed
@obycode obycode deleted the feat/miner-tenure-extend branch December 3, 2024 22:14
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.

4 participants