Skip to content

build: upgrade Hardhat 2 to @nomicfoundation/edr v0.25.1 - #7985

Merged
Wodann merged 39 commits into
v2from
hh2/tracing-unification
Nov 19, 2026
Merged

Wodann merged 39 commits into
v2from
hh2/tracing-unification

Conversation

@Wodann

@Wodann Wodann commented Feb 20, 2026 •

Copy link
Copy Markdown
Member

Hardhat 2 still pins @nomicfoundation/edr@0.12.0-next.23. Later EDR releases changed the API Hardhat 2 uses so Hardhat 3 could ship faster, so Hardhat 2 has received none of their fixes. This PR moves Hardhat 2 to EDR 0.25.1 and requires Node.js 22.

What changes

  • Trace bridge. The provider reads traces through Response.traces(), reinstated by feat: add backwards compatibility for Response::traces edr#1301, and maps them onto the VM events that solidity-coverage and hardhat-tracer listen to. It sets includeCallTraces: IncludeTraces.All and recordStack: StackSnapshotType.Top, matching EDR's Hardhat 2 patch.
  • Debug traces. EDR returns geth's format, so edrRpcDebugTraceToHardhat2 converts the default tracer's output back to Hardhat 2's. That means unprefixed, zero-padded values, storage on every step and memory captured unless disableMemory is set. Per-step storage is rebuilt from EDR's SLOAD and SSTORE snapshots by following each call frame's storage context. Built-in tracers such as callTracer pass through unchanged.
  • Provider config. network holds either the fork settings or the genesis gas limit and time, and blockGasLimit moves under mining. hardhat_reset keeps the original genesis values when switching from a fork back to a local network. Hardfork names pass to EDR as strings, which removes both SpecId tables.
  • Gas limits. Hardhat passes no default transaction gas limit, so EDR derives it per block. transactionGasCap still lifts the EIP-7825 cap for solidity-coverage. mining.interval ranges are validated at config load.
  • Stack traces and subscriptions. The provider handles the StackTrace, UnexpectedError and HeuristicFailed results of stackTrace(). The subscription callback reaches the wrapper through a WeakRef, so the provider thread can be collected.
  • Node.js 22. EDR declares engines.node >= 22 since 0.14.0. SUPPORTED_NODE_VERSIONS drops ^20.0.0, and .nvmrc, the dev container and new projects' @types/node move to 22.
  • Changesets. 18 changesets record the user-visible EDR changes since 0.12.0-next.23 and the Node 22 requirement.

Behaviour changes

  • Node.js 20 is no longer supported. It reached end of life on 2026-04-30.
  • debug_traceTransaction and debug_traceCall keep the Hardhat 2 format for the default tracer and gain geth's built-in tracers. An empty tracer now selects the default tracer. The remaining differences are in the debug-trace-tracers-and-options changeset. A halting step carries an error, an undefined opcode is named Unknown and a first-step STOP is kept. Storage can be stale under disableStack. debug_traceTransaction issues one eth_getTransactionByHash per trace to learn the root contract.
  • mining.interval ranges must satisfy 1 <= min <= max, so [0, N] is rejected with an error naming the key. This is breaking.
  • The prebuilt Linux gnu binaries need glibc 2.34 or later, and the forking RPC cache moves to rpc_cache/v2. Local Cancun-or-later networks get a different genesis block hash, because two system accounts start with nonce 1.
  • The error for an unresolvable fork RPC host reads Request failed after 9 retries and no longer names the host or the cause. The retries are not new.
Release notes of every EDR version since 0.12.0-next.23

The full list is in crates/edr_napi/CHANGELOG.md.

Validation

Third-party repositories ran through a local Verdaccio on 2026-10-18, from fresh clones, on Node 22 with identical commands. The candidate was this branch at 58316dda8 with EDR at NomicFoundation/edr#1301 head 47f7abfb8. The control was Hardhat 2.29.1 as shipped. Safe and NexusMutual ran with hardfork: "prague" on both builds, because their configured gas exceeds the Osaka cap. Counts are passing/failing tests, and ratios are candidate over control from single runs, so ±10% is noise.

