From 7f9beeee0e3781060ad48658a9914bc94ab2d762 Mon Sep 17 00:00:00 2001 From: j75689 Date: Mon, 29 Apr 2024 19:14:13 +0800 Subject: [PATCH] fix: sepc definition --- crates/interpreter/src/instructions/opcode.rs | 2 +- crates/precompile/src/lib.rs | 2 +- crates/primitives/Cargo.toml | 2 ++ crates/primitives/src/specification.rs | 18 ++++++++++-------- crates/revm/Cargo.toml | 2 ++ 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/crates/interpreter/src/instructions/opcode.rs b/crates/interpreter/src/instructions/opcode.rs index 4b313555..ef93ea60 100644 --- a/crates/interpreter/src/instructions/opcode.rs +++ b/crates/interpreter/src/instructions/opcode.rs @@ -947,7 +947,7 @@ pub const fn spec_opcode_gas(spec_id: SpecId) -> &'static [OpInfo; 256] { const TABLE: &[OpInfo;256] = &make_gas_table(SpecId::ECOTONE); TABLE } - #[cfg(feature = "optimism")] + #[cfg(feature = "opbnb")] SpecId::FERMAT => { const TABLE: &[OpInfo;256] = &make_gas_table(SpecId::FERMAT); TABLE diff --git a/crates/precompile/src/lib.rs b/crates/precompile/src/lib.rs index 9d64f776..1afad41c 100644 --- a/crates/precompile/src/lib.rs +++ b/crates/precompile/src/lib.rs @@ -279,7 +279,7 @@ impl PrecompileSpecId { BEDROCK | REGOLITH | CANYON => Self::BERLIN, #[cfg(feature = "optimism")] ECOTONE => Self::CANCUN, - #[cfg(feature = "optimism")] + #[cfg(feature = "opbnb")] FERMAT => Self::FERMAT, } } diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index e3ef145d..e8869eda 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -90,3 +90,5 @@ optional_beneficiary_reward = [] # See comments in `revm-precompile` c-kzg = ["dep:c-kzg", "dep:once_cell", "dep:derive_more"] + +opbnb = [] \ No newline at end of file diff --git a/crates/primitives/src/specification.rs b/crates/primitives/src/specification.rs index 5b10c489..3daf4012 100644 --- a/crates/primitives/src/specification.rs +++ b/crates/primitives/src/specification.rs @@ -58,11 +58,11 @@ pub enum SpecId { MERGE = 15, BEDROCK = 16, REGOLITH = 17, - SHANGHAI = 18, - CANYON = 19, - CANCUN = 20, - ECOTONE = 21, - FERMAT = 22, + FERMAT = 18, + SHANGHAI = 19, + CANYON = 20, + CANCUN = 21, + ECOTONE = 22, #[default] LATEST = u8::MAX, } @@ -104,12 +104,12 @@ impl From<&str> for SpecId { "Bedrock" => SpecId::BEDROCK, #[cfg(feature = "optimism")] "Regolith" => SpecId::REGOLITH, + #[cfg(feature = "opbnb")] + "Fermat" => SpecId::FERMAT, #[cfg(feature = "optimism")] "Canyon" => SpecId::CANYON, #[cfg(feature = "optimism")] "Ecotone" => SpecId::ECOTONE, - #[cfg(feature = "optimism")] - "Fermat" => SpecId::FERMAT, _ => Self::LATEST, } } @@ -140,6 +140,8 @@ impl From for &'static str { SpecId::BEDROCK => "Bedrock", #[cfg(feature = "optimism")] SpecId::REGOLITH => "Regolith", + #[cfg(feature = "opbnb")] + SpecId::FERMAT => "Fermat", #[cfg(feature = "optimism")] SpecId::CANYON => "Canyon", #[cfg(feature = "optimism")] @@ -201,7 +203,7 @@ spec!(REGOLITH, RegolithSpec); spec!(CANYON, CanyonSpec); #[cfg(feature = "optimism")] spec!(ECOTONE, EcotoneSpec); -#[cfg(feature = "optimism")] +#[cfg(feature = "opbnb")] spec!(FERMAT, FermatSpec); #[macro_export] diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index 856bc892..dfa3f870 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -103,6 +103,8 @@ optional_beneficiary_reward = ["revm-interpreter/optional_beneficiary_reward"] secp256k1 = ["revm-precompile/secp256k1"] c-kzg = ["revm-precompile/c-kzg"] +opbnb = ["revm-interpreter/opbnb", "revm-precompile/opbnb"] + [[example]] name = "fork_ref_transact" path = "../../examples/fork_ref_transact.rs"