mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 18:21:45 +00:00
Add Fulu boilerplate (#6695)
* Add Fulu boilerplate * Add more boilerplate * Change fulu_time to osaka_time * Merge branch 'unstable' into fulu-boilerplate * Fix tests * Merge branch 'unstable' into fulu-boilerplate * More test fixes * Apply suggestions * Remove `get_payload` boilerplate * Add lightclient fulu types and fix beacon-chain-tests * Disable Fulu in ef-tests * Reduce boilerplate for future forks * Small fixes * One more fix * Apply suggestions * Merge branch 'unstable' into fulu-boilerplate * Fix lints
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::{DBColumn, Error, StoreItem};
|
||||
use ssz::{Decode, Encode};
|
||||
use types::{
|
||||
BlobSidecarList, EthSpec, ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella,
|
||||
ExecutionPayloadDeneb, ExecutionPayloadElectra,
|
||||
ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadFulu,
|
||||
};
|
||||
|
||||
macro_rules! impl_store_item {
|
||||
@@ -26,6 +26,7 @@ impl_store_item!(ExecutionPayloadBellatrix);
|
||||
impl_store_item!(ExecutionPayloadCapella);
|
||||
impl_store_item!(ExecutionPayloadDeneb);
|
||||
impl_store_item!(ExecutionPayloadElectra);
|
||||
impl_store_item!(ExecutionPayloadFulu);
|
||||
impl_store_item!(BlobSidecarList);
|
||||
|
||||
/// This fork-agnostic implementation should be only used for writing.
|
||||
@@ -42,17 +43,21 @@ impl<E: EthSpec> StoreItem for ExecutionPayload<E> {
|
||||
}
|
||||
|
||||
fn from_store_bytes(bytes: &[u8]) -> Result<Self, Error> {
|
||||
ExecutionPayloadElectra::from_ssz_bytes(bytes)
|
||||
.map(Self::Electra)
|
||||
ExecutionPayloadFulu::from_ssz_bytes(bytes)
|
||||
.map(Self::Fulu)
|
||||
.or_else(|_| {
|
||||
ExecutionPayloadDeneb::from_ssz_bytes(bytes)
|
||||
.map(Self::Deneb)
|
||||
ExecutionPayloadElectra::from_ssz_bytes(bytes)
|
||||
.map(Self::Electra)
|
||||
.or_else(|_| {
|
||||
ExecutionPayloadCapella::from_ssz_bytes(bytes)
|
||||
.map(Self::Capella)
|
||||
ExecutionPayloadDeneb::from_ssz_bytes(bytes)
|
||||
.map(Self::Deneb)
|
||||
.or_else(|_| {
|
||||
ExecutionPayloadBellatrix::from_ssz_bytes(bytes)
|
||||
.map(Self::Bellatrix)
|
||||
ExecutionPayloadCapella::from_ssz_bytes(bytes)
|
||||
.map(Self::Capella)
|
||||
.or_else(|_| {
|
||||
ExecutionPayloadBellatrix::from_ssz_bytes(bytes)
|
||||
.map(Self::Bellatrix)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -16,7 +16,7 @@ use types::*;
|
||||
///
|
||||
/// This can be deleted once schema versions prior to V22 are no longer supported.
|
||||
#[superstruct(
|
||||
variants(Base, Altair, Bellatrix, Capella, Deneb, Electra),
|
||||
variants(Base, Altair, Bellatrix, Capella, Deneb, Electra, Fulu),
|
||||
variant_attributes(derive(Debug, PartialEq, Clone, Encode, Decode))
|
||||
)]
|
||||
#[derive(Debug, PartialEq, Clone, Encode)]
|
||||
@@ -68,9 +68,9 @@ where
|
||||
pub current_epoch_attestations: List<PendingAttestation<E>, E::MaxPendingAttestations>,
|
||||
|
||||
// Participation (Altair and later)
|
||||
#[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))]
|
||||
#[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra, Fulu))]
|
||||
pub previous_epoch_participation: List<ParticipationFlags, E::ValidatorRegistryLimit>,
|
||||
#[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))]
|
||||
#[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra, Fulu))]
|
||||
pub current_epoch_participation: List<ParticipationFlags, E::ValidatorRegistryLimit>,
|
||||
|
||||
// Finality
|
||||
@@ -80,13 +80,13 @@ where
|
||||
pub finalized_checkpoint: Checkpoint,
|
||||
|
||||
// Inactivity
|
||||
#[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))]
|
||||
#[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra, Fulu))]
|
||||
pub inactivity_scores: List<u64, E::ValidatorRegistryLimit>,
|
||||
|
||||
// Light-client sync committees
|
||||
#[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))]
|
||||
#[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra, Fulu))]
|
||||
pub current_sync_committee: Arc<SyncCommittee<E>>,
|
||||
#[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra))]
|
||||
#[superstruct(only(Altair, Bellatrix, Capella, Deneb, Electra, Fulu))]
|
||||
pub next_sync_committee: Arc<SyncCommittee<E>>,
|
||||
|
||||
// Execution
|
||||
@@ -110,37 +110,42 @@ where
|
||||
partial_getter(rename = "latest_execution_payload_header_electra")
|
||||
)]
|
||||
pub latest_execution_payload_header: ExecutionPayloadHeaderElectra<E>,
|
||||
#[superstruct(
|
||||
only(Fulu),
|
||||
partial_getter(rename = "latest_execution_payload_header_fulu")
|
||||
)]
|
||||
pub latest_execution_payload_header: ExecutionPayloadHeaderFulu<E>,
|
||||
|
||||
// Capella
|
||||
#[superstruct(only(Capella, Deneb, Electra))]
|
||||
#[superstruct(only(Capella, Deneb, Electra, Fulu))]
|
||||
pub next_withdrawal_index: u64,
|
||||
#[superstruct(only(Capella, Deneb, Electra))]
|
||||
#[superstruct(only(Capella, Deneb, Electra, Fulu))]
|
||||
pub next_withdrawal_validator_index: u64,
|
||||
|
||||
#[ssz(skip_serializing, skip_deserializing)]
|
||||
#[superstruct(only(Capella, Deneb, Electra))]
|
||||
#[superstruct(only(Capella, Deneb, Electra, Fulu))]
|
||||
pub historical_summaries: Option<List<HistoricalSummary, E::HistoricalRootsLimit>>,
|
||||
|
||||
// Electra
|
||||
#[superstruct(only(Electra))]
|
||||
#[superstruct(only(Electra, Fulu))]
|
||||
pub deposit_requests_start_index: u64,
|
||||
#[superstruct(only(Electra))]
|
||||
#[superstruct(only(Electra, Fulu))]
|
||||
pub deposit_balance_to_consume: u64,
|
||||
#[superstruct(only(Electra))]
|
||||
#[superstruct(only(Electra, Fulu))]
|
||||
pub exit_balance_to_consume: u64,
|
||||
#[superstruct(only(Electra))]
|
||||
#[superstruct(only(Electra, Fulu))]
|
||||
pub earliest_exit_epoch: Epoch,
|
||||
#[superstruct(only(Electra))]
|
||||
#[superstruct(only(Electra, Fulu))]
|
||||
pub consolidation_balance_to_consume: u64,
|
||||
#[superstruct(only(Electra))]
|
||||
#[superstruct(only(Electra, Fulu))]
|
||||
pub earliest_consolidation_epoch: Epoch,
|
||||
|
||||
#[superstruct(only(Electra))]
|
||||
#[superstruct(only(Electra, Fulu))]
|
||||
pub pending_deposits: List<PendingDeposit, E::PendingDepositsLimit>,
|
||||
#[superstruct(only(Electra))]
|
||||
#[superstruct(only(Electra, Fulu))]
|
||||
pub pending_partial_withdrawals:
|
||||
List<PendingPartialWithdrawal, E::PendingPartialWithdrawalsLimit>,
|
||||
#[superstruct(only(Electra))]
|
||||
#[superstruct(only(Electra, Fulu))]
|
||||
pub pending_consolidations: List<PendingConsolidation, E::PendingConsolidationsLimit>,
|
||||
}
|
||||
|
||||
@@ -409,6 +414,31 @@ impl<E: EthSpec> TryInto<BeaconState<E>> for PartialBeaconState<E> {
|
||||
],
|
||||
[historical_summaries]
|
||||
),
|
||||
PartialBeaconState::Fulu(inner) => impl_try_into_beacon_state!(
|
||||
inner,
|
||||
Fulu,
|
||||
BeaconStateFulu,
|
||||
[
|
||||
previous_epoch_participation,
|
||||
current_epoch_participation,
|
||||
current_sync_committee,
|
||||
next_sync_committee,
|
||||
inactivity_scores,
|
||||
latest_execution_payload_header,
|
||||
next_withdrawal_index,
|
||||
next_withdrawal_validator_index,
|
||||
deposit_requests_start_index,
|
||||
deposit_balance_to_consume,
|
||||
exit_balance_to_consume,
|
||||
earliest_exit_epoch,
|
||||
consolidation_balance_to_consume,
|
||||
earliest_consolidation_epoch,
|
||||
pending_deposits,
|
||||
pending_partial_withdrawals,
|
||||
pending_consolidations
|
||||
],
|
||||
[historical_summaries]
|
||||
),
|
||||
};
|
||||
Ok(state)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user