Skip to content

Commit 0ddcab8

Browse files
authored
feat(hardforks): add Osaka/BPO mainnet timestamps (alloy-rs/hardforks#81)
* feat(hardforks): add Osaka/BPO mainnet timestamps * feat(hardforks): update `mainnet_activation_timestamp` * feat(hardforks): expand mainnet hardfork list to include Osaka, BPO1, and BPO2 * feat(hardforks): update `from_chain_and_timestamp`
1 parent 740593c commit 0ddcab8

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

crates/hardforks/src/ethereum/mainnet.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,9 @@ pub const MAINNET_SHANGHAI_TIMESTAMP: u64 = 1_681_338_455;
8282
pub const MAINNET_CANCUN_TIMESTAMP: u64 = 1_710_338_135;
8383
/// Prague hard fork activation timestamp is 1746612311.
8484
pub const MAINNET_PRAGUE_TIMESTAMP: u64 = 1_746_612_311;
85+
/// Osaka hard fork activation timestamp is 1764798551.
86+
pub const MAINNET_OSAKA_TIMESTAMP: u64 = 1_764_798_551;
87+
/// BPO1 hardfork activation timestamp is 1765290071.
88+
pub const MAINNET_BPO1_TIMESTAMP: u64 = 1_765_290_071;
89+
/// BPO2 hardfork activation timestamp is 1767747671.
90+
pub const MAINNET_BPO2_TIMESTAMP: u64 = 1_767_747_671;

crates/hardforks/src/hardfork/ethereum.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,9 @@ impl EthereumHardfork {
276276
Self::Shanghai => Some(MAINNET_SHANGHAI_TIMESTAMP),
277277
Self::Cancun => Some(MAINNET_CANCUN_TIMESTAMP),
278278
Self::Prague => Some(MAINNET_PRAGUE_TIMESTAMP),
279-
// upcoming hardforks
279+
Self::Osaka => Some(MAINNET_OSAKA_TIMESTAMP),
280+
Self::Bpo1 => Some(MAINNET_BPO1_TIMESTAMP),
281+
Self::Bpo2 => Some(MAINNET_BPO2_TIMESTAMP),
280282
_ => None,
281283
}
282284
}
@@ -417,7 +419,7 @@ impl EthereumHardfork {
417419
}
418420

419421
/// Ethereum mainnet list of hardforks.
420-
pub const fn mainnet() -> [(Self, ForkCondition); 18] {
422+
pub const fn mainnet() -> [(Self, ForkCondition); 21] {
421423
[
422424
(Self::Frontier, ForkCondition::Block(MAINNET_FRONTIER_BLOCK)),
423425
(Self::Homestead, ForkCondition::Block(MAINNET_HOMESTEAD_BLOCK)),
@@ -444,6 +446,9 @@ impl EthereumHardfork {
444446
(Self::Shanghai, ForkCondition::Timestamp(MAINNET_SHANGHAI_TIMESTAMP)),
445447
(Self::Cancun, ForkCondition::Timestamp(MAINNET_CANCUN_TIMESTAMP)),
446448
(Self::Prague, ForkCondition::Timestamp(MAINNET_PRAGUE_TIMESTAMP)),
449+
(Self::Osaka, ForkCondition::Timestamp(MAINNET_OSAKA_TIMESTAMP)),
450+
(Self::Bpo1, ForkCondition::Timestamp(MAINNET_BPO1_TIMESTAMP)),
451+
(Self::Bpo2, ForkCondition::Timestamp(MAINNET_BPO2_TIMESTAMP)),
447452
]
448453
}
449454

@@ -620,7 +625,8 @@ impl EthereumHardfork {
620625
_i if timestamp < MAINNET_SHANGHAI_TIMESTAMP => Self::Paris,
621626
_i if timestamp < MAINNET_CANCUN_TIMESTAMP => Self::Shanghai,
622627
_i if timestamp < MAINNET_PRAGUE_TIMESTAMP => Self::Cancun,
623-
_ => Self::Prague,
628+
_i if timestamp < MAINNET_OSAKA_TIMESTAMP => Self::Prague,
629+
_ => Self::Osaka,
624630
}),
625631
NamedChain::Sepolia => Some(match timestamp {
626632
_i if timestamp < SEPOLIA_PARIS_TIMESTAMP => Self::London,

0 commit comments

Comments
 (0)