Skip to content

v2.2.5 - backport to develop#1615

Merged
pratikspatil024 merged 22 commits intodevelopfrom
master
Jul 4, 2025
Merged

v2.2.5 - backport to develop#1615
pratikspatil024 merged 22 commits intodevelopfrom
master

Conversation

@pratikspatil024
Copy link
Copy Markdown
Member

Description

Please provide a detailed description of what was done in this PR

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

Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it

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

marcello33 and others added 22 commits June 18, 2025 21:39
This commit implements a fork detection mechanism in the whitelist milestone validation system to resolve synchronization issues that occur when nodes sync from new milestone with extremely low latency. The problem was that nodes on different chain forks would be unable to sync with peers due to milestone validation rejecting chains with different block hashes, leading to "mismatch error" failures.

Root Cause Analysis:
The issue was caused by chain fork lock-in where milestone validation prevented nodes stuck on wrong forks from syncing to the correct canonical chain. Debug logs revealed that different nodes had different block hashes for the same block numbers, confirming a fork scenario where milestone validation was blocking recovery.

Solution Implemented:
- Added ChainReader interface to milestone validation for blockchain access
- Implemented fork detection logic in IsValidPeer method that checks if local blockchain has different hash than milestone hash for the same block number
- When a fork is detected, the validation allows peer synchronization to proceed, enabling automatic recovery to the canonical chain
- Added SetBlockchain method to inject blockchain reference after both whitelist service and blockchain are initialized (avoiding circular dependency)
- Updated service creation in eth/backend.go to set blockchain reference after initialization
When checkpoint verifier inserts canonical chain after rewind, the fork choice
logic in writeBlockAndSetHead() may determine that no reorg is needed, causing
blocks to be inserted with SideStatTy instead of CanonStatTy. This prevents
writeHeadBlock() from being called, leaving canonical hash mappings outdated.

The issue manifests as:
- "Successfully inserted canonical chain" log appears
- GetBlockByNumber() still returns old block hash
- Fork detection triggers false positives for whitelisted blocks
- Milestone reorg protection fails

Fix by explicitly calling SetCanonical() after InsertChain() to force
canonical status and ensure proper canonical hash mapping updates.
eth: fix canonical chain state inconsistency in checkpoint verifier
…rite the state sync records for a range of blocks (#1597)
…age after heimdall (v1 -> v2) migration (#1598)

* consensus/bor, params: added OverrideStateSyncRecordsInRange to overwrite the state sync records for a range of blocks

* amoy: added blocks in the OverrideStateSyncRecordsInRange for the outage after heimdall (v1 -> v2) migration
This is to fix a problem when the node is stuck at a loop when it is initially started and trying to whitelist the first milestone.
Instead of tracking all the block from the genesis, the metrics should just update the from the start block in the milestone.
@pratikspatil024 pratikspatil024 requested a review from a team July 4, 2025 14:22
@pratikspatil024 pratikspatil024 added the do not squash and merge This PR will be NOT be squashed and merged label Jul 4, 2025
@pratikspatil024 pratikspatil024 merged commit 80dcc84 into develop Jul 4, 2025
20 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not squash and merge This PR will be NOT be squashed and merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants