mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
evm: use Header AT in ConfigureEvmEnv (#10968)
This commit is contained in:
@ -59,7 +59,7 @@ impl<EvmConfig> OpExecutorProvider<EvmConfig> {
|
||||
|
||||
impl<EvmConfig> OpExecutorProvider<EvmConfig>
|
||||
where
|
||||
EvmConfig: ConfigureEvm,
|
||||
EvmConfig: ConfigureEvm<Header = Header>,
|
||||
{
|
||||
fn op_executor<DB>(&self, db: DB) -> OpBlockExecutor<EvmConfig, DB>
|
||||
where
|
||||
@ -75,7 +75,7 @@ where
|
||||
|
||||
impl<EvmConfig> BlockExecutorProvider for OpExecutorProvider<EvmConfig>
|
||||
where
|
||||
EvmConfig: ConfigureEvm,
|
||||
EvmConfig: ConfigureEvm<Header = Header>,
|
||||
{
|
||||
type Executor<DB: Database<Error: Into<ProviderError> + Display>> =
|
||||
OpBlockExecutor<EvmConfig, DB>;
|
||||
@ -109,7 +109,7 @@ pub struct OpEvmExecutor<EvmConfig> {
|
||||
|
||||
impl<EvmConfig> OpEvmExecutor<EvmConfig>
|
||||
where
|
||||
EvmConfig: ConfigureEvm,
|
||||
EvmConfig: ConfigureEvm<Header = Header>,
|
||||
{
|
||||
/// Executes the transactions in the block and returns the receipts.
|
||||
///
|
||||
@ -262,7 +262,7 @@ impl<EvmConfig, DB> OpBlockExecutor<EvmConfig, DB> {
|
||||
|
||||
impl<EvmConfig, DB> OpBlockExecutor<EvmConfig, DB>
|
||||
where
|
||||
EvmConfig: ConfigureEvm,
|
||||
EvmConfig: ConfigureEvm<Header = Header>,
|
||||
DB: Database<Error: Into<ProviderError> + Display>,
|
||||
{
|
||||
/// Configures a new evm configuration and block environment for the given block.
|
||||
@ -335,7 +335,7 @@ where
|
||||
|
||||
impl<EvmConfig, DB> Executor<DB> for OpBlockExecutor<EvmConfig, DB>
|
||||
where
|
||||
EvmConfig: ConfigureEvm,
|
||||
EvmConfig: ConfigureEvm<Header = Header>,
|
||||
DB: Database<Error: Into<ProviderError> + Display>,
|
||||
{
|
||||
type Input<'a> = BlockExecutionInput<'a, BlockWithSenders>;
|
||||
@ -376,7 +376,7 @@ pub struct OpBlockAccessListExecutor<EvmConfig, DB> {
|
||||
|
||||
impl<EvmConfig, DB> Executor<DB> for OpBlockAccessListExecutor<EvmConfig, DB>
|
||||
where
|
||||
EvmConfig: ConfigureEvm,
|
||||
EvmConfig: ConfigureEvm<Header = Header>,
|
||||
DB: Database<Error: Into<ProviderError> + Display>,
|
||||
{
|
||||
type Input<'a> = BlockExecutionInput<'a, BlockWithSenders>;
|
||||
@ -472,7 +472,7 @@ impl<EvmConfig, DB> OpBatchExecutor<EvmConfig, DB> {
|
||||
|
||||
impl<EvmConfig, DB> BatchExecutor<DB> for OpBatchExecutor<EvmConfig, DB>
|
||||
where
|
||||
EvmConfig: ConfigureEvm,
|
||||
EvmConfig: ConfigureEvm<Header = Header>,
|
||||
DB: Database<Error: Into<ProviderError> + Display>,
|
||||
{
|
||||
type Input<'a> = BlockExecutionInput<'a, BlockWithSenders>;
|
||||
|
||||
@ -106,7 +106,7 @@ impl ConfigureEvmEnv for OptimismEvmConfig {
|
||||
fn fill_cfg_env(
|
||||
&self,
|
||||
cfg_env: &mut CfgEnvWithHandlerCfg,
|
||||
header: &Header,
|
||||
header: &Self::Header,
|
||||
total_difficulty: U256,
|
||||
) {
|
||||
let spec_id = revm_spec(
|
||||
@ -127,9 +127,29 @@ impl ConfigureEvmEnv for OptimismEvmConfig {
|
||||
cfg_env.handler_cfg.is_optimism = self.chain_spec.is_optimism();
|
||||
}
|
||||
|
||||
fn fill_block_env(&self, block_env: &mut BlockEnv, header: &Self::Header, after_merge: bool) {
|
||||
block_env.number = U256::from(header.number);
|
||||
block_env.coinbase = header.beneficiary;
|
||||
block_env.timestamp = U256::from(header.timestamp);
|
||||
if after_merge {
|
||||
block_env.prevrandao = Some(header.mix_hash);
|
||||
block_env.difficulty = U256::ZERO;
|
||||
} else {
|
||||
block_env.difficulty = header.difficulty;
|
||||
block_env.prevrandao = None;
|
||||
}
|
||||
block_env.basefee = U256::from(header.base_fee_per_gas.unwrap_or_default());
|
||||
block_env.gas_limit = U256::from(header.gas_limit);
|
||||
|
||||
// EIP-4844 excess blob gas of this block, introduced in Cancun
|
||||
if let Some(excess_blob_gas) = header.excess_blob_gas {
|
||||
block_env.set_blob_excess_gas_and_price(excess_blob_gas);
|
||||
}
|
||||
}
|
||||
|
||||
fn next_cfg_and_block_env(
|
||||
&self,
|
||||
parent: &Header,
|
||||
parent: &Self::Header,
|
||||
attributes: NextBlockEnvAttributes,
|
||||
) -> (CfgEnvWithHandlerCfg, BlockEnv) {
|
||||
// configure evm env based on parent block
|
||||
|
||||
Reference in New Issue
Block a user