From 4fbef02ef9255372f8919a8ac2a03d18b9a2f21d Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Thu, 4 Jul 2024 17:20:48 +0200 Subject: [PATCH] qol: purge goerli --- Cargo.lock | 1 - book/cli/reth.md | 2 +- book/cli/reth/config.md | 2 +- book/cli/reth/db.md | 2 +- book/cli/reth/debug.md | 2 +- book/cli/reth/dump-genesis.md | 2 +- book/cli/reth/import.md | 2 +- book/cli/reth/init-state.md | 2 +- book/cli/reth/init.md | 2 +- book/cli/reth/node.md | 2 +- book/cli/reth/p2p.md | 2 +- book/cli/reth/prune.md | 2 +- book/cli/reth/recover.md | 2 +- book/cli/reth/recover/storage-tries.md | 2 +- book/cli/reth/stage.md | 2 +- book/cli/reth/stage/drop.md | 2 +- book/cli/reth/stage/dump.md | 2 +- book/cli/reth/stage/run.md | 2 +- book/cli/reth/stage/unwind.md | 2 +- book/cli/reth/test-vectors.md | 2 +- book/cli/reth/test-vectors/tables.md | 2 +- crates/chainspec/src/lib.rs | 10 +- crates/chainspec/src/spec.rs | 143 +----------------- crates/consensus/common/src/calc.rs | 6 +- .../ethereum-forks/src/hardfork/ethereum.rs | 23 --- crates/ethereum/consensus/src/lib.rs | 9 +- crates/evm/src/lib.rs | 32 +--- crates/net/peers/src/bootnodes/ethereum.rs | 16 -- crates/net/peers/src/bootnodes/mod.rs | 5 - crates/node/core/src/args/utils.rs | 6 +- crates/node/core/src/dirs.rs | 8 +- crates/primitives-traits/src/constants/mod.rs | 4 - crates/primitives/Cargo.toml | 3 - crates/primitives/src/header.rs | 57 ------- crates/primitives/src/lib.rs | 4 +- crates/primitives/src/proofs.rs | 10 +- crates/rpc/rpc-eth-api/src/helpers/state.rs | 11 +- crates/storage/db-common/src/init.rs | 16 +- 38 files changed, 57 insertions(+), 347 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 794606782d0c1..a74b2d98f3b0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8004,7 +8004,6 @@ dependencies = [ "proptest-derive 0.5.0", "rand 0.8.5", "rayon", - "reth-chainspec", "reth-codecs", "reth-ethereum-forks", "reth-primitives-traits", diff --git a/book/cli/reth.md b/book/cli/reth.md index b8ac550816d01..0a761e5089cf7 100644 --- a/book/cli/reth.md +++ b/book/cli/reth.md @@ -28,7 +28,7 @@ Options: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/config.md b/book/cli/reth/config.md index 1b2a89c665dea..df0d261b07b1c 100644 --- a/book/cli/reth/config.md +++ b/book/cli/reth/config.md @@ -18,7 +18,7 @@ Options: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/db.md b/book/cli/reth/db.md index b884b7d0f0b3e..b867134a9d334 100644 --- a/book/cli/reth/db.md +++ b/book/cli/reth/db.md @@ -56,7 +56,7 @@ Datadir: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/debug.md b/book/cli/reth/debug.md index 2779b8d770ace..d61094834d39a 100644 --- a/book/cli/reth/debug.md +++ b/book/cli/reth/debug.md @@ -20,7 +20,7 @@ Options: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/dump-genesis.md b/book/cli/reth/dump-genesis.md index 5add924021379..7197be305f26a 100644 --- a/book/cli/reth/dump-genesis.md +++ b/book/cli/reth/dump-genesis.md @@ -12,7 +12,7 @@ Options: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/import.md b/book/cli/reth/import.md index 5a139e348cf47..29a67f1817641 100644 --- a/book/cli/reth/import.md +++ b/book/cli/reth/import.md @@ -44,7 +44,7 @@ Datadir: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/init-state.md b/book/cli/reth/init-state.md index b1802b253a06e..d947baec376d1 100644 --- a/book/cli/reth/init-state.md +++ b/book/cli/reth/init-state.md @@ -44,7 +44,7 @@ Datadir: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/init.md b/book/cli/reth/init.md index 8fe3fe018c0d0..5eb9d4d03ba47 100644 --- a/book/cli/reth/init.md +++ b/book/cli/reth/init.md @@ -44,7 +44,7 @@ Datadir: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/node.md b/book/cli/reth/node.md index c27d7251c4926..fe96358e5f775 100644 --- a/book/cli/reth/node.md +++ b/book/cli/reth/node.md @@ -15,7 +15,7 @@ Options: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/p2p.md b/book/cli/reth/p2p.md index ada874d8bfa60..0177244a3a737 100644 --- a/book/cli/reth/p2p.md +++ b/book/cli/reth/p2p.md @@ -20,7 +20,7 @@ Options: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/prune.md b/book/cli/reth/prune.md index 77ea724abd887..0b3e701f6b30e 100644 --- a/book/cli/reth/prune.md +++ b/book/cli/reth/prune.md @@ -44,7 +44,7 @@ Datadir: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/recover.md b/book/cli/reth/recover.md index 9ffd8eb70f579..4fe28211db0b5 100644 --- a/book/cli/reth/recover.md +++ b/book/cli/reth/recover.md @@ -16,7 +16,7 @@ Options: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/recover/storage-tries.md b/book/cli/reth/recover/storage-tries.md index 649580382b117..d5df358a711d7 100644 --- a/book/cli/reth/recover/storage-tries.md +++ b/book/cli/reth/recover/storage-tries.md @@ -44,7 +44,7 @@ Datadir: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/stage.md b/book/cli/reth/stage.md index 17a888b6ecded..c9ff302c1aa08 100644 --- a/book/cli/reth/stage.md +++ b/book/cli/reth/stage.md @@ -19,7 +19,7 @@ Options: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/stage/drop.md b/book/cli/reth/stage/drop.md index dc2f1330bb05d..b700519e1a87e 100644 --- a/book/cli/reth/stage/drop.md +++ b/book/cli/reth/stage/drop.md @@ -44,7 +44,7 @@ Datadir: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/stage/dump.md b/book/cli/reth/stage/dump.md index f08b9ffd81c66..a5fd3052c0b63 100644 --- a/book/cli/reth/stage/dump.md +++ b/book/cli/reth/stage/dump.md @@ -51,7 +51,7 @@ Datadir: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/stage/run.md b/book/cli/reth/stage/run.md index a98a2be6dab6a..4fa8e0a38b231 100644 --- a/book/cli/reth/stage/run.md +++ b/book/cli/reth/stage/run.md @@ -44,7 +44,7 @@ Datadir: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/stage/unwind.md b/book/cli/reth/stage/unwind.md index 3af76e1d567ea..b9765bd8db184 100644 --- a/book/cli/reth/stage/unwind.md +++ b/book/cli/reth/stage/unwind.md @@ -49,7 +49,7 @@ Datadir: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/test-vectors.md b/book/cli/reth/test-vectors.md index da1b3c933f629..844c5ed8455a3 100644 --- a/book/cli/reth/test-vectors.md +++ b/book/cli/reth/test-vectors.md @@ -16,7 +16,7 @@ Options: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/book/cli/reth/test-vectors/tables.md b/book/cli/reth/test-vectors/tables.md index 3b8f52f2c211b..2a3023817b355 100644 --- a/book/cli/reth/test-vectors/tables.md +++ b/book/cli/reth/test-vectors/tables.md @@ -16,7 +16,7 @@ Options: Possible values are either a built-in chain or the path to a chain specification file. Built-in chains: - mainnet, sepolia, goerli, holesky, dev + mainnet, sepolia, holesky, dev [default: mainnet] diff --git a/crates/chainspec/src/lib.rs b/crates/chainspec/src/lib.rs index 162f281b6a4a5..17f766f5b0fdf 100644 --- a/crates/chainspec/src/lib.rs +++ b/crates/chainspec/src/lib.rs @@ -13,7 +13,7 @@ pub use alloy_chains::{Chain, ChainKind, NamedChain}; pub use info::ChainInfo; pub use spec::{ BaseFeeParams, BaseFeeParamsKind, ChainSpec, ChainSpecBuilder, DepositContract, - ForkBaseFeeParams, DEV, GOERLI, HOLESKY, MAINNET, SEPOLIA, + ForkBaseFeeParams, DEV, HOLESKY, MAINNET, SEPOLIA, }; #[cfg(feature = "optimism")] pub use spec::{BASE_MAINNET, BASE_SEPOLIA, OP_MAINNET, OP_SEPOLIA}; @@ -50,8 +50,8 @@ mod tests { #[test] fn test_named_id() { - let chain = Chain::from_named(NamedChain::Goerli); - assert_eq!(chain.id(), 5); + let chain = Chain::from_named(NamedChain::Holesky); + assert_eq!(chain.id(), 17000); } #[test] @@ -77,9 +77,9 @@ mod tests { #[test] fn test_into_u256() { - let chain = Chain::from_named(NamedChain::Goerli); + let chain = Chain::from_named(NamedChain::Holesky); let n: U256 = U256::from(chain.id()); - let expected = U256::from(5); + let expected = U256::from(17000); assert_eq!(n, expected); } diff --git a/crates/chainspec/src/spec.rs b/crates/chainspec/src/spec.rs index 33ca2f4f02442..b3662eb72ce63 100644 --- a/crates/chainspec/src/spec.rs +++ b/crates/chainspec/src/spec.rs @@ -35,8 +35,8 @@ pub use alloy_eips::eip1559::BaseFeeParams; #[cfg(feature = "optimism")] use reth_ethereum_forks::OptimismHardfork; use reth_network_peers::{ - base_nodes, base_testnet_nodes, goerli_nodes, holesky_nodes, mainnet_nodes, op_nodes, - op_testnet_nodes, sepolia_nodes, + base_nodes, base_testnet_nodes, holesky_nodes, mainnet_nodes, op_nodes, op_testnet_nodes, + sepolia_nodes, }; /// The Ethereum mainnet spec @@ -66,30 +66,6 @@ pub static MAINNET: Lazy> = Lazy::new(|| { .into() }); -/// The Goerli spec -pub static GOERLI: Lazy> = Lazy::new(|| { - ChainSpec { - chain: Chain::goerli(), - genesis: serde_json::from_str(include_str!("../res/genesis/goerli.json")) - .expect("Can't deserialize Goerli genesis json"), - genesis_hash: Some(b256!( - "bf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a" - )), - // - paris_block_and_final_difficulty: Some((7382818, U256::from(10_790_000))), - hardforks: EthereumHardfork::goerli().into(), - // https://goerli.etherscan.io/tx/0xa3c07dc59bfdb1bfc2d50920fed2ef2c1c4e0a09fe2325dbc14e07702f965a78 - deposit_contract: Some(DepositContract::new( - address!("ff50ed3d0ec03ac01d4c79aad74928bff48a7b2b"), - 4367322, - b256!("649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5"), - )), - base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()), - prune_delete_limit: 1700, - } - .into() -}); - /// The Sepolia spec pub static SEPOLIA: Lazy> = Lazy::new(|| { ChainSpec { @@ -715,7 +691,6 @@ impl ChainSpec { let chain = self.chain; match chain.try_into().ok()? { C::Mainnet => Some(mainnet_nodes()), - C::Goerli => Some(goerli_nodes()), C::Sepolia => Some(sepolia_nodes()), C::Holesky => Some(holesky_nodes()), C::Base => Some(base_nodes()), @@ -1457,63 +1432,6 @@ Post-merge hard forks (timestamp based): ); } - #[test] - fn goerli_hardfork_fork_ids() { - test_hardfork_fork_ids( - &GOERLI, - &[ - ( - EthereumHardfork::Frontier, - ForkId { hash: ForkHash([0xa3, 0xf5, 0xab, 0x08]), next: 1561651 }, - ), - ( - EthereumHardfork::Homestead, - ForkId { hash: ForkHash([0xa3, 0xf5, 0xab, 0x08]), next: 1561651 }, - ), - ( - EthereumHardfork::Tangerine, - ForkId { hash: ForkHash([0xa3, 0xf5, 0xab, 0x08]), next: 1561651 }, - ), - ( - EthereumHardfork::SpuriousDragon, - ForkId { hash: ForkHash([0xa3, 0xf5, 0xab, 0x08]), next: 1561651 }, - ), - ( - EthereumHardfork::Byzantium, - ForkId { hash: ForkHash([0xa3, 0xf5, 0xab, 0x08]), next: 1561651 }, - ), - ( - EthereumHardfork::Constantinople, - ForkId { hash: ForkHash([0xa3, 0xf5, 0xab, 0x08]), next: 1561651 }, - ), - ( - EthereumHardfork::Petersburg, - ForkId { hash: ForkHash([0xa3, 0xf5, 0xab, 0x08]), next: 1561651 }, - ), - ( - EthereumHardfork::Istanbul, - ForkId { hash: ForkHash([0xc2, 0x5e, 0xfa, 0x5c]), next: 4460644 }, - ), - ( - EthereumHardfork::Berlin, - ForkId { hash: ForkHash([0x75, 0x7a, 0x1c, 0x47]), next: 5062605 }, - ), - ( - EthereumHardfork::London, - ForkId { hash: ForkHash([0xb8, 0xc6, 0x29, 0x9d]), next: 1678832736 }, - ), - ( - EthereumHardfork::Shanghai, - ForkId { hash: ForkHash([0xf9, 0x84, 0x3a, 0xbf]), next: 1705473120 }, - ), - ( - EthereumHardfork::Cancun, - ForkId { hash: ForkHash([0x70, 0xcc, 0x14, 0xe2]), next: 0 }, - ), - ], - ); - } - #[test] fn sepolia_hardfork_fork_ids() { test_hardfork_fork_ids( @@ -1689,63 +1607,6 @@ Post-merge hard forks (timestamp based): ) } - #[test] - fn goerli_forkids() { - test_fork_ids( - &GOERLI, - &[ - ( - Head { number: 0, ..Default::default() }, - ForkId { hash: ForkHash([0xa3, 0xf5, 0xab, 0x08]), next: 1561651 }, - ), - ( - Head { number: 1561650, ..Default::default() }, - ForkId { hash: ForkHash([0xa3, 0xf5, 0xab, 0x08]), next: 1561651 }, - ), - ( - Head { number: 1561651, ..Default::default() }, - ForkId { hash: ForkHash([0xc2, 0x5e, 0xfa, 0x5c]), next: 4460644 }, - ), - ( - Head { number: 4460643, ..Default::default() }, - ForkId { hash: ForkHash([0xc2, 0x5e, 0xfa, 0x5c]), next: 4460644 }, - ), - ( - Head { number: 4460644, ..Default::default() }, - ForkId { hash: ForkHash([0x75, 0x7a, 0x1c, 0x47]), next: 5062605 }, - ), - ( - Head { number: 5062605, ..Default::default() }, - ForkId { hash: ForkHash([0xb8, 0xc6, 0x29, 0x9d]), next: 1678832736 }, - ), - ( - Head { number: 6000000, timestamp: 1678832735, ..Default::default() }, - ForkId { hash: ForkHash([0xb8, 0xc6, 0x29, 0x9d]), next: 1678832736 }, - ), - // First Shanghai block - ( - Head { number: 6000001, timestamp: 1678832736, ..Default::default() }, - ForkId { hash: ForkHash([0xf9, 0x84, 0x3a, 0xbf]), next: 1705473120 }, - ), - // Future Shanghai block - ( - Head { number: 6500002, timestamp: 1678832736, ..Default::default() }, - ForkId { hash: ForkHash([0xf9, 0x84, 0x3a, 0xbf]), next: 1705473120 }, - ), - // First Cancun block - ( - Head { number: 6500003, timestamp: 1705473120, ..Default::default() }, - ForkId { hash: ForkHash([0x70, 0xcc, 0x14, 0xe2]), next: 0 }, - ), - // Future Cancun block - ( - Head { number: 6500003, timestamp: 2705473120, ..Default::default() }, - ForkId { hash: ForkHash([0x70, 0xcc, 0x14, 0xe2]), next: 0 }, - ), - ], - ); - } - #[test] fn sepolia_forkids() { test_fork_ids( diff --git a/crates/consensus/common/src/calc.rs b/crates/consensus/common/src/calc.rs index feb7bff0d9085..e4b2abc13ba60 100644 --- a/crates/consensus/common/src/calc.rs +++ b/crates/consensus/common/src/calc.rs @@ -1,4 +1,4 @@ -use reth_chainspec::{Chain, ChainSpec, EthereumHardfork}; +use reth_chainspec::{ChainSpec, EthereumHardfork}; use reth_primitives::{constants::ETH_TO_WEI, BlockNumber, U256}; /// Calculates the base block reward. @@ -26,9 +26,7 @@ pub fn base_block_reward( block_difficulty: U256, total_difficulty: U256, ) -> Option { - if chain_spec.fork(EthereumHardfork::Paris).active_at_ttd(total_difficulty, block_difficulty) || - chain_spec.chain == Chain::goerli() - { + if chain_spec.fork(EthereumHardfork::Paris).active_at_ttd(total_difficulty, block_difficulty) { None } else { Some(base_block_reward_pre_merge(chain_spec, block_number)) diff --git a/crates/ethereum-forks/src/hardfork/ethereum.rs b/crates/ethereum-forks/src/hardfork/ethereum.rs index 9e2a8a1112160..7a2618c3c70f1 100644 --- a/crates/ethereum-forks/src/hardfork/ethereum.rs +++ b/crates/ethereum-forks/src/hardfork/ethereum.rs @@ -358,29 +358,6 @@ impl EthereumHardfork { ] } - /// Ethereum goerli list of hardforks. - pub const fn goerli() -> [(Self, ForkCondition); 14] { - [ - (Self::Frontier, ForkCondition::Block(0)), - (Self::Homestead, ForkCondition::Block(0)), - (Self::Dao, ForkCondition::Block(0)), - (Self::Tangerine, ForkCondition::Block(0)), - (Self::SpuriousDragon, ForkCondition::Block(0)), - (Self::Byzantium, ForkCondition::Block(0)), - (Self::Constantinople, ForkCondition::Block(0)), - (Self::Petersburg, ForkCondition::Block(0)), - (Self::Istanbul, ForkCondition::Block(1561651)), - (Self::Berlin, ForkCondition::Block(4460644)), - (Self::London, ForkCondition::Block(5062605)), - ( - Self::Paris, - ForkCondition::TTD { fork_block: None, total_difficulty: uint!(10_790_000_U256) }, - ), - (Self::Shanghai, ForkCondition::Timestamp(1678832736)), - (Self::Cancun, ForkCondition::Timestamp(1705473120)), - ] - } - /// Ethereum sepolia list of hardforks. pub const fn sepolia() -> [(Self, ForkCondition); 15] { [ diff --git a/crates/ethereum/consensus/src/lib.rs b/crates/ethereum/consensus/src/lib.rs index 2027fd539c1f8..09d9a6636ebe9 100644 --- a/crates/ethereum/consensus/src/lib.rs +++ b/crates/ethereum/consensus/src/lib.rs @@ -8,7 +8,7 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -use reth_chainspec::{Chain, ChainSpec, EthereumHardfork, EthereumHardforks}; +use reth_chainspec::{ChainSpec, EthereumHardfork, EthereumHardforks}; use reth_consensus::{Consensus, ConsensusError, PostExecutionInput}; use reth_consensus_common::validation::{ validate_4844_header_standalone, validate_against_parent_4844, @@ -198,10 +198,9 @@ impl Consensus for EthBeaconConsensus { }) } - // Goerli and early OP exception: - // * If the network is goerli pre-merge, ignore the extradata check, since we do not - // support clique. Same goes for OP blocks below Bedrock. - if self.chain_spec.chain != Chain::goerli() && !self.chain_spec.is_optimism() { + // Early OP exception: + // * If the network is pre-Bedrock OP, ignore the extradata check. + if !self.chain_spec.is_optimism() { validate_header_extradata(header)?; } } diff --git a/crates/evm/src/lib.rs b/crates/evm/src/lib.rs index 325eb7e296078..e4f1557a8c63f 100644 --- a/crates/evm/src/lib.rs +++ b/crates/evm/src/lib.rs @@ -15,9 +15,7 @@ extern crate alloc; use core::ops::Deref; use reth_chainspec::ChainSpec; -use reth_primitives::{ - header::block_coinbase, Address, Header, TransactionSigned, TransactionSignedEcRecovered, U256, -}; +use reth_primitives::{Address, Header, TransactionSigned, TransactionSignedEcRecovered, U256}; use revm::{inspector_handle_register, Database, Evm, EvmBuilder, GetInspector}; use revm_primitives::{ BlockEnv, Bytes, CfgEnvWithHandlerCfg, Env, EnvWithHandlerCfg, SpecId, TxEnv, @@ -137,26 +135,15 @@ pub trait ConfigureEvmEnv: Send + Sync + Unpin + Clone + 'static { ); /// Fill [`BlockEnv`] field according to the chain spec and given header - fn fill_block_env( - &self, - block_env: &mut BlockEnv, - chain_spec: &ChainSpec, - header: &Header, - after_merge: bool, - ) { - let coinbase = block_coinbase(chain_spec, header, after_merge); - Self::fill_block_env_with_coinbase(block_env, header, after_merge, coinbase); + fn fill_block_env(&self, block_env: &mut BlockEnv, header: &Header, after_merge: bool) { + Self::fill_block_env_inner(block_env, header, after_merge); } /// Fill block environment with coinbase. - fn fill_block_env_with_coinbase( - block_env: &mut BlockEnv, - header: &Header, - after_merge: bool, - coinbase: Address, - ) { + /// TODO: fix + fn fill_block_env_inner(block_env: &mut BlockEnv, header: &Header, after_merge: bool) { block_env.number = U256::from(header.number); - block_env.coinbase = coinbase; + block_env.coinbase = header.beneficiary; block_env.timestamp = U256::from(header.timestamp); if after_merge { block_env.prevrandao = Some(header.mix_hash); @@ -185,11 +172,6 @@ pub trait ConfigureEvmEnv: Send + Sync + Unpin + Clone + 'static { ) { Self::fill_cfg_env(cfg, chain_spec, header, total_difficulty); let after_merge = cfg.handler_cfg.spec_id >= SpecId::MERGE; - Self::fill_block_env_with_coinbase( - block_env, - header, - after_merge, - block_coinbase(chain_spec, header, after_merge), - ); + Self::fill_block_env_inner(block_env, header, after_merge); } } diff --git a/crates/net/peers/src/bootnodes/ethereum.rs b/crates/net/peers/src/bootnodes/ethereum.rs index ba77bb701fcd2..9cb6aac00e1f5 100644 --- a/crates/net/peers/src/bootnodes/ethereum.rs +++ b/crates/net/peers/src/bootnodes/ethereum.rs @@ -17,22 +17,6 @@ pub static SEPOLIA_BOOTNODES : [&str; 5] = [ "enode://9e9492e2e8836114cc75f5b929784f4f46c324ad01daf87d956f98b3b6c5fcba95524d6e5cf9861dc96a2c8a171ea7105bb554a197455058de185fa870970c7c@138.68.123.152:30303", // sepolia-bootnode-1-ams3 ]; -/// Görli Bootnodes -pub static GOERLI_BOOTNODES : [&str; 7] = [ - // Upstream bootnodes - "enode://011f758e6552d105183b1761c5e2dea0111bc20fd5f6422bc7f91e0fabbec9a6595caf6239b37feb773dddd3f87240d99d859431891e4a642cf2a0a9e6cbb98a@51.141.78.53:30303", - "enode://176b9417f511d05b6b2cf3e34b756cf0a7096b3094572a8f6ef4cdcb9d1f9d00683bf0f83347eebdf3b81c3521c2332086d9592802230bf528eaf606a1d9677b@13.93.54.137:30303", - "enode://46add44b9f13965f7b9875ac6b85f016f341012d84f975377573800a863526f4da19ae2c620ec73d11591fa9510e992ecc03ad0751f53cc02f7c7ed6d55c7291@94.237.54.114:30313", - "enode://b5948a2d3e9d486c4d75bf32713221c2bd6cf86463302339299bd227dc2e276cd5a1c7ca4f43a0e9122fe9af884efed563bd2a1fd28661f3b5f5ad7bf1de5949@18.218.250.66:30303", - - // Ethereum Foundation bootnode - "enode://a61215641fb8714a373c80edbfa0ea8878243193f57c96eeb44d0bc019ef295abd4e044fd619bfc4c59731a73fb79afe84e9ab6da0c743ceb479cbb6d263fa91@3.11.147.67:30303", - - // Goerli Initiative bootnodes - "enode://d4f764a48ec2a8ecf883735776fdefe0a3949eb0ca476bd7bc8d0954a9defe8fea15ae5da7d40b5d2d59ce9524a99daedadf6da6283fca492cc80b53689fb3b3@46.4.99.122:32109", - "enode://d2b720352e8216c9efc470091aa91ddafc53e222b32780f505c817ceef69e01d5b0b0797b69db254c586f493872352f5a022b4d8479a00fc92ec55f9ad46a27e@88.99.70.182:30303", -]; - /// Ethereum Foundation Holesky Bootnodes pub static HOLESKY_BOOTNODES : [&str; 2] = [ "enode://ac906289e4b7f12df423d654c5a962b6ebe5b3a74cc9e06292a85221f9a64a6f1cfdd6b714ed6dacef51578f92b34c60ee91e9ede9c7f8fadc4d347326d95e2b@146.190.13.128:30303", diff --git a/crates/net/peers/src/bootnodes/mod.rs b/crates/net/peers/src/bootnodes/mod.rs index ecd6de3103a66..31c91e5d1cea0 100644 --- a/crates/net/peers/src/bootnodes/mod.rs +++ b/crates/net/peers/src/bootnodes/mod.rs @@ -13,11 +13,6 @@ pub fn mainnet_nodes() -> Vec { parse_nodes(&MAINNET_BOOTNODES[..]) } -/// Returns parsed goerli nodes -pub fn goerli_nodes() -> Vec { - parse_nodes(&GOERLI_BOOTNODES[..]) -} - /// Returns parsed sepolia nodes pub fn sepolia_nodes() -> Vec { parse_nodes(&SEPOLIA_BOOTNODES[..]) diff --git a/crates/node/core/src/args/utils.rs b/crates/node/core/src/args/utils.rs index c80626f884cf0..064505ccb8629 100644 --- a/crates/node/core/src/args/utils.rs +++ b/crates/node/core/src/args/utils.rs @@ -11,14 +11,14 @@ use reth_chainspec::DEV; use reth_chainspec::{BASE_MAINNET, BASE_SEPOLIA, OP_MAINNET, OP_SEPOLIA}; #[cfg(not(feature = "optimism"))] -use reth_chainspec::{GOERLI, HOLESKY, MAINNET, SEPOLIA}; +use reth_chainspec::{HOLESKY, MAINNET, SEPOLIA}; #[cfg(feature = "optimism")] /// Chains supported by op-reth. First value should be used as the default. pub const SUPPORTED_CHAINS: &[&str] = &["optimism", "optimism-sepolia", "base", "base-sepolia"]; #[cfg(not(feature = "optimism"))] /// Chains supported by reth. First value should be used as the default. -pub const SUPPORTED_CHAINS: &[&str] = &["mainnet", "sepolia", "goerli", "holesky", "dev"]; +pub const SUPPORTED_CHAINS: &[&str] = &["mainnet", "sepolia", "holesky", "dev"]; /// The help info for the --chain flag pub fn chain_help() -> String { @@ -34,8 +34,6 @@ pub fn chain_value_parser(s: &str) -> eyre::Result, eyre::Error> #[cfg(not(feature = "optimism"))] "mainnet" => MAINNET.clone(), #[cfg(not(feature = "optimism"))] - "goerli" => GOERLI.clone(), - #[cfg(not(feature = "optimism"))] "sepolia" => SEPOLIA.clone(), #[cfg(not(feature = "optimism"))] "holesky" => HOLESKY.clone(), diff --git a/crates/node/core/src/dirs.rs b/crates/node/core/src/dirs.rs index 08f93b472a994..a43350c2890c2 100644 --- a/crates/node/core/src/dirs.rs +++ b/crates/node/core/src/dirs.rs @@ -259,10 +259,10 @@ impl From for MaybePlatformPath { /// Wrapper type around `PlatformPath` that includes a `Chain`, used for separating reth data for /// different networks. /// -/// If the chain is either mainnet, goerli, or sepolia, then the path will be: +/// If the chain is either mainnet, sepolia, or holesky, then the path will be: /// * mainnet: `/mainnet` -/// * goerli: `/goerli` /// * sepolia: `/sepolia` +/// * holesky: `/holesky` /// /// Otherwise, the path will be dependent on the chain ID: /// * `/` @@ -383,10 +383,6 @@ mod tests { #[test] fn test_maybe_testnet_datadir_path() { - let path = MaybePlatformPath::::default(); - let path = path.unwrap_or_chain_default(Chain::goerli(), DatadirArgs::default()); - assert!(path.as_ref().ends_with("reth/goerli"), "{path:?}"); - let path = MaybePlatformPath::::default(); let path = path.unwrap_or_chain_default(Chain::holesky(), DatadirArgs::default()); assert!(path.as_ref().ends_with("reth/holesky"), "{path:?}"); diff --git a/crates/primitives-traits/src/constants/mod.rs b/crates/primitives-traits/src/constants/mod.rs index 7ed018e8c8fb3..b6bf2f602edba 100644 --- a/crates/primitives-traits/src/constants/mod.rs +++ b/crates/primitives-traits/src/constants/mod.rs @@ -104,10 +104,6 @@ pub const ETH_TO_WEI: u128 = FINNEY_TO_WEI * 1000; pub const MAINNET_GENESIS_HASH: B256 = b256!("d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3"); -/// Goerli genesis hash: `0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a` -pub const GOERLI_GENESIS_HASH: B256 = - b256!("bf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a"); - /// Sepolia genesis hash: `0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9` pub const SEPOLIA_GENESIS_HASH: B256 = b256!("25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9"); diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 1bd31171c1ed3..1eb5fc35aba27 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -18,7 +18,6 @@ reth-codecs.workspace = true reth-ethereum-forks.workspace = true reth-static-file-types.workspace = true reth-trie-common.workspace = true -reth-chainspec.workspace = true revm-primitives = { workspace = true, features = ["serde"] } # ethereum @@ -88,7 +87,6 @@ asm-keccak = ["alloy-primitives/asm-keccak"] arbitrary = [ "reth-primitives-traits/arbitrary", "revm-primitives/arbitrary", - "reth-chainspec/arbitrary", "reth-ethereum-forks/arbitrary", "nybbles/arbitrary", "alloy-trie/arbitrary", @@ -100,7 +98,6 @@ arbitrary = [ c-kzg = ["dep:c-kzg", "revm-primitives/c-kzg", "dep:tempfile", "alloy-eips/kzg"] zstd-codec = ["dep:zstd"] optimism = [ - "reth-chainspec/optimism", "reth-codecs/optimism", "reth-ethereum-forks/optimism", "revm-primitives/optimism", diff --git a/crates/primitives/src/header.rs b/crates/primitives/src/header.rs index b3d9095ff07bf..217c59af69485 100644 --- a/crates/primitives/src/header.rs +++ b/crates/primitives/src/header.rs @@ -1,39 +1,12 @@ //! Header types. -use crate::{recover_signer_unchecked, Address, Bytes}; use alloy_rlp::{Decodable, Encodable}; use bytes::BufMut; -use reth_chainspec::{Chain, ChainSpec}; use reth_codecs::derive_arbitrary; use serde::{Deserialize, Serialize}; pub use reth_primitives_traits::{Header, HeaderError, SealedHeader}; -/// Return the coinbase address for the given header and chain spec. -pub fn block_coinbase(chain_spec: &ChainSpec, header: &Header, after_merge: bool) -> Address { - // Clique consensus fills the EXTRA_SEAL (last 65 bytes) of the extra data with the - // signer's signature. - // - // On the genesis block, the extra data is filled with zeros, so we should not attempt to - // recover the signer on the genesis block. - // - // From EIP-225: - // - // * `EXTRA_SEAL`: Fixed number of extra-data suffix bytes reserved for signer seal. - // * 65 bytes fixed as signatures are based on the standard `secp256k1` curve. - // * Filled with zeros on genesis block. - if chain_spec.chain == Chain::goerli() && !after_merge && header.number > 0 { - recover_header_signer(header).unwrap_or_else(|err| { - panic!( - "Failed to recover goerli Clique Consensus signer from header ({}, {}) using extradata {}: {:?}", - header.number, header.hash_slow(), header.extra_data, err - ) - }) - } else { - header.beneficiary - } -} - /// Error type for recovering Clique signer from a header. #[derive(Debug, thiserror_no_std::Error)] pub enum CliqueSignerRecoveryError { @@ -45,27 +18,6 @@ pub enum CliqueSignerRecoveryError { InvalidSignature(#[from] secp256k1::Error), } -/// Recover the account from signed header per clique consensus rules. -pub fn recover_header_signer(header: &Header) -> Result { - let extra_data_len = header.extra_data.len(); - // Fixed number of extra-data suffix bytes reserved for signer signature. - // 65 bytes fixed as signatures are based on the standard secp256k1 curve. - // Filled with zeros on genesis block. - let signature_start_byte = extra_data_len - 65; - let signature: [u8; 65] = header.extra_data[signature_start_byte..] - .try_into() - .map_err(|_| CliqueSignerRecoveryError::InvalidExtraData)?; - let seal_hash = { - let mut header_to_seal = header.clone(); - header_to_seal.extra_data = Bytes::from(header.extra_data[..signature_start_byte].to_vec()); - header_to_seal.hash_slow() - }; - - // TODO: this is currently unchecked recovery, does this need to be checked w.r.t EIP-2? - recover_signer_unchecked(&signature, &seal_hash.0) - .map_err(CliqueSignerRecoveryError::InvalidSignature) -} - /// Represents the direction for a headers request depending on the `reverse` field of the request. /// > The response must contain a number of block headers, of rising number when reverse is 0, /// > falling when 1 @@ -413,13 +365,4 @@ mod tests { Header::decode(&mut data.as_slice()) .expect_err("blob_gas_used size should make this header decoding fail"); } - - #[test] - fn test_recover_genesis_goerli_signer() { - // just ensures that `block_coinbase` does not panic on the genesis block - let chain_spec = reth_chainspec::GOERLI.clone(); - let header = chain_spec.genesis_header(); - let block_coinbase = block_coinbase(&chain_spec, &header, false); - assert_eq!(block_coinbase, header.beneficiary); - } } diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 5d3def5c3e585..666a84361b3f8 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -43,8 +43,8 @@ pub use block::{ #[cfg(feature = "zstd-codec")] pub use compression::*; pub use constants::{ - DEV_GENESIS_HASH, EMPTY_OMMER_ROOT_HASH, GOERLI_GENESIS_HASH, HOLESKY_GENESIS_HASH, - KECCAK_EMPTY, MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH, + DEV_GENESIS_HASH, EMPTY_OMMER_ROOT_HASH, HOLESKY_GENESIS_HASH, KECCAK_EMPTY, + MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH, }; pub use genesis::{ChainConfig, Genesis, GenesisAccount}; pub use header::{Header, HeadersDirection, SealedHeader}; diff --git a/crates/primitives/src/proofs.rs b/crates/primitives/src/proofs.rs index 9e0a0357905f2..ab57be8ffd1da 100644 --- a/crates/primitives/src/proofs.rs +++ b/crates/primitives/src/proofs.rs @@ -140,7 +140,7 @@ mod tests { use alloy_genesis::GenesisAccount; use alloy_primitives::{b256, Address, LogData}; use alloy_rlp::Decodable; - use reth_chainspec::{GOERLI, HOLESKY, MAINNET, SEPOLIA}; + use reth_chainspec::{HOLESKY, MAINNET, SEPOLIA}; use reth_trie_common::root::{state_root_ref_unhashed, state_root_unhashed}; use std::collections::HashMap; @@ -535,14 +535,6 @@ mod tests { "mainnet state root mismatch" ); - let expected_goerli_state_root = - b256!("5d6cded585e73c4e322c30c2f782a336316f17dd85a4863b9d838d2d4b8b3008"); - let calculated_goerli_state_root = state_root_ref_unhashed(&GOERLI.genesis.alloc); - assert_eq!( - expected_goerli_state_root, calculated_goerli_state_root, - "goerli state root mismatch" - ); - let expected_sepolia_state_root = b256!("5eb6e371a698b8d68f665192350ffcecbbbf322916f4b51bd79bb6887da3f494"); let calculated_sepolia_state_root = state_root_ref_unhashed(&SEPOLIA.genesis.alloc); diff --git a/crates/rpc/rpc-eth-api/src/helpers/state.rs b/crates/rpc/rpc-eth-api/src/helpers/state.rs index 50678a8776785..107d4a1c0c6ad 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/state.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/state.rs @@ -4,9 +4,7 @@ use futures::Future; use reth_evm::ConfigureEvmEnv; use reth_primitives::{Address, BlockId, Bytes, Header, B256, U256}; -use reth_provider::{ - BlockIdReader, ChainSpecProvider, StateProvider, StateProviderBox, StateProviderFactory, -}; +use reth_provider::{BlockIdReader, StateProvider, StateProviderBox, StateProviderFactory}; use reth_rpc_eth_types::{ EthApiError, EthResult, EthStateCache, PendingBlockEnv, RpcInvalidTransactionError, }; @@ -207,12 +205,7 @@ pub trait LoadState { let (cfg, mut block_env, _) = self.evm_env_at(header.parent_hash.into()).await?; let after_merge = cfg.handler_cfg.spec_id >= SpecId::MERGE; - self.evm_config().fill_block_env( - &mut block_env, - &LoadPendingBlock::provider(self).chain_spec(), - header, - after_merge, - ); + self.evm_config().fill_block_env(&mut block_env, header, after_merge); Ok((cfg, block_env)) } diff --git a/crates/storage/db-common/src/init.rs b/crates/storage/db-common/src/init.rs index bf0c28379c354..e4e9ad75b1879 100644 --- a/crates/storage/db-common/src/init.rs +++ b/crates/storage/db-common/src/init.rs @@ -521,7 +521,7 @@ struct GenesisAccountWithAddress { mod tests { use super::*; use alloy_genesis::Genesis; - use reth_chainspec::{Chain, GOERLI, MAINNET, SEPOLIA}; + use reth_chainspec::{Chain, HOLESKY, MAINNET, SEPOLIA}; use reth_db::DatabaseEnv; use reth_db_api::{ cursor::DbCursorRO, @@ -529,7 +529,7 @@ mod tests { table::{Table, TableRow}, transaction::DbTx, }; - use reth_primitives::{GOERLI_GENESIS_HASH, MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH}; + use reth_primitives::{HOLESKY_GENESIS_HASH, MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH}; use reth_primitives_traits::IntegerList; use reth_provider::test_utils::create_test_provider_factory_with_chain_spec; @@ -553,21 +553,21 @@ mod tests { } #[test] - fn success_init_genesis_goerli() { + fn success_init_genesis_sepolia() { let genesis_hash = - init_genesis(create_test_provider_factory_with_chain_spec(GOERLI.clone())).unwrap(); + init_genesis(create_test_provider_factory_with_chain_spec(SEPOLIA.clone())).unwrap(); // actual, expected - assert_eq!(genesis_hash, GOERLI_GENESIS_HASH); + assert_eq!(genesis_hash, SEPOLIA_GENESIS_HASH); } #[test] - fn success_init_genesis_sepolia() { + fn success_init_genesis_holesky() { let genesis_hash = - init_genesis(create_test_provider_factory_with_chain_spec(SEPOLIA.clone())).unwrap(); + init_genesis(create_test_provider_factory_with_chain_spec(HOLESKY.clone())).unwrap(); // actual, expected - assert_eq!(genesis_hash, SEPOLIA_GENESIS_HASH); + assert_eq!(genesis_hash, HOLESKY_GENESIS_HASH); } #[test]