mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: holesky support (#4359)
This commit is contained in:
1000
crates/primitives/res/genesis/holesky.json
Normal file
1000
crates/primitives/res/genesis/holesky.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,4 +1,5 @@
|
||||
use crate::{
|
||||
holesky_nodes,
|
||||
net::{goerli_nodes, mainnet_nodes, sepolia_nodes},
|
||||
NodeRecord, U256, U64,
|
||||
};
|
||||
@ -11,7 +12,7 @@ use std::{fmt, str::FromStr};
|
||||
mod spec;
|
||||
pub use spec::{
|
||||
AllGenesisFormats, BaseFeeParams, ChainSpec, ChainSpecBuilder, DisplayHardforks, ForkCondition,
|
||||
ForkTimestamps, DEV, GOERLI, MAINNET, SEPOLIA,
|
||||
ForkTimestamps, DEV, GOERLI, HOLESKY, MAINNET, SEPOLIA,
|
||||
};
|
||||
|
||||
// The chain info module.
|
||||
@ -44,6 +45,11 @@ impl Chain {
|
||||
Chain::Named(ethers_core::types::Chain::Sepolia)
|
||||
}
|
||||
|
||||
/// Returns the holesky chain.
|
||||
pub const fn holesky() -> Self {
|
||||
Chain::Named(ethers_core::types::Chain::Holesky)
|
||||
}
|
||||
|
||||
/// Returns the dev chain.
|
||||
pub const fn dev() -> Self {
|
||||
Chain::Named(ethers_core::types::Chain::Dev)
|
||||
@ -88,6 +94,7 @@ impl Chain {
|
||||
Mainnet => Some(mainnet_nodes()),
|
||||
Goerli => Some(goerli_nodes()),
|
||||
Sepolia => Some(sepolia_nodes()),
|
||||
Holesky => Some(holesky_nodes()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,6 +157,47 @@ pub static SEPOLIA: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
.into()
|
||||
});
|
||||
|
||||
/// The Holesky spec
|
||||
pub static HOLESKY: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
ChainSpec {
|
||||
chain: Chain::holesky(),
|
||||
genesis: serde_json::from_str(include_str!("../../res/genesis/holesky.json"))
|
||||
.expect("Can't deserialize Holesky genesis json"),
|
||||
genesis_hash: Some(H256(hex!(
|
||||
"ff9006519a8ce843ac9c28549d24211420b546e12ce2d170c77a8cca7964f23d"
|
||||
))),
|
||||
paris_block_and_final_difficulty: Some((0, U256::from(1))),
|
||||
fork_timestamps: ForkTimestamps::default().shanghai(1694790240),
|
||||
hardforks: BTreeMap::from([
|
||||
(Hardfork::Frontier, ForkCondition::Block(0)),
|
||||
(Hardfork::Homestead, ForkCondition::Block(0)),
|
||||
(Hardfork::Dao, ForkCondition::Block(0)),
|
||||
(Hardfork::Tangerine, ForkCondition::Block(0)),
|
||||
(Hardfork::SpuriousDragon, ForkCondition::Block(0)),
|
||||
(Hardfork::Byzantium, ForkCondition::Block(0)),
|
||||
(Hardfork::Constantinople, ForkCondition::Block(0)),
|
||||
(Hardfork::Petersburg, ForkCondition::Block(0)),
|
||||
(Hardfork::Istanbul, ForkCondition::Block(0)),
|
||||
(Hardfork::MuirGlacier, ForkCondition::Block(0)),
|
||||
(Hardfork::Berlin, ForkCondition::Block(0)),
|
||||
(Hardfork::London, ForkCondition::Block(0)),
|
||||
(
|
||||
Hardfork::Paris,
|
||||
ForkCondition::TTD { fork_block: None, total_difficulty: U256::ZERO },
|
||||
),
|
||||
(Hardfork::Shanghai, ForkCondition::Timestamp(1694790240)),
|
||||
]),
|
||||
deposit_contract: Some(DepositContract::new(
|
||||
H160(hex!("4242424242424242424242424242424242424242")),
|
||||
0,
|
||||
H256(hex!("649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5")),
|
||||
)),
|
||||
base_fee_params: BaseFeeParams::ethereum(),
|
||||
prune_batch_sizes: PruneBatchSizes::testnet(),
|
||||
}
|
||||
.into()
|
||||
});
|
||||
|
||||
/// Dev testnet specification
|
||||
///
|
||||
/// Includes 20 prefunded accounts with 10_000 ETH each derived from mnemonic "test test test test
|
||||
@ -1088,7 +1129,7 @@ mod tests {
|
||||
use crate::{
|
||||
constants::EMPTY_WITHDRAWALS, Address, AllGenesisFormats, Chain, ChainSpec,
|
||||
ChainSpecBuilder, DisplayHardforks, ForkCondition, ForkHash, ForkId, Genesis, Hardfork,
|
||||
Head, DEV, GOERLI, H256, MAINNET, SEPOLIA, U256,
|
||||
Head, DEV, GOERLI, H256, HOLESKY, MAINNET, SEPOLIA, U256,
|
||||
};
|
||||
use bytes::BytesMut;
|
||||
use ethers_core::types as EtherType;
|
||||
@ -1898,4 +1939,11 @@ Post-merge hard forks (timestamp based):
|
||||
let expected_forkhash = ForkHash(hex_literal::hex!("8062457a"));
|
||||
assert_eq!(ForkHash::from(genesis_hash), expected_forkhash);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn holesky_paris_activated_at_genesis() {
|
||||
assert!(HOLESKY
|
||||
.fork(Hardfork::Paris)
|
||||
.active_at_ttd(HOLESKY.genesis.difficulty, HOLESKY.genesis.difficulty));
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,6 +84,10 @@ pub const GOERLI_GENESIS: H256 =
|
||||
pub const SEPOLIA_GENESIS: H256 =
|
||||
H256(hex!("25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9"));
|
||||
|
||||
/// Holesky genesis hash.
|
||||
pub const HOLESKY_GENESIS: H256 =
|
||||
H256(hex!("ff9006519a8ce843ac9c28549d24211420b546e12ce2d170c77a8cca7964f23d"));
|
||||
|
||||
/// Testnet genesis hash.
|
||||
pub const DEV_GENESIS: H256 =
|
||||
H256(hex!("2f980576711e3617a5e4d83dd539548ec0f7792007d505a3d2e9674833af2d7c"));
|
||||
|
||||
@ -61,11 +61,12 @@ pub use block::{
|
||||
pub use bloom::Bloom;
|
||||
pub use chain::{
|
||||
AllGenesisFormats, BaseFeeParams, Chain, ChainInfo, ChainSpec, ChainSpecBuilder,
|
||||
DisplayHardforks, ForkCondition, ForkTimestamps, DEV, GOERLI, MAINNET, SEPOLIA,
|
||||
DisplayHardforks, ForkCondition, ForkTimestamps, DEV, GOERLI, HOLESKY, MAINNET, SEPOLIA,
|
||||
};
|
||||
pub use compression::*;
|
||||
pub use constants::{
|
||||
DEV_GENESIS, EMPTY_OMMER_ROOT, GOERLI_GENESIS, KECCAK_EMPTY, MAINNET_GENESIS, SEPOLIA_GENESIS,
|
||||
DEV_GENESIS, EMPTY_OMMER_ROOT, GOERLI_GENESIS, HOLESKY_GENESIS, KECCAK_EMPTY, MAINNET_GENESIS,
|
||||
SEPOLIA_GENESIS,
|
||||
};
|
||||
pub use eip4844::{calculate_excess_blob_gas, kzg_to_versioned_hash};
|
||||
pub use forkid::{ForkFilter, ForkHash, ForkId, ForkTransition, ValidationError};
|
||||
|
||||
Reference in New Issue
Block a user