mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 20:39:10 +00:00
Use 'super-features' for past forks
This commit is contained in:
@@ -68,7 +68,7 @@ pub struct BeaconBlockBody<E: EthSpec, Payload: AbstractExecPayload<E> = FullPay
|
||||
pub attestations: VariableList<Attestation<E>, E::MaxAttestations>,
|
||||
pub deposits: VariableList<Deposit, E::MaxDeposits>,
|
||||
pub voluntary_exits: VariableList<SignedVoluntaryExit, E::MaxVoluntaryExits>,
|
||||
#[superstruct(feature(SyncCommittees))]
|
||||
#[superstruct(feature(Altair))]
|
||||
pub sync_aggregate: SyncAggregate<E>,
|
||||
// We flatten the execution payload so that serde can use the name of the inner type,
|
||||
// either `execution_payload` for full payloads, or `execution_payload_header` for blinded
|
||||
@@ -85,10 +85,10 @@ pub struct BeaconBlockBody<E: EthSpec, Payload: AbstractExecPayload<E> = FullPay
|
||||
#[superstruct(only(Electra), partial_getter(rename = "execution_payload_electra"))]
|
||||
#[serde(flatten)]
|
||||
pub execution_payload: Payload::Electra,
|
||||
#[superstruct(feature(Withdrawals))]
|
||||
#[superstruct(feature(Capella))]
|
||||
pub bls_to_execution_changes:
|
||||
VariableList<SignedBlsToExecutionChange, E::MaxBlsToExecutionChanges>,
|
||||
#[superstruct(feature(Blobs))]
|
||||
#[superstruct(feature(Deneb))]
|
||||
pub blob_kzg_commitments: KzgCommitments<E>,
|
||||
#[superstruct(feature(not(Merge)))]
|
||||
#[ssz(skip_serializing, skip_deserializing)]
|
||||
|
||||
@@ -269,15 +269,15 @@ where
|
||||
pub slashings: FixedVector<u64, E::EpochsPerSlashingsVector>,
|
||||
|
||||
// Attestations (genesis fork only)
|
||||
#[superstruct(feature(not(SyncCommittees)))]
|
||||
#[superstruct(feature(not(Altair)))]
|
||||
pub previous_epoch_attestations: VariableList<PendingAttestation<E>, E::MaxPendingAttestations>,
|
||||
#[superstruct(feature(not(SyncCommittees)))]
|
||||
#[superstruct(feature(not(Altair)))]
|
||||
pub current_epoch_attestations: VariableList<PendingAttestation<E>, E::MaxPendingAttestations>,
|
||||
|
||||
// Participation (Altair and later)
|
||||
#[superstruct(feature(SyncCommittees))]
|
||||
#[superstruct(feature(Altair))]
|
||||
pub previous_epoch_participation: VariableList<ParticipationFlags, E::ValidatorRegistryLimit>,
|
||||
#[superstruct(feature(SyncCommittees))]
|
||||
#[superstruct(feature(Altair))]
|
||||
pub current_epoch_participation: VariableList<ParticipationFlags, E::ValidatorRegistryLimit>,
|
||||
|
||||
// Finality
|
||||
@@ -292,13 +292,13 @@ where
|
||||
|
||||
// Inactivity
|
||||
#[serde(with = "ssz_types::serde_utils::quoted_u64_var_list")]
|
||||
#[superstruct(feature(SyncCommittees))]
|
||||
#[superstruct(feature(Altair))]
|
||||
pub inactivity_scores: VariableList<u64, E::ValidatorRegistryLimit>,
|
||||
|
||||
// Light-client sync committees
|
||||
#[superstruct(feature(SyncCommittees))]
|
||||
#[superstruct(feature(Altair))]
|
||||
pub current_sync_committee: Arc<SyncCommittee<E>>,
|
||||
#[superstruct(feature(SyncCommittees))]
|
||||
#[superstruct(feature(Altair))]
|
||||
pub next_sync_committee: Arc<SyncCommittee<E>>,
|
||||
|
||||
// Execution
|
||||
@@ -324,14 +324,14 @@ where
|
||||
pub latest_execution_payload_header: ExecutionPayloadHeaderElectra<E>,
|
||||
|
||||
// Capella
|
||||
#[superstruct(feature(Withdrawals), partial_getter(copy))]
|
||||
#[superstruct(feature(Capella), partial_getter(copy))]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub next_withdrawal_index: u64,
|
||||
#[superstruct(feature(Withdrawals), partial_getter(copy))]
|
||||
#[superstruct(feature(Capella), partial_getter(copy))]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub next_withdrawal_validator_index: u64,
|
||||
// Deep history valid from Capella onwards.
|
||||
#[superstruct(feature(Withdrawals))]
|
||||
#[superstruct(feature(Capella))]
|
||||
pub historical_summaries: VariableList<HistoricalSummary, E::HistoricalRootsLimit>,
|
||||
|
||||
// Caching (not in the spec)
|
||||
|
||||
@@ -1,12 +1,25 @@
|
||||
// A list of all individual features that are available.
|
||||
// We can gate parts of the code behind checks that ensure a feature is active.
|
||||
//
|
||||
// For now, older Forks have a single "super-feature" which contains all features associated with
|
||||
// that Fork. It may be worth splitting these up at a later time.
|
||||
pub enum FeatureName {
|
||||
// Altair.
|
||||
SyncCommittees,
|
||||
Altair,
|
||||
// Bellatrix.
|
||||
Merge,
|
||||
// Capella.
|
||||
Withdrawals,
|
||||
Capella,
|
||||
// Deneb.
|
||||
Blobs,
|
||||
Deneb,
|
||||
// Electra.
|
||||
//
|
||||
// Supply deposits on chain.
|
||||
EIP6110,
|
||||
// EL triggerable exits.
|
||||
EIP7002,
|
||||
// Increase MAX_EFFECTIVE_BALANCE.
|
||||
EIP7251,
|
||||
// Committee index outside Attestation.
|
||||
EIP7549,
|
||||
}
|
||||
|
||||
@@ -4,19 +4,19 @@ use superstruct::superstruct;
|
||||
#[superstruct(variants_and_features_decl = "FORK_ORDER")]
|
||||
pub const FORK_ORDER: &[(ForkName, &[FeatureName])] = &[
|
||||
(ForkName::Base, &[]),
|
||||
(ForkName::Altair, &[FeatureName::SyncCommittees]),
|
||||
(ForkName::Altair, &[FeatureName::Altair]),
|
||||
(ForkName::Merge, &[FeatureName::Merge]),
|
||||
(ForkName::Capella, &[FeatureName::Withdrawals]),
|
||||
(ForkName::Deneb, &[FeatureName::Blobs]),
|
||||
(ForkName::Capella, &[FeatureName::Capella]),
|
||||
(ForkName::Deneb, &[FeatureName::Deneb]),
|
||||
(ForkName::Electra, &[]),
|
||||
];
|
||||
|
||||
#[superstruct(feature_dependencies_decl = "FEATURE_DEPENDENCIES")]
|
||||
pub const FEATURE_DEPENDENCIES: &[(FeatureName, &[FeatureName])] = &[
|
||||
(FeatureName::SyncCommittees, &[]),
|
||||
(FeatureName::Merge, &[FeatureName::SyncCommittees]),
|
||||
(FeatureName::Withdrawals, &[FeatureName::Merge]),
|
||||
(FeatureName::Blobs, &[FeatureName::Withdrawals]),
|
||||
(FeatureName::Altair, &[]),
|
||||
(FeatureName::Merge, &[FeatureName::Altair]),
|
||||
(FeatureName::Capella, &[FeatureName::Merge]),
|
||||
(FeatureName::Deneb, &[FeatureName::Capella]),
|
||||
];
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user