mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 18:21:45 +00:00
Update to spec v1.1.8 (#2893)
## Proposed Changes Change the canonical fork name for the merge to Bellatrix. Keep other merge naming the same to avoid churn. I've also fixed and enabled the `fork` and `transition` tests for Bellatrix, and the v1.1.7 fork choice tests. Additionally, the `BellatrixPreset` has been added with tests. It gets served via the `/config/spec` API endpoint along with the other presets.
This commit is contained in:
@@ -2,7 +2,7 @@ use super::per_block_processing::{
|
||||
errors::BlockProcessingError, process_operations::process_deposit,
|
||||
};
|
||||
use crate::common::DepositDataTree;
|
||||
use crate::upgrade::{upgrade_to_altair, upgrade_to_merge};
|
||||
use crate::upgrade::{upgrade_to_altair, upgrade_to_bellatrix};
|
||||
use safe_arith::{ArithError, SafeArith};
|
||||
use tree_hash::TreeHash;
|
||||
use types::DEPOSIT_TREE_DEPTH;
|
||||
@@ -58,13 +58,13 @@ pub fn initialize_beacon_state_from_eth1<T: EthSpec>(
|
||||
|
||||
// Similarly, perform an upgrade to the merge if configured from genesis.
|
||||
if spec
|
||||
.merge_fork_epoch
|
||||
.bellatrix_fork_epoch
|
||||
.map_or(false, |fork_epoch| fork_epoch == T::genesis_epoch())
|
||||
{
|
||||
upgrade_to_merge(&mut state, spec)?;
|
||||
upgrade_to_bellatrix(&mut state, spec)?;
|
||||
|
||||
// Remove intermediate Altair fork from `state.fork`.
|
||||
state.fork_mut().previous_version = spec.merge_fork_version;
|
||||
state.fork_mut().previous_version = spec.bellatrix_fork_version;
|
||||
|
||||
// Override latest execution payload header.
|
||||
// See https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/merge/beacon-chain.md#testing
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::upgrade::{upgrade_to_altair, upgrade_to_merge};
|
||||
use crate::upgrade::{upgrade_to_altair, upgrade_to_bellatrix};
|
||||
use crate::{per_epoch_processing::EpochProcessingSummary, *};
|
||||
use safe_arith::{ArithError, SafeArith};
|
||||
use types::*;
|
||||
@@ -52,8 +52,8 @@ pub fn per_slot_processing<T: EthSpec>(
|
||||
upgrade_to_altair(state, spec)?;
|
||||
}
|
||||
// If the Merge fork epoch is reached, perform an irregular state upgrade.
|
||||
if spec.merge_fork_epoch == Some(state.current_epoch()) {
|
||||
upgrade_to_merge(state, spec)?;
|
||||
if spec.bellatrix_fork_epoch == Some(state.current_epoch()) {
|
||||
upgrade_to_bellatrix(state, spec)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@ pub mod altair;
|
||||
pub mod merge;
|
||||
|
||||
pub use altair::upgrade_to_altair;
|
||||
pub use merge::upgrade_to_merge;
|
||||
pub use merge::upgrade_to_bellatrix;
|
||||
|
||||
@@ -5,7 +5,7 @@ use types::{
|
||||
};
|
||||
|
||||
/// Transform a `Altair` state into an `Merge` state.
|
||||
pub fn upgrade_to_merge<E: EthSpec>(
|
||||
pub fn upgrade_to_bellatrix<E: EthSpec>(
|
||||
pre_state: &mut BeaconState<E>,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), Error> {
|
||||
@@ -24,7 +24,7 @@ pub fn upgrade_to_merge<E: EthSpec>(
|
||||
slot: pre.slot,
|
||||
fork: Fork {
|
||||
previous_version: pre.fork.current_version,
|
||||
current_version: spec.merge_fork_version,
|
||||
current_version: spec.bellatrix_fork_version,
|
||||
epoch,
|
||||
},
|
||||
// History
|
||||
|
||||
Reference in New Issue
Block a user