enable 4844 at epoch 3

This commit is contained in:
Marius van der Wijden 2022-09-18 12:13:03 +02:00
parent 257087b010
commit 6f7d21c542
3 changed files with 14 additions and 9 deletions

View File

@ -18,7 +18,7 @@ impl<T: BeaconChainTypes> ToStatusMessage for BeaconChain<T> {
/// Build a `StatusMessage` representing the state of the given `beacon_chain`.
pub(crate) fn status_message<T: BeaconChainTypes>(beacon_chain: &BeaconChain<T>) -> StatusMessage {
let fork_digest = [0x9c, 0x67, 0x11, 0x28];
let fork_digest = beacon_chain.enr_fork_id().fork_digest;
let cached_head = beacon_chain.canonical_head.cached_head();
let mut finalized_checkpoint = cached_head.finalized_checkpoint();

View File

@ -236,7 +236,9 @@ impl ChainSpec {
/// Returns the name of the fork which is active at `epoch`.
pub fn fork_name_at_epoch(&self, epoch: Epoch) -> ForkName {
match self.bellatrix_fork_epoch {
match self.eip4844_fork_epoch {
Some(fork_epoch) if epoch >= fork_epoch => ForkName::Eip4844,
_ => match self.bellatrix_fork_epoch {
Some(fork_epoch) if epoch >= fork_epoch => ForkName::Merge,
_ => match self.altair_fork_epoch {
Some(fork_epoch) if epoch >= fork_epoch => ForkName::Altair,
@ -245,6 +247,8 @@ impl ChainSpec {
}
}
}
/// Returns the fork version for a named fork.
pub fn fork_version_for_name(&self, fork_name: ForkName) -> [u8; 4] {
match fork_name {
@ -582,7 +586,7 @@ impl ChainSpec {
/*
* Eip4844 hard fork params
*/
eip4844_fork_epoch: None,
eip4844_fork_epoch: Some(Epoch::new(3)),
eip4844_fork_version: [0x83, 0x00, 0x0f, 0xfd],
/*

View File

@ -42,7 +42,7 @@ impl ForkName {
ForkName::Eip4844 => {
spec.altair_fork_epoch = Some(Epoch::new(0));
spec.bellatrix_fork_epoch = Some(Epoch::new(0));
spec.eip4844_fork_epoch = Some(Epoch::new(0));
spec.eip4844_fork_epoch = Some(Epoch::new(3));
spec
}
}
@ -126,6 +126,7 @@ impl FromStr for ForkName {
"phase0" | "base" => ForkName::Base,
"altair" => ForkName::Altair,
"bellatrix" | "merge" => ForkName::Merge,
"eip4844" => ForkName::Eip4844,
_ => return Err(format!("unknown fork name: {}", fork_name)),
})
}