Skip to content

feat(unwind): log reorg paths that bypass the on-disk unwind - #23071

Open
MoonBoi9001 wants to merge 3 commits into
erigontech:mainfrom
MoonBoi9001:mb9/log-reorg-paths-that-skip-disk-unwind
Open

feat(unwind): log reorg paths that bypass the on-disk unwind#23071
MoonBoi9001 wants to merge 3 commits into
erigontech:mainfrom
MoonBoi9001:mb9/log-reorg-paths-that-skip-disk-unwind

Conversation

@MoonBoi9001

@MoonBoi9001 MoonBoi9001 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

This PR adds a log line to each of the 4 code paths that can switch the canonical chain without running the on-disk unwind (defect 2 in #23062). Today they skip silently, so a reorg that leaves stale data behind looks identical to a healthy one in a node's journal; the logs make the skips visible and countable while the right behavior for each path is decided. Nothing else changes: log statements plus 1 stage-progress read in fork choice.

Where each line fires:

  • The RAM-only branch of UnwindExecutionStage logs whenever it handles an unwind without touching disk.
  • The fork-choice extension skip logs only when execution progress is above the reorg point; the normal block-by-block extension stays silent.
  • UnwindTo logs when it drops an unwind request because the target is behind commitment.
  • The per-stage skip logs at Info when a stage sits exactly at the unwind point, and at Debug when it is clearly behind.

Four branches can switch the canonical chain without running the on-disk unwind, and none of
them said so in the log, so a reorg that leaves stale index data behind is invisible in a node's
journal. Each branch now logs when it skips, making the silent cases visible and countable.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves observability around fork-choice / unwind scenarios that can change the canonical chain without running the on-disk unwind, by adding targeted log lines (and one execution-stage progress read in fork-choice) so these “silent skips” become visible in node journals.

Changes:

  • Log when Sync.UnwindTo drops an unwind request because the target is behind commitment.
  • Log when Sync.unwindStage skips unwinding because a stage is at/below the unwind point (Info when exactly at point; Debug when behind).
  • In fork-choice, log when the unwind path is skipped even though executed progress is above the reorg point; add a stage-progress read to support that decision.
  • Log when UnwindExecutionStage takes the RAM-only unwind path (disk state untouched).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
execution/stagedsync/sync.go Adds logs for dropped unwind requests and per-stage unwind skip conditions.
execution/stagedsync/stage_execute.go Adds an Info log when execution unwind is RAM-only (no disk unwind).
execution/execmodule/forkchoice.go Adds an execution progress read and logs when FCU unwind is skipped despite executed state being above reorg target.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread execution/stagedsync/sync.go
Comment thread execution/execmodule/forkchoice.go
The dropped-request log recorded the unwind reason's error, which is often nil (fork-choice
unwinds carry none), hiding why the request was dropped. Record the commitment-check error
that actually caused the drop instead.
The other error returns on the unwind path wrap their errors with the function name; the new
stage-progress read returned its error bare, making failures harder to attribute.
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.

2 participants