Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions execution/execmodule/forkchoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions execution/stagedsync/stage_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 6 additions & 0 deletions execution/stagedsync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down