mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
emv: add BlockHeader trait and default fill_block_env (#10993)
This commit is contained in:
@ -114,26 +114,6 @@ impl ConfigureEvmEnv for MyEvmConfig {
|
||||
self.inner.fill_cfg_env(cfg_env, header, total_difficulty);
|
||||
}
|
||||
|
||||
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: &Self::Header,
|
||||
|
||||
Reference in New Issue
Block a user