Skip to content

Stop miner when reorg from milestone#1635

Merged
cffls merged 1 commit intodevelopfrom
fix_ms_miner_race
Jul 15, 2025
Merged

Stop miner when reorg from milestone#1635
cffls merged 1 commit intodevelopfrom
fix_ms_miner_race

Conversation

@cffls
Copy link
Copy Markdown
Contributor

@cffls cffls commented Jul 14, 2025

Description

This resolved a possible race condition when a milestone reorg happens at the same time when a validator mines a new block. The miner should be completely stopped when setHead canonical head and inserting finalized chain. Without this, a block producing node can get stuck after a reorg.

Changes

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • Changes only for a subset of nodes

Nodes audience

In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)

Checklist

  • I have added at least 2 reviewer or the whole pos-v1 team
  • I have added sufficient documentation in code
  • I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply
  • Created a task in Jira and informed the team for implementation in Erigon client (if applicable)
  • Includes RPC methods changes, and the Notion documentation has been updated

Cross repository changes

  • This PR requires changes to heimdall
    • In case link the PR here:
  • This PR requires changes to matic-cli
    • In case link the PR here:

Testing

  • I have added unit tests
  • I have added tests to CI
  • I have tested this code manually on local environment
  • I have tested this code manually on remote devnet using express-cli
  • I have tested this code manually on amoy
  • I have created new e2e tests into express-cli

Manual tests

Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it

Additional comments

Please post additional comments in this section if you have them, otherwise delete it

This resolved a possible race condition when a milestone reorg happens at the same time when a validator mines a new block. The miner should be completely stopped when setHead canonical head and inserting finalized chain.
@cffls cffls requested a review from a team July 14, 2025 18:12
@lucca30
Copy link
Copy Markdown
Contributor

lucca30 commented Jul 14, 2025

Mentioning #1631 since it's going to be fixed on this PR.

@cffls cffls merged commit fa78c75 into develop Jul 15, 2025
9 of 10 checks passed
@kamuikatsurgi kamuikatsurgi deleted the fix_ms_miner_race branch July 15, 2025 05:20
cffls added a commit to cffls/bor that referenced this pull request Jul 15, 2025
This resolved a possible race condition when a milestone reorg happens at the same time when a validator mines a new block. The miner should be completely stopped when setHead canonical head and inserting finalized chain.
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.

3 participants