Skip to content

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

Open
anaPerezGhiglia wants to merge 2 commits into
chore/remove-op-hardfork-osakafrom
build/upgrade-revm-tag-v113
Open

build: upgrade REVM to v41.0.0 (tag v113)#1604
anaPerezGhiglia wants to merge 2 commits into
chore/remove-op-hardfork-osakafrom
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 through a shallow mirror repo (details below). The crate's own version number is not a usable reference since not-released version has the still declares 20.0.0 in the manifest, which s the last crates.io release, that still pins revm ^38.
  • 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 Introduce EDR-owned 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, via mirror tag op-reth-v2.4.1-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)
op-revm: why a mirror repo

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 anaPerezGhiglia/op-revm at tag op-reth-v2.4.1-a9a8dad: a byte-identical snapshot of rust/op-revm at monorepo commit a9a8dad, the commit shipped in op-reth v2.4.1, which pins revm 41.0.0. The tag convention is <upstream release>-<upstream sha>, so the manifest documents its own provenance. The mirror includes a PROVENANCE.md (update procedure) and a verify.sh that re-checks byte-identity against the GitHub API.

Why a mirror instead of the monorepo. Stable cargo cannot shallow-clone git dependencies, so depending on the monorepo directly costs ~1.1 GB per machine and CI cache; the mirror clone is ~128 KB.

Note. The mirror currently lives under a personal account. If this solution is accepted, the recommended path is to migrate the repo to the NomicFoundation organization so ownership and updates are team-managed.

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.

@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 769a9d9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a 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
# ^38), so a shallow mirror of the ethereum-optimism monorepo commit matching
# the op-reth v2.4.1 release (workspace pins revm 41.0.0, the revm version at
# tag v113) is used instead. See the mirror's PROVENANCE.md.
op-revm = { git = "https://github.com/anaPerezGhiglia/op-revm", tag = "op-reth-v2.4.1-a9a8dad", default-features = false, features = [

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The tag is on a mirror repo we control, following a one-tag-per-snapshot convention (documented in its PROVENANCE.md). Tags should never be moved, and new snapshots get new tags.
Reproducibility comes from Cargo.lock, which records the exact commit.
Keeping the tag as is unless someone from the teams agrees on this approach.

@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.
⚠️ Please upload report for BASE (chore/remove-op-hardfork-osaka@e09ca21). Learn more about missing BASE report.

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                        @@
##             chore/remove-op-hardfork-osaka    #1604   +/-   ##
=================================================================
  Coverage                                  ?   79.87%           
=================================================================
  Files                                     ?      454           
  Lines                                     ?    79251           
  Branches                                  ?    79251           
=================================================================
  Hits                                      ?    63302           
  Misses                                    ?    13766           
  Partials                                  ?     2183           

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

2 participants