Skip to content

Commit

Permalink
fix(primitives): specify the optimism cfg on spec_to_generic (#1412)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored May 13, 2024
1 parent 287ae36 commit 38c4d3e
Showing 1 changed file with 68 additions and 5 deletions.
73 changes: 68 additions & 5 deletions crates/primitives/src/specification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,77 @@ spec!(CANYON, CanyonSpec);
#[cfg(feature = "optimism")]
spec!(ECOTONE, EcotoneSpec);

#[cfg(not(feature = "optimism"))]
#[macro_export]
macro_rules! spec_to_generic {
($spec_id:expr, $e:expr) => {{
match $spec_id {
$crate::SpecId::FRONTIER | SpecId::FRONTIER_THAWING => {
use $crate::FrontierSpec as SPEC;
$e
}
$crate::SpecId::HOMESTEAD | SpecId::DAO_FORK => {
use $crate::HomesteadSpec as SPEC;
$e
}
$crate::SpecId::TANGERINE => {
use $crate::TangerineSpec as SPEC;
$e
}
$crate::SpecId::SPURIOUS_DRAGON => {
use $crate::SpuriousDragonSpec as SPEC;
$e
}
$crate::SpecId::BYZANTIUM => {
use $crate::ByzantiumSpec as SPEC;
$e
}
$crate::SpecId::PETERSBURG | $crate::SpecId::CONSTANTINOPLE => {
use $crate::PetersburgSpec as SPEC;
$e
}
$crate::SpecId::ISTANBUL | $crate::SpecId::MUIR_GLACIER => {
use $crate::IstanbulSpec as SPEC;
$e
}
$crate::SpecId::BERLIN => {
use $crate::BerlinSpec as SPEC;
$e
}
$crate::SpecId::LONDON
| $crate::SpecId::ARROW_GLACIER
| $crate::SpecId::GRAY_GLACIER => {
use $crate::LondonSpec as SPEC;
$e
}
$crate::SpecId::MERGE => {
use $crate::MergeSpec as SPEC;
$e
}
$crate::SpecId::SHANGHAI => {
use $crate::ShanghaiSpec as SPEC;
$e
}
$crate::SpecId::CANCUN => {
use $crate::CancunSpec as SPEC;
$e
}
$crate::SpecId::LATEST => {
use $crate::LatestSpec as SPEC;
$e
}
$crate::SpecId::PRAGUE => {
use $crate::PragueSpec as SPEC;
$e
}
}
}};
}

#[cfg(feature = "optimism")]
#[macro_export]
macro_rules! spec_to_generic {
($spec_id:expr, $e:expr) => {{
// We are transitioning from var to generic spec.
match $spec_id {
$crate::SpecId::FRONTIER | SpecId::FRONTIER_THAWING => {
use $crate::FrontierSpec as SPEC;
Expand Down Expand Up @@ -271,22 +338,18 @@ macro_rules! spec_to_generic {
use $crate::PragueSpec as SPEC;
$e
}
#[cfg(feature = "optimism")]
$crate::SpecId::BEDROCK => {
use $crate::BedrockSpec as SPEC;
$e
}
#[cfg(feature = "optimism")]
$crate::SpecId::REGOLITH => {
use $crate::RegolithSpec as SPEC;
$e
}
#[cfg(feature = "optimism")]
$crate::SpecId::CANYON => {
use $crate::CanyonSpec as SPEC;
$e
}
#[cfg(feature = "optimism")]
$crate::SpecId::ECOTONE => {
use $crate::EcotoneSpec as SPEC;
$e
Expand Down

0 comments on commit 38c4d3e

Please sign in to comment.