feat: add support for Geth built-in tracers#1251
Conversation
🦋 Changeset detectedLatest commit: 9288ab8 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 |
703348d to
b1caf09
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1251 +/- ##
==========================================
- Coverage 74.03% 74.01% -0.02%
==========================================
Files 438 438
Lines 75049 74931 -118
Branches 75049 74931 -118
==========================================
- Hits 55559 55459 -100
+ Misses 17463 17436 -27
- Partials 2027 2036 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds support for Geth built-in tracers by updating the Hardhat dependency from version 2.26.1 to 2.28.0 and implementing corresponding changes in the EDR codebase to handle debug tracing with Geth-compatible options.
Key Changes
- Updates Hardhat to version 2.28.0 with patches to support Geth debug tracing
- Replaces custom EIP-3155 tracer implementation with
revm-inspectorsDebugInspector - Updates test fixtures to match Geth 1.16.7 output format
Reviewed changes
Copilot reviewed 22 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updates Hardhat dependency from 2.26.1 to 2.28.0 |
| pnpm-workspace.yaml | Adds "hardhat" to immediate install exceptions |
| patches/hardhat@2.28.0.patch | Adds patch file for Hardhat 2.28.0 |
| patches/hardhat@2.26.1.patch | Removes obsolete patch for Hardhat 2.26.1 |
| crates/edr_provider/src/debug_trace.rs | Replaces custom tracer with DebugInspector from revm-inspectors |
| crates/edr_provider/src/requests/debug.rs | Updates debug trace methods to use GethDebugTracingOptions |
| crates/edr_provider/Cargo.toml | Adds dependencies for alloy-rpc-types-trace and revm-inspectors |
| hardhat-tests/test/internal/hardhat-network/provider/utils/assertEqualTraces.ts | Simplifies trace comparison logic |
| hardhat-tests/test/fixture-debug-traces/*.ts | Updates test fixtures with Geth 1.16.7 traces |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hardhat-tests/test/fixture-debug-traces/elongatedMemoryRegressionTestTrace.ts
Show resolved
Hide resolved
hardhat-tests/test/internal/hardhat-network/provider/modules/debug/traceTransaction.ts
Show resolved
Hide resolved
|
|
||
| Our API is now aligned with Geth's tracing capabilities. | ||
|
|
||
| BREAKING CHANGE: Memory capture used to be enabled by default on geth, but has since been flipped <https://github.com/ethereum/go-ethereum/pull/23558> and is now disabled by default. We have followed suit and disabled it by default as well. If you were relying on memory capture, you will need to explicitly enable it by setting the `enableMemory` option to `true` in your tracer configuration. |
|
Lint error should be resolved by #1255 |
| viaIR: true, | ||
| }, | ||
| }, | ||
| { |
There was a problem hiding this comment.
Motivation: To ensure that the stack trace tests keep succeeding, we need to add new solc compiler descriptions up until the version of Solidity that EDR reports as supporting.
This PR removes our custom EIP-3155 tracer and instead uses
revm-inspector'sDebugInspector. This brings us one step closer to unification of the tracing architecture, as we can use the same underlying inspector to generate our stack traces.During testing, I discovered a bug in
revm-inspectors. I was able to fix the bug and created a PR. After some back and forth, I'm waiting for the final approval. Until then, I decided to go ahead with a temporary dependency patch, using my fork ofrevm-inspectors. If desired, I can move the fork to the NomicFoundation organisation.The
hardhat-testsare using fixtures to validate that the generated output ofdebug_traceCallanddebug_traceTransactionmatches what Geth returns for specific requests. Unfortunately, the fixtures were old and no longer reflect the behaviour of the latest version of Geth. As such, I had to update the fixtures.For future reference, I added instructions for how to generate new fixtures for future versions of Geth to each individual fixture. The instructions slightly differ per fixture as each fixture contains different JSON-RPC requests.
For fixtures that use "forking mode" I could not use Geth, since Geth does not support the concept of forking a blockchain. It can only fully sync to the live blockchain. To avoid a lot of time and storage to sync a node, I generated fixtures for "forking mode" by calling Alchemy. As Alchemy runs a mixture of clients (e.g. Erigon, Reth, and Geth), this does run a risk of hitting an Archive node that generates its JSON-RPC responses using Reth, which uses the same
alloydependency as us. I deemed this to be an acceptable trade-off to save a lot of time.There is one outstanding issue. A previously disabled test can theoretically be re-enabled. However, I discovered a bug in REVM. I fixed the bug and created a PR. Once that's merged, I'll upgrade REVM and re-activate the test in a follow-up PR.