Skip to content

Commit 93e15f0

Browse files
committed
op-node: add clarifying comments to logBlockProcessingMetrics
1 parent 5949703 commit 93e15f0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

op-node/rollup/engine/payload_success.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,25 @@ func (e *EngineController) logBlockProcessingMetrics(updateEngineFinish time.Tim
6565
return
6666
}
6767

68-
buildTime := ev.InsertStarted.Sub(ev.BuildStarted)
68+
var totalTime time.Duration
69+
var buildTime time.Duration
6970
insertTime := updateEngineFinish.Sub(ev.InsertStarted)
7071

71-
var totalTime time.Duration
72-
if !ev.BuildStarted.IsZero() {
73-
totalTime = updateEngineFinish.Sub(ev.BuildStarted)
74-
} else {
72+
if ev.BuildStarted.IsZero() {
73+
// BuildStarted may be zero if sequencer already built + gossiped a block, but failed during
74+
// insertion and needed a retry of the insertion.
75+
buildTime = 0
7576
totalTime = insertTime
77+
} else {
78+
buildTime = ev.InsertStarted.Sub(ev.BuildStarted)
79+
totalTime = updateEngineFinish.Sub(ev.BuildStarted)
7680
}
7781

7882
// Protect against divide-by-zero
7983
var mgasps float64
8084
if totalTime > 0 {
85+
// Calculate "block-processing" mgasps.
86+
// NOTE: "realtime" mgasps (chain throughput) is a different calculation: (GasUsed / blockPeriod)
8187
mgasps = float64(ev.Envelope.ExecutionPayload.GasUsed) * 1000 / float64(totalTime)
8288
}
8389

0 commit comments

Comments
 (0)