Skip to content

Debug Trace Speedup#3058

Open
Kbhat1 wants to merge 18 commits intomainfrom
kartik/debug-trace-speedups
Open

Debug Trace Speedup#3058
Kbhat1 wants to merge 18 commits intomainfrom
kartik/debug-trace-speedups

Conversation

@Kbhat1
Copy link
Contributor

@Kbhat1 Kbhat1 commented Mar 12, 2026

Describe your changes and provide context

  • Avoid store-tracer overhead on ordinary debug_trace* calls; use debug_traceStateAccess when Cosmos/store-level access tracing is needed
  • Keep profiled block tracing on the default tracer path while preserving legacy semantics for explicit tracers like flatCallTracer
  • Parallelize native/default block trace execution across per-tx prestate snapshots while preserving ordered state advancement (largest improvement)

Testing performed to validate your change

  • Tested on node

Kbhat1 added 4 commits March 12, 2026 10:04
Avoid store tracing for ordinary debug traces, cache repeated traced EVM state reads, and parallelize native block trace execution.

Made-with: Cursor
@github-actions
Copy link

github-actions bot commented Mar 12, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed❌ failed (0)Mar 18, 2026, 8:54 PM

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 46.72897% with 171 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.18%. Comparing base (8a11ce5) to head (896d58d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
evmrpc/block_trace_profiled.go 45.19% 124 Missing and 30 partials ⚠️
evmrpc/tracers.go 72.72% 2 Missing and 4 partials ⚠️
x/evm/state/balance.go 25.00% 2 Missing and 4 partials ⚠️
sei-cosmos/types/context.go 42.85% 2 Missing and 2 partials ⚠️
x/evm/state/code.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3058      +/-   ##
==========================================
- Coverage   58.61%   58.18%   -0.43%     
==========================================
  Files        2090     2074      -16     
  Lines      172771   171777     -994     
==========================================
- Hits       101262    99946    -1316     
- Misses      62532    62878     +346     
+ Partials     8977     8953      -24     
Flag Coverage Δ
sei-chain-pr 68.73% <46.72%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
app/app.go 61.13% <100.00%> (-6.09%) ⬇️
x/evm/state/code.go 82.35% <0.00%> (ø)
sei-cosmos/types/context.go 92.30% <42.85%> (-1.37%) ⬇️
evmrpc/tracers.go 65.19% <72.72%> (-0.37%) ⬇️
x/evm/state/balance.go 60.20% <25.00%> (-1.76%) ⬇️
evmrpc/block_trace_profiled.go 45.19% <45.19%> (ø)

... and 98 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Kbhat1 Kbhat1 requested a review from yzang2019 March 13, 2026 14:47
Kbhat1 added 3 commits March 16, 2026 13:42
Drop the tracing-only DBImpl read cache so this branch keeps only the two debug trace speedups that materially simplify and improve the hot path: avoiding ordinary store tracing and parallelizing block traces.

Made-with: Cursor
@Kbhat1 Kbhat1 requested a review from codchen March 17, 2026 16:28
@Kbhat1 Kbhat1 enabled auto-merge March 17, 2026 21:13
@Kbhat1 Kbhat1 disabled auto-merge March 17, 2026 22:04
Kbhat1 added 6 commits March 17, 2026 22:27
Keep the profiled block trace path on the default tracer only so explicit tracers like flatCallTracer continue using the legacy implementation and preserve per-transaction failure semantics.

Made-with: Cursor
Cover profiled default block tracing regressions by asserting failed txs do not abort the whole request and block traces match transaction replay.

Made-with: Cursor
…ncement

The parallel state-advancement path was skipping PrepareTx (which runs
the tracer ante handler: address association, sig verification, context
setup) before ApplyMessage. This meant snapshots given to worker N+1
could be missing ante-handler side effects from tx N.

Add PrepareTx to advanceState so the main thread's state matches what
profiledTraceTx produces on each worker. The TracerAnteHandler is
lightweight (no fee charging) so the overhead is minimal and parallelism
is preserved.

Also change failure handling: instead of aborting the entire RPC with a
top-level error on the first state-advancement failure, return partial
per-tx results with error entries for unreached txs, matching the
sequential path's semantics.

Made-with: Cursor
The DoesNotAbortOnFailedTx test asserted that both txs have non-empty
"result" fields. With PrepareTx in the parallel state advancement, a
failed tx's worker may receive a nonce error from the shared store
flush, producing an "error" entry instead of a "result" entry. The
second tx (not dispatched due to the break) gets an error fill entry.

Relax the assertion: verify that both txs have per-tx entries (either
result or error) and that no top-level abort occurred, which is the
test's actual intent.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants