mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
execution: add transaction and header AT to ConfigureEvmEnv (#10754)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -48,6 +48,8 @@ impl EthEvmConfig {
|
||||
}
|
||||
|
||||
impl ConfigureEvmEnv for EthEvmConfig {
|
||||
type Header = Header;
|
||||
|
||||
fn fill_cfg_env(
|
||||
&self,
|
||||
cfg_env: &mut CfgEnvWithHandlerCfg,
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -87,6 +87,8 @@ impl MyEvmConfig {
|
||||
}
|
||||
|
||||
impl ConfigureEvmEnv for MyEvmConfig {
|
||||
type Header = Header;
|
||||
|
||||
fn fill_cfg_env(
|
||||
&self,
|
||||
cfg_env: &mut CfgEnvWithHandlerCfg,
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user