build: upgrade revm to tag v112 - #1590
Conversation
🦋 Changeset detectedLatest commit: 264279e 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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
There was a problem hiding this comment.
Pull request overview
This PR upgrades the workspace’s REVM dependency family to revm 40.0.3 (tag v112) to enable full EIP-8037 support for the Amsterdam hardfork, and adapts EDR/Foundry integration code to the updated REVM APIs (including removed SpecId variants, signed state gas accounting, and new types like TransactionId / AddressSet).
Changes:
- Upgrade REVM crates and related dependencies; introduce git pins for
op-revm(mirror) andfoundry-fork-db(Foundry-core rev) to bridge missing crates.io releases for REVM 40. - Preserve JS-facing hardfork API compatibility via name constants and compatibility mappings for removed REVM hardfork discriminants.
- Update EVM execution/inspection/tracing glue for API changes (signed state gas clamping,
TransactionId,AddressSet,CallOutcomefield additions) and vendor the removededge_covinspector.
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/tracing/src/lib.rs | Clamp signed per-frame state gas to 0 when exporting unsigned trace gas fields. |
| crates/state/api/src/lib.rs | Re-export TransactionId from revm_state for downstream callers. |
| crates/state/api/src/diff.rs | Update account creation in diffs to use Account::from(AccountInfo) and new field visibility. |
| crates/primitives/src/lib.rs | Re-export AddressSet for use across workspace boundaries. |
| crates/precompile/src/lib.rs | Adapt precompile provider warm-address API to return &AddressSet and maintain a deduped cache. |
| crates/foundry/evm/evm/src/inspectors/stack.rs | Switch edge coverage inspector wiring to the vendored implementation and update CallOutcome construction. |
| crates/foundry/evm/evm/src/inspectors/mod.rs | Add and export the vendored edge_cov inspector module. |
| crates/foundry/evm/evm/src/inspectors/logs.rs | Initialize the new charged_new_account_state_gas field in literal CallOutcome construction. |
| crates/foundry/evm/evm/src/inspectors/edge_cov.rs | Vendor revm-inspectors 0.39 edge coverage inspector to replace the removed upstream module. |
| crates/foundry/evm/evm/src/executors/mod.rs | Update initial_total_gas field access to method call form. |
| crates/foundry/evm/core/src/opts.rs | Adjust rustdoc link target for configure_env reference after refactor/import changes. |
| crates/foundry/evm/core/src/backend/predeploy.rs | Update predeploy account construction to use Account::from and new field visibility. |
| crates/foundry/evm/core/src/backend/mod.rs | Adapt to TransactionId and updated precompile warm-address plumbing. |
| crates/foundry/cheatcodes/src/inspector.rs | Update CallOutcome literals and replace is_error() with is_halt() usage. |
| crates/edr_solidity/src/nested_trace/conversion.rs | Handle new InternalResult::Suspend variant during nested-trace conversion. |
| crates/edr_provider/tests/integration/issues/issue_361.rs | Update test hardfork selection to the EVM-equivalent fork after REVM SpecId cleanup. |
| crates/edr_provider/tests/integration/eip7778.rs | Use TransactionId::ZERO in storage-slot construction to match new API. |
| crates/edr_provider/src/requests/validation.rs | Update validation test hardfork selection to the EVM-equivalent fork. |
| crates/edr_provider/src/data.rs | Update storage-slot tracking and gas accounting API usages (TransactionId, initial_total_gas(), Account::from). |
| crates/edr_napi/src/chains/l1.rs | Preserve JS enum/string hardfork API while mapping removed forks to semantic predecessors internally. |
| crates/edr_napi/src/account.rs | Use TransactionId::ZERO when building storage overrides from JS input. |
| crates/edr_eth/src/block/reward.rs | Adjust miner reward logic to match updated/reduced SpecId set. |
| crates/edr_coverage/src/collector.rs | Initialize new CallOutcome field for coverage collector’s synthetic precompile outcomes. |
| crates/edr_chain_l1/src/chains.rs | Re-introduce removed hardfork name constants and omit removed fork activations while preserving string API. |
| crates/blockchain/local/src/lib.rs | Update tests to construct accounts via Account::from without now-private fields. |
| crates/blockchain/fork/src/lib.rs | Update fork setup accounts to use Account::from without now-private fields. |
| crates/block/header/src/difficulty.rs | Adjust difficulty bomb delay logic and document loss of distinguishability for removed glacier forks. |
| Cargo.toml | Upgrade REVM family versions; add git pins for op-revm mirror and foundry-fork-db rev. |
| Cargo.lock | Lockfile updates for upgraded REVM ecosystem and introduced git-sourced dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # No op-revm release supports revm 40 (op-revm 20.0.0 on crates.io pins revm | ||
| # ^38), so a shallow mirror of the ethereum-optimism monorepo commit matching | ||
| # the op-reth v2.4.0 release (workspace pins revm 40.0.3, the revm version at | ||
| # tag v112) is used instead. See the mirror's PROVENANCE.md. | ||
| op-revm = { git = "https://github.com/anaPerezGhiglia/op-revm", tag = "op-reth-v2.4.0-b40d2ce", default-features = false, features = [ | ||
| "c-kzg", |
There was a problem hiding this comment.
This repo checks in the Cargo.lock file which records the exact resolved commit, so builds are reproducible and a moved tag can't silently change CI. Also, if we are keeping the mirror repo, the intent is to migrate it to NomicFoundation organization
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1590 +/- ##
==========================================
- Coverage 79.82% 79.76% -0.07%
==========================================
Files 453 454 +1
Lines 79019 79054 +35
Branches 79019 79054 +35
==========================================
- Hits 63078 63055 -23
- Misses 13760 13821 +61
+ Partials 2181 2178 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
7d010d1 to
264279e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 38 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
crates/edr_napi/src/chains/l1.rs:156
- This changeset removes support for several legacy hardfork names/variants (e.g.
muirGlacier,arrowGlacier,daoFork) by rejecting them inSpecId::from_str, but the PR description states that the JS-facing API keeps all variants and name strings for backwards compatibility. Please align the PR description and the intended API surface: either reintroduce the removed variants/strings (mapping them to their EVM-equivalent successors internally), or update the PR description to reflect that these hardfork identifiers are now unsupported/rejected.
edr_chain_l1::chains::name::CANCUN => Ok(SpecId::Cancun),
edr_chain_l1::chains::name::PRAGUE => Ok(SpecId::Prague),
edr_chain_l1::chains::name::OSAKA => Ok(SpecId::Osaka),
edr_chain_l1::chains::name::AMSTERDAM => Ok(SpecId::Amsterdam),
_ => Err(napi::Error::new(
napi::Status::InvalidArg,
format!("The provided hardfork `{s}` is not supported."),
)),
ping op-revm to commit sha b40d2ce pin foundry-fork-db to commit sha 8027e5c
No need to update HH@ patch since loads EDR fine
264279e to
b2ec0e7
Compare
|
superseded by #1604 |
mainRemoved hardforks: breaking change
REVM dropped hardofrks that were EVM-equivalent: Frontier Thawing, DAO Fork, Constantinople, Muir Glacier, Arrow Glacier, Gray Glacier
PENDING: Refactor EDR so that we no longer depend internally on REVM SpecId type. We care about all hardforks since we need to be protocol compliant, that means that we care about all hardforks, even if they don't introduce changes in the EVM semantics
Summary
Upgrades the revm dependency family from
revm 38.0.0to tagv112 - revm 40.0.3, the version required for implementing support of the Amsterdam hardfork.The upgrade required resolving an ecosystem gap: no crates.io release of
op-revmorfoundry-fork-dbsupports revm 40:op-revm's releases stop at revm^38(its revm-41 work is unreleased monorepo development)foundry-fork-dbjumped from^38(0.26.0) straight to^41(0.27.0)Additionally, this PR contains a breaking change: the hardforks that revm removed as EVM-equivalent (Frontier Thawing, DAO Fork, Constantinople, Muir Glacier, Arrow Glacier, Gray Glacier) are removed from EDR's API as well. See the "Removed hardforks" section below.
Dependency resolution
op-revm: shallow mirror, pinned by tagop-revm20.0.0 on crates.io pins revm^38; development moved to the Optimism monorepo, where the next bump targets revm 41. This PR consumes op-revm from a shallow mirror:ethereum-optimism/optimism@b40d2ce(rust/op-revm), the canonical monorepo commit matching the op-reth v2.4.0 release, whose workspace pins revm 40.0.3. For more details on this snapshot read its PROVENANCE.mdOpSpecId::KARST, unblocking the known Karst activation gap inedr_op(not wired up here; separate change).Cargo.toml-only change, so disagreeing here is cheap. Options considered:-Zgit=shallow-depsis nightly-only).Cargo.tomland the lock file).foundry-fork-dbgit pin: the 0.26.0 release, recompiled against revm 40foundry-fork-db0.26.0 pins revm^38and 0.27.0 pins revm^41; the revm-40 port exists only inside thefoundry-rs/foundry-coremonorepo. This PR pins the exact revision that upstream Foundry's own revm-40 upgrade (foundry-rs/foundry#14925) shipped:The pinned revision's Rust source is byte-identical to the released 0.26.0 package; only
Cargo.tomldiffers (revm requirement bumped to 40.0.3, dependency floors tightened). The history ofcrates/fork-dbup to the pinned commit shows the four commits since thefork-db-v0.26.0tag (revm bump, dependency pins, changelog/release tooling), and the crate delta can be checked in afoundry-coreclone with:A verification recipe against the published package is also in the
Cargo.tomlcomment: diff the crates.io 0.26.0 package againstcrates/fork-dbat the pinned rev.Provenance: chosen by Foundry's maintainers for the identical upgrade, CI-tested there, and distributed in ~3 weeks of Foundry nightlies (e.g. nightly
9022115); it was never part of a stable Foundry release (v1.7.1 predates the bump).A shared revm version is required because revm types are fork-db's public interface (
SharedBackend: DatabaseRef,AccountInfo/Bytecodein the cache and snapshot types); two revm copies do not unify at theCacheDB<SharedBackend>seam.Temporary by design: dissolves when the workspace moves to a revm for which fork-db has a crates.io release (0.27.0+ at revm 41+).
revm-inspectors
Bumped to 0.40.1 (crates.io, revm ^40).
This release removed the
edge_covmodule. Its main consumer, Foundry, took it in-tree.The 0.39.0 implementation is vendored at
crates/foundry/evm/evm/src/inspectors/edge_cov.rs, the same path where upstream Foundry maintains its copy, to keep coverage-guided fuzzing behavior-identical.This file is part of the foundry-port surface: the next foundry backport sync replaces it with upstream's since-evolved version.
Other code changes
API adaptations
Account::original_infois now private; newTransactionIdnewtype. Construction sites useAccount::from(AccountInfo);TransactionId::ZEROat slot-construction sites.PrecompileProvider::warm_addressesnow returns&AddressSet(was a boxed iterator).crates/precompilestoresunique_addressesas anAddressSet; the publicinto_addresses()shape is preserved.AddressSetis re-exported fromedr_primitives.CallOutcomegainedcharged_new_account_state_gas(EIP-8037, feat(eip8037): Amsterdam bal-devnet-7 bluealloy/revm#3667): initializedfalseat the 8 inspector sites that constructCallOutcomeliterally. This matches upstream Foundry's sites verbatim and is exact on all pre-Amsterdam hardforks, where state gas is always zero. Each site carries a TODO: the value stays at upstream parity, and whether to diverge (copying the flag fromCallInputs) is deferred until EIP-8037 is fully implemented.Gas::state_gas_spent()changedu64→i64(per-frame state gas can be transiently negative when 0→x→0 storage restoration refills more than the frame charged). The tracing surface clamps at 0 for the unsignedResultGasrepresentation, with a TODO to carry the signed value through when EIP-8037 support is implemented (crates/tracing/src/lib.rs).InternalResult::Suspendnew variant handled inedr_solidity/nested_trace/conversion.rs.initial_total_gasfield→method (2 sites),is_error()→is_halt().Full version table
op-reth-v2.4.0-b40d2ce)foundry-core@8027e5cc)Follow-ups (out of scope)
OpSpecId::KARSTactivations inedr_op(now unblocked by the op-revm pin).check-generated-filesworkflow (runs on push tomain) will fail once this PR lands: now thatOpSpecId::KARSTenum variant exists in revm, the check will parse the karst activation points, so the regenerated configs will differ from the committedgenerated/op.rs.edge_cov.rswith upstream Foundry's evolved copy on the next foundry backport sync.charged_new_account_state_gaswhen Amsterdam support graduates from early-access.