execution: add transaction and header AT to ConfigureEvmEnv (#10754)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Thomas Coratger
2024-09-17 14:18:03 +02:00
committed by GitHub
parent 2a04b1c100
commit 92dacf4f52
5 changed files with 11 additions and 0 deletions

View File

@ -48,6 +48,8 @@ impl EthEvmConfig {
}
impl ConfigureEvmEnv for EthEvmConfig {
type Header = Header;
fn fill_cfg_env(
&self,
cfg_env: &mut CfgEnvWithHandlerCfg,

View File

@ -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();

View File

@ -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);
}

View File

@ -87,6 +87,8 @@ impl MyEvmConfig {
}
impl ConfigureEvmEnv for MyEvmConfig {
type Header = Header;
fn fill_cfg_env(
&self,
cfg_env: &mut CfgEnvWithHandlerCfg,

View File

@ -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)
}