Skip to content

feat(evm): Block/Tx/Cfg setters traits#13672

Merged
zerosnacks merged 3 commits intofoundry-rs:masterfrom
mablr:feature/evm_Block_Tx_Cfg_setters_traits
Mar 9, 2026
Merged

feat(evm): Block/Tx/Cfg setters traits#13672
zerosnacks merged 3 commits intofoundry-rs:masterfrom
mablr:feature/evm_Block_Tx_Cfg_setters_traits

Conversation

@mablr
Copy link
Copy Markdown
Collaborator

@mablr mablr commented Mar 8, 2026

Motivation

  • Foundry requires mutable Block/Tx/Cfg for cheatcodes.
  • We want Foundry to support multiple EVMs: Eth, Op and Tempo
  • For that we need to get rid of concrete fields mutations, and use instead generic setters
  • But ... revm provides only getters traits Block/Transaction/Cfg

Solution

  • Introduced FoundryBlock/FoundryTransaction/FoundryCfg, respectively extending revm's Block/Transaction/Cfg.
  • Enforced through FoundryContextExt: ContextTr<Block: FoundryBlock, Tx: FoundryTransaction, Cfg: FoundryCfg>
  • Provides idiomatic patterns like ctx.cfg_mut().set_spec(spec_id)

The extension of these traits for Tempo will follow a logic similar to #13512, with "no-op" defaults.

Copy link
Copy Markdown
Contributor

@0xrusowsky 0xrusowsky left a comment

Choose a reason for hiding this comment

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

directionally looks good, left some questions though

Comment thread crates/evm/core/src/env.rs
Comment thread crates/evm/evm/src/inspectors/stack.rs
Comment thread crates/evm/core/src/env.rs
@mablr mablr requested a review from 0xrusowsky March 9, 2026 09:42
Copy link
Copy Markdown
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

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

makes sense! pending final check @0xrusowsky

@zerosnacks zerosnacks merged commit ba6d845 into foundry-rs:master Mar 9, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Foundry Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants