Skip to content
Merged
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
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