From dfca3edd9732372e19dea88462eaece1e74824f1 Mon Sep 17 00:00:00 2001 From: Roshan Date: Wed, 26 Jun 2024 10:54:35 +0800 Subject: [PATCH] upgrade: add `HaberFix` for bsc --- crates/precompile/src/lib.rs | 2 ++ crates/primitives/src/specification.rs | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/crates/precompile/src/lib.rs b/crates/precompile/src/lib.rs index d4054752..13b30e22 100644 --- a/crates/precompile/src/lib.rs +++ b/crates/precompile/src/lib.rs @@ -480,6 +480,8 @@ impl PrecompileSpecId { FERMAT => Self::FERMAT, #[cfg(any(feature = "bsc", feature = "opbnb"))] HABER => Self::HABER, + #[cfg(feature = "bsc")] + HABER_FIX => Self::HABER, LATEST => Self::LATEST, } } diff --git a/crates/primitives/src/specification.rs b/crates/primitives/src/specification.rs index 85a4f4a9..4b21d2c7 100644 --- a/crates/primitives/src/specification.rs +++ b/crates/primitives/src/specification.rs @@ -113,15 +113,15 @@ pub enum SpecId { FEYNMAN_FIX = 28, // FeynmanFix timestamp(1713419340) CANCUN = 29, // Cancun timestamp(1718863500) HABER = 30, // Haber timestamp(1718863500) + HABER_FIX = 31, // HaberFix timestamp(1720591588) - // TODO: or u8::MAX - n? /// Not enabled in bsc - DAO_FORK = 31, - ARROW_GLACIER = 32, - GRAY_GLACIER = 33, - MERGE = 34, - PRAGUE = 35, - PRAGUE_EOF = 36, + DAO_FORK = 100, + ARROW_GLACIER = 101, + GRAY_GLACIER = 102, + MERGE = 103, + PRAGUE = 104, + PRAGUE_EOF = 105, #[default] LATEST = u8::MAX, } @@ -211,6 +211,8 @@ impl From<&str> for SpecId { "FeynmanFix" => SpecId::FEYNMAN_FIX, #[cfg(any(feature = "opbnb", feature = "bsc"))] "Haber" => SpecId::HABER, + #[cfg(feature = "bsc")] + "HaberFix" => SpecId::HABER_FIX, _ => Self::LATEST, } } @@ -285,6 +287,8 @@ impl From for &'static str { SpecId::FEYNMAN_FIX => "FeynmanFix", #[cfg(any(feature = "opbnb", feature = "bsc"))] SpecId::HABER => "Haber", + #[cfg(feature = "bsc")] + SpecId::HABER_FIX => "HaberFix", SpecId::LATEST => "Latest", } } @@ -642,7 +646,7 @@ macro_rules! spec_to_generic { use $crate::PragueEofSpec as SPEC; $e } - $crate::SpecId::HABER => { + $crate::SpecId::HABER | $crate::SpecId::HABER_FIX => { use $crate::HaberSpec as SPEC; $e } @@ -740,6 +744,8 @@ mod tests { spec_to_generic!(FEYNMAN_FIX, assert_eq!(SPEC::SPEC_ID, FEYNMAN)); #[cfg(feature = "bsc")] spec_to_generic!(HABER, assert_eq!(SPEC::SPEC_ID, HABER)); + #[cfg(feature = "bsc")] + spec_to_generic!(HABER_FIX, assert_eq!(SPEC::SPEC_ID, HABER)); } }