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

fix p2p incompatible forks for opbnb testnet and mainnet #17

Merged
merged 2 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion 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 All @@ -250,7 +254,7 @@ impl ForkFilter {

// Compute cache based on filtered forks and the current head.
let cache = Cache::compute_cache(&forks, head);

// Create and return a new `ForkFilter`.
Self { forks, head, cache }
}
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
Loading