From 61fdf68e03eb1b11e0617627458dffdf76d48a0f Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Wed, 20 Sep 2023 18:47:38 -0400 Subject: [PATCH 1/2] fix: add CANCUN to revm_spec_by_timestamp_after_merge --- crates/revm/revm-primitives/src/config.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/revm/revm-primitives/src/config.rs b/crates/revm/revm-primitives/src/config.rs index 22d5a15cf0e4..7f755c78afac 100644 --- a/crates/revm/revm-primitives/src/config.rs +++ b/crates/revm/revm-primitives/src/config.rs @@ -10,7 +10,9 @@ pub fn revm_spec_by_timestamp_after_merge( chain_spec: &ChainSpec, timestamp: u64, ) -> revm::primitives::SpecId { - if chain_spec.is_fork_active_at_timestamp(Hardfork::Shanghai, timestamp) { + if chain_spec.is_cancun_activated_at_timestamp(timestamp) { + revm::primitives::CANCUN + } else if chain_spec.is_shanghai_activated_at_timestamp(timestamp) { revm::primitives::SHANGHAI } else { revm::primitives::MERGE From b5102ff4db3bce4ffd6633d0ef2fac9eb1a2cc43 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Wed, 20 Sep 2023 18:51:56 -0400 Subject: [PATCH 2/2] update test_to_revm_spec --- crates/revm/revm-primitives/src/config.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/revm/revm-primitives/src/config.rs b/crates/revm/revm-primitives/src/config.rs index 7f755c78afac..1ea528d1ed51 100644 --- a/crates/revm/revm-primitives/src/config.rs +++ b/crates/revm/revm-primitives/src/config.rs @@ -59,6 +59,14 @@ mod tests { use reth_primitives::{ChainSpecBuilder, Head, MAINNET, U256}; #[test] fn test_to_revm_spec() { + assert_eq!( + revm_spec(&ChainSpecBuilder::mainnet().cancun_activated().build(), Head::default()), + revm::primitives::CANCUN + ); + assert_eq!( + revm_spec(&ChainSpecBuilder::mainnet().shanghai_activated().build(), Head::default()), + revm::primitives::SHANGHAI + ); assert_eq!( revm_spec(&ChainSpecBuilder::mainnet().paris_activated().build(), Head::default()), revm::primitives::MERGE