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

Fix: correct burn view for miner block broadcast #5515

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

Conversation

jcnelson
Copy link
Member

This fixes the burn view calculation for the Nakamoto miner when accepting and broadcasting a block.

It builds atop #5508, so don't bother merging until #5508 is in develop.

@jcnelson jcnelson requested a review from a team as a code owner November 27, 2024 20:15
@aldur
Copy link
Contributor

aldur commented Dec 3, 2024

  1. Merge hotfix: remove chain stall race condition #5508 to master
  2. After release merge master into develop.
  3. Merge this to develop.

jferrant
jferrant previously approved these changes Dec 4, 2024
@jcnelson
Copy link
Member Author

jcnelson commented Dec 5, 2024

This now contains the hotfix to the miner @obycode @jferrant

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.

Just a few questions.

@aldur aldur added this to the 3.1.0.0.2 milestone Dec 11, 2024
Comment on lines +537 to +542
match Self::can_continue_tenure(
&self.sortdb,
&mut self.chainstate,
sn.consensus_hash,
mining_pkh_opt,
) {
Copy link
Member

Choose a reason for hiding this comment

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

Does can_continue_tenure need to be invoked here? After the recent changes to this PR, can_continue_tenure checks if there's a sortition in the most recent snapshot, and if there is, it returns None. I think this can just be replaced with return Some(MinerDirective::StopTenure) -- everything else is functionally dead code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I can remove this and just stop the tenure.

Copy link
Member

Choose a reason for hiding this comment

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

I think this was a bad suggestion -- can_continue_tenure does return Ok(Some(..)) here in the event that the next tenure is a reorg, which is the correct behavior (and its roughly how the miner works in develop already). That's why miner_forking and tenure_extend_after_bad_commit started failing.

@kantai kantai self-requested a review January 17, 2025 18:59
Copy link
Member

@kantai kantai left a comment

Choose a reason for hiding this comment

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

This LGTM, will approve once merge conflicts are resolved and tests pass (which I think they should already).

/// We would do this if we were the miner of the ongoing tenure, but did not win the last
/// sortition, and the winning miner never produced a block.
/// Try to start up a tenure-extend.
/// Only do this if the miner won the last-ever sortition but the burn view has changed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this say "the last valid sortition"?

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

Successfully merging this pull request may close these issues.

5 participants