Skip to content

Commit

Permalink
chore: pass generic header to validate_header_base_fee (#12921)
Browse files Browse the repository at this point in the history
  • Loading branch information
htiennv authored Nov 27, 2024
1 parent 4724564 commit 8d70e89
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions crates/consensus/common/src/validation.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Collection of methods for block validation.
use alloy_consensus::{constants::MAXIMUM_EXTRA_DATA_SIZE, Header};
use alloy_consensus::{constants::MAXIMUM_EXTRA_DATA_SIZE, BlockHeader, Header};
use alloy_eips::eip4844::{DATA_GAS_PER_BLOB, MAX_DATA_GAS_PER_BLOCK};
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_consensus::ConsensusError;
Expand All @@ -23,12 +23,12 @@ pub const fn validate_header_gas(header: &Header) -> Result<(), ConsensusError>

/// Ensure the EIP-1559 base fee is set if the London hardfork is active.
#[inline]
pub fn validate_header_base_fee<ChainSpec: EthereumHardforks>(
header: &Header,
pub fn validate_header_base_fee<H: BlockHeader, ChainSpec: EthereumHardforks>(
header: &H,
chain_spec: &ChainSpec,
) -> Result<(), ConsensusError> {
if chain_spec.is_fork_active_at_block(EthereumHardfork::London, header.number) &&
header.base_fee_per_gas.is_none()
if chain_spec.is_fork_active_at_block(EthereumHardfork::London, header.number()) &&
header.base_fee_per_gas().is_none()
{
return Err(ConsensusError::BaseFeeMissing)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl<ChainSpec: Send + Sync + EthChainSpec + EthereumHardforks + Debug> HeaderVa
{
fn validate_header(&self, header: &SealedHeader) -> Result<(), ConsensusError> {
validate_header_gas(header)?;
validate_header_base_fee(header, &self.chain_spec)?;
validate_header_base_fee(header.header(), &self.chain_spec)?;

// EIP-4895: Beacon chain push withdrawals as operations
if self.chain_spec.is_shanghai_active_at_timestamp(header.timestamp) &&
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Consensus for OpBeaconConsensus {
impl HeaderValidator for OpBeaconConsensus {
fn validate_header(&self, header: &SealedHeader) -> Result<(), ConsensusError> {
validate_header_gas(header)?;
validate_header_base_fee(header, &self.chain_spec)
validate_header_base_fee(header.header(), &self.chain_spec)
}

fn validate_header_against_parent(
Expand Down

0 comments on commit 8d70e89

Please sign in to comment.