Trait ConfigureEvmEnv

pub trait ConfigureEvmEnv:
    Send
    + Sync
    + Unpin
    + Clone
    + 'static {
    type Header: BlockHeader;
    type Transaction;
    type Error: Error + Send + Sync;

Show 13 methods // Required methods fn encrypt( &self, _data: &Bytes, _seismic_elements: &TxSeismicElements, ) -> Result<Bytes, EVMError<EnclaveError>>; fn decrypt( &self, _data: &Bytes, _seismic_elements: &TxSeismicElements, ) -> Result<Bytes, EVMError<EnclaveError>>; fn get_eph_rng_keypair(&self) -> Result<Keypair, EVMError<EnclaveError>>; fn fill_tx_env( &self, tx_env: &mut TxEnv, transaction: &Self::Transaction, sender: Address, ) -> Result<(), EVMError<EnclaveError>>; fn fill_tx_env_system_contract_call( &self, env: &mut Env, caller: Address, contract: Address, data: Bytes, ); fn fill_cfg_env( &self, cfg_env: &mut CfgEnvWithHandlerCfg, header: &Self::Header, total_difficulty: Uint<256, 4>, ); fn next_cfg_and_block_env( &self, parent: &Self::Header, attributes: NextBlockEnvAttributes, ) -> Result<(CfgEnvWithHandlerCfg, BlockEnv), Self::Error>; // Provided methods fn fill_seismic_tx_env( &self, _tx_env: &mut TxEnv, _tx: &TxSeismic, _sender: Address, _tx_hash: FixedBytes<32>, ) -> Result<(), EVMError<EnclaveError>> { ... } fn tx_env( &self, transaction: &Self::Transaction, signer: Address, ) -> Result<TxEnv, EVMError<EnclaveError>> { ... } fn cfg_env( &self, header: &Self::Header, total_difficulty: Uint<256, 4>, ) -> CfgEnvWithHandlerCfg { ... } fn fill_block_env( &self, block_env: &mut BlockEnv, header: &Self::Header, after_merge: bool, ) { ... } fn cfg_and_block_env( &self, header: &Self::Header, total_difficulty: Uint<256, 4>, ) -> (CfgEnvWithHandlerCfg, BlockEnv) { ... } fn fill_cfg_and_block_env( &self, cfg: &mut CfgEnvWithHandlerCfg, block_env: &mut BlockEnv, header: &Self::Header, total_difficulty: Uint<256, 4>, ) { ... }
}
Expand description

This represents the set of methods used to configure the EVM’s environment before block execution.

Default trait method implementation is done w.r.t. L1.

Required Associated Types§

type Header: BlockHeader

The header type used by the EVM.

type Transaction

The transaction type.

type Error: Error + Send + Sync

The error type that is returned by Self::next_cfg_and_block_env.

Required Methods§

fn encrypt( &self, _data: &Bytes, _seismic_elements: &TxSeismicElements, ) -> Result<Bytes, EVMError<EnclaveError>>

seismic feature encrypt the transaction

fn decrypt( &self, _data: &Bytes, _seismic_elements: &TxSeismicElements, ) -> Result<Bytes, EVMError<EnclaveError>>

seismic feature decrypt the transaction

fn get_eph_rng_keypair(&self) -> Result<Keypair, EVMError<EnclaveError>>

Get current eph_rng_keypair

fn fill_tx_env( &self, tx_env: &mut TxEnv, transaction: &Self::Transaction, sender: Address, ) -> Result<(), EVMError<EnclaveError>>

Fill transaction environment from a transaction and the given sender address.

fn fill_tx_env_system_contract_call( &self, env: &mut Env, caller: Address, contract: Address, data: Bytes, )

Fill transaction environment with a system contract call.

fn fill_cfg_env( &self, cfg_env: &mut CfgEnvWithHandlerCfg, header: &Self::Header, total_difficulty: Uint<256, 4>, )

Fill CfgEnvWithHandlerCfg fields according to the chain spec and given header.

This must set the corresponding spec id in the handler cfg, based on timestamp or total difficulty

fn next_cfg_and_block_env( &self, parent: &Self::Header, attributes: NextBlockEnvAttributes, ) -> Result<(CfgEnvWithHandlerCfg, BlockEnv), Self::Error>

Returns the configured CfgEnvWithHandlerCfg and BlockEnv for parent + 1 block.

This is intended for usage in block building after the merge and requires additional attributes that can’t be derived from the parent block: attributes that are determined by the CL, such as the timestamp, suggested fee recipient, and randomness value.

Provided Methods§

fn fill_seismic_tx_env( &self, _tx_env: &mut TxEnv, _tx: &TxSeismic, _sender: Address, _tx_hash: FixedBytes<32>, ) -> Result<(), EVMError<EnclaveError>>

seismic feature decrypt the transaction

fn tx_env( &self, transaction: &Self::Transaction, signer: Address, ) -> Result<TxEnv, EVMError<EnclaveError>>

Returns a TxEnv from a transaction and Address.

fn cfg_env( &self, header: &Self::Header, total_difficulty: Uint<256, 4>, ) -> CfgEnvWithHandlerCfg

Returns a CfgEnvWithHandlerCfg for the given header.

fn fill_block_env( &self, block_env: &mut BlockEnv, header: &Self::Header, after_merge: bool, )

Fill BlockEnv field according to the chain spec and given header

fn cfg_and_block_env( &self, header: &Self::Header, total_difficulty: Uint<256, 4>, ) -> (CfgEnvWithHandlerCfg, BlockEnv)

Creates a new CfgEnvWithHandlerCfg and BlockEnv for the given header.

fn fill_cfg_and_block_env( &self, cfg: &mut CfgEnvWithHandlerCfg, block_env: &mut BlockEnv, header: &Self::Header, total_difficulty: Uint<256, 4>, )

Convenience function to call both fill_cfg_env and ConfigureEvmEnv::fill_block_env.

Note: Implementers should ensure that all fields are required fields are filled.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl ConfigureEvmEnv for EthEvmConfig

§

fn get_eph_rng_keypair(&self) -> Result<Keypair, EVMError<EnclaveError>>

Get current eph_rng_keypair

§

fn fill_seismic_tx_env( &self, tx_env: &mut TxEnv, tx: &TxSeismic, sender: Address, tx_hash: FixedBytes<32>, ) -> Result<(), EVMError<EnclaveError>>

seismic feature decrypt the transaction

§

type Header = Header

§

type Transaction = TransactionSigned

§

type Error = Infallible

§

fn encrypt( &self, data: &Bytes, seismic_elements: &TxSeismicElements, ) -> Result<Bytes, EVMError<EnclaveError>>

§

fn decrypt( &self, data: &Bytes, seismic_elements: &TxSeismicElements, ) -> Result<Bytes, EVMError<EnclaveError>>

§

fn fill_tx_env( &self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address, ) -> Result<(), EVMError<EnclaveError>>

§

fn fill_tx_env_system_contract_call( &self, env: &mut Env, caller: Address, contract: Address, data: Bytes, )

§

fn fill_cfg_env( &self, cfg_env: &mut CfgEnvWithHandlerCfg, header: &Header, total_difficulty: Uint<256, 4>, )

§

fn next_cfg_and_block_env( &self, parent: &<EthEvmConfig as ConfigureEvmEnv>::Header, attributes: NextBlockEnvAttributes, ) -> Result<(CfgEnvWithHandlerCfg, BlockEnv), <EthEvmConfig as ConfigureEvmEnv>::Error>

§

impl<'a, T> ConfigureEvmEnv for &'a T
where T: 'a + ConfigureEvmEnv + ?Sized, &'a T: Send + Sync + Unpin + Clone + 'static,

§

type Header = <T as ConfigureEvmEnv>::Header

§

type Transaction = <T as ConfigureEvmEnv>::Transaction

§

type Error = <T as ConfigureEvmEnv>::Error

§

fn encrypt( &self, _data: &Bytes, _seismic_elements: &TxSeismicElements, ) -> Result<Bytes, EVMError<EnclaveError>>

§

fn decrypt( &self, _data: &Bytes, _seismic_elements: &TxSeismicElements, ) -> Result<Bytes, EVMError<EnclaveError>>

§

fn get_eph_rng_keypair(&self) -> Result<Keypair, EVMError<EnclaveError>>

§

fn fill_seismic_tx_env( &self, _tx_env: &mut TxEnv, _tx: &TxSeismic, _sender: Address, _tx_hash: FixedBytes<32>, ) -> Result<(), EVMError<EnclaveError>>

§

