Skip to content

Commit

Permalink
fix p2p incompatible forks for opbnb testnet and mainnet (#17)
Browse files Browse the repository at this point in the history
* fix p2p incompatible forks for opbnb testnet and mainnet

* fix blank line

---------

Co-authored-by: Keefe Liu <[email protected]>
  • Loading branch information
keefel and Keefe Liu authored May 24, 2024
1 parent 3c9d4a9 commit b636310
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/ethereum-forks/src/forkid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ impl ForkFilter {
forks.remove(&ForkFilterKey::Time(0));
forks.remove(&ForkFilterKey::Block(0));

// Skip Fermat hardfork for opbnb
forks.remove(&ForkFilterKey::Time(1698991506));
forks.remove(&ForkFilterKey::Time(1701151200));

let forks = forks
.into_iter()
// filter out forks that are pre-genesis by timestamp
Expand Down
9 changes: 9 additions & 0 deletions crates/primitives/src/chain/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,10 @@ pub static OPBNB_TESTNET: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
(Hardfork::Regolith, ForkCondition::Timestamp(0)),
(Hardfork::PreContractForkBlock, ForkCondition::Block(5805494)),
(Hardfork::Fermat, ForkCondition::Timestamp(1698991506)),
(Hardfork::Shanghai, ForkCondition::Timestamp(1715753400)),
(Hardfork::Canyon, ForkCondition::Timestamp(1715753400)),
(Hardfork::Cancun, ForkCondition::Timestamp(1715754600)),
(Hardfork::Ecotone, ForkCondition::Timestamp(1715754600)),
]),
base_fee_params: BaseFeeParamsKind::Variable(
vec![(Hardfork::London, BaseFeeParams::ethereum())].into(),
Expand Down Expand Up @@ -963,6 +967,11 @@ impl ChainSpec {
}) {
let cond = ForkCondition::Timestamp(timestamp);
if cond.active_at_head(head) {
// Skip Fermat hardfork for opbnb
if timestamp == 1698991506 || timestamp == 1701151200 {
continue;
}

if timestamp != current_applied {
forkhash += timestamp;
current_applied = timestamp;
Expand Down

0 comments on commit b636310

Please sign in to comment.