mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add a --dev option (#3866)
This commit is contained in:
@ -130,6 +130,43 @@ pub static SEPOLIA: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
.into()
|
||||
});
|
||||
|
||||
/// Dev testnet specification
|
||||
///
|
||||
/// Includes 20 prefunded accounts with 10_000 ETH each derived from mnemonic "test test test test
|
||||
/// test test test test test test test junk".
|
||||
pub static DEV: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
ChainSpec {
|
||||
chain: Chain::dev(),
|
||||
genesis: serde_json::from_str(include_str!("../../res/genesis/dev.json"))
|
||||
.expect("Can't deserialize Dev testnet genesis json"),
|
||||
genesis_hash: Some(H256(hex!(
|
||||
"2f980576711e3617a5e4d83dd539548ec0f7792007d505a3d2e9674833af2d7c"
|
||||
))),
|
||||
paris_block_and_final_difficulty: Some((0, U256::from(0))),
|
||||
fork_timestamps: ForkTimestamps::default().shanghai(0),
|
||||
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: Some(0), total_difficulty: U256::from(0) },
|
||||
),
|
||||
(Hardfork::Shanghai, ForkCondition::Timestamp(0)),
|
||||
]),
|
||||
}
|
||||
.into()
|
||||
});
|
||||
|
||||
/// An Ethereum chain specification.
|
||||
///
|
||||
/// A chain specification describes:
|
||||
@ -887,8 +924,8 @@ where
|
||||
mod tests {
|
||||
use crate::{
|
||||
Address, AllGenesisFormats, Chain, ChainSpec, ChainSpecBuilder, DisplayHardforks,
|
||||
ForkCondition, ForkHash, ForkId, Genesis, Hardfork, Head, GOERLI, H256, MAINNET, SEPOLIA,
|
||||
U256,
|
||||
ForkCondition, ForkHash, ForkId, Genesis, Hardfork, Head, DEV, GOERLI, H256, MAINNET,
|
||||
SEPOLIA, U256,
|
||||
};
|
||||
use bytes::BytesMut;
|
||||
use ethers_core::types as EtherType;
|
||||
@ -1188,6 +1225,17 @@ Post-merge hard forks (timestamp based):
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dev_forkids() {
|
||||
test_fork_ids(
|
||||
&DEV,
|
||||
&[(
|
||||
Head { number: 0, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0x45, 0xb8, 0x36, 0x12]), next: 0 },
|
||||
)],
|
||||
)
|
||||
}
|
||||
|
||||
/// Checks that time-based forks work
|
||||
///
|
||||
/// This is based off of the test vectors here: https://github.com/ethereum/go-ethereum/blob/5c8cc10d1e05c23ff1108022f4150749e73c0ca1/core/forkid/forkid_test.go#L155-L188
|
||||
|
||||
Reference in New Issue
Block a user