Skip to content

Speed up unwinding forks #16583

@mattsse

Description

@mattsse

Describe the feature

this currently behaves like an incremental unwind loop:

// We unwind because of a detached head.
let unwind_to =
local_head.block.number.saturating_sub(BEACON_CONSENSUS_REORG_UNWIND_DEPTH).max(1);

so that for example, if node is on a fork it keeps unwinding until it its local head is part of the canonical chain again.

Especially with lower block times and deep reorgs, e.g. unichain sepolia (>4000 blocks) this entire process will take a while.
to improve this we can do various things
a) this constat should be increased
b) maybe even take into account the chain's blocktime (can be derived from comparing two headers) or from the chainid/chainspec
c) use some exponential unwind distance

c) would be preferred here but is likely the most invasive

we can also include some hint: Option number in here:

DetachedHead {

Additional context

No response

Metadata

Metadata

Assignees

Labels

A-op-rethRelated to Optimism and op-rethA-staged-syncRelated to staged sync (pipelines and stages)C-enhancementNew feature or request

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions