Skip to content

Commit

Permalink
execution: add transaction and header AT to ConfigureEvmEnv (#10754)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
  • Loading branch information
tcoratger and mattsse authored Sep 17, 2024
1 parent 2a04b1c commit 92dacf4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/ethereum/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ impl EthEvmConfig {
}

impl ConfigureEvmEnv for EthEvmConfig {
type Header = Header;

fn fill_cfg_env(
&self,
cfg_env: &mut CfgEnvWithHandlerCfg,
Expand Down
3 changes: 3 additions & 0 deletions crates/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ pub trait ConfigureEvm: ConfigureEvmEnv {
/// Default trait method implementation is done w.r.t. L1.
#[auto_impl::auto_impl(&, Arc)]
pub trait ConfigureEvmEnv: Send + Sync + Unpin + Clone + 'static {
/// The header type used by the EVM.
type Header;

/// Returns a [`TxEnv`] from a [`TransactionSignedEcRecovered`].
fn tx_env(&self, transaction: &TransactionSignedEcRecovered) -> TxEnv {
let mut tx_env = TxEnv::default();
Expand Down
2 changes: 2 additions & 0 deletions crates/optimism/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ impl OptimismEvmConfig {
}

impl ConfigureEvmEnv for OptimismEvmConfig {
type Header = Header;

fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
transaction.fill_tx_env(tx_env, sender);
}
Expand Down
2 changes: 2 additions & 0 deletions examples/custom-evm/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ impl MyEvmConfig {
}

impl ConfigureEvmEnv for MyEvmConfig {
type Header = Header;

fn fill_cfg_env(
&self,
cfg_env: &mut CfgEnvWithHandlerCfg,
Expand Down
2 changes: 2 additions & 0 deletions examples/stateful-precompile/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ impl StatefulPrecompileMut for WrappedPrecompile {
}

impl ConfigureEvmEnv for MyEvmConfig {
type Header = Header;

fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
self.inner.fill_tx_env(tx_env, transaction, sender)
}
Expand Down

0 comments on commit 92dacf4

Please sign in to comment.