Skip to content

Commit

Permalink
fix: add CANCUN to revm_spec_by_timestamp_after_merge (#4699)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected authored Sep 20, 2023
1 parent 1718f14 commit 30b4ddb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/revm/revm-primitives/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -57,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
Expand Down

0 comments on commit 30b4ddb

Please sign in to comment.