Skip to content

Commit

Permalink
remove EuclidV1 since it does not related to evm
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsing committed Feb 14, 2025
1 parent da4a08e commit 2841ff8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 38 deletions.
2 changes: 1 addition & 1 deletion crates/precompile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ impl PrecompileSpecId {
#[cfg(feature = "scroll")]
PRE_BERNOULLI => Self::PRE_BERNOULLI,
#[cfg(feature = "scroll")]
BERNOULLI | CURIE | EUCLID_V1 => Self::BERNOULLI,
BERNOULLI | CURIE => Self::BERNOULLI,
#[cfg(feature = "scroll")]
EUCLID_V2 => Self::EUCLID_V2,
#[cfg(feature = "optimism")]
Expand Down
41 changes: 6 additions & 35 deletions crates/primitives/src/specification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ pub enum SpecId {
/// Although the Curie update include new opcodes in Cancun, the most important change
/// `EIP-4844` is not included. So we sort it before Cancun.
CURIE = 19,
/// EuclidV1 does not change the EVM behavior.
EUCLID_V1 = 20,
/// EuclidV2
EUCLID_V2 = 21,
CANCUN = 22,
PRAGUE = 23,
OSAKA = 24,
///
/// Note: EuclidV1 does not change the EVM behavior.
EUCLID_V2 = 20,
CANCUN = 21,
PRAGUE = 22,
OSAKA = 23,
#[default]
LATEST = u8::MAX,
}
Expand Down Expand Up @@ -185,8 +185,6 @@ impl From<&str> for SpecId {
#[cfg(feature = "scroll")]
"Curie" => SpecId::CURIE,
#[cfg(feature = "scroll")]
"EuclidV1" => SpecId::EUCLID_V1,
#[cfg(feature = "scroll")]
"EuclidV2" => SpecId::EUCLID_V2,
_ => Self::LATEST,
}
Expand Down Expand Up @@ -239,8 +237,6 @@ impl From<SpecId> for &'static str {
#[cfg(feature = "scroll")]
SpecId::CURIE => "Curie",
#[cfg(feature = "scroll")]
SpecId::EUCLID_V1 => "EuclidV1",
#[cfg(feature = "scroll")]
SpecId::EUCLID_V2 => "EuclidV2",
SpecId::LATEST => "Latest",
}
Expand Down Expand Up @@ -318,8 +314,6 @@ spec!(BERNOULLI, BernoulliSpec);
#[cfg(feature = "scroll")]
spec!(CURIE, CurieSpec);
#[cfg(feature = "scroll")]
spec!(EUCLID_V1, EuclidV1Spec);
#[cfg(feature = "scroll")]
spec!(EUCLID_V2, EuclidV2Spec);

