From b44a38bfcc51032adeb5b34ed02d7ace27646b35 Mon Sep 17 00:00:00 2001 From: Akase Haruka Date: Fri, 15 Nov 2024 16:36:29 +0800 Subject: [PATCH] feat: add EUCLID spec (#68) * add EUCLID spec * update revm --- Cargo.lock | 8 ++++---- crates/core/src/hardfork.rs | 23 +++++++++++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5a00d0a3..f50fc3e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2951,7 +2951,7 @@ dependencies = [ [[package]] name = "revm" version = "17.1.0" -source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v49#a8438521f63b5c259bb395b30db59f24a9922e64" +source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v49#91708073cefa4d22767d5a69a6636e68c09084e4" dependencies = [ "auto_impl", "cfg-if", @@ -2965,7 +2965,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "13.0.0" -source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v49#a8438521f63b5c259bb395b30db59f24a9922e64" +source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v49#91708073cefa4d22767d5a69a6636e68c09084e4" dependencies = [ "cfg-if", "revm-primitives", @@ -2975,7 +2975,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "14.0.0" -source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v49#a8438521f63b5c259bb395b30db59f24a9922e64" +source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v49#91708073cefa4d22767d5a69a6636e68c09084e4" dependencies = [ "aurora-engine-modexp", "c-kzg", @@ -2993,7 +2993,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "13.0.0" -source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v49#a8438521f63b5c259bb395b30db59f24a9922e64" +source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v49#91708073cefa4d22767d5a69a6636e68c09084e4" dependencies = [ "alloy-eip2930", "alloy-eip7702", diff --git a/crates/core/src/hardfork.rs b/crates/core/src/hardfork.rs index f8b7bd04..3fea5c02 100644 --- a/crates/core/src/hardfork.rs +++ b/crates/core/src/hardfork.rs @@ -20,15 +20,27 @@ static HARDFORK_HEIGHTS: Lazy>> = Lazy::new(|| let mut map = HashMap::new(); map.insert( SCROLL_DEVNET_CHAIN_ID, - HashMap::from([(SpecId::BERNOULLI, 0), (SpecId::CURIE, 5)]), + HashMap::from([ + (SpecId::BERNOULLI, 0), + (SpecId::CURIE, 5), + (SpecId::EUCLID, u64::MAX), + ]), ); map.insert( SCROLL_TESTNET_CHAIN_ID, - HashMap::from([(SpecId::BERNOULLI, 3747132), (SpecId::CURIE, 4740239)]), + HashMap::from([ + (SpecId::BERNOULLI, 3747132), + (SpecId::CURIE, 4740239), + (SpecId::EUCLID, u64::MAX), + ]), ); map.insert( SCROLL_MAINNET_CHAIN_ID, - HashMap::from([(SpecId::BERNOULLI, 5220340), (SpecId::CURIE, 7096836)]), + HashMap::from([ + (SpecId::BERNOULLI, 5220340), + (SpecId::CURIE, 7096836), + (SpecId::EUCLID, u64::MAX), + ]), ); map @@ -39,6 +51,7 @@ static HARDFORK_HEIGHTS: Lazy>> = Lazy::new(|| pub struct HardforkConfig { bernoulli_block: u64, curie_block: u64, + euclid_block: u64, } impl HardforkConfig { @@ -48,6 +61,7 @@ impl HardforkConfig { Self { bernoulli_block: heights.get(&SpecId::BERNOULLI).copied().unwrap_or(0), curie_block: heights.get(&SpecId::CURIE).copied().unwrap_or(0), + euclid_block: heights.get(&SpecId::EUCLID).copied().unwrap_or(0), } } else { dev_warn!( @@ -75,7 +89,8 @@ impl HardforkConfig { match block_number { n if n < self.bernoulli_block => SpecId::PRE_BERNOULLI, n if n < self.curie_block => SpecId::BERNOULLI, - _ => SpecId::CURIE, + n if n < self.euclid_block => SpecId::CURIE, + _ => SpecId::EUCLID, } }