Skip to content

Merge branch 'develop' into state-sync-tracing

02f998a
Select commit
Loading
Failed to load commit list.
Open

(feat): tracing support for state-sync transactions #2172

Merge branch 'develop' into state-sync-tracing
02f998a
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed May 13, 2026 in 24m 28s

Code review found 2 important issues

Found 5 candidates, confirmed 5. See review comments for details.

Details

Severity Count
🔴 Important 2
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important core/state_processor.go:156-184 Live tracing: state-sync logs get TxHash/TxIndex of the last regular tx
🔴 Important eth/tracers/state_sync_tracing_hooks.go:40-56 WrapStateSyncHooks silently drops block-level and system-call hooks, breaking supply tracer
🟡 Nit eth/tracers/api.go:1258-1272 Synthetic state-sync receipt in traceTx diverges from canonical receipt (GasUsed and Bloom)

Annotations

Check failure on line 184 in core/state_processor.go

See this annotation in the file changed.

@claude claude / Claude Code Review

Live tracing: state-sync logs get TxHash/TxIndex of the last regular tx

Live tracing: state-sync log TxHash/TxIndex are wrong. `OnTxStart` fires for the state-sync tx at `state_processor.go:168`, but `statedb.SetTxContext` is never called for it — the tx loop at lines 117-118 skips state-sync via `continue`, so after the loop `statedb.thash` / `statedb.txIndex` still hold the last regular tx's values. When Finalize → `Bor.CommitStates` → `statefull.ApplyMessage` emits logs via the tracingStateDB, `inner.AddLog` stamps `log.TxHash` / `log.TxIndex` from the stale cont

Check failure on line 56 in eth/tracers/state_sync_tracing_hooks.go

See this annotation in the file changed.

@claude claude / Claude Code Review

WrapStateSyncHooks silently drops block-level and system-call hooks, breaking supply tracer

WrapStateSyncHooks at eth/tracers/state_sync_tracing_hooks.go:40-56 builds the returned `*tracing.Hooks` from scratch, populating only 12 of the ~24 fields on `tracing.Hooks`. The omitted fields — `OnBlockchainInit`, `OnClose`, `OnBlockStart`, `OnBlockEnd`, `OnSkippedBlock`, `OnGenesisBlock`, `OnSystemCallStart`/`V2`, `OnSystemCallEnd`, `OnNonceChangeV2`, `OnCodeChangeV2`, `OnBlockHashRead` — are silently dropped by the wrapper. Since `eth/backend.go:316-322` unconditionally applies this wrapper

Check warning on line 1272 in eth/tracers/api.go

See this annotation in the file changed.

@claude claude / Claude Code Review

Synthetic state-sync receipt in traceTx diverges from canonical receipt (GasUsed and Bloom)

The synthetic `*types.Receipt` built for state-sync tracing at `eth/tracers/api.go:1258-1271` omits the `Bloom` field, but the canonical state-sync receipt in `consensus/bor/bor.go:1296` explicitly sets `stateSyncReceipt.Bloom = types.CreateBloom(stateSyncReceipt)`. The same `OnTxEnd(receipt, ...)` is reached from both paths (live via `state_processor.go:198`, replay via `traceTx`), so a tracer that consumes `receipt.Bloom` would see a populated bloom under `--vmtrace` and an empty one under `de