Skip to content

Commit

Permalink
feat: introduce Haber fork into opBNB testnet (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
j75689 authored Jun 3, 2024
1 parent 6a63951 commit 63e5419
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 8 deletions.
30 changes: 26 additions & 4 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,6 @@ similar-asserts = "1.5.0"
test-fuzz = "5"

[patch.crates-io]
revm = { git = "https://github.com/bnb-chain/revm.git", rev = "deb253b" }
revm-primitives = { git = "https://github.com/bnb-chain/revm.git", rev = "deb253b" }
revm = { git = "https://github.com/bnb-chain/revm.git", rev = "2f38e6c" }
revm-primitives = { git = "https://github.com/bnb-chain/revm.git", rev = "2f38e6c" }
alloy-chains = { git = "https://github.com/alloy-rs/chains.git", rev = "906d6fb" }
5 changes: 5 additions & 0 deletions crates/ethereum-forks/src/hardfork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ pub enum Hardfork {
/// Fermat
#[cfg(all(feature = "optimism", feature = "opbnb"))]
Fermat,
/// Haber
#[cfg(all(feature = "optimism", feature = "opbnb"))]
Haber,
// ArbOS20Atlas,

// Upcoming
Expand Down Expand Up @@ -564,6 +567,8 @@ impl FromStr for Hardfork {
"precontractforkblock" => Hardfork::PreContractForkBlock,
#[cfg(all(feature = "optimism", feature = "opbnb"))]
"fermat" => Hardfork::Fermat,
#[cfg(all(feature = "optimism", feature = "opbnb"))]
"haber" => Hardfork::Haber,
#[cfg(feature = "optimism")]
"canyon" => Hardfork::Canyon,
#[cfg(feature = "optimism")]
Expand Down
1 change: 1 addition & 0 deletions crates/primitives/src/chain/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ pub static OPBNB_TESTNET: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
(Hardfork::Canyon, ForkCondition::Timestamp(1715753400)),
(Hardfork::Cancun, ForkCondition::Timestamp(1715754600)),
(Hardfork::Ecotone, ForkCondition::Timestamp(1715754600)),
(Hardfork::Haber, ForkCondition::Timestamp(1717048800)),
]),
base_fee_params: BaseFeeParamsKind::Variable(
vec![(Hardfork::London, BaseFeeParams::ethereum())].into(),
Expand Down
8 changes: 6 additions & 2 deletions crates/primitives/src/revm/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(
) -> revm_primitives::SpecId {
#[cfg(feature = "optimism")]
if chain_spec.is_optimism() {
return if chain_spec.fork(Hardfork::Ecotone).active_at_timestamp(timestamp) {
return 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) {
revm_primitives::CANYON
Expand All @@ -36,7 +38,9 @@ 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::Ecotone).active_at_head(&block) {
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) {
return revm_primitives::CANYON
Expand Down

0 comments on commit 63e5419

Please sign in to comment.