Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions crates/chainspec/src/api.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::{ChainSpec, DepositContract};
use alloc::{boxed::Box, vec::Vec};
use alloy_chains::Chain;
use alloy_consensus::Header;
use alloy_eips::{calc_next_block_base_fee, eip1559::BaseFeeParams, eip7840::BlobParams};
use alloy_genesis::Genesis;
use alloy_primitives::{B256, U256};
Expand Down Expand Up @@ -75,8 +74,8 @@ pub trait EthChainSpec: Send + Sync + Unpin + Debug {
}
}

impl EthChainSpec for ChainSpec {
type Header = Header;
impl<H: BlockHeader> EthChainSpec for ChainSpec<H> {
type Header = H;

fn chain(&self) -> Chain {
self.chain
Expand Down
4 changes: 2 additions & 2 deletions crates/chainspec/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ impl From<ForkBaseFeeParams> for BaseFeeParamsKind {
#[derive(Clone, Debug, PartialEq, Eq, From)]
pub struct ForkBaseFeeParams(Vec<(Box<dyn Hardfork>, BaseFeeParams)>);

impl core::ops::Deref for ChainSpec {
impl<H: BlockHeader> core::ops::Deref for ChainSpec<H> {
type Target = ChainHardforks;

fn deref(&self) -> &Self::Target {
Expand Down Expand Up @@ -1033,7 +1033,7 @@ impl From<&Arc<ChainSpec>> for ChainSpecBuilder {
}
}

impl EthExecutorSpec for ChainSpec {
impl<H: BlockHeader> EthExecutorSpec for ChainSpec<H> {
fn deposit_contract_address(&self) -> Option<Address> {
self.deposit_contract.map(|deposit_contract| deposit_contract.address)
}
Expand Down
11 changes: 6 additions & 5 deletions crates/ethereum/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use alloy_consensus::Header;
use alloy_primitives::B256;
use reth_chainspec::{ChainSpec, ChainSpecBuilder};
use reth_consensus_common::validation::validate_against_parent_gas_limit;
Expand All @@ -215,7 +216,7 @@ mod tests {
let child = header_with_gas_limit((parent.gas_limit + 5) as u64);

assert_eq!(
validate_against_parent_gas_limit(&child, &parent, &ChainSpec::default()),
validate_against_parent_gas_limit(&child, &parent, &ChainSpec::<Header>::default()),
Ok(())
);
}
Expand All @@ -226,7 +227,7 @@ mod tests {
let child = header_with_gas_limit(MINIMUM_GAS_LIMIT - 1);

assert_eq!(
validate_against_parent_gas_limit(&child, &parent, &ChainSpec::default()),
validate_against_parent_gas_limit(&child, &parent, &ChainSpec::<Header>::default()),
Err(ConsensusError::GasLimitInvalidMinimum { child_gas_limit: child.gas_limit as u64 })
);
}
Expand All @@ -239,7 +240,7 @@ mod tests {
);

assert_eq!(
validate_against_parent_gas_limit(&child, &parent, &ChainSpec::default()),
validate_against_parent_gas_limit(&child, &parent, &ChainSpec::<Header>::default()),
Err(ConsensusError::GasLimitInvalidIncrease {
parent_gas_limit: parent.gas_limit,
child_gas_limit: child.gas_limit,
Expand All @@ -253,7 +254,7 @@ mod tests {
let child = header_with_gas_limit(parent.gas_limit - 5);

assert_eq!(
validate_against_parent_gas_limit(&child, &parent, &ChainSpec::default()),
validate_against_parent_gas_limit(&child, &parent, &ChainSpec::<Header>::default()),
Ok(())
);
}
Expand All @@ -266,7 +267,7 @@ mod tests {
);

assert_eq!(
validate_against_parent_gas_limit(&child, &parent, &ChainSpec::default()),
validate_against_parent_gas_limit(&child, &parent, &ChainSpec::<Header>::default()),
Err(ConsensusError::GasLimitInvalidDecrease {
parent_gas_limit: parent.gas_limit,
child_gas_limit: child.gas_limit,
Expand Down
Loading