mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: make DatabaseProvider generic over chainspec (#10978)
This commit is contained in:
@ -48,6 +48,8 @@ thiserror.workspace = true
|
||||
schnellru.workspace = true
|
||||
itertools.workspace = true
|
||||
|
||||
reth-chainspec = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
# reth
|
||||
reth-payload-builder = { workspace = true, features = ["test-utils"] }
|
||||
@ -79,4 +81,5 @@ optimism = [
|
||||
"reth-primitives/optimism",
|
||||
"reth-provider/optimism",
|
||||
"reth-blockchain-tree/optimism",
|
||||
"reth-chainspec"
|
||||
]
|
||||
|
||||
@ -197,7 +197,7 @@ where
|
||||
/// The payload store.
|
||||
payload_builder: PayloadBuilderHandle<N::Engine>,
|
||||
/// Validator for execution payloads
|
||||
payload_validator: ExecutionPayloadValidator,
|
||||
payload_validator: ExecutionPayloadValidator<N::ChainSpec>,
|
||||
/// Current blockchain tree action.
|
||||
blockchain_tree_action: Option<BlockchainTreeAction<N::Engine>>,
|
||||
/// Pending forkchoice update.
|
||||
@ -462,7 +462,8 @@ where
|
||||
) -> bool {
|
||||
// On Optimism, the proposers are allowed to reorg their own chain at will.
|
||||
#[cfg(feature = "optimism")]
|
||||
if self.blockchain.chain_spec().is_optimism() {
|
||||
if reth_chainspec::EthChainSpec::chain(self.blockchain.chain_spec().as_ref()).is_optimism()
|
||||
{
|
||||
debug!(
|
||||
target: "consensus::engine",
|
||||
fcu_head_num=?header.number,
|
||||
|
||||
@ -517,7 +517,7 @@ mod tests {
|
||||
fn build<N>(
|
||||
self,
|
||||
pipeline: Pipeline<N>,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
chain_spec: Arc<N::ChainSpec>,
|
||||
) -> EngineSyncController<N, Either<Client, TestFullBlockClient>>
|
||||
where
|
||||
N: ProviderNodeTypes,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
//! Collection of methods for block validation.
|
||||
|
||||
use reth_chainspec::{ChainSpec, EthereumHardforks};
|
||||
use reth_chainspec::{EthChainSpec, EthereumHardforks};
|
||||
use reth_consensus::ConsensusError;
|
||||
use reth_primitives::{
|
||||
constants::{
|
||||
@ -25,7 +25,7 @@ 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(
|
||||
pub fn validate_header_base_fee<ChainSpec: EthereumHardforks>(
|
||||
header: &Header,
|
||||
chain_spec: &ChainSpec,
|
||||
) -> Result<(), ConsensusError> {
|
||||
@ -101,7 +101,7 @@ pub fn validate_prague_request(block: &SealedBlock) -> Result<(), ConsensusError
|
||||
/// - Compares the transactions root in the block header to the block body
|
||||
/// - Pre-execution transaction validation
|
||||
/// - (Optionally) Compares the receipts root in the block header to the block body
|
||||
pub fn validate_block_pre_execution(
|
||||
pub fn validate_block_pre_execution<ChainSpec: EthereumHardforks>(
|
||||
block: &SealedBlock,
|
||||
chain_spec: &ChainSpec,
|
||||
) -> Result<(), ConsensusError> {
|
||||
@ -218,7 +218,7 @@ pub fn validate_against_parent_hash_number(
|
||||
|
||||
/// Validates the base fee against the parent and EIP-1559 rules.
|
||||
#[inline]
|
||||
pub fn validate_against_parent_eip1559_base_fee(
|
||||
pub fn validate_against_parent_eip1559_base_fee<ChainSpec: EthChainSpec + EthereumHardforks>(
|
||||
header: &Header,
|
||||
parent: &Header,
|
||||
chain_spec: &ChainSpec,
|
||||
|
||||
Reference in New Issue
Block a user