fn tx_env( &self, transaction: &<&'a T as ConfigureEvmEnv>::Transaction, signer: Address, ) -> Result<TxEnv, EVMError<EnclaveError>>

§

fn fill_tx_env( &self, tx_env: &mut TxEnv, transaction: &<&'a T as ConfigureEvmEnv>::Transaction, sender: Address, ) -> Result<(), EVMError<EnclaveError>>

§

fn fill_tx_env_system_contract_call( &self, env: &mut Env, caller: Address, contract: Address, data: Bytes, )

§

fn cfg_env( &self, header: &<&'a T as ConfigureEvmEnv>::Header, total_difficulty: Uint<256, 4>, ) -> CfgEnvWithHandlerCfg

§

fn fill_cfg_env( &self, cfg_env: &mut CfgEnvWithHandlerCfg, header: &<&'a T as ConfigureEvmEnv>::Header, total_difficulty: Uint<256, 4>, )

§

fn fill_block_env( &self, block_env: &mut BlockEnv, header: &<&'a T as ConfigureEvmEnv>::Header, after_merge: bool, )

§

fn cfg_and_block_env( &self, header: &<&'a T as ConfigureEvmEnv>::Header, total_difficulty: Uint<256, 4>, ) -> (CfgEnvWithHandlerCfg, BlockEnv)

§

fn fill_cfg_and_block_env( &self, cfg: &mut CfgEnvWithHandlerCfg, block_env: &mut BlockEnv, header: &<&'a T as ConfigureEvmEnv>::Header, total_difficulty: Uint<256, 4>, )

§

fn next_cfg_and_block_env( &self, parent: &<&'a T as ConfigureEvmEnv>::Header, attributes: NextBlockEnvAttributes, ) -> Result<(CfgEnvWithHandlerCfg, BlockEnv), <&'a T as ConfigureEvmEnv>::Error>

§

impl<T> ConfigureEvmEnv for Arc<T>
where T: ConfigureEvmEnv + ?Sized, Arc<T>: Send + Sync + Unpin + Clone + 'static,

§

type Header = <T as ConfigureEvmEnv>::Header

§

type Transaction = <T as ConfigureEvmEnv>::Transaction

§

type Error = <T as ConfigureEvmEnv>::Error

§

fn encrypt( &self, _data: &Bytes, _seismic_elements: &TxSeismicElements, ) -> Result<Bytes, EVMError<EnclaveError>>

§

fn decrypt( &self, _data: &Bytes, _seismic_elements: &TxSeismicElements, ) -> Result<Bytes, EVMError<EnclaveError>>

§

fn get_eph_rng_keypair(&self) -> Result<Keypair, EVMError<EnclaveError>>

§

fn fill_seismic_tx_env( &self, _tx_env: &mut TxEnv, _tx: &TxSeismic, _sender: Address, _tx_hash: FixedBytes<32>, ) -> Result<(), EVMError<EnclaveError>>

§

fn tx_env( &self, transaction: &<Arc<T> as ConfigureEvmEnv>::Transaction, signer: Address, ) -> Result<TxEnv, EVMError<EnclaveError>>

§

fn fill_tx_env( &self, tx_env: &mut TxEnv, transaction: &<Arc<T> as ConfigureEvmEnv>::Transaction, sender: Address, ) -> Result<(), EVMError<EnclaveError>>

§

fn fill_tx_env_system_contract_call( &self, env: &mut Env, caller: Address, contract: Address, data: Bytes, )

§

fn cfg_env( &self, header: &<Arc<T> as ConfigureEvmEnv>::Header, total_difficulty: Uint<256, 4>, ) -> CfgEnvWithHandlerCfg

§

fn fill_cfg_env( &self, cfg_env: &mut CfgEnvWithHandlerCfg, header: &<Arc<T> as ConfigureEvmEnv>::Header, total_difficulty: Uint<256, 4>, )

§

fn fill_block_env( &self, block_env: &mut BlockEnv, header: &<Arc<T> as ConfigureEvmEnv>::Header, after_merge: bool, )

§

fn cfg_and_block_env( &self, header: &<Arc<T> as ConfigureEvmEnv>::Header, total_difficulty: Uint<256, 4>, ) -> (CfgEnvWithHandlerCfg, BlockEnv)

§

fn fill_cfg_and_block_env( &self, cfg: &mut CfgEnvWithHandlerCfg, block_env: &mut BlockEnv, header: &<Arc<T> as ConfigureEvmEnv>::Header, total_difficulty: Uint<256, 4>, )

§

fn next_cfg_and_block_env( &self, parent: &<Arc<T> as ConfigureEvmEnv>::Header, attributes: NextBlockEnvAttributes, ) -> Result<(CfgEnvWithHandlerCfg, BlockEnv), <Arc<T> as ConfigureEvmEnv>::Error>

Implementors§