Skip to content

Commit

Permalink
fix: reuse timestamp for blocks failing CCC (#1031)
Browse files Browse the repository at this point in the history
we assume that same height wont trigger multiple reorgs to be able
to put an upper bound on the reorg depth. We rely on the fact that
AsyncChecker executes transactions one-by-one and tells worker the
safe set of transactions to include in the replacement block that
wont trigger another error on the same block. If worker changes the
timestamp and that causes significant changes to the execution flow
of included transactions; we might have a height where multiple
reorgs happen.
  • Loading branch information
omerfirmak authored and 0xmountaintop committed Oct 10, 2024
1 parent f957d4d commit cb9964d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions miner/scroll_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,13 @@ func (w *worker) newWork(now time.Time, parentHash common.Hash, reorging bool, r
Time: uint64(now.Unix()),
}

if reorgReason != nil {
// if we are replacing a failing block, reuse the timestamp to make sure
// the information we get from AsyncChecker is reliable. Changing timestamp
// might alter execution flow of reorged transactions.
header.Time = w.chain.GetHeaderByNumber(header.Number.Uint64()).Time
}

parentState, err := w.chain.StateAt(parent.Root())
if err != nil {
return fmt.Errorf("failed to fetch parent state: %w", err)
Expand Down

0 comments on commit cb9964d

Please sign in to comment.