Suite Control Candidate Wall Peak RSS
solidity-coverage unit, integration 135/0, 125/4 identical 1.01–1.06 0.95–1.10
hardhat-tracer test 33/2 identical 0.99 0.59
hardhat-gas-reporter unit, merge, integration 16/5, 2/1, 244/7 identical 1.89, 1.42, 1.31 1.01, 1.00, 1.19
Uniswap v3-core test 959/0 959/0 0.88 0.43
Seaport test, gas report, coverage 402/0, 402/0, 401/0 identical 0.99, 0.99, 1.13 0.85, 0.84, 0.99
Rocket Pool test, gas report, coverage 424/0, 26/1, 424/0 identical 0.82, 0.94, 0.97 0.27, 0.37, 0.63
Safe default, L1, L2, secp256r1, coverage 464/0, 1/0, 467/0, 4/0, 458/0 463/1, 1/0, 466/1, 4/0, 457/1 0.90–1.01 0.97–1.08
NexusMutual unit, integration, layout 1058/0, 223/0, 2/0 identical 0.88 summed 0.58, 0.59, 1.00
OpenZeppelin v5.7.0 test, gas report, coverage 8043/0, 8043/0, 8010/0 identical 0.94, 0.92, 0.96 0.68, 0.70, 1.00

The failures are identical on both builds: gas-reporter cases that need API keys or a live Alchemy host, solidity-coverage's 60M-gas deployment under the Osaka cap, two hardhat-tracer JSON cases, and Rocket Pool's signer-less deploy config. The gas-reporter ratios carry no signal, since its short suites and its fork to a dead host are retried by both builds. Control was OOM-killed three times at 5.7–6.0 GB on Rocket Pool coverage and NexusMutual, where the candidate peaked at 3.3–4.4 GB.

