mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Add Electra fork boilerplate (#5122)
* Add Electra fork boilerplate * Remove electra from spec tests * Fix tests * Remove sneaky log file * Fix more tests * Fix even more tests and add suggestions * Remove unrelated lcli addition * Update more tests * Merge branch 'unstable' into electra * Add comment for test-suite lcli override * Merge branch 'unstable' into electra * Cleanup * Merge branch 'unstable' into electra * Apply suggestions * Merge branch 'unstable' into electra * Merge sigp/unstable into electra * Merge branch 'unstable' into electra
This commit is contained in:
@@ -4,6 +4,7 @@ use super::per_block_processing::{
|
||||
use crate::common::DepositDataTree;
|
||||
use crate::upgrade::{
|
||||
upgrade_to_altair, upgrade_to_bellatrix, upgrade_to_capella, upgrade_to_deneb,
|
||||
upgrade_to_electra,
|
||||
};
|
||||
use safe_arith::{ArithError, SafeArith};
|
||||
use tree_hash::TreeHash;
|
||||
@@ -104,8 +105,25 @@ pub fn initialize_beacon_state_from_eth1<T: EthSpec>(
|
||||
|
||||
// Override latest execution payload header.
|
||||
// See https://github.com/ethereum/consensus-specs/blob/dev/specs/deneb/beacon-chain.md#testing
|
||||
if let Some(ExecutionPayloadHeader::Deneb(header)) = execution_payload_header {
|
||||
*state.latest_execution_payload_header_deneb_mut()? = header;
|
||||
if let Some(ExecutionPayloadHeader::Deneb(ref header)) = execution_payload_header {
|
||||
*state.latest_execution_payload_header_deneb_mut()? = header.clone();
|
||||
}
|
||||
}
|
||||
|
||||
// Upgrade to electra if configured from genesis.
|
||||
if spec
|
||||
.electra_fork_epoch
|
||||
.map_or(false, |fork_epoch| fork_epoch == T::genesis_epoch())
|
||||
{
|
||||
upgrade_to_electra(&mut state, spec)?;
|
||||
|
||||
// Remove intermediate Deneb fork from `state.fork`.
|
||||
state.fork_mut().previous_version = spec.electra_fork_version;
|
||||
|
||||
// Override latest execution payload header.
|
||||
// See https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#testing
|
||||
if let Some(ExecutionPayloadHeader::Electra(header)) = execution_payload_header {
|
||||
*state.latest_execution_payload_header_electra_mut()? = header.clone();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user