mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-28 08:37:59 -05:00
feat: add testnet cancun timestamps (#5842)
This commit is contained in:
@@ -97,6 +97,7 @@ pub static GOERLI: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
ForkCondition::TTD { fork_block: None, total_difficulty: U256::from(10_790_000) },
|
||||
),
|
||||
(Hardfork::Shanghai, ForkCondition::Timestamp(1678832736)),
|
||||
(Hardfork::Cancun, ForkCondition::Timestamp(1705473120)),
|
||||
]),
|
||||
// https://goerli.etherscan.io/tx/0xa3c07dc59bfdb1bfc2d50920fed2ef2c1c4e0a09fe2325dbc14e07702f965a78
|
||||
deposit_contract: Some(DepositContract::new(
|
||||
@@ -144,6 +145,7 @@ pub static SEPOLIA: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
},
|
||||
),
|
||||
(Hardfork::Shanghai, ForkCondition::Timestamp(1677557088)),
|
||||
(Hardfork::Cancun, ForkCondition::Timestamp(1706655072)),
|
||||
]),
|
||||
// https://sepolia.etherscan.io/tx/0x025ecbf81a2f1220da6285d1701dc89fb5a956b62562ee922e1a9efd73eb4b14
|
||||
deposit_contract: Some(DepositContract::new(
|
||||
@@ -187,6 +189,7 @@ pub static HOLESKY: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
|
||||
ForkCondition::TTD { fork_block: Some(0), total_difficulty: U256::ZERO },
|
||||
),
|
||||
(Hardfork::Shanghai, ForkCondition::Timestamp(1696000704)),
|
||||
(Hardfork::Cancun, ForkCondition::Timestamp(1707305664)),
|
||||
]),
|
||||
deposit_contract: Some(DepositContract::new(
|
||||
address!("4242424242424242424242424242424242424242"),
|
||||
@@ -1635,14 +1638,12 @@ Post-merge hard forks (timestamp based):
|
||||
// Tests that all predefined timestamps are correctly set up in the chainspecs
|
||||
#[test]
|
||||
fn test_predefined_chain_spec_fork_timestamps() {
|
||||
fn ensure_timestamp_fork_conditions(spec: &ChainSpec) {
|
||||
fn ensure_timestamp_fork_conditions(spec: &ChainSpec, known_timestamp_based_forks: usize) {
|
||||
// This is a sanity test that ensures we always set all currently known fork timestamps,
|
||||
// this will fail if a new timestamp based fork condition has added to the hardforks but
|
||||
// no corresponding entry in the ForkTimestamp types, See also
|
||||
// [ForkTimestamps::from_hardforks]
|
||||
|
||||
// currently there are only 1 timestamps known: shanghai
|
||||
let known_timestamp_based_forks = 1;
|
||||
let num_timestamp_based_forks =
|
||||
spec.hardforks.values().copied().filter(ForkCondition::is_timestamp).count();
|
||||
assert_eq!(num_timestamp_based_forks, known_timestamp_based_forks);
|
||||
@@ -1651,9 +1652,11 @@ Post-merge hard forks (timestamp based):
|
||||
assert!(spec.fork_timestamps.shanghai.is_some());
|
||||
}
|
||||
|
||||
for spec in [&*MAINNET, &*SEPOLIA] {
|
||||
ensure_timestamp_fork_conditions(spec);
|
||||
}
|
||||
// currently there is only 1 timestamp fork known for mainnet: shanghai
|
||||
ensure_timestamp_fork_conditions(&MAINNET, 1);
|
||||
|
||||
// currently there are 2 timestamp forks known for sepolia: shanghai, cancun
|
||||
ensure_timestamp_fork_conditions(&SEPOLIA, 2);
|
||||
}
|
||||
|
||||
// Tests that we skip any fork blocks in block #0 (the genesis ruleset)
|
||||
@@ -1922,7 +1925,11 @@ Post-merge hard forks (timestamp based):
|
||||
Hardfork::London,
|
||||
ForkId { hash: ForkHash([0xb8, 0xc6, 0x29, 0x9d]), next: 1678832736 },
|
||||
),
|
||||
(Hardfork::Shanghai, ForkId { hash: ForkHash([0xf9, 0x84, 0x3a, 0xbf]), next: 0 }),
|
||||
(
|
||||
Hardfork::Shanghai,
|
||||
ForkId { hash: ForkHash([0xf9, 0x84, 0x3a, 0xbf]), next: 1705473120 },
|
||||
),
|
||||
(Hardfork::Cancun, ForkId { hash: ForkHash([0x70, 0xcc, 0x14, 0xe2]), next: 0 }),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -1976,7 +1983,11 @@ Post-merge hard forks (timestamp based):
|
||||
Hardfork::Paris,
|
||||
ForkId { hash: ForkHash([0xb9, 0x6c, 0xbd, 0x13]), next: 1677557088 },
|
||||
),
|
||||
(Hardfork::Shanghai, ForkId { hash: ForkHash([0xf7, 0xf9, 0xbc, 0x08]), next: 0 }),
|
||||
(
|
||||
Hardfork::Shanghai,
|
||||
ForkId { hash: ForkHash([0xf7, 0xf9, 0xbc, 0x08]), next: 1706655072 },
|
||||
),
|
||||
(Hardfork::Cancun, ForkId { hash: ForkHash([0x88, 0xcf, 0x81, 0xd9]), next: 0 }),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -2052,6 +2063,44 @@ Post-merge hard forks (timestamp based):
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn holesky_forkids() {
|
||||
test_fork_ids(
|
||||
&HOLESKY,
|
||||
&[
|
||||
(
|
||||
Head { number: 0, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0xc6, 0x1a, 0x60, 0x98]), next: 1696000704 },
|
||||
),
|
||||
// First MergeNetsplit block
|
||||
(
|
||||
Head { number: 123, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0xc6, 0x1a, 0x60, 0x98]), next: 1696000704 },
|
||||
),
|
||||
// Last MergeNetsplit block
|
||||
(
|
||||
Head { number: 123, timestamp: 1696000703, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0xc6, 0x1a, 0x60, 0x98]), next: 1696000704 },
|
||||
),
|
||||
// First Shanghai block
|
||||
(
|
||||
Head { number: 123, timestamp: 1696000704, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0xfd, 0x4f, 0x01, 0x6b]), next: 1707305664 },
|
||||
),
|
||||
// Last Shanghai block
|
||||
(
|
||||
Head { number: 123, timestamp: 1707305663, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0xfd, 0x4f, 0x01, 0x6b]), next: 1707305664 },
|
||||
),
|
||||
// First Cancun block
|
||||
(
|
||||
Head { number: 123, timestamp: 1707305664, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0x9b, 0x19, 0x2a, 0xd0]), next: 0 },
|
||||
),
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn goerli_forkids() {
|
||||
test_fork_ids(
|
||||
@@ -2088,12 +2137,22 @@ Post-merge hard forks (timestamp based):
|
||||
// First Shanghai block
|
||||
(
|
||||
Head { number: 6000001, timestamp: 1678832736, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0xf9, 0x84, 0x3a, 0xbf]), next: 0 },
|
||||
ForkId { hash: ForkHash([0xf9, 0x84, 0x3a, 0xbf]), next: 1705473120 },
|
||||
),
|
||||
// Future Shanghai block
|
||||
(
|
||||
Head { number: 6500000, timestamp: 1678832736, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0xf9, 0x84, 0x3a, 0xbf]), next: 0 },
|
||||
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 },
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -2120,9 +2179,20 @@ Post-merge hard forks (timestamp based):
|
||||
Head { number: 1735372, timestamp: 1677557087, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0xb9, 0x6c, 0xbd, 0x13]), next: 1677557088 },
|
||||
),
|
||||
// First Shanghai block
|
||||
(
|
||||
Head { number: 1735372, timestamp: 1677557088, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0xf7, 0xf9, 0xbc, 0x08]), next: 0 },
|
||||
ForkId { hash: ForkHash([0xf7, 0xf9, 0xbc, 0x08]), next: 1706655072 },
|
||||
),
|
||||
// Last Shanghai block
|
||||
(
|
||||
Head { number: 1735372, timestamp: 1706655071, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0xf7, 0xf9, 0xbc, 0x08]), next: 1706655072 },
|
||||
),
|
||||
// First Cancun block
|
||||
(
|
||||
Head { number: 1735372, timestamp: 1706655072, ..Default::default() },
|
||||
ForkId { hash: ForkHash([0x88, 0xcf, 0x81, 0xd9]), next: 0 },
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user