#[cfg(not(any(feature = "optimism", feature = "scroll")))]
Expand Down Expand Up @@ -577,11 +571,6 @@ macro_rules! spec_to_generic {
$e
}
#[cfg(feature = "scroll")]
$crate::SpecId::EUCLID_V1 => {
use $crate::EuclidV1Spec as SPEC;
$e
}
#[cfg(feature = "scroll")]
$crate::SpecId::EUCLID_V2 => {
use $crate::EuclidV2Spec as SPEC;
$e
Expand Down Expand Up @@ -628,8 +617,6 @@ mod tests {
#[cfg(feature = "scroll")]
spec_to_generic!(CURIE, assert_eq!(SPEC::SPEC_ID, CURIE));
#[cfg(feature = "scroll")]
spec_to_generic!(EUCLID_V1, assert_eq!(SPEC::SPEC_ID, EUCLID_V1));
#[cfg(feature = "scroll")]
spec_to_generic!(EUCLID_V2, assert_eq!(SPEC::SPEC_ID, EUCLID_V2));
spec_to_generic!(CANCUN, assert_eq!(SPEC::SPEC_ID, CANCUN));
#[cfg(feature = "optimism")]
Expand Down Expand Up @@ -827,7 +814,6 @@ mod scroll_tests {
assert!(PreBernoulliSpec::enabled(SpecId::SHANGHAI));
assert!(!PreBernoulliSpec::enabled(SpecId::BERNOULLI));
assert!(!PreBernoulliSpec::enabled(SpecId::CURIE));
assert!(!PreBernoulliSpec::enabled(SpecId::EUCLID_V1));
assert!(!PreBernoulliSpec::enabled(SpecId::EUCLID_V2));
assert!(!PreBernoulliSpec::enabled(SpecId::CANCUN));
assert!(!PreBernoulliSpec::enabled(SpecId::LATEST));
Expand All @@ -839,7 +825,6 @@ mod scroll_tests {
assert!(BernoulliSpec::enabled(SpecId::SHANGHAI));
assert!(BernoulliSpec::enabled(SpecId::PRE_BERNOULLI));
assert!(!BernoulliSpec::enabled(SpecId::CURIE));
assert!(!BernoulliSpec::enabled(SpecId::EUCLID_V1));
assert!(!BernoulliSpec::enabled(SpecId::EUCLID_V2));
assert!(!BernoulliSpec::enabled(SpecId::CANCUN));
assert!(!BernoulliSpec::enabled(SpecId::LATEST));
Expand All @@ -851,32 +836,18 @@ mod scroll_tests {
assert!(CurieSpec::enabled(SpecId::SHANGHAI));
assert!(CurieSpec::enabled(SpecId::PRE_BERNOULLI));
assert!(CurieSpec::enabled(SpecId::BERNOULLI));
assert!(!CurieSpec::enabled(SpecId::EUCLID_V1));
assert!(!CurieSpec::enabled(SpecId::EUCLID_V2));
assert!(!CurieSpec::enabled(SpecId::CANCUN));
assert!(!CurieSpec::enabled(SpecId::LATEST));
}

#[test]
fn test_euclid_v1_post_merge_hardforks() {
assert!(EuclidV1Spec::enabled(SpecId::MERGE));
assert!(EuclidV1Spec::enabled(SpecId::SHANGHAI));
assert!(EuclidV1Spec::enabled(SpecId::PRE_BERNOULLI));
assert!(EuclidV1Spec::enabled(SpecId::BERNOULLI));
assert!(EuclidV1Spec::enabled(SpecId::CURIE));
assert!(!EuclidV1Spec::enabled(SpecId::EUCLID_V2));
assert!(!EuclidV1Spec::enabled(SpecId::CANCUN));
assert!(!EuclidV1Spec::enabled(SpecId::LATEST));
}

#[test]
fn test_euclid_v2_post_merge_hardforks() {
assert!(EuclidV2Spec::enabled(SpecId::MERGE));
assert!(EuclidV2Spec::enabled(SpecId::SHANGHAI));
assert!(EuclidV2Spec::enabled(SpecId::PRE_BERNOULLI));
assert!(EuclidV2Spec::enabled(SpecId::BERNOULLI));
assert!(EuclidV2Spec::enabled(SpecId::CURIE));
assert!(EuclidV2Spec::enabled(SpecId::EUCLID_V1));
assert!(!EuclidV2Spec::enabled(SpecId::CANCUN));
assert!(!EuclidV2Spec::enabled(SpecId::LATEST));
}
Expand Down
3 changes: 1 addition & 2 deletions crates/revm/src/handler/mainnet/pre_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use crate::{
},
Context, ContextPrecompiles,
};
use revm_precompile::primitives::SpecId;

/// Main precompile load
#[inline]
Expand Down Expand Up @@ -109,7 +108,7 @@ pub fn apply_eip7702_auth_list<SPEC: Spec, EXT, DB: Database>(
return Ok(0);
}
#[cfg(feature = "scroll")]
if !SPEC::enabled(SpecId::EUCLID_V2) {
if !SPEC::enabled(crate::primitives::SpecId::EUCLID_V2) {
return Ok(0);
}

Expand Down

0 comments on commit 2841ff8

Please sign in to comment.