Skip to content

Commit

Permalink
add holocene to spec
Browse files Browse the repository at this point in the history
  • Loading branch information
cody-wang-cb committed Sep 23, 2024
1 parent 66adad0 commit 5a59869
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions crates/optimism/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ pub enum OptimismSpecId {
ECOTONE = 21,
FJORD = 22,
GRANITE = 23,
PRAGUE = 24,
PRAGUE_EOF = 25,
HOLOCENE = 24,
PRAGUE = 25,
PRAGUE_EOF = 26,
#[default]
LATEST = u8::MAX,
}
Expand Down Expand Up @@ -136,7 +137,8 @@ impl OptimismSpecId {
OptimismSpecId::CANCUN
| OptimismSpecId::ECOTONE
| OptimismSpecId::FJORD
| OptimismSpecId::GRANITE => SpecId::CANCUN,
| OptimismSpecId::GRANITE
| OptimismSpecId::HOLOCENE => SpecId::CANCUN,
OptimismSpecId::PRAGUE => SpecId::PRAGUE,
OptimismSpecId::PRAGUE_EOF => SpecId::PRAGUE_EOF,
OptimismSpecId::LATEST => SpecId::LATEST,
Expand Down Expand Up @@ -195,6 +197,7 @@ pub mod id {
pub const ECOTONE: &str = "Ecotone";
pub const FJORD: &str = "Fjord";
pub const GRANITE: &str = "Granite";
pub const HOLOCENE: &str = "Holocene";
}

impl From<&str> for OptimismSpecId {
Expand Down Expand Up @@ -260,6 +263,7 @@ impl From<OptimismSpecId> for &'static str {
OptimismSpecId::ECOTONE => id::ECOTONE,
OptimismSpecId::FJORD => id::FJORD,
OptimismSpecId::GRANITE => id::GRANITE,
OptimismSpecId::HOLOCENE => id::HOLOCENE,
OptimismSpecId::LATEST => id::LATEST,
}
}
Expand Down Expand Up @@ -321,6 +325,7 @@ spec!(CANYON, CanyonSpec);
spec!(ECOTONE, EcotoneSpec);
spec!(FJORD, FjordSpec);
spec!(GRANITE, GraniteSpec);
spec!(HOLOCENE, HoloceneSpec);

#[macro_export]
macro_rules! optimism_spec_to_generic {
Expand Down Expand Up @@ -413,6 +418,10 @@ macro_rules! optimism_spec_to_generic {
use $crate::FjordSpec as SPEC;
$e
}
$crate::OptimismSpecId::HOLOCENE => {
use $crate::HoloceneSpec as SPEC;
$e
}
}
}};
}
Expand Down Expand Up @@ -619,6 +628,10 @@ mod tests {
OptimismSpecId::GRANITE,
assert_eq!(SPEC::OPTIMISM_SPEC_ID, OptimismSpecId::GRANITE)
);
optimism_spec_to_generic!(
OptimismSpecId::HOLOCENE,
assert_eq!(SPEC::OPTIMISM_SPEC_ID, OptimismSpecId::HOLOCENE)
);
optimism_spec_to_generic!(
OptimismSpecId::PRAGUE,
assert_eq!(SPEC::OPTIMISM_SPEC_ID, OptimismSpecId::PRAGUE)
Expand Down

0 comments on commit 5a59869

Please sign in to comment.