Skip to content

build: upgrade REVM to v41.0.0 (tag v113) - #1604

Merged
anaPerezGhiglia merged 23 commits into
mainfrom
build/upgrade-revm-tag-v113
Aug 20, 2026
Merged

build: upgrade REVM to v41.0.0 (tag v113)#1604
anaPerezGhiglia merged 23 commits into
mainfrom
build/upgrade-revm-tag-v113

Conversation

@anaPerezGhiglia

@anaPerezGhiglia anaPerezGhiglia commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Supersedes #1590.

Changes

  • Upgrades all revm workspace dependencies to the versions released at revm tag v113, which unifies every revm crate at 41.0.0.
  • op-revm moves from crates.io 19.0.0 to the version released with op-reth v2.4.1, consumed as a git dependency on the ethereum-optimism/optimism monorepo pinned at that release's commit (details below).
  • foundry-fork-db bumps to the plain crates.io release 0.27 (pins revm ^41).
  • No public API changes. revm's "SpecId cleanup" removed several historical hardfork variants, but EDR's own L1Hardfork/OpHardfork types (introduced in refactor: introduce EDR-owned protocol hardfork types #1601) retain all of them; the removals are absorbed at the revm conversion boundary.

Dependency changes

Crate Old New
revm 38.0.0 41.0.0
revm-bytecode 10.0.0 41.0.0
revm-context 16.0.1 41.0.0
revm-context-interface 17.0.1 41.0.0
revm-database-interface =11.0.1 =41.0.0
revm-handler 18.1.0 41.0.0
revm-inspector 19.0.0 41.0.0
revm-interpreter 35.0.1 41.0.0
revm-precompile 34.0.0 41.0.0
revm-primitives 23.0.0 41.0.0
revm-state 11.0.1 41.0.0
op-revm 19.0.0 (crates.io) op-reth v2.4.1 release, git pin ethereum-optimism/optimism@a9a8dad
revm-inspectors 0.39.0 0.41.2 (0.42 requires revm 42)
foundry-fork-db 0.26 0.27 (crates.io)
c-kzg 2.1.4 ^2.1.7 (required by revm-precompile 41)

The locked alloy 2.x family moves 2.0.5 → 2.3.0 — a floor inherited from the monorepo's vendored op-alloy (see the op-revm section).

op-revm: git dependency on the optimism monorepo

Why not crates.io. No op-revm release supports revm 41: the last crates.io release (20.0.0) still pins revm = "^38".

What is pinned. A git dependency on ethereum-optimism/optimism at rev a9a8dad3f1500a4cc2e4077edb480848bfdef29a — the commit of the op-reth v2.4.1 release, which pins revm 41.0.0. This is unreleased code but an accepted trade-off; the priority is keeping L1 on released revm.

Known costs.

  • The monorepo adds ~1.1 GB to cargo's cache (git db + checkout), per machine and CI cache (stable cargo cannot shallow-clone git dependencies).
  • The monorepo is also op-alloy's home (the source of truth of the published crate), which op-revm depends on by path. As a consequence, op-revm resolves the in-repo op-alloy-consensus instead of the crates.io release with the same version number
    • that raises the locked alloy 2.x family to 2.3.0 and leaves two op-alloy-consensus 2.0.0 entries (registry + git) in the lockfile.
    • The duplication causes no type mismatch today.

Alternative. A follow-up PR will propose replacing this with a shallow per-snapshot mirror (~1 MB, single registry op-alloy copy), laying out the trade-offs in detail.

Hardfork handling: revm's SpecId cleanup

L1. revm 39's "SpecId cleanup" (see the MIGRATION_GUIDE) removed six historical SpecId variants, and this upgrade's 38→41 jump crosses that removal. Thanks to the refactor done in #1601, EDR's L1Hardfork gets to keeps all of its variants. The only change is in the From<L1Hardfork> for SpecId conversion, which now maps each removed variant to the fork with identical EVM rules:

Removed by revm Runs with the EVM rules of
Frontier Thawing Frontier
DAO Fork Homestead
Constantinople Petersburg
Muir Glacier Istanbul
Arrow Glacier, Gray Glacier London

The napi/config surface (names, parsing, serialization) is fully unchanged, so no Hardhat coordination is needed.

OP. OpSpecId gained KARST, the OP hardfork that activates the L1 Osaka EVM rules. EDR has no corresponding OpHardfork variant yet, so nothing converts to it; Karst support is a follow-up. Until it lands, the chain-config generator keeps ignoring the registry's karst_time entries (it parses with OpHardfork::from_str), so the check-generated-files workflow stays green.

Tests. The revm_parity modules asserted variant-set equality with revm and instructed their own deletion once the sets diverged. That happened here; they are replaced with monotonicity/default tests.

Other code changes required by the API delta
  • Warm precompile addresses: PrecompileProvider::warm_addresses now returns &AddressSet instead of a boxed iterator. The provider stores the set and converts once; AddressSet is re-exported from edr_primitives.
  • Account construction: Account.original_info is now Option<Box<_>>, and transaction ids use a new TransactionId newtype. Call sites build accounts with Account::from(info) plus a status and use TransactionId::ZERO; TransactionId is re-exported from edr_state_api.
  • EIP-8037 groundwork: revm added CallOutcome.charged_new_account_state_gas, which our 8 inspector sites set to false (matching upstream foundry), and made Gas::state_gas_spent() signed, which tracing clamps at 0. Both are TODO-flagged, to revisit when fully implementing EIP-8037.
  • Small renames: initial_total_gas field → method; new InternalResult::Suspend variant handled in nested-trace conversion; deprecated is_error()is_halt() in cheatcodes.
  • edge_cov vendored: revm-inspectors 0.40 removed the edge_cov module; upstream foundry took it in-tree, and so do we. The 0.39.0 snapshot lives at crates/foundry/evm/evm/src/inspectors/edge_cov.rs — the same path as foundry's copy — keeping coverage-guided fuzzing behavior identical. It is part of the foundry-port surface: the next foundry backport sync replaces it with upstream's since-evolved version.

Follow-ups (out of scope)

  • Add OP Karst support: add an OpHardfork::KARST variant, the Karst activation entries (regenerating the chain configs), and napi exposure.
  • EIP-8037 completeness: the charged_new_account_state_gas sites and the signed state-gas clamp.
  • edge_cov module: replaced by upstream foundry's version at the next foundry backport sync.
  • op-revm dependency footprint: spinoff PR proposing a shallow per-snapshot mirror instead of the monorepo git dep (see the op-revm section's known costs).

@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 01ba1ff

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

@anaPerezGhiglia
anaPerezGhiglia requested a review from Copilot August 6, 2026 19:31

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

Upgrades the workspace’s REVM dependency family to revm/revm-* 41.0.0 (tag v113), including aligning ecosystem crates (foundry-fork-db, revm-inspectors) and adapting EDR integration points to updated REVM APIs/types (e.g., TransactionId, state gas signedness, and inspector outcome fields).

Changes:

  • Bump REVM crates to 41.0.0, update foundry-fork-db to 0.27, and move op-revm to a git-sourced mirror matching op-reth v2.4.1.
  • Update EDR/foundry integration code to new REVM APIs: TransactionId, initial_total_gas() accessor, charged_new_account_state_gas field, and state gas clamping for unsigned trace surfaces.
  • Vendor edge_cov inspector implementation into the foundry port to replace the removed revm-inspectors::edge_cov module.

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/tracing/src/lib.rs Clamp signed per-frame state gas to 0 when producing unsigned ResultGas.
crates/state/api/src/lib.rs Re-export TransactionId from revm_state for downstream use.
crates/state/api/src/diff.rs Switch account creation to Account::from(...) and set status/storage explicitly where needed.
crates/primitives/src/lib.rs Re-export AddressSet from alloy_primitives map utilities.
crates/precompile/src/lib.rs Update precompile warm address handling to use AddressSet and new warm_addresses signature.
crates/foundry/evm/evm/src/inspectors/stack.rs Route edge coverage to vendored inspector; add charged_new_account_state_gas field initialization.
crates/foundry/evm/evm/src/inspectors/mod.rs Add and re-export new edge_cov module.
crates/foundry/evm/evm/src/inspectors/logs.rs Initialize charged_new_account_state_gas in CallOutcome construction.
crates/foundry/evm/evm/src/inspectors/edge_cov.rs New vendored edge coverage inspector implementation.
crates/foundry/evm/evm/src/executors/mod.rs Adapt to initial_total_gas() API change.
crates/foundry/evm/core/src/opts.rs Fix intra-doc link to crate::fork::configure_env.
crates/foundry/evm/core/src/backend/predeploy.rs Use Account::from(...) for predeploy account insertion.
crates/foundry/evm/core/src/backend/mod.rs Introduce TransactionId::ZERO uses and adapt precompile warm address plumbing.
crates/foundry/cheatcodes/src/inspector.rs Initialize charged_new_account_state_gas; update result halt check (is_halt).
crates/edr_solidity/src/nested_trace/conversion.rs Handle new InternalResult::Suspend conversion path.
crates/edr_provider/tests/integration/eip7778.rs Update storage slot construction to use TransactionId::ZERO.
crates/edr_provider/src/data.rs Update storage slot/change tracking and account construction to use TransactionId/Account::from.
crates/edr_op/src/hardfork.rs Simplify parity tests to only check default mapping vs op_revm::OpSpecId.
crates/edr_napi/src/account.rs Update NAPI account override storage slots to use TransactionId::ZERO.
crates/edr_coverage/src/collector.rs Initialize charged_new_account_state_gas in coverage inspector outcomes.
crates/edr_chain_l1/src/hardfork.rs Update L1Hardfork -> EvmSpecId conversion to account for REVM SpecId cleanup; refresh tests accordingly.
crates/blockchain/local/src/lib.rs Update test account construction to use Account::from(...).
crates/blockchain/fork/src/lib.rs Update account construction to use Account::from(...) for special predeploy accounts.
Cargo.toml Upgrade REVM dependency set, bump foundry-fork-db, and switch op-revm to a git mirror source.
Cargo.lock Lockfile updates reflecting dependency upgrades and the git-sourced op-revm.

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

Comment thread Cargo.toml Outdated
@anaPerezGhiglia
anaPerezGhiglia marked this pull request as ready for review August 6, 2026 23:55
@anaPerezGhiglia
anaPerezGhiglia force-pushed the build/upgrade-revm-tag-v113 branch from 62f59f1 to f392718 Compare August 7, 2026 00:15
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 7, 2026 00:15 — with GitHub Actions Inactive
@anaPerezGhiglia anaPerezGhiglia added the no changeset needed This PR doesn't require a changeset label Aug 7, 2026
@anaPerezGhiglia
anaPerezGhiglia requested a review from a team August 7, 2026 00:16
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 7, 2026 00:18 — with GitHub Actions Inactive
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 7, 2026 00:18 — with GitHub Actions Inactive
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.14013% with 72 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.89%. Comparing base (d2064e1) to head (01ba1ff).

Files with missing lines Patch % Lines
crates/foundry/evm/evm/src/inspectors/edge_cov.rs 0.00% 55 Missing ⚠️
crates/foundry/cheatcodes/src/inspector.rs 70.58% 4 Missing and 1 partial ⚠️
crates/foundry/evm/evm/src/inspectors/logs.rs 0.00% 4 Missing ⚠️
crates/foundry/evm/evm/src/inspectors/stack.rs 55.55% 4 Missing ⚠️
crates/tracing/src/lib.rs 0.00% 2 Missing ⚠️
crates/edr_solidity/src/nested_trace/conversion.rs 0.00% 1 Missing ⚠️
crates/precompile/src/lib.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1604      +/-   ##
==========================================
- Coverage   80.00%   79.89%   -0.12%     
==========================================
  Files         453      454       +1     
  Lines       79292    79294       +2     
  Branches    79292    79294       +2     
==========================================
- Hits        63435    63348      -87     
- Misses      13675    13763      +88     
- Partials     2182     2183       +1     

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

@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 7, 2026 12:51 — with GitHub Actions Inactive
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 7, 2026 12:54 — with GitHub Actions Inactive
@anaPerezGhiglia
anaPerezGhiglia had a problem deploying to github-action-benchmark August 7, 2026 12:54 — with GitHub Actions Failure
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 7, 2026 13:49 — with GitHub Actions Inactive
Wodann and others added 3 commits August 12, 2026 23:49
…ponding associated type names

Two sites got narrower bounds:

chain/spec/evm/src/lib.rs:27 — ContextForChainSpec only needs the EVM-level type, so it now projects through EvmHardforkChainSpec.
edr_napi_core/src/solidity/config.rs:224-225 — the combined bound decomposed into EvmHardforkChainSpec<EvmHardfork: HardforkTr> + ProtocolHardforkChainSpec<ProtocolHardfork: FromStr<Err = UnknownHardfork>>.
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 19, 2026 23:25 — with GitHub Actions Inactive
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 19, 2026 23:49 — with GitHub Actions Inactive
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 20, 2026 00:15 — with GitHub Actions Inactive
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 20, 2026 00:17 — with GitHub Actions Inactive
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 20, 2026 00:17 — with GitHub Actions Inactive
Base automatically changed from chore/remove-op-hardfork-osaka to main August 20, 2026 14:13
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 20, 2026 14:18 — with GitHub Actions Inactive
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 20, 2026 14:29 — with GitHub Actions Inactive
@anaPerezGhiglia
anaPerezGhiglia temporarily deployed to github-action-benchmark August 20, 2026 14:29 — with GitHub Actions Inactive
@anaPerezGhiglia
anaPerezGhiglia added this pull request to the merge queue Aug 20, 2026
Merged via the queue into main with commit 3fa7eb4 Aug 20, 2026
63 checks passed
@anaPerezGhiglia
anaPerezGhiglia deleted the build/upgrade-revm-tag-v113 branch August 20, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changeset needed This PR doesn't require a changeset

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants