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

chore: enable cancun hardfork #6393

Merged
merged 1 commit into from
Nov 22, 2023
Merged
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
13 changes: 12 additions & 1 deletion crates/anvil/src/hardfork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub enum Hardfork {
GrayGlacier,
Paris,
Shanghai,
Cancun,
#[default]
Latest,
}
Expand All @@ -44,6 +45,9 @@ impl Hardfork {
Hardfork::GrayGlacier => 15050000,
Hardfork::Paris => 15537394,
Hardfork::Shanghai | Hardfork::Latest => 17034870,

// TODO: set block number after activation
Hardfork::Cancun => unreachable!(),
}
}

Expand Down Expand Up @@ -92,6 +96,10 @@ impl Hardfork {
// update `next` when another fork block num is known
ForkId { hash: ForkHash([0xc1, 0xfd, 0xf1, 0x81]), next: 0 }
}
Hardfork::Cancun => {
// TODO: set fork hash once known
ForkId { hash: ForkHash([0xc1, 0xfd, 0xf1, 0x81]), next: 0 }
}
}
}
}
Expand All @@ -118,7 +126,7 @@ impl FromStr for Hardfork {
"grayglacier" | "14" => Hardfork::GrayGlacier,
"paris" | "merge" | "15" => Hardfork::Paris,
"shanghai" | "16" => Hardfork::Shanghai,
// "cancun" | "17"=> Hardfork::Cancun,
"cancun" | "17" => Hardfork::Cancun,
"latest" => Hardfork::Latest,
_ => return Err(format!("Unknown hardfork {s}")),
};
Expand All @@ -145,6 +153,9 @@ impl From<Hardfork> for SpecId {
Hardfork::GrayGlacier => SpecId::GRAY_GLACIER,
Hardfork::Paris => SpecId::MERGE,
Hardfork::Shanghai | Hardfork::Latest => SpecId::SHANGHAI,

// TODO: switch to latest after activation
Hardfork::Cancun => SpecId::CANCUN,
}
}
}
Expand Down