Skip to content

simulators/engine: make SetBlock robust for reorg chains#1395

Merged
spencer-tb merged 1 commit into
ethereum:masterfrom
jsvisa:fix-engine-setBlock-robust
Apr 17, 2026
Merged

simulators/engine: make SetBlock robust for reorg chains#1395
spencer-tb merged 1 commit into
ethereum:masterfrom
jsvisa:fix-engine-setBlock-robust

Conversation

@jsvisa

@jsvisa jsvisa commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

Fix the test in InvalidMissingAncestorReOrgSyncTest, ref https://hive.ethpandaops.io/#/test/generic/1772181860-0161f15e42e305dde23a1cb982021954?testnumber=323

FAIL (Invalid Missing Ancestor Syncing ReOrg, Timestamp, EmptyTxs=False, CanonicalReOrg=False, Invalid P8):
TEST ISSUE - Failed to set invalid block: failed to commit state: commit aborted due to database error:
    missing trie node bcce1472eb9dba20d7c6261be584a4f269252a86becefd17c0179c4a9daebdc2 
        (owner 37d65eaa92c6bc4c13a5ec45527f0c18ea8932588728769ec7aecfe6d9f32e42)
        (path ) 
    unexpected node: (37d65eaa92c6bc4c13a5ec45527f0c18ea8932588728769ec7aecfe6d9f32e42 []),
        ...

The engine simulator uses SetBlock to force-insert sidechain blocks, including invalid ones.
SetBlock used the payload parent StateRoot as the only source of truth for state reconstruction.

After inserting invalid blocks, that root can be non-replayable in the local path-scheme trie, so the next insertion fails with:

failed to commit state ... missing trie node.

So proposed to change:

  • Track the actual committed state root produced by SetBlock for each inserted block hash.
  • When inserting a child block, try the provided parentRoot first.
  • If it fails, retry from the tracked committed root of the parent hash.
  • Store the newly committed root for subsequent insertions.

This keeps sidechain injection progressing even when payload-header roots on invalid branches are not replayable.

also closes #1382

…rg sync chains

Signed-off-by: Delweng <delweng@gmail.com>
@jsvisa

jsvisa commented Mar 3, 2026

Copy link
Copy Markdown
Contributor Author

@fjl PTAL

@spencer-tb spencer-tb changed the title fix(simulators/engine): make SetBlock robust for reorg chains simulators/engine: make SetBlock robust for reorg chains Apr 17, 2026

@spencer-tb spencer-tb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM from my side!

@spencer-tb spencer-tb merged commit d80ce53 into ethereum:master Apr 17, 2026
6 checks passed
yperbasis added a commit to erigontech/erigon that referenced this pull request Apr 28, 2026
The previous pinned ref (684d4add) lacks ethereum/hive#1395
"simulators/engine: make SetBlock robust for reorg chains", which is
the upstream fix for the two cancun TEST ISSUE failures observed in
the prior run on this branch:

- Invalid Missing Ancestor Syncing ReOrg, ..., CanonicalReOrg=False, Invalid P8
- Invalid Missing Ancestor Syncing ReOrg, ..., CanonicalReOrg=True, Invalid P8

Bumping to current master (02075f47) so the gate tightening to
max-allowed-failures: 0 in the previous commit is testable against a
hive that no longer trips on the SetBlock reorg path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

InvalidMissingAncestorReOrgSyncTest fails with "missing trie node" due to PathScheme in modified geth

2 participants