Skip to content

Commit

Permalink
fix: fix the hardforks' order (#55)
Browse files Browse the repository at this point in the history
* fix: fix the hardforks' order

* adjust order of Fermat hardfork

* update dependencies
  • Loading branch information
yutianwu committed Jul 8, 2024
1 parent 9dab153 commit 9cd08f4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,11 @@ test-fuzz = "5"
iai-callgrind = "0.11"

[patch.crates-io]
revm = { git = "https://github.com/bnb-chain/revm", rev = "dfca3edd9732372e19dea88462eaece1e74824f1" }
revm-interpreter = { git = "https://github.com/bnb-chain/revm", rev = "dfca3edd9732372e19dea88462eaece1e74824f1" }
revm-precompile = { git = "https://github.com/bnb-chain/revm", rev = "dfca3edd9732372e19dea88462eaece1e74824f1" }
revm-primitives = { git = "https://github.com/bnb-chain/revm", rev = "dfca3edd9732372e19dea88462eaece1e74824f1" }
revm = { git = "https://github.com/bnb-chain/revm", rev = "e4bf75d62e36077fb3904c400332da0376c03383" }
revm-interpreter = { git = "https://github.com/bnb-chain/revm", rev = "e4bf75d62e36077fb3904c400332da0376c03383" }
revm-precompile = { git = "https://github.com/bnb-chain/revm", rev = "e4bf75d62e36077fb3904c400332da0376c03383" }
revm-primitives = { git = "https://github.com/bnb-chain/revm", rev = "e4bf75d62e36077fb3904c400332da0376c03383" }
alloy-chains = { git = "https://github.com/bnb-chain/alloy-chains-rs.git", rev = "b7c5379cf47345181f8dce350acafb958f47152a" }

[patch."https://github.com/bluealloy/revm"]
revm = { git = "https://github.com/bnb-chain/revm", rev = "dfca3edd9732372e19dea88462eaece1e74824f1" }
revm = { git = "https://github.com/bnb-chain/revm", rev = "e4bf75d62e36077fb3904c400332da0376c03383" }
6 changes: 3 additions & 3 deletions crates/ethereum-forks/src/hardfork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ pub enum Hardfork {
Feynman,
/// BSC `FeynmanFix` hardfork
FeynmanFix,
/// `Fermat`
#[cfg(all(feature = "optimism", feature = "opbnb"))]
Fermat,
/// Canyon:
/// <https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/superchain-upgrades.md#canyon>.
#[cfg(feature = "optimism")]
Expand All @@ -110,9 +113,6 @@ pub enum Hardfork {
/// `PreContractForkBlock`
#[cfg(all(feature = "optimism", feature = "opbnb"))]
PreContractForkBlock,
/// `Fermat`
#[cfg(all(feature = "optimism", feature = "opbnb"))]
Fermat,
// ArbOS20Atlas,
/// BSC `Haber` hardfork
Haber,
Expand Down
12 changes: 6 additions & 6 deletions crates/primitives/src/revm/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ pub fn revm_spec_by_timestamp_after_merge(
) -> revm_primitives::SpecId {
#[cfg(feature = "optimism")]
if chain_spec.is_optimism() {
return if chain_spec.fork(Hardfork::Haber).active_at_timestamp(timestamp) {
revm_primitives::HABER
} else if chain_spec.fork(Hardfork::Fjord).active_at_timestamp(timestamp) {
return if chain_spec.fork(Hardfork::Fjord).active_at_timestamp(timestamp) {
revm_primitives::FJORD
} else if chain_spec.fork(Hardfork::Haber).active_at_timestamp(timestamp) {
revm_primitives::HABER
} else if chain_spec.fork(Hardfork::Ecotone).active_at_timestamp(timestamp) {
revm_primitives::ECOTONE
} else if chain_spec.fork(Hardfork::Canyon).active_at_timestamp(timestamp) {
Expand Down Expand Up @@ -62,10 +62,10 @@ pub fn revm_spec_by_timestamp_after_merge(
pub fn revm_spec(chain_spec: &ChainSpec, block: Head) -> revm_primitives::SpecId {
#[cfg(feature = "optimism")]
if chain_spec.is_optimism() {
if chain_spec.fork(Hardfork::Haber).active_at_head(&block) {
return revm_primitives::HABER
} else if chain_spec.fork(Hardfork::Fjord).active_at_head(&block) {
if chain_spec.fork(Hardfork::Fjord).active_at_head(&block) {
return revm_primitives::FJORD
} else if chain_spec.fork(Hardfork::Haber).active_at_head(&block) {
return revm_primitives::HABER
} else if chain_spec.fork(Hardfork::Ecotone).active_at_head(&block) {
return revm_primitives::ECOTONE
} else if chain_spec.fork(Hardfork::Canyon).active_at_head(&block) {
Expand Down

0 comments on commit 9cd08f4

Please sign in to comment.