The table predates the debug trace conversion. On that run, Safe's SafeToL2Setup failed on the candidate only, because it reads unprefixed stack words and per-step storage from a trace. With the conversion in place, at b7d610cbb with EDR 0.25.0, the Safe default suite passed 465 tests and the L2 suite 468. That is one more than the candidate column in each case. The conversion suite, recorded from Hardhat 2.29.1, lives in EDR's hardhat-tests (NomicFoundation/edr#1907), where it runs against every EDR change. Before it moved, 105 of its 117 runs failed without the conversion. The VM event bridge is covered here by trace-event-bridge.ts.

At EDR 0.25.1, the core suite outside stack traces passes with 1194 tests.

Notes for review

  • The changesets include the Hardhat 3 ones for EDR changes relevant to Hardhat 2. New ones cover the Node 22 requirement and the EDR changes that had none.
  • The @types/node devDependencies and the toolboxes' >=20.0.0 peers stay at 20, as a follow-up, to keep this PR on the EDR upgrade.
  • The E2E job failed at hardhat compile in a fresh yarn project with ERR_PACKAGE_PATH_NOT_EXPORTED under @scure/bip32. The PR changes no crypto dependency, and the last green v2 run predates @noble/hashes 2.4.0, so the failure looks registry-side.
  • The history carries a WIP: title and two add-then-revert pairs. Squash-merging folds them.
  • Two paths have no test by design. The debug-trace root-address lookup's error fallback needs a race or a mock, and a failed CREATE's storage context is never entered again.

@Wodann
Wodann requested a review from Copilot February 20, 2026 22:40
@Wodann Wodann self-assigned this Feb 20, 2026
@changeset-bot

changeset-bot Bot commented Feb 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 491f433

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
hardhat Minor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the @nomicfoundation/edr dependency from v0.12.0-next.22 to v0.12.0-next.26, adapting the codebase to handle breaking API changes in the EDR library. The upgrade includes changes to API naming conventions, trace handling mechanisms, and error reporting structures.

Changes:

  • Migrated from deprecated getLatestSupportedSolcVersion to latestSupportedSolidityVersion API
  • Updated trace handling to use new EDR Response methods (traces() and stackTrace() as method calls)
  • Simplified trace conversion functions to work with EDR's new flattened data structures
  • Enhanced error handling with discriminated union pattern for stack traces

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/hardhat-core/test/helpers/compilation.ts Updated import and usage of renamed Solidity version API
packages/hardhat-core/test/builtin-tasks/compile.ts Updated import and usage of renamed Solidity version API
packages/hardhat-core/src/internal/hardhat-network/provider/utils/convertToEdr.ts Removed deprecated edrRpcDebugTraceToHardhat function; updated trace conversion functions to work with new EDR data structures
packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts Added IncludeTraces configuration; updated trace and stack trace handling to use new method-based API and discriminated unions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alcuadrado alcuadrado changed the title build: upgrade to @nomicfoundation/edr v0.12.0-next.26 build: upgrade to @nomicfoundation/edr v0.12.0-next.26 (v2) Feb 24, 2026
@Wodann Wodann changed the title build: upgrade to @nomicfoundation/edr v0.12.0-next.26 (v2) build: upgrade to @nomicfoundation/edr v0.12.0-next.x (v2) Mar 3, 2026
@Wodann
Wodann force-pushed the hh2/tracing-unification branch from c46cf5b to 72777b3 Compare July 7, 2026 19:32
Copilot AI review requested due to automatic review settings July 8, 2026 05:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 18:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 20:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Wodann added 8 commits October 6, 2026 13:51
Match the observability config of EDR's hardhat@2.28.6 patch, which
also records calls to precompiles.
EDR holds the subscription callback through a threadsafe function. V8
cannot trace through it, so a strong reference to the wrapper roots
the wrapper and its provider. The provider's OS thread is then never
released.

The callback now reaches the wrapper through a `WeakRef`, which
replaces the `EdrProviderEventAdapter` indirection.

Ported from EDR's Hardhat patch (NomicFoundation/edr#1720).
Wodann added a commit to NomicFoundation/edr that referenced this pull request Oct 31, 2026
Hardhat 2 converts EDR's geth-format debug traces back to its legacy
format in the open NomicFoundation/hardhat#7985. EDR's patched Hardhat
2.28.6 lacked that conversion, and the debug fixtures in hardhat-tests
had been switched to geth's format by f4bdc36. EDR CI therefore tested
a format that Hardhat 2 no longer returns.

Port the conversion from NomicFoundation/hardhat#7985. The port adds
edrRpcDebugTraceToHardhat2 and its StorageTracker to convertToEdr.ts. It
wires the memory default, the empty tracer handling and the result
conversion into the provider's request method. RpcStructLog gains the
returnData field. The debug trace code matches #7985. Outside it, the
port keeps EDR's existing patch and its formatting.

The compiled files come from TypeScript 5.0.4 with the package's own
2.28.6 tsconfig. That compiler reproduces the patched provider.js byte
for byte. The source maps are now regenerated with the code they map.

Restore the fixtures, the modules/debug tests and assertEqualTraces from
f4bdc36^ in the same commit, so every commit keeps the debug tests
green. Requests drop enableMemory, since the package captures memory by
default. assertEqualTraces loses the empty-memory and refund
normalisations that only geth's format needed. It now compares
returnValue without the 0x prefix that Hardhat 2 adds, because the
fixtures store it unprefixed. The reverted mainnet fixture is exempt,
since TurboGeth recorded no return value for it. The zeroed gasCost of
call and create steps is dropped. The only such step left, a STATICCALL
in the revert fixture, matches EDR's value.

The skipped post-London fork case and its fixture are removed instead of
restored. The case was skipped for
https://github.com/NomicFoundation/hardhat/issues/3519, and the fixture
served nothing else. The stale TODO about ethereumjs memory words goes
with them.

Some later changes still apply and are kept. The tests use ALCHEMY_URL
without a non-null assertion, as in d2e5ae8. assertEqualTraces drops
the assertions that the stricter eslint preset rejects. The unsupported
tracer tests keep the expectations of f4bdc36, because EDR rejects
such a tracer as a JavaScript tracer and debug_traceTransaction checks
the hash first.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Oct 31, 2026
NomicFoundation/hardhat#7985 tests its debug trace conversion with
traces recorded from Hardhat 2.29.1 and EDR 0.12.0-next.23. The suite
covers storage contexts across calls and creations, reverts, precompile
calls and the request options.

Copy debug-trace.ts next to the other debug tests and its fixture next
to the other debug fixtures. The imports now use the hardhat package
and the helpers of hardhat-tests. Every test keeps its title. The suite
runs on every provider that PROVIDERS defines.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Oct 31, 2026
Hardhat 2 converts EDR's geth-format debug traces back to its legacy
format in the open NomicFoundation/hardhat#7985. EDR's patched Hardhat
2.28.6 lacked that conversion, and the debug fixtures in hardhat-tests
had been switched to geth's format by f4bdc36. EDR CI therefore tested
a format that Hardhat 2 no longer returns.

Port the conversion from NomicFoundation/hardhat#7985. The port adds
edrRpcDebugTraceToHardhat2 and its StorageTracker to convertToEdr.ts. It
wires the memory default, the empty tracer handling and the result
conversion into the provider's request method. RpcStructLog gains the
returnData field. The debug trace code matches #7985. Outside it, the
port keeps EDR's existing patch and its formatting.

The compiled files come from TypeScript 5.0.4 with the package's own
2.28.6 tsconfig. That compiler reproduces the patched provider.js byte
for byte. The source maps are now regenerated with the code they map.

Restore the fixtures, the modules/debug tests and assertEqualTraces from
f4bdc36^ in the same commit, so every commit keeps the debug tests
green. Requests drop enableMemory, since the package captures memory by
default. assertEqualTraces loses the empty-memory and refund
normalisations that only geth's format needed. It now compares
returnValue without the 0x prefix that Hardhat 2 adds, because the
fixtures store it unprefixed. The reverted mainnet fixture is exempt,
since TurboGeth recorded no return value for it. The zeroed gasCost of
call and create steps is dropped. The only such step left, a STATICCALL
in the revert fixture, matches EDR's value.

The skipped post-London fork case and its fixture are removed instead of
restored. The case was skipped for
https://github.com/NomicFoundation/hardhat/issues/3519, and the fixture
served nothing else. The stale TODO about ethereumjs memory words goes
with them.

Some later changes still apply and are kept. The tests use ALCHEMY_URL
without a non-null assertion, as in d2e5ae8. assertEqualTraces drops
the assertions that the stricter eslint preset rejects. The unsupported
tracer tests keep the expectations of f4bdc36, because EDR rejects
such a tracer as a JavaScript tracer and debug_traceTransaction checks
the hash first.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Oct 31, 2026
NomicFoundation/hardhat#7985 tests its debug trace conversion with
traces recorded from Hardhat 2.29.1 and EDR 0.12.0-next.23. The suite
covers storage contexts across calls and creations, reverts, precompile
calls and the request options.

Copy debug-trace.ts next to the other debug tests and its fixture next
to the other debug fixtures. The imports now use the hardhat package
and the helpers of hardhat-tests. Every test keeps its title. The suite
runs on every provider that PROVIDERS defines.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Oct 31, 2026
Hardhat 2 converts EDR's geth-format debug traces back to its legacy
format in the open NomicFoundation/hardhat#7985. EDR's patched Hardhat
2.28.6 lacked that conversion, and the debug fixtures in hardhat-tests
had been switched to geth's format by f4bdc36. EDR CI therefore tested
a format that Hardhat 2 no longer returns.

Port the conversion from NomicFoundation/hardhat#7985. The port adds
edrRpcDebugTraceToHardhat2 and its StorageTracker to convertToEdr.ts. It
wires the memory default, the empty tracer handling and the result
conversion into the provider's request method. RpcStructLog gains the
returnData field. The debug trace code matches #7985. Outside it, the
port keeps EDR's existing patch and its formatting.

The compiled files come from TypeScript 5.0.4 with the package's own
2.28.6 tsconfig. That compiler reproduces the patched provider.js byte
for byte. The source maps are now regenerated with the code they map.

Restore the fixtures, the modules/debug tests and assertEqualTraces from
f4bdc36^ in the same commit, so every commit keeps the debug tests
green. Requests drop enableMemory, since the package captures memory by
default. assertEqualTraces loses the empty-memory and refund
normalisations that only geth's format needed. It now compares
returnValue without the 0x prefix that Hardhat 2 adds, because the
fixtures store it unprefixed. The reverted mainnet fixture is exempt,
since TurboGeth recorded no return value for it. The zeroed gasCost of
call and create steps is dropped. The only such step left, a STATICCALL
in the revert fixture, matches EDR's value.

The skipped post-London fork case and its fixture are removed instead of
restored. The case was skipped for
https://github.com/NomicFoundation/hardhat/issues/3519, and the fixture
served nothing else. The stale TODO about ethereumjs memory words goes
with them.

Some later changes still apply and are kept. The tests use ALCHEMY_URL
without a non-null assertion, as in d2e5ae8. assertEqualTraces drops
the assertions that the stricter eslint preset rejects. The unsupported
tracer tests keep the expectations of f4bdc36, because EDR rejects
such a tracer as a JavaScript tracer and debug_traceTransaction checks
the hash first.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Oct 31, 2026
NomicFoundation/hardhat#7985 tests its debug trace conversion with
traces recorded from Hardhat 2.29.1 and EDR 0.12.0-next.23. The suite
covers storage contexts across calls and creations, reverts, precompile
calls and the request options.

Copy debug-trace.ts next to the other debug tests and its fixture next
to the other debug fixtures. The imports now use the hardhat package
and the helpers of hardhat-tests. Every test keeps its title. The suite
runs on every provider that PROVIDERS defines.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Nov 6, 2026
Hardhat 2 converts EDR's geth-format debug traces back to its legacy
format in the open NomicFoundation/hardhat#7985. EDR's patched Hardhat
2.28.6 lacked that conversion, so EDR CI tested a format that Hardhat 2
no longer returns.

Port the conversion from #7985. The port adds edrRpcDebugTraceToHardhat2
and its StorageTracker to convertToEdr.ts. It wires the memory default,
the empty tracer handling and the result conversion into the provider's
request method. RpcStructLog gains the returnData field. The debug trace
code matches #7985. Outside it, the port keeps EDR's existing patch and
its formatting.

The compiled files come from TypeScript 5.0.4 with the package's own
2.28.6 tsconfig. That compiler reproduces the patched provider.js byte
for byte. The source maps are now regenerated with the code they map.

The previous commit restored the Hardhat 2 format fixtures. This commit
restores the modules/debug tests and assertEqualTraces from f4bdc36^,
so the debug tests are green again. Requests drop enableMemory, since
the package captures memory by default. assertEqualTraces loses the
geth-only normalisations and the zeroing of call-opcode gas, which EDR
now reports as the fixtures do. It compares returnValue without its
prefix, except for a failed trace whose fixture recorded none. The
skipped post-London fork test goes with its fixture.

Some later changes still apply and are kept. The tests use ALCHEMY_URL
without a non-null assertion, as in d2e5ae8. assertEqualTraces drops
the assertions that the stricter eslint preset rejects. The unsupported
tracer tests keep the expectations of f4bdc36, because EDR rejects
such a tracer as a JavaScript tracer and debug_traceTransaction checks
the hash first.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Nov 6, 2026
NomicFoundation/hardhat#7985 tests its debug trace conversion with
traces recorded from Hardhat 2.29.1 and EDR 0.12.0-next.23. The suite
covers storage contexts across calls and creations, reverts, precompile
calls and the request options.

Copy debug-trace.ts next to the other debug tests and its fixture next
to the other debug fixtures. The imports now use the hardhat package
and the helpers of hardhat-tests. Every test keeps its title. The suite
runs on every provider that PROVIDERS defines.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Nov 6, 2026
Hardhat 2 converts EDR's geth-format debug traces back to its legacy
format in the open NomicFoundation/hardhat#7985. EDR's patched Hardhat
2.28.6 lacked that conversion, so EDR CI tested a format that Hardhat 2
no longer returns.

Port the conversion from #7985. The port adds edrRpcDebugTraceToHardhat2
and its StorageTracker to convertToEdr.ts. It wires the memory default,
the empty tracer handling and the result conversion into the provider's
request method. RpcStructLog gains the returnData field. The debug trace
code matches #7985. Outside it, the port keeps EDR's existing patch and
its formatting.

The compiled files come from TypeScript 5.0.4 with the package's own
2.28.6 tsconfig. That compiler reproduces the patched provider.js byte
for byte. The source maps are now regenerated with the code they map.

An earlier commit restored the Hardhat 2 format fixtures. This commit
restores the modules/debug tests and assertEqualTraces from f4bdc36^,
so the debug tests are green again. Requests drop enableMemory, since
the package captures memory by default. assertEqualTraces loses the
geth-only normalisations and the zeroing of call-opcode gas, which EDR
now reports as the fixtures do. It compares returnValue without its
prefix, except for a failed trace whose fixture recorded none. The
skipped post-London fork test goes with its fixture.

Some later changes still apply and are kept. The tests use ALCHEMY_URL
without a non-null assertion, as in d2e5ae8. assertEqualTraces drops
the assertions that the stricter eslint preset rejects. The unsupported
tracer tests keep the expectations of f4bdc36, because EDR rejects
such a tracer as a JavaScript tracer and debug_traceTransaction checks
the hash first.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Nov 6, 2026
NomicFoundation/hardhat#7985 tests its debug trace conversion with
traces recorded from Hardhat 2.29.1 and EDR 0.12.0-next.23. The suite
covers storage contexts across calls and creations, reverts, precompile
calls and the request options.

Copy debug-trace.ts next to the other debug tests and its fixture next
to the other debug fixtures. The imports now use the hardhat package
and the helpers of hardhat-tests. Every test keeps its title. The suite
runs on every provider that PROVIDERS defines.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Nov 6, 2026
Hardhat 2 converts EDR's geth-format debug traces back to its legacy
format in the open NomicFoundation/hardhat#7985. EDR's patched Hardhat
2.28.6 lacked that conversion, so EDR CI tested a format that Hardhat 2
no longer returns.

Port the conversion from #7985. The port adds edrRpcDebugTraceToHardhat2
and its StorageTracker to convertToEdr.ts. It wires the memory default,
the empty tracer handling and the result conversion into the provider's
request method. RpcStructLog gains the returnData field. The debug trace
code matches #7985. Outside it, the port keeps EDR's existing patch and
its formatting.

The compiled files come from TypeScript 5.0.4 with the package's own
2.28.6 tsconfig. That compiler reproduces the patched provider.js byte
for byte. The source maps are now regenerated with the code they map.

The revert commit restored the Hardhat 2 format fixtures and reversed
the test hunks of #1251, so the debug tests are green again from here.
assertEqualTraces loses the refund normalisation that only geth's format
needed and the zeroing of call-opcode gas, which EDR now reports as the
fixtures do. It compares returnValue without its prefix, except for a
failed trace whose fixture recorded none. The unsupported tracer tests
expect EDR's rejection of such a tracer as a JavaScript tracer, and
debug_traceTransaction checks the hash first.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Nov 6, 2026
NomicFoundation/hardhat#7985 tests its debug trace conversion with
traces recorded from Hardhat 2.29.1 and EDR 0.12.0-next.23. The suite
covers storage contexts across calls and creations, reverts, precompile
calls and the request options.

Copy debug-trace.ts next to the other debug tests and its fixture next
to the other debug fixtures. The imports now use the hardhat package
and the helpers of hardhat-tests. Every test keeps its title. The suite
runs on every provider that PROVIDERS defines.
The debug trace conversion tests and their Hardhat 2.29.1 recording now
live in EDR's hardhat-tests directory, which runs the Hardhat 2 package
against every EDR change in EDR's CI. Keeping a second copy here would
drift from that one, so this removes it.

Until Hardhat releases this conversion and EDR bumps its patched
package to that release, EDR's suite exercises the copy of the
conversion in EDR's Hardhat 2 patch rather than this source.
Wodann added a commit to NomicFoundation/edr that referenced this pull request Nov 6, 2026
Hardhat 2 converts EDR's geth-format debug traces back to its legacy
format in the open NomicFoundation/hardhat#7985. EDR's patched Hardhat
2.28.6 lacked that conversion, so EDR CI tested a format that Hardhat 2
no longer returns.

Port the conversion from #7985. The port adds edrRpcDebugTraceToHardhat2
and its StorageTracker to convertToEdr.ts. It wires the memory default,
the empty tracer handling and the result conversion into the provider's
request method. RpcStructLog gains the returnData field. The debug trace
code matches #7985. Outside it, the port keeps EDR's existing patch and
its formatting.

The compiled files come from TypeScript 5.0.4 with the package's own
2.28.6 tsconfig. That compiler reproduces the patched provider.js byte
for byte. The source maps are now regenerated with the code they map.

The revert commit restored the Hardhat 2 format fixtures and reversed
the test hunks of #1251, so the debug tests are green again from here.
assertEqualTraces loses the refund normalisation that only geth's format
needed and the zeroing of call-opcode gas, which EDR now reports as the
fixtures do. It compares returnValue without its prefix, except for a
failed trace whose fixture recorded none. The unsupported tracer tests
expect EDR's rejection of such a tracer as a JavaScript tracer, and
debug_traceTransaction checks the hash first.
The release reduces the memory used to record call traces, which the
provider collects for the VM event bridge. Its other changes concern
the Amsterdam hardfork and Solidity tests, which Hardhat 2 does not
expose.
@Wodann
Wodann requested a review from kanej November 16, 2026 11:07
@Wodann
Wodann marked this pull request as ready for review November 16, 2026 11:07
@Wodann
Wodann requested a balanced review from Copilot November 16, 2026 11:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

@Wodann Wodann changed the title build: upgrade Hardhat 2 to @nomicfoundation/edr v0.x build: upgrade Hardhat 2 to @nomicfoundation/edr v0.25.1 Nov 16, 2026
@Wodann
Wodann requested a balanced review from Copilot November 17, 2026 05:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Comment thread .changeset/edr-glibc-2-34.md Resolved

@kanej kanej left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have read through the changes, attempted to break it with AI, ran manual checks against new projects with hardhat-tracer and reran the validation section of the github description.

I am happy this is good to go.

@Wodann

Wodann commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

I have read through the changes, attempted to break it with AI, ran manual checks against new projects with hardhat-tracer and reran the validation section of the github description.

I am happy this is good to go.

Thanks for double checking!

@Wodann
Wodann merged commit b501bed into v2 Nov 19, 2026
251 of 254 checks passed
@Wodann
Wodann deleted the hh2/tracing-unification branch November 19, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants