chore: pass generic header to validate_header_gas (#12931)

This commit is contained in:
maze
2024-11-28 00:03:44 -08:00
committed by GitHub
parent bb0bd77916
commit a3eb302f72
3 changed files with 6 additions and 6 deletions

View File

@@ -11,11 +11,11 @@ use revm_primitives::calc_excess_blob_gas;
/// Gas used needs to be less than gas limit. Gas used is going to be checked after execution.
#[inline]
pub const fn validate_header_gas(header: &Header) -> Result<(), ConsensusError> {
if header.gas_used > header.gas_limit {
pub fn validate_header_gas<H: BlockHeader>(header: &H) -> Result<(), ConsensusError> {
if header.gas_used() > header.gas_limit() {
return Err(ConsensusError::HeaderGasUsedExceedsGasLimit {
gas_used: header.gas_used,
gas_limit: header.gas_limit,
gas_used: header.gas_used(),
gas_limit: header.gas_limit(),
})
}
Ok(())

View File

@@ -118,7 +118,7 @@ impl<ChainSpec: Send + Sync + EthChainSpec + EthereumHardforks + Debug> HeaderVa
for EthBeaconConsensus<ChainSpec>
{
fn validate_header(&self, header: &SealedHeader) -> Result<(), ConsensusError> {
validate_header_gas(header)?;
validate_header_gas(header.header())?;
validate_header_base_fee(header.header(), &self.chain_spec)?;
// EIP-4895: Beacon chain push withdrawals as operations

View File

@@ -92,7 +92,7 @@ impl Consensus for OpBeaconConsensus {
impl HeaderValidator for OpBeaconConsensus {
fn validate_header(&self, header: &SealedHeader) -> Result<(), ConsensusError> {
validate_header_gas(header)?;
validate_header_gas(header.header())?;
validate_header_base_fee(header.header(), &self.chain_spec)
}