execution: support long reorgs in non-finality - #23612
Conversation
|
Reviewed the current head. Bugs only. Two of these are the same root cause: 1.
|
There was a problem hiding this comment.
Pull request overview
Extends reorg support during non-finality by retaining execution and snapshot data back to the finalized block.
Changes:
- Uses finality as the pruning and retirement boundary.
- Rejects reorgs crossing finalized history.
- Adds retirement events, deterministic fork generation, import handling, and non-finality tests.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
node/shards/events.go |
Adds state-retirement events. |
node/shards/events_test.go |
Tests retirement notifications. |
node/eth/backend.go |
Configures state reorg depth. |
execution/tests/state_database_test.go |
Migrates test DB options. |
execution/tests/blockgen/chain_makers.go |
Makes beacon roots deterministic. |
execution/state/state_test.go |
Migrates test DB options. |
execution/stagedsync/stageloop/stageloop.go |
Exposes retirement hooks. |
execution/stagedsync/stage_execute.go |
Makes pruning finality-aware. |
execution/stagedsync/stage_execute_unwind_test.go |
Migrates test DB options. |
execution/stagedsync/stage_execute_unwind_routing_test.go |
Migrates test DB options. |
execution/stagedsync/stage_execute_resume_test.go |
Migrates test DB options. |
execution/stagedsync/exec3_parallel_test.go |
Migrates test DB options. |
execution/stagedsync/committer_step_boundary_test.go |
Migrates test DB options. |
execution/execmodule/forkchoice.go |
Enforces finality and emits retirement events. |
execution/execmodule/execmoduletester/options.go |
Adds forkchoice test options. |
execution/execmodule/execmoduletester/exec_module_tester.go |
Extends finality and retirement testing. |
execution/execmodule/exec_module_test.go |
Tests deterministic divergent forks. |
execution/execmodule/exec_module_non_finality_test.go |
Tests long-reorg behavior. |
execution/exec/txtask_test.go |
Migrates test DB options. |
execution/engineapi/engine_api_state_churn_prune_test.go |
Removes obsolete deep-unwind test. |
execution/engineapi/engine_api_state_churn_files_test.go |
Updates reorg test configuration. |
db/test/domains_restart_test.go |
Migrates test DB options. |
db/test/domain_shared_bench_test.go |
Migrates benchmark DB options. |
db/state/aggregator.go |
Gates state retirement by finality. |
db/state/aggregator_bench_test.go |
Migrates benchmark DB options. |
db/snapshotsync/freezeblocks/block_snapshots.go |
Caps block retirement at finality. |
db/rawdb/accessors_chain.go |
Adds finalized-height lookup. |
db/kv/temporal/temporaltest/kv_temporal_testdb.go |
Adds configurable test DB options. |
db/kv/membatchwithdb/memory_mutation_test.go |
Migrates test DB options. |
db/integrity/commitment_version_integration_test.go |
Migrates test DB options. |
db/integrity/commitment_state_verify_test.go |
Migrates test DB options. |
cmd/utils/app/import_reorg_test.go |
Verifies imported finality metadata. |
cmd/utils/app/import_cmd.go |
Preserves and finalizes import forkchoice state. |
cmd/integration/commands/stages.go |
Adapts aggregation return values. |
cmd/integration/commands/dump_state_test.go |
Migrates test DB options. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return nil, err | ||
| } | ||
| for !isCanonicalHash { | ||
| if currentParentNumber < finalisedBlockNum { |
| func ReadForkchoiceFinalizedNum(db kv.Getter) uint64 { | ||
| h := ReadForkchoiceFinalized(db) | ||
| if h == (common.Hash{}) { | ||
| return 0 | ||
| } | ||
| n := ReadHeaderNumber(db, h) | ||
| if n == nil { | ||
| return 0 | ||
| } | ||
| return *n |
|
fixes #17070
(warning: written by a human)
we add support for reorgs longer than MAX_REORG_DEPTH during periods of non-finality by: