Conversation
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Avoid store tracing for ordinary debug traces, cache repeated traced EVM state reads, and parallelize native block trace execution. Made-with: Cursor
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3058 +/- ##
==========================================
- Coverage 58.71% 58.12% -0.59%
==========================================
Files 2094 2074 -20
Lines 172970 171030 -1940
==========================================
- Hits 101555 99419 -2136
- Misses 62430 62685 +255
+ Partials 8985 8926 -59
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Made-with: Cursor
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
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
codchen
left a comment
There was a problem hiding this comment.
correctness-wise I don't see issues when eyeballing the change, but we should run blockaudit against 10k blocks within each historical version if not done already, given the abundance of edge cases in those older upgrades.
performance-wise, if I'm understanding correctly, the parallel path would execute each transaction twice: once to build prestate (which is sequential, without logger), and once to generate traces (which is parallel and with logger). This makes sense if state access is no longer the bottleneck and the logger now contributes the most to latency, but if this condition changes in the future (e.g. maybe with longer history, state access slows down again) then we might need to revisit.
…shes The parallel block trace path had a data race: worker goroutines read from statedb copies whose CacheMultiStore chains cascaded to the original's CacheMultiStore, while the main goroutine called CleanupForTracer which flushed (Write()) those shared CacheMultiStore layers concurrently. Fix by introducing ResetForTracer() which resets in-memory state (tempState, journal) and creates a new Snapshot layer without flushing the CMS hierarchy. The parallel path uses PrepareTxNoFlush (which calls ResetForTracer) instead of PrepareTx (which calls CleanupForTracer). This ensures no goroutine calls Write() on any CMS layer that another goroutine may be reading from. Also fix Copy() to allocate a fresh backing array for snapshottedCtxs, preventing the original and copy from aliasing the same slice memory. Made-with: Cursor
Describe your changes and provide context
Testing performed to validate your change