qol: purge goerli (#9310)

This commit is contained in:
Roman Krasiuk
2024-07-05 03:38:58 -07:00
committed by GitHub
parent 21a9dfc9ec
commit 26b7b9720c
37 changed files with 52 additions and 368 deletions

View File

@ -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);
}

View File

@ -29,8 +29,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
@ -60,30 +60,6 @@ pub static MAINNET: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
.into()
});
/// The Goerli spec
pub static GOERLI: Lazy<Arc<ChainSpec>> = 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"
)),
// <https://goerli.etherscan.io/block/7382818>
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<Arc<ChainSpec>> = Lazy::new(|| {
ChainSpec {
@ -709,7 +685,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()),
@ -1443,63 +1418,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(
@ -1675,63 +1593,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(