mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: integrate blob_params_at_timestamp (#14128)
This commit is contained in:
@ -21,7 +21,7 @@ use alloc::{sync::Arc, vec::Vec};
|
||||
use alloy_consensus::{BlockHeader, Header};
|
||||
use alloy_primitives::{Address, U256};
|
||||
use core::{convert::Infallible, fmt::Debug};
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_chainspec::{ChainSpec, EthChainSpec};
|
||||
use reth_evm::{env::EvmEnv, ConfigureEvm, ConfigureEvmEnv, Database, Evm, NextBlockEnvAttributes};
|
||||
use reth_primitives::TransactionSigned;
|
||||
use reth_primitives_traits::transaction::execute::FillTxEnv;
|
||||
@ -32,7 +32,7 @@ use revm_primitives::{
|
||||
};
|
||||
|
||||
mod config;
|
||||
use alloy_eips::{eip1559::INITIAL_BASE_FEE, eip7840::BlobParams};
|
||||
use alloy_eips::eip1559::INITIAL_BASE_FEE;
|
||||
pub use config::{revm_spec, revm_spec_by_timestamp_and_block_number};
|
||||
use reth_ethereum_forks::EthereumHardfork;
|
||||
|
||||
@ -188,13 +188,12 @@ impl ConfigureEvmEnv for EthEvmConfig {
|
||||
parent.number() + 1,
|
||||
);
|
||||
|
||||
let blob_params =
|
||||
if spec_id >= SpecId::PRAGUE { BlobParams::prague() } else { BlobParams::cancun() };
|
||||
|
||||
// if the parent block did not have excess blob gas (i.e. it was pre-cancun), but it is
|
||||
// cancun now, we need to set the excess blob gas to the default value(0)
|
||||
let blob_excess_gas_and_price = parent
|
||||
.next_block_excess_blob_gas(blob_params)
|
||||
.maybe_next_block_excess_blob_gas(
|
||||
self.chain_spec.blob_params_at_timestamp(attributes.timestamp),
|
||||
)
|
||||
.or_else(|| (spec_id == SpecId::CANCUN).then_some(0))
|
||||
.map(|gas| BlobExcessGasAndPrice::new(gas, spec_id >= SpecId::PRAGUE));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user