mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-27 01:33:33 +00:00
fix compilation errors, rename capella -> shanghai, cleanup some rebase issues
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::beacon_block_body::{
|
||||
BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyMerge, BeaconBlockBodyRef,
|
||||
BeaconBlockBodyRefMut, BeaconBlockBodyShanghai,
|
||||
BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyCapella, BeaconBlockBodyMerge,
|
||||
BeaconBlockBodyRef, BeaconBlockBodyRefMut,
|
||||
};
|
||||
use crate::test_utils::TestRandom;
|
||||
use crate::*;
|
||||
@@ -17,7 +17,7 @@ use tree_hash_derive::TreeHash;
|
||||
|
||||
/// A block of the `BeaconChain`.
|
||||
#[superstruct(
|
||||
variants(Base, Altair, Merge, Shanghai),
|
||||
variants(Base, Altair, Merge, Capella),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Debug,
|
||||
@@ -64,8 +64,8 @@ pub struct BeaconBlock<T: EthSpec, Payload: ExecPayload<T> = FullPayload<T>> {
|
||||
pub body: BeaconBlockBodyAltair<T, Payload>,
|
||||
#[superstruct(only(Merge), partial_getter(rename = "body_merge"))]
|
||||
pub body: BeaconBlockBodyMerge<T, Payload>,
|
||||
#[superstruct(only(Shanghai), partial_getter(rename = "body_shanghai"))]
|
||||
pub body: BeaconBlockBodyShanghai<T, Payload>,
|
||||
#[superstruct(only(Capella), partial_getter(rename = "body_capella"))]
|
||||
pub body: BeaconBlockBodyCapella<T, Payload>,
|
||||
}
|
||||
|
||||
pub type BlindedBeaconBlock<E> = BeaconBlock<E, BlindedPayload<E>>;
|
||||
@@ -191,7 +191,7 @@ impl<'a, T: EthSpec, Payload: ExecPayload<T>> BeaconBlockRef<'a, T, Payload> {
|
||||
BeaconBlockRef::Base { .. } => ForkName::Base,
|
||||
BeaconBlockRef::Altair { .. } => ForkName::Altair,
|
||||
BeaconBlockRef::Merge { .. } => ForkName::Merge,
|
||||
BeaconBlockRef::Shanghai { .. } => ForkName::Shanghai,
|
||||
BeaconBlockRef::Capella { .. } => ForkName::Capella,
|
||||
};
|
||||
|
||||
if fork_at_slot == object_fork {
|
||||
|
||||
@@ -13,7 +13,7 @@ use tree_hash_derive::TreeHash;
|
||||
///
|
||||
/// This *superstruct* abstracts over the hard-fork.
|
||||
#[superstruct(
|
||||
variants(Base, Altair, Merge, Shanghai),
|
||||
variants(Base, Altair, Merge, Capella),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Debug,
|
||||
@@ -47,16 +47,16 @@ pub struct BeaconBlockBody<T: EthSpec, Payload: ExecPayload<T> = FullPayload<T>>
|
||||
pub attestations: VariableList<Attestation<T>, T::MaxAttestations>,
|
||||
pub deposits: VariableList<Deposit, T::MaxDeposits>,
|
||||
pub voluntary_exits: VariableList<SignedVoluntaryExit, T::MaxVoluntaryExits>,
|
||||
#[superstruct(only(Altair, Merge, Shanghai))]
|
||||
#[superstruct(only(Altair, Merge, Capella))]
|
||||
pub sync_aggregate: SyncAggregate<T>,
|
||||
// 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
|
||||
// payloads.
|
||||
#[superstruct(only(Merge, Shanghai))]
|
||||
#[superstruct(only(Merge, Capella))]
|
||||
#[serde(flatten)]
|
||||
pub execution_payload: Payload,
|
||||
#[superstruct(only(Shanghai))]
|
||||
pub blob_kzgs: VariableList<KZGCommitment, T::MaxObjectListSize>,
|
||||
#[superstruct(only(Capella))]
|
||||
pub blob_kzgs: VariableList<KZGCommitment, T::MaxBlobsPerBlock>,
|
||||
#[superstruct(only(Base, Altair))]
|
||||
#[ssz(skip_serializing, skip_deserializing)]
|
||||
#[tree_hash(skip_hashing)]
|
||||
@@ -71,7 +71,7 @@ impl<'a, T: EthSpec> BeaconBlockBodyRef<'a, T> {
|
||||
BeaconBlockBodyRef::Base { .. } => ForkName::Base,
|
||||
BeaconBlockBodyRef::Altair { .. } => ForkName::Altair,
|
||||
BeaconBlockBodyRef::Merge { .. } => ForkName::Merge,
|
||||
BeaconBlockBodyRef::Shanghai { .. } => ForkName::Shanghai,
|
||||
BeaconBlockBodyRef::Capella { .. } => ForkName::Capella,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ impl From<BeaconStateHash> for Hash256 {
|
||||
|
||||
/// The state of the `BeaconChain` at some slot.
|
||||
#[superstruct(
|
||||
variants(Base, Altair, Merge, Shanghai),
|
||||
variants(Base, Altair, Merge, Capella),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Derivative,
|
||||
@@ -250,9 +250,9 @@ where
|
||||
pub current_epoch_attestations: VariableList<PendingAttestation<T>, T::MaxPendingAttestations>,
|
||||
|
||||
// Participation (Altair and later)
|
||||
#[superstruct(only(Altair, Merge, Shanghai))]
|
||||
#[superstruct(only(Altair, Merge, Capella))]
|
||||
pub previous_epoch_participation: VariableList<ParticipationFlags, T::ValidatorRegistryLimit>,
|
||||
#[superstruct(only(Altair, Merge, Shanghai))]
|
||||
#[superstruct(only(Altair, Merge, Capella))]
|
||||
pub current_epoch_participation: VariableList<ParticipationFlags, T::ValidatorRegistryLimit>,
|
||||
|
||||
// Finality
|
||||
@@ -267,17 +267,17 @@ where
|
||||
|
||||
// Inactivity
|
||||
#[serde(with = "ssz_types::serde_utils::quoted_u64_var_list")]
|
||||
#[superstruct(only(Altair, Merge, Shanghai))]
|
||||
#[superstruct(only(Altair, Merge, Capella))]
|
||||
pub inactivity_scores: VariableList<u64, T::ValidatorRegistryLimit>,
|
||||
|
||||
// Light-client sync committees
|
||||
#[superstruct(only(Altair, Merge, Shanghai))]
|
||||
#[superstruct(only(Altair, Merge, Capella))]
|
||||
pub current_sync_committee: Arc<SyncCommittee<T>>,
|
||||
#[superstruct(only(Altair, Merge, Shanghai))]
|
||||
#[superstruct(only(Altair, Merge, Capella))]
|
||||
pub next_sync_committee: Arc<SyncCommittee<T>>,
|
||||
|
||||
// Execution
|
||||
#[superstruct(only(Merge, Shanghai))]
|
||||
#[superstruct(only(Merge, Capella))]
|
||||
pub latest_execution_payload_header: ExecutionPayloadHeader<T>,
|
||||
|
||||
// Caching (not in the spec)
|
||||
@@ -389,7 +389,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
BeaconState::Base { .. } => ForkName::Base,
|
||||
BeaconState::Altair { .. } => ForkName::Altair,
|
||||
BeaconState::Merge { .. } => ForkName::Merge,
|
||||
BeaconState::Shanghai { .. } => ForkName::Shanghai,
|
||||
BeaconState::Capella { .. } => ForkName::Capella,
|
||||
};
|
||||
|
||||
if fork_at_slot == object_fork {
|
||||
@@ -1103,7 +1103,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
BeaconState::Base(state) => (&mut state.validators, &mut state.balances),
|
||||
BeaconState::Altair(state) => (&mut state.validators, &mut state.balances),
|
||||
BeaconState::Merge(state) => (&mut state.validators, &mut state.balances),
|
||||
BeaconState::Shanghai(state) => (&mut state.validators, &mut state.balances),
|
||||
BeaconState::Capella(state) => (&mut state.validators, &mut state.balances),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1300,14 +1300,14 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
BeaconState::Base(_) => Err(BeaconStateError::IncorrectStateVariant),
|
||||
BeaconState::Altair(state) => Ok(&mut state.current_epoch_participation),
|
||||
BeaconState::Merge(state) => Ok(&mut state.current_epoch_participation),
|
||||
BeaconState::Shanghai(state) => Ok(&mut state.current_epoch_participation),
|
||||
BeaconState::Capella(state) => Ok(&mut state.current_epoch_participation),
|
||||
}
|
||||
} else if epoch == self.previous_epoch() {
|
||||
match self {
|
||||
BeaconState::Base(_) => Err(BeaconStateError::IncorrectStateVariant),
|
||||
BeaconState::Altair(state) => Ok(&mut state.previous_epoch_participation),
|
||||
BeaconState::Merge(state) => Ok(&mut state.previous_epoch_participation),
|
||||
BeaconState::Shanghai(state) => Ok(&mut state.previous_epoch_participation),
|
||||
BeaconState::Capella(state) => Ok(&mut state.previous_epoch_participation),
|
||||
}
|
||||
} else {
|
||||
Err(BeaconStateError::EpochOutOfBounds)
|
||||
@@ -1612,7 +1612,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
BeaconState::Base(inner) => BeaconState::Base(inner.clone()),
|
||||
BeaconState::Altair(inner) => BeaconState::Altair(inner.clone()),
|
||||
BeaconState::Merge(inner) => BeaconState::Merge(inner.clone()),
|
||||
BeaconState::Shanghai(inner) => BeaconState::Shanghai(inner.clone()),
|
||||
BeaconState::Capella(inner) => BeaconState::Capella(inner.clone()),
|
||||
};
|
||||
if config.committee_caches {
|
||||
*res.committee_caches_mut() = self.committee_caches().clone();
|
||||
|
||||
@@ -8,13 +8,13 @@ use tree_hash_derive::TreeHash;
|
||||
|
||||
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, PartialEq, Default)]
|
||||
pub struct BlobWrapper<E: EthSpec> {
|
||||
pub struct BlobsSidecar<E: EthSpec> {
|
||||
pub beacon_block_root: Hash256,
|
||||
pub beacon_block_slot: Slot,
|
||||
pub blobs: VariableList<Blob<E::ChunksPerBlob>, E::MaxObjectListSize>,
|
||||
pub blobs: VariableList<Blob<E::FieldElementsPerBlob>, E::MaxBlobsPerBlock>,
|
||||
}
|
||||
|
||||
impl<E: EthSpec> BlobWrapper<E> {
|
||||
impl<E: EthSpec> BlobsSidecar<E> {
|
||||
pub fn empty() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
@@ -22,6 +22,6 @@ impl<E: EthSpec> BlobWrapper<E> {
|
||||
// Fixed part
|
||||
Self::empty().as_ssz_bytes().len()
|
||||
// Max size of variable length `blobs` field
|
||||
+ (E::max_object_list_size() * <Blob<E::ChunksPerBlob> as Encode>::ssz_fixed_len())
|
||||
+ (E::max_object_list_size() * <Blob<E::FieldElementsPerBlob> as Encode>::ssz_fixed_len())
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ pub enum Domain {
|
||||
ContributionAndProof,
|
||||
SyncCommitteeSelectionProof,
|
||||
ApplicationMask(ApplicationDomain),
|
||||
//FIXME(sean) add this domain
|
||||
//BlobsSideCar,
|
||||
}
|
||||
|
||||
/// Lighthouse's internal configuration struct.
|
||||
@@ -151,10 +153,10 @@ pub struct ChainSpec {
|
||||
pub safe_slots_to_import_optimistically: u64,
|
||||
|
||||
/*
|
||||
* Shanghai hard fork params
|
||||
* Capella hard fork params
|
||||
*/
|
||||
pub shanghai_fork_version: [u8; 4],
|
||||
pub shanghai_fork_epoch: Option<Epoch>,
|
||||
pub capella_fork_version: [u8; 4],
|
||||
pub capella_fork_epoch: Option<Epoch>,
|
||||
|
||||
/*
|
||||
* Networking
|
||||
@@ -236,8 +238,8 @@ impl ChainSpec {
|
||||
|
||||
/// Returns the name of the fork which is active at `epoch`.
|
||||
pub fn fork_name_at_epoch(&self, epoch: Epoch) -> ForkName {
|
||||
match self.shanghai_fork_epoch {
|
||||
Some(fork_epoch) if epoch >= fork_epoch => ForkName::Shanghai,
|
||||
match self.capella_fork_epoch {
|
||||
Some(fork_epoch) if epoch >= fork_epoch => ForkName::Capella,
|
||||
_ => match self.bellatrix_fork_epoch {
|
||||
Some(fork_epoch) if epoch >= fork_epoch => ForkName::Merge,
|
||||
_ => match self.altair_fork_epoch {
|
||||
@@ -254,7 +256,7 @@ impl ChainSpec {
|
||||
ForkName::Base => self.genesis_fork_version,
|
||||
ForkName::Altair => self.altair_fork_version,
|
||||
ForkName::Merge => self.bellatrix_fork_version,
|
||||
ForkName::Shanghai => self.shanghai_fork_version,
|
||||
ForkName::Capella => self.capella_fork_version,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +266,7 @@ impl ChainSpec {
|
||||
ForkName::Base => Some(Epoch::new(0)),
|
||||
ForkName::Altair => self.altair_fork_epoch,
|
||||
ForkName::Merge => self.bellatrix_fork_epoch,
|
||||
ForkName::Shanghai => self.shanghai_fork_epoch,
|
||||
ForkName::Capella => self.capella_fork_epoch,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +276,7 @@ impl ChainSpec {
|
||||
BeaconState::Base(_) => self.inactivity_penalty_quotient,
|
||||
BeaconState::Altair(_) => self.inactivity_penalty_quotient_altair,
|
||||
BeaconState::Merge(_) => self.inactivity_penalty_quotient_bellatrix,
|
||||
BeaconState::Shanghai(_) => self.inactivity_penalty_quotient_bellatrix,
|
||||
BeaconState::Capella(_) => self.inactivity_penalty_quotient_bellatrix,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +289,7 @@ impl ChainSpec {
|
||||
BeaconState::Base(_) => self.proportional_slashing_multiplier,
|
||||
BeaconState::Altair(_) => self.proportional_slashing_multiplier_altair,
|
||||
BeaconState::Merge(_) => self.proportional_slashing_multiplier_bellatrix,
|
||||
BeaconState::Shanghai(_) => self.proportional_slashing_multiplier_bellatrix,
|
||||
BeaconState::Capella(_) => self.proportional_slashing_multiplier_bellatrix,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +302,7 @@ impl ChainSpec {
|
||||
BeaconState::Base(_) => self.min_slashing_penalty_quotient,
|
||||
BeaconState::Altair(_) => self.min_slashing_penalty_quotient_altair,
|
||||
BeaconState::Merge(_) => self.min_slashing_penalty_quotient_bellatrix,
|
||||
BeaconState::Shanghai(_) => self.min_slashing_penalty_quotient_bellatrix,
|
||||
BeaconState::Capella(_) => self.min_slashing_penalty_quotient_bellatrix,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,12 +585,11 @@ impl ChainSpec {
|
||||
safe_slots_to_import_optimistically: 128u64,
|
||||
|
||||
/*
|
||||
* Shanghai hardfork params
|
||||
* Capella hardfork params
|
||||
*/
|
||||
//FIXME(sean)
|
||||
shanghai_fork_version: [0x03, 0x00, 0x00, 0x00],
|
||||
shanghai_fork_epoch: None,
|
||||
|
||||
capella_fork_version: [0x03, 0x00, 0x00, 0x00],
|
||||
capella_fork_epoch: None,
|
||||
/*
|
||||
* Network specific
|
||||
*/
|
||||
@@ -644,10 +645,10 @@ impl ChainSpec {
|
||||
// `Uint256::MAX` which is `2*256- 1`.
|
||||
.checked_add(Uint256::one())
|
||||
.expect("addition does not overflow"),
|
||||
// Shanghai
|
||||
// Capella
|
||||
//FIXME(sean)
|
||||
shanghai_fork_version: [0x03, 0x00, 0x00, 0x01],
|
||||
shanghai_fork_epoch: None,
|
||||
capella_fork_version: [0x03, 0x00, 0x00, 0x01],
|
||||
capella_fork_epoch: None,
|
||||
// Other
|
||||
network_id: 2, // lighthouse testnet network id
|
||||
deposit_chain_id: 5,
|
||||
@@ -804,8 +805,8 @@ impl ChainSpec {
|
||||
safe_slots_to_import_optimistically: 128u64,
|
||||
|
||||
//FIXME(sean)
|
||||
shanghai_fork_version: [0x03, 0x00, 0x00, 0x64],
|
||||
shanghai_fork_epoch: None,
|
||||
capella_fork_version: [0x03, 0x00, 0x00, 0x64],
|
||||
capella_fork_epoch: None,
|
||||
|
||||
/*
|
||||
* Network specific
|
||||
@@ -883,14 +884,14 @@ pub struct Config {
|
||||
pub bellatrix_fork_epoch: Option<MaybeQuoted<Epoch>>,
|
||||
|
||||
// FIXME(sean): remove this default
|
||||
#[serde(default = "default_shanghai_fork_version")]
|
||||
#[serde(default = "default_capella_fork_version")]
|
||||
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
|
||||
shanghai_fork_version: [u8; 4],
|
||||
capella_fork_version: [u8; 4],
|
||||
// FIXME(sean): remove this default
|
||||
#[serde(default = "default_shanghai_fork_epoch")]
|
||||
#[serde(default = "default_capella_fork_epoch")]
|
||||
#[serde(serialize_with = "serialize_fork_epoch")]
|
||||
#[serde(deserialize_with = "deserialize_fork_epoch")]
|
||||
pub shanghai_fork_epoch: Option<MaybeQuoted<Epoch>>,
|
||||
pub capella_fork_epoch: Option<MaybeQuoted<Epoch>>,
|
||||
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
seconds_per_slot: u64,
|
||||
@@ -929,7 +930,7 @@ fn default_bellatrix_fork_version() -> [u8; 4] {
|
||||
[0xff, 0xff, 0xff, 0xff]
|
||||
}
|
||||
|
||||
fn default_shanghai_fork_version() -> [u8; 4] {
|
||||
fn default_capella_fork_version() -> [u8; 4] {
|
||||
// This value shouldn't be used.
|
||||
[0xff, 0xff, 0xff, 0xff]
|
||||
}
|
||||
@@ -1030,9 +1031,9 @@ impl Config {
|
||||
bellatrix_fork_epoch: spec
|
||||
.bellatrix_fork_epoch
|
||||
.map(|epoch| MaybeQuoted { value: epoch }),
|
||||
shanghai_fork_version: spec.shanghai_fork_version,
|
||||
shanghai_fork_epoch: spec
|
||||
.shanghai_fork_epoch
|
||||
capella_fork_version: spec.capella_fork_version,
|
||||
capella_fork_epoch: spec
|
||||
.capella_fork_epoch
|
||||
.map(|epoch| MaybeQuoted { value: epoch }),
|
||||
|
||||
seconds_per_slot: spec.seconds_per_slot,
|
||||
@@ -1079,8 +1080,8 @@ impl Config {
|
||||
altair_fork_epoch,
|
||||
bellatrix_fork_epoch,
|
||||
bellatrix_fork_version,
|
||||
shanghai_fork_epoch,
|
||||
shanghai_fork_version,
|
||||
capella_fork_epoch,
|
||||
capella_fork_version,
|
||||
seconds_per_slot,
|
||||
seconds_per_eth1_block,
|
||||
min_validator_withdrawability_delay,
|
||||
@@ -1111,8 +1112,8 @@ impl Config {
|
||||
altair_fork_epoch: altair_fork_epoch.map(|q| q.value),
|
||||
bellatrix_fork_epoch: bellatrix_fork_epoch.map(|q| q.value),
|
||||
bellatrix_fork_version,
|
||||
shanghai_fork_epoch: shanghai_fork_epoch.map(|q| q.value),
|
||||
shanghai_fork_version,
|
||||
capella_fork_epoch: capella_fork_epoch.map(|q| q.value),
|
||||
capella_fork_version,
|
||||
seconds_per_slot,
|
||||
seconds_per_eth1_block,
|
||||
min_validator_withdrawability_delay,
|
||||
|
||||
@@ -22,3 +22,16 @@ pub mod altair {
|
||||
pub mod merge {
|
||||
pub const INTERVALS_PER_SLOT: u64 = 3;
|
||||
}
|
||||
pub mod cappella {
|
||||
use crate::Uint256;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref BLS_MODULUS: Uint256 = Uint256::from_dec_str(
|
||||
"52435875175126190479447740508185965837690552500527637822603658699938581184513"
|
||||
)
|
||||
.expect("should initialize BLS_MODULUS");
|
||||
}
|
||||
pub const BLOB_TX_TYPE: u8 = 5;
|
||||
}
|
||||
|
||||
@@ -96,10 +96,10 @@ pub trait EthSpec: 'static + Default + Sync + Send + Clone + Debug + PartialEq +
|
||||
type MinGasLimit: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type MaxExtraDataBytes: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
/*
|
||||
* New in Shanghaisharding
|
||||
* New in Capella
|
||||
*/
|
||||
type MaxObjectListSize: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type ChunksPerBlob: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type MaxBlobsPerBlock: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type FieldElementsPerBlob: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
/*
|
||||
* Derived values (set these CAREFULLY)
|
||||
*/
|
||||
@@ -229,11 +229,11 @@ pub trait EthSpec: 'static + Default + Sync + Send + Clone + Debug + PartialEq +
|
||||
}
|
||||
|
||||
fn max_object_list_size() -> usize {
|
||||
Self::MaxObjectListSize::to_usize()
|
||||
Self::MaxBlobsPerBlock::to_usize()
|
||||
}
|
||||
|
||||
fn chunks_per_blob() -> usize {
|
||||
Self::ChunksPerBlob::to_usize()
|
||||
Self::FieldElementsPerBlob::to_usize()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,8 +275,8 @@ impl EthSpec for MainnetEthSpec {
|
||||
type GasLimitDenominator = U1024;
|
||||
type MinGasLimit = U5000;
|
||||
type MaxExtraDataBytes = U32;
|
||||
type MaxObjectListSize = U16777216; // 2**24
|
||||
type ChunksPerBlob = U4096;
|
||||
type MaxBlobsPerBlock = U16777216; // 2**24
|
||||
type FieldElementsPerBlob = U4096;
|
||||
type SyncSubcommitteeSize = U128; // 512 committee size / 4 sync committee subnet count
|
||||
type MaxPendingAttestations = U4096; // 128 max attestations * 32 slots per epoch
|
||||
type SlotsPerEth1VotingPeriod = U2048; // 64 epochs * 32 slots per epoch
|
||||
@@ -325,8 +325,8 @@ impl EthSpec for MinimalEthSpec {
|
||||
GasLimitDenominator,
|
||||
MinGasLimit,
|
||||
MaxExtraDataBytes,
|
||||
MaxObjectListSize,
|
||||
ChunksPerBlob
|
||||
MaxBlobsPerBlock,
|
||||
FieldElementsPerBlob
|
||||
});
|
||||
|
||||
fn default_spec() -> ChainSpec {
|
||||
@@ -371,8 +371,8 @@ impl EthSpec for GnosisEthSpec {
|
||||
type SyncSubcommitteeSize = U128; // 512 committee size / 4 sync committee subnet count
|
||||
type MaxPendingAttestations = U2048; // 128 max attestations * 16 slots per epoch
|
||||
type SlotsPerEth1VotingPeriod = U1024; // 64 epochs * 16 slots per epoch
|
||||
type MaxObjectListSize = U16777216; // 2**24
|
||||
type ChunksPerBlob = U4096;
|
||||
type MaxBlobsPerBlock = U16777216; // 2**24
|
||||
type FieldElementsPerBlob = U4096;
|
||||
|
||||
fn default_spec() -> ChainSpec {
|
||||
ChainSpec::gnosis()
|
||||
|
||||
@@ -47,10 +47,10 @@ impl ForkContext {
|
||||
));
|
||||
}
|
||||
|
||||
if spec.shanghai_fork_epoch.is_some() {
|
||||
if spec.capella_fork_epoch.is_some() {
|
||||
fork_to_digest.push((
|
||||
ForkName::Shanghai,
|
||||
ChainSpec::compute_fork_digest(spec.shanghai_fork_version, genesis_validators_root),
|
||||
ForkName::Capella,
|
||||
ChainSpec::compute_fork_digest(spec.capella_fork_version, genesis_validators_root),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ pub enum ForkName {
|
||||
Base,
|
||||
Altair,
|
||||
Merge,
|
||||
Shanghai,
|
||||
Capella,
|
||||
}
|
||||
|
||||
impl ForkName {
|
||||
@@ -39,9 +39,9 @@ impl ForkName {
|
||||
spec.bellatrix_fork_epoch = Some(Epoch::new(0));
|
||||
spec
|
||||
}
|
||||
ForkName::Shanghai => {
|
||||
ForkName::Capella => {
|
||||
spec.bellatrix_fork_epoch = Some(Epoch::new(0));
|
||||
spec.shanghai_fork_epoch = Some(Epoch::new(0));
|
||||
spec.capella_fork_epoch = Some(Epoch::new(0));
|
||||
spec
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ impl ForkName {
|
||||
ForkName::Base => None,
|
||||
ForkName::Altair => Some(ForkName::Base),
|
||||
ForkName::Merge => Some(ForkName::Altair),
|
||||
ForkName::Shanghai => Some(ForkName::Merge),
|
||||
ForkName::Capella => Some(ForkName::Merge),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ impl ForkName {
|
||||
match self {
|
||||
ForkName::Base => Some(ForkName::Altair),
|
||||
ForkName::Altair => Some(ForkName::Merge),
|
||||
ForkName::Merge => Some(ForkName::Shanghai),
|
||||
ForkName::Shanghai => None,
|
||||
ForkName::Merge => Some(ForkName::Capella),
|
||||
ForkName::Capella => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ macro_rules! map_fork_name_with {
|
||||
($t::Merge(value), extra_data)
|
||||
}
|
||||
//TODO: don't have a beacon state variant for the new fork yet
|
||||
ForkName::Shanghai => {
|
||||
ForkName::Capella => {
|
||||
let (value, extra_data) = $body;
|
||||
($t::Merge(value), extra_data)
|
||||
}
|
||||
@@ -137,7 +137,7 @@ impl Display for ForkName {
|
||||
ForkName::Base => "phase0".fmt(f),
|
||||
ForkName::Altair => "altair".fmt(f),
|
||||
ForkName::Merge => "bellatrix".fmt(f),
|
||||
ForkName::Shanghai => "shanghai".fmt(f),
|
||||
ForkName::Capella => "capella".fmt(f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,11 +86,13 @@ pub mod sync_subnet_id;
|
||||
mod tree_hash_impls;
|
||||
pub mod validator_registration_data;
|
||||
|
||||
mod blob_wrapper;
|
||||
mod blobs_sidecar;
|
||||
mod kzg_commitment;
|
||||
mod signed_blobs_sidecar;
|
||||
pub mod slot_data;
|
||||
#[cfg(feature = "sqlite")]
|
||||
pub mod sqlite;
|
||||
|
||||
pub use kzg_commitment::KZGCommitment;
|
||||
|
||||
use ethereum_types::{H160, H256};
|
||||
@@ -101,17 +103,17 @@ pub use crate::attestation_data::AttestationData;
|
||||
pub use crate::attestation_duty::AttestationDuty;
|
||||
pub use crate::attester_slashing::AttesterSlashing;
|
||||
pub use crate::beacon_block::{
|
||||
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockShanghai, BeaconBlockMerge, BeaconBlockRef,
|
||||
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockCapella, BeaconBlockMerge, BeaconBlockRef,
|
||||
BeaconBlockRefMut, BlindedBeaconBlock,
|
||||
};
|
||||
pub use crate::beacon_block_body::{
|
||||
BeaconBlockBody, BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyMerge,
|
||||
BeaconBlockBodyRef, BeaconBlockBodyRefMut, BeaconBlockBodyShanghai,
|
||||
BeaconBlockBody, BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyCapella,
|
||||
BeaconBlockBodyMerge, BeaconBlockBodyRef, BeaconBlockBodyRefMut,
|
||||
};
|
||||
pub use crate::beacon_block_header::BeaconBlockHeader;
|
||||
pub use crate::beacon_committee::{BeaconCommittee, OwnedBeaconCommittee};
|
||||
pub use crate::beacon_state::{BeaconTreeHashCache, Error as BeaconStateError, *};
|
||||
pub use crate::blob_wrapper::BlobWrapper;
|
||||
pub use crate::blobs_sidecar::BlobsSidecar;
|
||||
pub use crate::chain_spec::{ChainSpec, Config, Domain};
|
||||
pub use crate::checkpoint::Checkpoint;
|
||||
pub use crate::config_and_preset::{
|
||||
@@ -148,7 +150,7 @@ pub use crate::shuffling_id::AttestationShufflingId;
|
||||
pub use crate::signed_aggregate_and_proof::SignedAggregateAndProof;
|
||||
pub use crate::signed_beacon_block::{
|
||||
SignedBeaconBlock, SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockHash,
|
||||
SignedBeaconBlockMerge, SignedBlindedBeaconBlock,SignedBeaconBlockShanghai
|
||||
SignedBeaconBlockMerge, SignedBlindedBeaconBlock,SignedBeaconBlockCapella
|
||||
};
|
||||
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
|
||||
pub use crate::signed_contribution_and_proof::SignedContributionAndProof;
|
||||
|
||||
@@ -38,7 +38,7 @@ impl From<SignedBeaconBlockHash> for Hash256 {
|
||||
|
||||
/// A `BeaconBlock` and a signature from its proposer.
|
||||
#[superstruct(
|
||||
variants(Base, Altair, Merge, Shanghai),
|
||||
variants(Base, Altair, Merge, Capella),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Debug,
|
||||
@@ -72,8 +72,8 @@ pub struct SignedBeaconBlock<E: EthSpec, Payload: ExecPayload<E> = FullPayload<E
|
||||
pub message: BeaconBlockAltair<E, Payload>,
|
||||
#[superstruct(only(Merge), partial_getter(rename = "message_merge"))]
|
||||
pub message: BeaconBlockMerge<E, Payload>,
|
||||
#[superstruct(only(Shanghai), partial_getter(rename = "message_shanghai"))]
|
||||
pub message: BeaconBlockShanghai<E, Payload>,
|
||||
#[superstruct(only(Capella), partial_getter(rename = "message_capella"))]
|
||||
pub message: BeaconBlockCapella<E, Payload>,
|
||||
pub signature: Signature,
|
||||
}
|
||||
|
||||
@@ -131,8 +131,8 @@ impl<E: EthSpec, Payload: ExecPayload<E>> SignedBeaconBlock<E, Payload> {
|
||||
BeaconBlock::Merge(message) => {
|
||||
SignedBeaconBlock::Merge(SignedBeaconBlockMerge { message, signature })
|
||||
}
|
||||
BeaconBlock::Shanghai(message) => {
|
||||
SignedBeaconBlock::Shanghai(SignedBeaconBlockShanghai { message, signature })
|
||||
BeaconBlock::Capella(message) => {
|
||||
SignedBeaconBlock::Capella(SignedBeaconBlockCapella { message, signature })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
15
consensus/types/src/signed_blobs_sidecar.rs
Normal file
15
consensus/types/src/signed_blobs_sidecar.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use crate::{Blob, BlobsSidecar, EthSpec, Hash256, Slot};
|
||||
use bls::Signature;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use ssz::Encode;
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use ssz_types::VariableList;
|
||||
use tree_hash::TreeHash;
|
||||
use tree_hash_derive::TreeHash;
|
||||
|
||||
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, PartialEq)]
|
||||
pub struct SignedBlobsSidecar<E: EthSpec> {
|
||||
pub message: BlobsSidecar<E>,
|
||||
pub signature: Signature,
|
||||
}
|
||||
Reference in New Issue
Block a user