Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce Haber fork to opBNB testnet #27

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading