Repository navigation
perf: record only the opcode step data EDR reads - #1917
Conversation
🦋 Changeset detectedLatest commit: 27f6128 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
211be66 to
8687cb8
Compare
|
/bench |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1917 +/- ##
==========================================
+ Coverage 81.57% 81.65% +0.08%
==========================================
Files 473 475 +2
Lines 84228 84612 +384
Branches 84228 84612 +384
==========================================
+ Hits 68707 69091 +384
+ Misses 13232 13228 -4
- Partials 2289 2293 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
🚀 Starting regression benchmark for |
|
❌ Regression benchmark failed for |
RecordedTraceArena only tracks fields EDR uses573d8a5 to
fb7ea30
Compare
|
/bench |
There was a problem hiding this comment.
🟡 Changes recommended
The differential test never compares creation-frame steps because HALTER exhausts forwarded gas, leaving ROOT below CREATE’s 32,000-gas base cost.
1 open issue
What changed in this PR
This PR reduces provider tracing memory use by recording only the opcode data EDR consumes, while keeping the Solidity test runner on its existing recorder.
Changes:
- Adds compact per-frame steps and routes provider stack traces and JavaScript trace output through them.
- Adds differential tests and shares the bytecode builder across test suites.
- Pins a
revm-inspectorsfork that exposes the active trace.
| File | Description |
|---|---|
crates/edr_test_utils/src/lib.rs |
Exports shared bytecode utilities. |
crates/edr_test_utils/src/bytecode.rs |
Shares the builder and adds variable-length pushes. |
crates/edr_solidity/tests/recorded_steps.rs |
Compares compact steps with upstream recording. |
crates/edr_solidity/src/tracing.rs |
Records compact steps and optional snapshots. |
crates/edr_solidity/src/solidity_stack_trace.rs |
Supports stack traces from compact steps. |
crates/edr_solidity/src/recorded_steps.rs |
Defines compact step storage and accessors. |
crates/edr_solidity/src/nested_trace/conversion.rs |
Converts either step source into nested traces. |
crates/edr_solidity/src/nested_trace.rs |
Exposes conversion with separate step storage. |
crates/edr_solidity/src/lib.rs |
Exports the recorded-steps module. |
crates/edr_solidity/Cargo.toml |
Adds differential-test dependencies. |
crates/edr_provider/tests/integration/eip8246.rs |
Uses shared bytecode utilities. |
crates/edr_provider/tests/integration/eip8037.rs |
Uses shared bytecode utilities. |
crates/edr_provider/tests/integration/eip8024.rs |
Uses shared bytecode utilities. |
crates/edr_provider/tests/integration/eip7997.rs |
Uses the shared bytecode builder. |
crates/edr_provider/tests/integration/eip7954.rs |
Uses shared opcode exports. |
crates/edr_provider/tests/integration/eip7843.rs |
Uses shared bytecode utilities. |
crates/edr_provider/tests/integration/eip7778.rs |
Uses shared bytecode utilities. |
crates/edr_provider/tests/integration/eip2780.rs |
Uses shared bytecode utilities. |
crates/edr_provider/tests/integration/disable_block_gas_limit.rs |
Uses shared bytecode utilities. |
crates/edr_provider/tests/common/mod.rs |
Removes the local bytecode module export. |
crates/edr_provider/tests/common/gas_reporter.rs |
Uses shared bytecode utilities. |
crates/edr_provider/src/requests/eth/call.rs |
Returns recorded trace arenas. |
crates/edr_provider/src/observability.rs |
Disables upstream steps and collects compact traces. |
crates/edr_provider/src/lib.rs |
Updates provider response trace types. |
crates/edr_provider/src/error.rs |
Builds failure stack traces from compact steps. |
crates/edr_provider/src/debug_trace.rs |
Updates accompanying call-trace storage. |
crates/edr_provider/src/data/gas.rs |
Carries compact traces through gas estimation. |
crates/edr_provider/src/data.rs |
Updates execution result trace types. |
crates/edr_napi/src/trace.rs |
Converts compact steps into JavaScript trace messages. |
crates/edr_napi/src/provider/response.rs |
Updates response memory-accounting test fixtures. |
crates/edr_napi_core/src/spec.rs |
Carries recorded arenas in binding responses. |
Cargo.toml |
Pins the inspector fork exposing active_trace. |
Cargo.lock |
Locks the fork and added test dependencies. |
Review effort: Balanced
|
🚀 Starting regression benchmark for |
|
✅ Regression benchmark passed for |
215de82 to
67997e2
Compare
67997e2 to
5805944
Compare
- `RecordedTraceArena` no longer derefs to `CallTraceArena`
a8f74df to
27f6128
Compare

Summary
revm-inspectors 0.44grewCallTraceStepfrom 192 to 232 B (EIP-8037 state-gas fields). The provider records every opcode step of every transaction, so this increased peak memory and, for calls with many steps, wall time. EDR never reads those fields.This PR turns off
TracingInspector's step recording and records steps in EDR instead, keeping only what EDR reads: the PC and opcode, plus stack and memory snapshots when the provider is configured for them.Changes
SolidityTracingInspector, which already wrapsTracingInspector, now records each frame's steps in a compact table (8 B per step).traces()API read steps from that table. Their output is unchanged.SolidityTracingInspectornow builds the wrappedTracingInspectoritself, with steps disabled, so they cannot be recorded twice.TracingInspector's for every call frame and every stack/memory snapshot setting.BytecodeBuildermoved from the provider tests toedr_test_utilsso the differential test can use it.Solidity test runner
The runner keeps recording steps with
TracingInspector, so the provider and the runner now read steps from different sources. They remain compatible: both go through the same stack-trace conversion and heuristics, which read only each step's PC and opcode, and the differential test guarantees that both sources record the same steps.Moving the runner to the same recorder is a possible follow-up, out of scope here, though it may not be worth it.
revm-inspectors fork
Finding the frame a step belongs to requires
TracingInspector::active_trace, which is private. This PR pins a fork of revm-inspectors 0.44.2 where it is public (a one-line change). Upstream PR: paradigmxyz/revm-inspectors#584. Once released, the fork can be dropped.Benchmarks
Hardhat 3 regression benchmark (run 41910123883), compared like the benchmark action does (one run per commit). Rows are the benchmarks the revm 43 upgrade (#1847) made more than 10% worse:
17db6cd3cmainb660a0842main-vvvv, peak RSS-vvv, peak RSS-vvv, peak RSS-vvvv, peak RSS-vvvv, peak RSS-vvvv, peak RSSIn every row, this PR more than undoes the regression, and every mocha and vitest benchmark ends at or below its value before revm 43. Solidity-test benchmarks stay within −5% to +4% of
main; they record steps only when re-running a failing test. All benchmarks: comparison tables.