mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-27 16:18:08 -05:00
chore: pass generic header to validate_header_gas (#12931)
This commit is contained in:
@@ -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(())
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user