diff --git a/execution/execmodule/forkchoice.go b/execution/execmodule/forkchoice.go index 7186fa73322..1b6f67ca84e 100644 --- a/execution/execmodule/forkchoice.go +++ b/execution/execmodule/forkchoice.go @@ -290,6 +290,14 @@ func (e *ExecModule) unwindIfNeeded( err = fmt.Errorf("updateForkChoice: %w", err) return nil, err } + } else { + execProgress, err := stages.GetStageProgress(tx, stages.Execution) + if err != nil { + return nil, fmt.Errorf("updateForkChoice: %w", err) + } + if execProgress > unwindTarget { + e.logger.Info("updateForkChoice: unwind skipped with executed state above reorg point", "unwindTarget", unwindTarget, "lastCanonicalBlock", lastCanonicalBlock, "execProgress", execProgress) + } } // SD.Unwind (inside RunUnwind) tx-aware-invalidates the BranchCache by // the unwound txNum, so no whole-cache clear is needed here. diff --git a/execution/stagedsync/stage_execute.go b/execution/stagedsync/stage_execute.go index 4fa4990f57f..0a7bdc94e8d 100644 --- a/execution/stagedsync/stage_execute.go +++ b/execution/stagedsync/stage_execute.go @@ -407,6 +407,7 @@ func UnwindExecutionStage(u *UnwindState, s *StageState, doms *execctx.SharedDom // Do not `ResetPendingUpdates()` here. Unlike the disk-unwind path below (which discards then // rebuilds commitment state via unwindExec3 + SeekCommitment), this early return only rewinds the in-RAM overlay + logger.Info(fmt.Sprintf("[%s] Unwind Execution: RAM-only, disk state untouched", u.LogPrefix()), "unwindPoint", u.UnwindPoint, "progress", s.BlockNumber) _, err = unwindDomsToBlock(ctx, rwTx, cfg.blockReader, doms, s.BlockNumber, nil) return err } diff --git a/execution/stagedsync/sync.go b/execution/stagedsync/sync.go index 640d62d1174..91a92181028 100644 --- a/execution/stagedsync/sync.go +++ b/execution/stagedsync/sync.go @@ -140,6 +140,7 @@ func (s *Sync) UnwindTo(unwindPoint uint64, reason UnwindReason, tx kv.Tx) error // Ignore in the case that snapshots are ahead of commitment, it will be resolved later. // This can be a problem if snapshots include a wrong chain so it is ok to ignore it. if errors.Is(err, commitmentdb.ErrBehindCommitment) { + s.logger.Info("UnwindTo: unwind request dropped, target behind commitment", "requested", unwindPoint, "err", err) return nil } if err != nil { @@ -538,6 +539,11 @@ func (s *Sync) unwindStage(initialCycle bool, stage *Stage, sd *execctx.SharedDo unwind.Reason = s.unwindReason if stageState.BlockNumber <= unwind.UnwindPoint { + if stageState.BlockNumber == unwind.UnwindPoint { + s.logger.Info("unwind skipped, stage exactly at unwind point", "stage", stage.ID, "unwindPoint", unwind.UnwindPoint) + } else { + s.logger.Debug("unwind skipped, stage below unwind point", "stage", stage.ID, "progress", stageState.BlockNumber, "unwindPoint", unwind.UnwindPoint) + } return nil }