feat: integrate blob_params_at_timestamp (#14128)

This commit is contained in:
joshieDo
2025-01-31 18:18:34 +00:00
committed by GitHub
parent 214f3b3b8e
commit d3acdda21b
11 changed files with 55 additions and 58 deletions

View File

@ -9,17 +9,16 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![allow(clippy::useless_let_if_seq)]
use alloy_consensus::{Header, Transaction, Typed2718, EMPTY_OMMER_ROOT_HASH};
use alloy_consensus::{BlockHeader, Header, Transaction, Typed2718, EMPTY_OMMER_ROOT_HASH};
use alloy_eips::{
eip4844::MAX_DATA_GAS_PER_BLOCK, eip6110, eip7685::Requests, eip7840::BlobParams,
merge::BEACON_NONCE,
eip4844::MAX_DATA_GAS_PER_BLOCK, eip6110, eip7685::Requests, merge::BEACON_NONCE,
};
use alloy_primitives::U256;
use reth_basic_payload_builder::{
commit_withdrawals, is_better_payload, BuildArguments, BuildOutcome, PayloadBuilder,
PayloadConfig,
};
use reth_chainspec::{ChainSpec, ChainSpecProvider};
use reth_chainspec::{ChainSpec, ChainSpecProvider, EthChainSpec};
use reth_errors::RethError;
use reth_evm::{
env::EvmEnv, system_calls::SystemCaller, ConfigureEvm, Evm, EvmError, InvalidTxError,
@ -419,13 +418,9 @@ where
.map_err(PayloadBuilderError::other)?;
excess_blob_gas = if chain_spec.is_cancun_active_at_timestamp(parent_header.timestamp) {
let blob_params = if chain_spec.is_prague_active_at_timestamp(attributes.timestamp) {
BlobParams::prague()
} else {
// cancun
BlobParams::cancun()
};
parent_header.next_block_excess_blob_gas(blob_params)
parent_header.maybe_next_block_excess_blob_gas(
chain_spec.blob_params_at_timestamp(attributes.timestamp),
)
} else {
// for the first post-fork block, both parent.blob_gas_used and
// parent.excess_blob_gas are evaluated as 0