Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions crates/scroll/alloy/hardforks/src/hardfork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ hardfork!(
/// EuclidV2 <https://docs.scroll.io/en/technology/overview/scroll-upgrades/euclid-upgrade/>
EuclidV2,
/// Feynman <https://docs.scroll.io/en/technology/overview/scroll-upgrades/feynman-upgrade/>
Feynman
Feynman,
/// Galileo <https://docs.scroll.io/en/technology/overview/scroll-upgrades/galileo-upgrade/>
Galileo,
}
);

impl ScrollHardfork {
/// Scroll mainnet list of hardforks.
pub const fn scroll_mainnet() -> [(Self, ForkCondition); 8] {
pub const fn scroll_mainnet() -> [(Self, ForkCondition); 9] {
[
(Self::Archimedes, ForkCondition::Block(0)),
(Self::Bernoulli, ForkCondition::Block(5220340)),
Expand All @@ -37,11 +39,12 @@ impl ScrollHardfork {
(Self::Euclid, ForkCondition::Timestamp(1744815600)),
(Self::EuclidV2, ForkCondition::Timestamp(1745305200)),
(Self::Feynman, ForkCondition::Timestamp(1755576000)),
(Self::Galileo, ForkCondition::Timestamp(u64::MAX)),
]
}

/// Scroll sepolia list of hardforks.
pub const fn scroll_sepolia() -> [(Self, ForkCondition); 8] {
pub const fn scroll_sepolia() -> [(Self, ForkCondition); 9] {
[
(Self::Archimedes, ForkCondition::Block(0)),
(Self::Bernoulli, ForkCondition::Block(3747132)),
Expand All @@ -51,6 +54,7 @@ impl ScrollHardfork {
(Self::Euclid, ForkCondition::Timestamp(1741680000)),
(Self::EuclidV2, ForkCondition::Timestamp(1741852800)),
(Self::Feynman, ForkCondition::Timestamp(1753167600)),
(Self::Galileo, ForkCondition::Timestamp(u64::MAX)),
]
}
}
Expand All @@ -62,8 +66,16 @@ mod tests {

#[test]
fn check_scroll_hardfork_from_str() {
let hardfork_str =
["BernOulLi", "CUrie", "DaRwIn", "DaRwInV2", "EUcliD", "eUClidv2", "FEYnmaN"];
let hardfork_str = [
"BernOulLi",
"CUrie",
"DaRwIn",
"DaRwInV2",
"EUcliD",
"eUClidv2",
"FEYnmaN",
"gaLiLEo",
];
let expected_hardforks = [
ScrollHardfork::Bernoulli,
ScrollHardfork::Curie,
Expand All @@ -72,6 +84,7 @@ mod tests {
ScrollHardfork::Euclid,
ScrollHardfork::EuclidV2,
ScrollHardfork::Feynman,
ScrollHardfork::Galileo,
];

let hardforks: Vec<ScrollHardfork> =
Expand Down
5 changes: 5 additions & 0 deletions crates/scroll/alloy/hardforks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ pub trait ScrollHardforks: EthereumHardforks {
fn is_feynman_active_at_timestamp(&self, timestamp: u64) -> bool {
self.scroll_fork_activation(ScrollHardfork::Feynman).active_at_timestamp(timestamp)
}

/// Returns `true` if [`Galileo`](ScrollHardfork::Galileo) is active at given block timestamp.
fn is_galileo_active_at_timestamp(&self, timestamp: u64) -> bool {
self.scroll_fork_activation(ScrollHardfork::Galileo).active_at_timestamp(timestamp)
}
}

/// A type allowing to configure activation [`ForkCondition`]s for a given list of
Expand Down
8 changes: 7 additions & 1 deletion crates/scroll/chainspec/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ pub struct ScrollHardforkInfo {
pub euclid_v2_time: Option<u64>,
/// feynman hardfork timestamp
pub feynman_time: Option<u64>,
/// galileo hardfork timestamp
pub galileo_time: Option<u64>,
}

impl ScrollHardforkInfo {
Expand Down Expand Up @@ -187,7 +189,8 @@ mod tests {
"curieBlock": 12,
"darwinTime": 0,
"euclidTime": 11,
"feynmanTime": 100
"feynmanTime": 100,
"galileoTime": 110
}
"#;

Expand All @@ -205,6 +208,7 @@ mod tests {
euclid_time: Some(11),
euclid_v2_time: None,
feynman_time: Some(100),
galileo_time: Some(110),
}
);
}
Expand All @@ -219,6 +223,7 @@ mod tests {
"darwinTime": 0,
"euclidTime": 11,
"feynmanTime": 100,
"galileoTime": 110,
"scroll": {
"feeVaultAddress": "0x5300000000000000000000000000000000000005",
"maxTxPayloadBytesPerBlock": 122880,
Expand Down Expand Up @@ -247,6 +252,7 @@ mod tests {
euclid_time: Some(11),
euclid_v2_time: None,
feynman_time: Some(100),
galileo_time: Some(110),
}),
scroll_chain_config: ScrollChainConfig {
fee_vault_address: Some(address!("5300000000000000000000000000000000000005")),
Expand Down
15 changes: 13 additions & 2 deletions crates/scroll/chainspec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ impl From<Genesis> for ScrollChainSpec {
(ScrollHardfork::Euclid.boxed(), hard_fork_info.euclid_time),
(ScrollHardfork::EuclidV2.boxed(), hard_fork_info.euclid_v2_time),
(ScrollHardfork::Feynman.boxed(), hard_fork_info.feynman_time),
(ScrollHardfork::Galileo.boxed(), hard_fork_info.galileo_time),
];

let mut time_hardforks = time_hardfork_opts
Expand Down Expand Up @@ -545,7 +546,11 @@ mod tests {
),
(
Head { number: 7096836, timestamp: 1755576000, ..Default::default() },
ForkId { hash: ForkHash([0x38, 0x0f, 0x78, 0x5d]), next: 0 },
ForkId { hash: ForkHash([0x38, 0x0f, 0x78, 0x5d]), next: u64::MAX },
),
(
Head { number: 7096836, timestamp: u64::MAX, ..Default::default() },
ForkId { hash: ForkHash([0x50, 0xe7, 0xe6, 0xd5]), next: 0 },
),
],
);
Expand Down Expand Up @@ -633,7 +638,11 @@ mod tests {
),
(
Head { number: 4740239, timestamp: 1753167600, ..Default::default() },
ForkId { hash: ForkHash([0x19, 0xbb, 0x92, 0xc6]), next: 0 },
ForkId { hash: ForkHash([0x19, 0xbb, 0x92, 0xc6]), next: u64::MAX },
),
(
Head { number: 4740239, timestamp: u64::MAX, ..Default::default() },
ForkId { hash: ForkHash([0xf8, 0x27, 0xe0, 0xfc]), next: 0 },
),
],
);
Expand Down Expand Up @@ -734,6 +743,7 @@ mod tests {
(String::from("darwinTime"), 0.into()),
(String::from("darwinV2Time"), 0.into()),
(String::from("feynmanTime"), 0.into()),
(String::from("galileoTime"), 0.into()),
(
String::from("scroll"),
serde_json::json!({
Expand Down Expand Up @@ -777,6 +787,7 @@ mod tests {
ScrollHardfork::Darwin.boxed(),
ScrollHardfork::DarwinV2.boxed(),
ScrollHardfork::Feynman.boxed(),
ScrollHardfork::Galileo.boxed(),
];

assert!(expected_hardforks
Expand Down
3 changes: 3 additions & 0 deletions crates/scroll/hardforks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub static SCROLL_MAINNET_HARDFORKS: LazyLock<ChainHardforks> = LazyLock::new(||
(ScrollHardfork::Euclid.boxed(), ForkCondition::Timestamp(1744815600)),
(ScrollHardfork::EuclidV2.boxed(), ForkCondition::Timestamp(1745305200)),
(ScrollHardfork::Feynman.boxed(), ForkCondition::Timestamp(1755576000)),
(ScrollHardfork::Galileo.boxed(), ForkCondition::Timestamp(u64::MAX)),
])
});

Expand All @@ -64,6 +65,7 @@ pub static SCROLL_SEPOLIA_HARDFORKS: LazyLock<ChainHardforks> = LazyLock::new(||
(ScrollHardfork::Euclid.boxed(), ForkCondition::Timestamp(1741680000)),
(ScrollHardfork::EuclidV2.boxed(), ForkCondition::Timestamp(1741852800)),
(ScrollHardfork::Feynman.boxed(), ForkCondition::Timestamp(1753167600)),
(ScrollHardfork::Galileo.boxed(), ForkCondition::Timestamp(u64::MAX)),
])
});

Expand All @@ -88,5 +90,6 @@ pub static DEV_HARDFORKS: LazyLock<ChainHardforks> = LazyLock::new(|| {
(ScrollHardfork::Euclid.boxed(), ForkCondition::Timestamp(0)),
(ScrollHardfork::EuclidV2.boxed(), ForkCondition::Timestamp(0)),
(ScrollHardfork::Feynman.boxed(), ForkCondition::Timestamp(0)),
(ScrollHardfork::Galileo.boxed(), ForkCondition::Timestamp(0)),
])
});
Loading