mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-31 21:27:12 +00:00
Merge conflicts
This commit is contained in:
@@ -4,8 +4,8 @@ use super::per_block_processing::{
|
||||
use crate::common::DepositDataTree;
|
||||
use crate::upgrade::electra::upgrade_state_to_electra;
|
||||
use crate::upgrade::{
|
||||
upgrade_to_altair, upgrade_to_bellatrix, upgrade_to_capella, upgrade_to_deneb,
|
||||
upgrade_to_eip7805, upgrade_to_fulu, upgrade_to_gloas,
|
||||
upgrade_to_altair, upgrade_to_bellatrix, upgrade_to_capella, upgrade_to_deneb, upgrade_to_fulu,
|
||||
upgrade_to_gloas, upgrade_to_heze,
|
||||
};
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use safe_arith::{ArithError, SafeArith};
|
||||
@@ -141,22 +141,6 @@ pub fn initialize_beacon_state_from_eth1<E: EthSpec>(
|
||||
}
|
||||
}
|
||||
|
||||
// Upgrade to eip7805 if configured from genesis.
|
||||
if spec
|
||||
.eip7805_fork_epoch
|
||||
.is_some_and(|fork_epoch| fork_epoch == E::genesis_epoch())
|
||||
{
|
||||
upgrade_to_eip7805(&mut state, spec)?;
|
||||
|
||||
// Remove intermediate Electra fork from `state.fork`.
|
||||
state.fork_mut().previous_version = spec.eip7805_fork_version;
|
||||
|
||||
// Override latest execution payload header.
|
||||
if let Some(ExecutionPayloadHeader::Eip7805(ref header)) = execution_payload_header {
|
||||
*state.latest_execution_payload_header_eip7805_mut()? = header.clone();
|
||||
}
|
||||
}
|
||||
|
||||
// Upgrade to fulu if configured from genesis.
|
||||
if spec
|
||||
.fulu_fork_epoch
|
||||
@@ -198,6 +182,17 @@ pub fn initialize_beacon_state_from_eth1<E: EthSpec>(
|
||||
state.latest_block_header_mut().body_root = genesis_body_root;
|
||||
}
|
||||
|
||||
// Upgrade to heze if configured from genesis.
|
||||
if spec
|
||||
.heze_fork_epoch
|
||||
.is_some_and(|fork_epoch| fork_epoch == E::genesis_epoch())
|
||||
{
|
||||
upgrade_to_heze(&mut state, spec)?;
|
||||
|
||||
// Remove intermediate Gloas fork from `state.fork`.
|
||||
state.fork_mut().previous_version = spec.heze_fork_version;
|
||||
}
|
||||
|
||||
// Now that we have our validators, initialize the caches (including the committees)
|
||||
state.build_caches(spec)?;
|
||||
|
||||
@@ -209,10 +204,9 @@ pub fn initialize_beacon_state_from_eth1<E: EthSpec>(
|
||||
|
||||
/// Create an unsigned genesis `BeaconBlock`.
|
||||
///
|
||||
/// Per spec, the genesis block body is empty (all default fields) except for Gloas,
|
||||
/// where `body.signed_execution_payload_bid.message` is initialised from
|
||||
/// `state.latest_execution_payload_bid` so that the first post-genesis proposer can
|
||||
/// build on the correct execution layer head.
|
||||
/// For Gloas and later, the block's `signed_execution_payload_bid` is populated from the state's
|
||||
/// `latest_execution_payload_bid` so that the body root is consistent with
|
||||
/// `state.latest_block_header.body_root`.
|
||||
///
|
||||
/// `state.latest_block_header.body_root` is set from this same block's body, so the
|
||||
/// two must stay in sync.
|
||||
@@ -221,9 +215,16 @@ pub fn genesis_block<E: EthSpec>(
|
||||
spec: &ChainSpec,
|
||||
) -> Result<BeaconBlock<E>, BeaconStateError> {
|
||||
let mut block = BeaconBlock::empty(spec);
|
||||
if let BeaconBlock::Gloas(ref mut gloas_block) = block {
|
||||
let bid = state.latest_execution_payload_bid()?.clone();
|
||||
gloas_block.body.signed_execution_payload_bid.message = bid;
|
||||
if let Ok(block) = block.as_gloas_mut() {
|
||||
let state_bid = state.latest_execution_payload_bid()?;
|
||||
let bid = &mut block.body.signed_execution_payload_bid.message;
|
||||
bid.block_hash = state_bid.block_hash;
|
||||
bid.execution_requests_root = state_bid.execution_requests_root;
|
||||
} else if let Ok(block) = block.as_heze_mut() {
|
||||
let state_bid = state.latest_execution_payload_bid()?;
|
||||
let bid = &mut block.body.signed_execution_payload_bid.message;
|
||||
bid.block_hash = state_bid.block_hash;
|
||||
bid.execution_requests_root = state_bid.execution_requests_root;
|
||||
}
|
||||
Ok(block)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user