Skip to content

fix: recognise console calls by the Hardhat console address - #1821

Merged
Wodann merged 2 commits into
mainfrom
fix/stack-trace-console-address
Oct 6, 2026
Merged

Wodann merged 2 commits into
mainfrom
fix/stack-trace-console-address

Conversation

@Wodann

@Wodann Wodann commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

The nested trace conversion in crates/edr_solidity/src/nested_trace/conversion.rs uses the address as code for calls to the Hardhat console and the cheatcode contract, because neither has deployed bytecode. Since c938af2 it compared against a local copy of the console address that held 0x…01, the ecrecover precompile, instead of 0x000000000000000000636F6e736F6c652e6c6f67.

This PR reuses the console and cheatcode addresses from foundry_evm_core::constants instead of local copies.

What changes

  • Shared constants. convert_node imports HARDHAT_CONSOLE_ADDRESS and CHEATCODE_ADDRESS from foundry-evm-core, now a direct dependency of edr_solidity. It was already a transitive dependency through foundry-evm-traces, so the crate graph does not change.
  • Unit tests. console_call_uses_address_as_code and cheatcode_call_uses_address_as_code convert a one-node arena with no known code.

Behaviour changes

  • None visible today. The call's code is only used to identify the called contract, and neither the placeholder nor the address bytes match a compiled contract, so console calls stay unrecognised either way. console.log calls never fail, so they are never the frame the stack-trace heuristics inspect. The existing 0_5/console-logs/multiple-messages/reverting fixture passes on main and on this branch.

Validation

console_call_uses_address_as_code fails on main (code 0x00 instead of the 20 console address bytes) and passes here.

Notes for review

The nested trace conversion defined its own copy of the Hardhat console
address. That copy held the `ecrecover` precompile address instead.
Console calls therefore got a placeholder instead of their address as
code.

Reuse the console and cheatcode addresses from foundry-evm-core.
@Wodann
Wodann temporarily deployed to github-action-benchmark October 5, 2026 20:13 — with GitHub Actions Inactive
@changeset-bot

changeset-bot Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fc09b82

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

This PR includes changesets to release 1 package
Name Type
@nomicfoundation/edr Patch

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

@Wodann
Wodann had a problem deploying to github-action-benchmark October 5, 2026 20:20 — with GitHub Actions Error
@Wodann
Wodann had a problem deploying to github-action-benchmark October 5, 2026 20:20 — with GitHub Actions Error
@Wodann
Wodann temporarily deployed to github-action-benchmark October 5, 2026 20:21 — with GitHub Actions Inactive
@Wodann
Wodann requested a balanced review from Copilot October 5, 2026 20:22
@Wodann Wodann self-assigned this Oct 5, 2026
@Wodann
Wodann marked this pull request as ready for review October 5, 2026 20:24

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 review overview

🟢 Approval recommended

The correction is narrowly scoped, includes targeted regression tests, and has no identified blocking issues.

Review effort: Balanced
Findings: None

What changed in this PR

Corrects Hardhat console address recognition in Solidity nested-trace conversion by replacing local addresses with shared Foundry constants.

Changes:

  • Reuses console and cheatcode address constants.
  • Adds regression tests for both address-as-code paths.
  • Updates dependency metadata and adds a patch release note.
File Description
crates/​edr_solidity/​src/​nested_trace/​conversion.rs Uses shared addresses and adds regression tests.
crates/​edr_solidity/​Cargo.toml Adds the direct foundry-evm-core dependency.
Cargo.lock Records the direct dependency.
.changeset/​fix-stack-trace-console-address.md Documents the console-address fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Wodann
Wodann requested a review from a team October 5, 2026 20:28
@Wodann
Wodann temporarily deployed to github-action-benchmark October 5, 2026 20:29 — with GitHub Actions Inactive
@Wodann
Wodann temporarily deployed to github-action-benchmark October 5, 2026 20:29 — with GitHub Actions Inactive
@codecov

codecov Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.56%. Comparing base (2a2460c) to head (fc09b82).

Files with missing lines Patch % Lines
crates/edr_solidity/src/nested_trace/conversion.rs 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1821      +/-   ##
==========================================
- Coverage   80.57%   80.56%   -0.01%     
==========================================
  Files         469      469              
  Lines       82311    82327      +16     
  Branches    82311    82327      +16     
==========================================
+ Hits        66320    66329       +9     
- Misses      13742    13747       +5     
- Partials     2249     2251       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@popescuoctavian popescuoctavian 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.

LGTM, thanks!

@Wodann
Wodann added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit d1666ba Oct 6, 2026
91 of 95 checks passed
@Wodann
Wodann deleted the fix/stack-trace-console-address branch October 6, 2026 13:53

This branch was previously deployed

1 inactive deployment
github-action-benchmark — fc09b827 Deployed Oct 5, 2026 by Wodann via Run JS Solidity test runner benchmark #5565
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