feat: use SealedHeader in ChainSpec (#14514)

This commit is contained in:
Arsenii Kulikov
2025-02-15 17:30:05 +04:00
committed by GitHub
parent 8123d6bd3b
commit 0f4914a944
18 changed files with 185 additions and 190 deletions

View File

@ -19,3 +19,4 @@ reth-tracing.workspace = true
tokio-stream.workspace = true
reth-discv4 = { workspace = true, features = ["test-utils"] }
alloy-primitives.workspace = true
alloy-genesis.workspace = true

View File

@ -1,8 +1,5 @@
use alloy_primitives::{b256, B256};
use reth_chainspec::{
once_cell_set, BaseFeeParams, Chain, ChainHardforks, ChainSpec, EthereumHardfork,
ForkCondition, Hardfork,
};
use alloy_genesis::Genesis;
use reth_chainspec::ChainSpec;
use reth_discv4::NodeRecord;
use reth_primitives::Head;
@ -11,29 +8,9 @@ use std::sync::Arc;
const SHANGHAI_BLOCK: u64 = 50523000;
pub(crate) fn polygon_chain_spec() -> Arc<ChainSpec> {
const GENESIS: B256 = b256!("a9c28ce2141b56c474f1dc504bee9b01eb1bd7d1a507580d5519d4437a97de1b");
ChainSpec {
chain: Chain::from_id(137),
// <https://github.com/maticnetwork/bor/blob/d521b8e266b97efe9c8fdce8167e9dd77b04637d/builder/files/genesis-mainnet-v1.json>
genesis: serde_json::from_str(include_str!("./genesis.json")).expect("deserialize genesis"),
genesis_hash: once_cell_set(GENESIS),
genesis_header: Default::default(),
paris_block_and_final_difficulty: None,
hardforks: ChainHardforks::new(vec![
(EthereumHardfork::Petersburg.boxed(), ForkCondition::Block(0)),
(EthereumHardfork::Istanbul.boxed(), ForkCondition::Block(3395000)),
(EthereumHardfork::MuirGlacier.boxed(), ForkCondition::Block(3395000)),
(EthereumHardfork::Berlin.boxed(), ForkCondition::Block(14750000)),
(EthereumHardfork::London.boxed(), ForkCondition::Block(23850000)),
(EthereumHardfork::Shanghai.boxed(), ForkCondition::Block(SHANGHAI_BLOCK)),
]),
deposit_contract: None,
base_fee_params: reth_chainspec::BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
prune_delete_limit: 0,
blob_params: Default::default(),
}
.into()
let genesis: Genesis =
serde_json::from_str(include_str!("./genesis.json")).expect("deserialize genesis");
Arc::new(genesis.into())
}
/// Polygon mainnet boot nodes <https://github.com/maticnetwork/bor/blob/master/params/bootnodes.go#L79>