mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Rename eip4844 to deneb (#4129)
* rename 4844 to deneb * rename 4844 to deneb * move excess data gas field * get EF tests working * fix ef tests lint * fix the blob identifier ef test * fix accessed files ef test script * get beacon chain tests passing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::beacon_block_body::{
|
||||
BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyEip4844, BeaconBlockBodyMerge,
|
||||
BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyDeneb, BeaconBlockBodyMerge,
|
||||
BeaconBlockBodyRef, BeaconBlockBodyRefMut,
|
||||
};
|
||||
use crate::test_utils::TestRandom;
|
||||
@@ -17,7 +17,7 @@ use tree_hash_derive::TreeHash;
|
||||
|
||||
/// A block of the `BeaconChain`.
|
||||
#[superstruct(
|
||||
variants(Base, Altair, Merge, Capella, Eip4844),
|
||||
variants(Base, Altair, Merge, Capella, Deneb),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Debug,
|
||||
@@ -72,8 +72,8 @@ pub struct BeaconBlock<T: EthSpec, Payload: AbstractExecPayload<T> = FullPayload
|
||||
pub body: BeaconBlockBodyMerge<T, Payload>,
|
||||
#[superstruct(only(Capella), partial_getter(rename = "body_capella"))]
|
||||
pub body: BeaconBlockBodyCapella<T, Payload>,
|
||||
#[superstruct(only(Eip4844), partial_getter(rename = "body_eip4844"))]
|
||||
pub body: BeaconBlockBodyEip4844<T, Payload>,
|
||||
#[superstruct(only(Deneb), partial_getter(rename = "body_deneb"))]
|
||||
pub body: BeaconBlockBodyDeneb<T, Payload>,
|
||||
}
|
||||
|
||||
pub type BlindedBeaconBlock<E> = BeaconBlock<E, BlindedPayload<E>>;
|
||||
@@ -126,8 +126,8 @@ impl<T: EthSpec, Payload: AbstractExecPayload<T>> BeaconBlock<T, Payload> {
|
||||
/// Usually it's better to prefer `from_ssz_bytes` which will decode the correct variant based
|
||||
/// on the fork slot.
|
||||
pub fn any_from_ssz_bytes(bytes: &[u8]) -> Result<Self, ssz::DecodeError> {
|
||||
BeaconBlockEip4844::from_ssz_bytes(bytes)
|
||||
.map(BeaconBlock::Eip4844)
|
||||
BeaconBlockDeneb::from_ssz_bytes(bytes)
|
||||
.map(BeaconBlock::Deneb)
|
||||
.or_else(|_| BeaconBlockCapella::from_ssz_bytes(bytes).map(BeaconBlock::Capella))
|
||||
.or_else(|_| BeaconBlockMerge::from_ssz_bytes(bytes).map(BeaconBlock::Merge))
|
||||
.or_else(|_| BeaconBlockAltair::from_ssz_bytes(bytes).map(BeaconBlock::Altair))
|
||||
@@ -206,7 +206,7 @@ impl<'a, T: EthSpec, Payload: AbstractExecPayload<T>> BeaconBlockRef<'a, T, Payl
|
||||
BeaconBlockRef::Altair { .. } => ForkName::Altair,
|
||||
BeaconBlockRef::Merge { .. } => ForkName::Merge,
|
||||
BeaconBlockRef::Capella { .. } => ForkName::Capella,
|
||||
BeaconBlockRef::Eip4844 { .. } => ForkName::Eip4844,
|
||||
BeaconBlockRef::Deneb { .. } => ForkName::Deneb,
|
||||
};
|
||||
|
||||
if fork_at_slot == object_fork {
|
||||
@@ -560,15 +560,15 @@ impl<T: EthSpec, Payload: AbstractExecPayload<T>> EmptyBlock for BeaconBlockCape
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: EthSpec, Payload: AbstractExecPayload<T>> EmptyBlock for BeaconBlockEip4844<T, Payload> {
|
||||
/// Returns an empty Eip4844 block to be used during genesis.
|
||||
impl<T: EthSpec, Payload: AbstractExecPayload<T>> EmptyBlock for BeaconBlockDeneb<T, Payload> {
|
||||
/// Returns an empty Deneb block to be used during genesis.
|
||||
fn empty(spec: &ChainSpec) -> Self {
|
||||
BeaconBlockEip4844 {
|
||||
BeaconBlockDeneb {
|
||||
slot: spec.genesis_slot,
|
||||
proposer_index: 0,
|
||||
parent_root: Hash256::zero(),
|
||||
state_root: Hash256::zero(),
|
||||
body: BeaconBlockBodyEip4844 {
|
||||
body: BeaconBlockBodyDeneb {
|
||||
randao_reveal: Signature::empty(),
|
||||
eth1_data: Eth1Data {
|
||||
deposit_root: Hash256::zero(),
|
||||
@@ -582,7 +582,7 @@ impl<T: EthSpec, Payload: AbstractExecPayload<T>> EmptyBlock for BeaconBlockEip4
|
||||
deposits: VariableList::empty(),
|
||||
voluntary_exits: VariableList::empty(),
|
||||
sync_aggregate: SyncAggregate::empty(),
|
||||
execution_payload: Payload::Eip4844::default(),
|
||||
execution_payload: Payload::Deneb::default(),
|
||||
bls_to_execution_changes: VariableList::empty(),
|
||||
blob_kzg_commitments: VariableList::empty(),
|
||||
},
|
||||
@@ -669,7 +669,7 @@ impl_from!(BeaconBlockBase, <E, FullPayload<E>>, <E, BlindedPayload<E>>, |body:
|
||||
impl_from!(BeaconBlockAltair, <E, FullPayload<E>>, <E, BlindedPayload<E>>, |body: BeaconBlockBodyAltair<_, _>| body.into());
|
||||
impl_from!(BeaconBlockMerge, <E, FullPayload<E>>, <E, BlindedPayload<E>>, |body: BeaconBlockBodyMerge<_, _>| body.into());
|
||||
impl_from!(BeaconBlockCapella, <E, FullPayload<E>>, <E, BlindedPayload<E>>, |body: BeaconBlockBodyCapella<_, _>| body.into());
|
||||
impl_from!(BeaconBlockEip4844, <E, FullPayload<E>>, <E, BlindedPayload<E>>, |body: BeaconBlockBodyEip4844<_, _>| body.into());
|
||||
impl_from!(BeaconBlockDeneb, <E, FullPayload<E>>, <E, BlindedPayload<E>>, |body: BeaconBlockBodyDeneb<_, _>| body.into());
|
||||
|
||||
// We can clone blocks with payloads to blocks without payloads, without cloning the payload.
|
||||
macro_rules! impl_clone_as_blinded {
|
||||
@@ -701,7 +701,7 @@ impl_clone_as_blinded!(BeaconBlockBase, <E, FullPayload<E>>, <E, BlindedPayload<
|
||||
impl_clone_as_blinded!(BeaconBlockAltair, <E, FullPayload<E>>, <E, BlindedPayload<E>>);
|
||||
impl_clone_as_blinded!(BeaconBlockMerge, <E, FullPayload<E>>, <E, BlindedPayload<E>>);
|
||||
impl_clone_as_blinded!(BeaconBlockCapella, <E, FullPayload<E>>, <E, BlindedPayload<E>>);
|
||||
impl_clone_as_blinded!(BeaconBlockEip4844, <E, FullPayload<E>>, <E, BlindedPayload<E>>);
|
||||
impl_clone_as_blinded!(BeaconBlockDeneb, <E, FullPayload<E>>, <E, BlindedPayload<E>>);
|
||||
|
||||
// A reference to a full beacon block can be cloned into a blinded beacon block, without cloning the
|
||||
// execution payload.
|
||||
@@ -820,16 +820,16 @@ mod tests {
|
||||
#[test]
|
||||
fn roundtrip_4844_block() {
|
||||
let rng = &mut XorShiftRng::from_seed([42; 16]);
|
||||
let spec = &ForkName::Eip4844.make_genesis_spec(MainnetEthSpec::default_spec());
|
||||
let spec = &ForkName::Deneb.make_genesis_spec(MainnetEthSpec::default_spec());
|
||||
|
||||
let inner_block = BeaconBlockEip4844 {
|
||||
let inner_block = BeaconBlockDeneb {
|
||||
slot: Slot::random_for_test(rng),
|
||||
proposer_index: u64::random_for_test(rng),
|
||||
parent_root: Hash256::random_for_test(rng),
|
||||
state_root: Hash256::random_for_test(rng),
|
||||
body: BeaconBlockBodyEip4844::random_for_test(rng),
|
||||
body: BeaconBlockBodyDeneb::random_for_test(rng),
|
||||
};
|
||||
let block = BeaconBlock::Eip4844(inner_block.clone());
|
||||
let block = BeaconBlock::Deneb(inner_block.clone());
|
||||
|
||||
test_ssz_tree_hash_pair_with(&block, &inner_block, |bytes| {
|
||||
BeaconBlock::from_ssz_bytes(bytes, spec)
|
||||
@@ -851,12 +851,12 @@ mod tests {
|
||||
let altair_slot = altair_epoch.start_slot(E::slots_per_epoch());
|
||||
let capella_epoch = altair_fork_epoch + 1;
|
||||
let capella_slot = capella_epoch.start_slot(E::slots_per_epoch());
|
||||
let eip4844_epoch = capella_epoch + 1;
|
||||
let eip4844_slot = eip4844_epoch.start_slot(E::slots_per_epoch());
|
||||
let deneb_epoch = capella_epoch + 1;
|
||||
let deneb_slot = deneb_epoch.start_slot(E::slots_per_epoch());
|
||||
|
||||
spec.altair_fork_epoch = Some(altair_epoch);
|
||||
spec.capella_fork_epoch = Some(capella_epoch);
|
||||
spec.eip4844_fork_epoch = Some(eip4844_epoch);
|
||||
spec.deneb_fork_epoch = Some(deneb_epoch);
|
||||
|
||||
// BeaconBlockBase
|
||||
{
|
||||
@@ -924,10 +924,10 @@ mod tests {
|
||||
.expect_err("bad capella block cannot be decoded");
|
||||
}
|
||||
|
||||
// BeaconBlockEip4844
|
||||
// BeaconBlockDeneb
|
||||
{
|
||||
let good_block = BeaconBlock::Eip4844(BeaconBlockEip4844 {
|
||||
slot: eip4844_slot,
|
||||
let good_block = BeaconBlock::Deneb(BeaconBlockDeneb {
|
||||
slot: deneb_slot,
|
||||
..<_>::random_for_test(rng)
|
||||
});
|
||||
// It's invalid to have an Capella block with a epoch lower than the fork epoch.
|
||||
@@ -939,11 +939,11 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
BeaconBlock::from_ssz_bytes(&good_block.as_ssz_bytes(), &spec)
|
||||
.expect("good eip4844 block can be decoded"),
|
||||
.expect("good deneb block can be decoded"),
|
||||
good_block
|
||||
);
|
||||
BeaconBlock::from_ssz_bytes(&bad_block.as_ssz_bytes(), &spec)
|
||||
.expect_err("bad eip4844 block cannot be decoded");
|
||||
.expect_err("bad deneb block cannot be decoded");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ pub type KzgCommitments<T> = VariableList<KzgCommitment, <T as EthSpec>::MaxBlob
|
||||
///
|
||||
/// This *superstruct* abstracts over the hard-fork.
|
||||
#[superstruct(
|
||||
variants(Base, Altair, Merge, Capella, Eip4844),
|
||||
variants(Base, Altair, Merge, Capella, Deneb),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Debug,
|
||||
@@ -53,7 +53,7 @@ pub struct BeaconBlockBody<T: EthSpec, Payload: AbstractExecPayload<T> = FullPay
|
||||
pub attestations: VariableList<Attestation<T>, T::MaxAttestations>,
|
||||
pub deposits: VariableList<Deposit, T::MaxDeposits>,
|
||||
pub voluntary_exits: VariableList<SignedVoluntaryExit, T::MaxVoluntaryExits>,
|
||||
#[superstruct(only(Altair, Merge, Capella, Eip4844))]
|
||||
#[superstruct(only(Altair, Merge, Capella, Deneb))]
|
||||
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
|
||||
@@ -64,13 +64,13 @@ pub struct BeaconBlockBody<T: EthSpec, Payload: AbstractExecPayload<T> = FullPay
|
||||
#[superstruct(only(Capella), partial_getter(rename = "execution_payload_capella"))]
|
||||
#[serde(flatten)]
|
||||
pub execution_payload: Payload::Capella,
|
||||
#[superstruct(only(Eip4844), partial_getter(rename = "execution_payload_eip4844"))]
|
||||
#[superstruct(only(Deneb), partial_getter(rename = "execution_payload_deneb"))]
|
||||
#[serde(flatten)]
|
||||
pub execution_payload: Payload::Eip4844,
|
||||
#[superstruct(only(Capella, Eip4844))]
|
||||
pub execution_payload: Payload::Deneb,
|
||||
#[superstruct(only(Capella, Deneb))]
|
||||
pub bls_to_execution_changes:
|
||||
VariableList<SignedBlsToExecutionChange, T::MaxBlsToExecutionChanges>,
|
||||
#[superstruct(only(Eip4844))]
|
||||
#[superstruct(only(Deneb))]
|
||||
pub blob_kzg_commitments: KzgCommitments<T>,
|
||||
#[superstruct(only(Base, Altair))]
|
||||
#[ssz(skip_serializing, skip_deserializing)]
|
||||
@@ -92,7 +92,7 @@ impl<'a, T: EthSpec, Payload: AbstractExecPayload<T>> BeaconBlockBodyRef<'a, T,
|
||||
Self::Base(_) | Self::Altair(_) => Err(Error::IncorrectStateVariant),
|
||||
Self::Merge(body) => Ok(Payload::Ref::from(&body.execution_payload)),
|
||||
Self::Capella(body) => Ok(Payload::Ref::from(&body.execution_payload)),
|
||||
Self::Eip4844(body) => Ok(Payload::Ref::from(&body.execution_payload)),
|
||||
Self::Deneb(body) => Ok(Payload::Ref::from(&body.execution_payload)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ impl<'a, T: EthSpec> BeaconBlockBodyRef<'a, T> {
|
||||
BeaconBlockBodyRef::Altair { .. } => ForkName::Altair,
|
||||
BeaconBlockBodyRef::Merge { .. } => ForkName::Merge,
|
||||
BeaconBlockBodyRef::Capella { .. } => ForkName::Capella,
|
||||
BeaconBlockBodyRef::Eip4844 { .. } => ForkName::Eip4844,
|
||||
BeaconBlockBodyRef::Deneb { .. } => ForkName::Deneb,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -330,14 +330,14 @@ impl<E: EthSpec> From<BeaconBlockBodyCapella<E, FullPayload<E>>>
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> From<BeaconBlockBodyEip4844<E, FullPayload<E>>>
|
||||
impl<E: EthSpec> From<BeaconBlockBodyDeneb<E, FullPayload<E>>>
|
||||
for (
|
||||
BeaconBlockBodyEip4844<E, BlindedPayload<E>>,
|
||||
Option<ExecutionPayloadEip4844<E>>,
|
||||
BeaconBlockBodyDeneb<E, BlindedPayload<E>>,
|
||||
Option<ExecutionPayloadDeneb<E>>,
|
||||
)
|
||||
{
|
||||
fn from(body: BeaconBlockBodyEip4844<E, FullPayload<E>>) -> Self {
|
||||
let BeaconBlockBodyEip4844 {
|
||||
fn from(body: BeaconBlockBodyDeneb<E, FullPayload<E>>) -> Self {
|
||||
let BeaconBlockBodyDeneb {
|
||||
randao_reveal,
|
||||
eth1_data,
|
||||
graffiti,
|
||||
@@ -347,13 +347,13 @@ impl<E: EthSpec> From<BeaconBlockBodyEip4844<E, FullPayload<E>>>
|
||||
deposits,
|
||||
voluntary_exits,
|
||||
sync_aggregate,
|
||||
execution_payload: FullPayloadEip4844 { execution_payload },
|
||||
execution_payload: FullPayloadDeneb { execution_payload },
|
||||
bls_to_execution_changes,
|
||||
blob_kzg_commitments,
|
||||
} = body;
|
||||
|
||||
(
|
||||
BeaconBlockBodyEip4844 {
|
||||
BeaconBlockBodyDeneb {
|
||||
randao_reveal,
|
||||
eth1_data,
|
||||
graffiti,
|
||||
@@ -363,7 +363,7 @@ impl<E: EthSpec> From<BeaconBlockBodyEip4844<E, FullPayload<E>>>
|
||||
deposits,
|
||||
voluntary_exits,
|
||||
sync_aggregate,
|
||||
execution_payload: BlindedPayloadEip4844 {
|
||||
execution_payload: BlindedPayloadDeneb {
|
||||
execution_payload_header: From::from(&execution_payload),
|
||||
},
|
||||
bls_to_execution_changes,
|
||||
@@ -455,9 +455,9 @@ impl<E: EthSpec> BeaconBlockBodyCapella<E, FullPayload<E>> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> BeaconBlockBodyEip4844<E, FullPayload<E>> {
|
||||
pub fn clone_as_blinded(&self) -> BeaconBlockBodyEip4844<E, BlindedPayload<E>> {
|
||||
let BeaconBlockBodyEip4844 {
|
||||
impl<E: EthSpec> BeaconBlockBodyDeneb<E, FullPayload<E>> {
|
||||
pub fn clone_as_blinded(&self) -> BeaconBlockBodyDeneb<E, BlindedPayload<E>> {
|
||||
let BeaconBlockBodyDeneb {
|
||||
randao_reveal,
|
||||
eth1_data,
|
||||
graffiti,
|
||||
@@ -467,12 +467,12 @@ impl<E: EthSpec> BeaconBlockBodyEip4844<E, FullPayload<E>> {
|
||||
deposits,
|
||||
voluntary_exits,
|
||||
sync_aggregate,
|
||||
execution_payload: FullPayloadEip4844 { execution_payload },
|
||||
execution_payload: FullPayloadDeneb { execution_payload },
|
||||
bls_to_execution_changes,
|
||||
blob_kzg_commitments,
|
||||
} = self;
|
||||
|
||||
BeaconBlockBodyEip4844 {
|
||||
BeaconBlockBodyDeneb {
|
||||
randao_reveal: randao_reveal.clone(),
|
||||
eth1_data: eth1_data.clone(),
|
||||
graffiti: *graffiti,
|
||||
@@ -482,7 +482,7 @@ impl<E: EthSpec> BeaconBlockBodyEip4844<E, FullPayload<E>> {
|
||||
deposits: deposits.clone(),
|
||||
voluntary_exits: voluntary_exits.clone(),
|
||||
sync_aggregate: sync_aggregate.clone(),
|
||||
execution_payload: BlindedPayloadEip4844 {
|
||||
execution_payload: BlindedPayloadDeneb {
|
||||
execution_payload_header: execution_payload.into(),
|
||||
},
|
||||
bls_to_execution_changes: bls_to_execution_changes.clone(),
|
||||
|
||||
@@ -176,7 +176,7 @@ impl From<BeaconStateHash> for Hash256 {
|
||||
|
||||
/// The state of the `BeaconChain` at some slot.
|
||||
#[superstruct(
|
||||
variants(Base, Altair, Merge, Capella, Eip4844),
|
||||
variants(Base, Altair, Merge, Capella, Deneb),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Derivative,
|
||||
@@ -256,9 +256,9 @@ where
|
||||
pub current_epoch_attestations: VariableList<PendingAttestation<T>, T::MaxPendingAttestations>,
|
||||
|
||||
// Participation (Altair and later)
|
||||
#[superstruct(only(Altair, Merge, Capella, Eip4844))]
|
||||
#[superstruct(only(Altair, Merge, Capella, Deneb))]
|
||||
pub previous_epoch_participation: VariableList<ParticipationFlags, T::ValidatorRegistryLimit>,
|
||||
#[superstruct(only(Altair, Merge, Capella, Eip4844))]
|
||||
#[superstruct(only(Altair, Merge, Capella, Deneb))]
|
||||
pub current_epoch_participation: VariableList<ParticipationFlags, T::ValidatorRegistryLimit>,
|
||||
|
||||
// Finality
|
||||
@@ -273,13 +273,13 @@ where
|
||||
|
||||
// Inactivity
|
||||
#[serde(with = "ssz_types::serde_utils::quoted_u64_var_list")]
|
||||
#[superstruct(only(Altair, Merge, Capella, Eip4844))]
|
||||
#[superstruct(only(Altair, Merge, Capella, Deneb))]
|
||||
pub inactivity_scores: VariableList<u64, T::ValidatorRegistryLimit>,
|
||||
|
||||
// Light-client sync committees
|
||||
#[superstruct(only(Altair, Merge, Capella, Eip4844))]
|
||||
#[superstruct(only(Altair, Merge, Capella, Deneb))]
|
||||
pub current_sync_committee: Arc<SyncCommittee<T>>,
|
||||
#[superstruct(only(Altair, Merge, Capella, Eip4844))]
|
||||
#[superstruct(only(Altair, Merge, Capella, Deneb))]
|
||||
pub next_sync_committee: Arc<SyncCommittee<T>>,
|
||||
|
||||
// Execution
|
||||
@@ -294,20 +294,20 @@ where
|
||||
)]
|
||||
pub latest_execution_payload_header: ExecutionPayloadHeaderCapella<T>,
|
||||
#[superstruct(
|
||||
only(Eip4844),
|
||||
partial_getter(rename = "latest_execution_payload_header_eip4844")
|
||||
only(Deneb),
|
||||
partial_getter(rename = "latest_execution_payload_header_deneb")
|
||||
)]
|
||||
pub latest_execution_payload_header: ExecutionPayloadHeaderEip4844<T>,
|
||||
pub latest_execution_payload_header: ExecutionPayloadHeaderDeneb<T>,
|
||||
|
||||
// Capella
|
||||
#[superstruct(only(Capella, Eip4844), partial_getter(copy))]
|
||||
#[superstruct(only(Capella, Deneb), partial_getter(copy))]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
pub next_withdrawal_index: u64,
|
||||
#[superstruct(only(Capella, Eip4844), partial_getter(copy))]
|
||||
#[superstruct(only(Capella, Deneb), partial_getter(copy))]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
pub next_withdrawal_validator_index: u64,
|
||||
// Deep history valid from Capella onwards.
|
||||
#[superstruct(only(Capella, Eip4844))]
|
||||
#[superstruct(only(Capella, Deneb))]
|
||||
pub historical_summaries: VariableList<HistoricalSummary, T::HistoricalRootsLimit>,
|
||||
|
||||
// Caching (not in the spec)
|
||||
@@ -420,7 +420,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
BeaconState::Altair { .. } => ForkName::Altair,
|
||||
BeaconState::Merge { .. } => ForkName::Merge,
|
||||
BeaconState::Capella { .. } => ForkName::Capella,
|
||||
BeaconState::Eip4844 { .. } => ForkName::Eip4844,
|
||||
BeaconState::Deneb { .. } => ForkName::Deneb,
|
||||
};
|
||||
|
||||
if fork_at_slot == object_fork {
|
||||
@@ -720,7 +720,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
BeaconState::Capella(state) => Ok(ExecutionPayloadHeaderRef::Capella(
|
||||
&state.latest_execution_payload_header,
|
||||
)),
|
||||
BeaconState::Eip4844(state) => Ok(ExecutionPayloadHeaderRef::Eip4844(
|
||||
BeaconState::Deneb(state) => Ok(ExecutionPayloadHeaderRef::Deneb(
|
||||
&state.latest_execution_payload_header,
|
||||
)),
|
||||
}
|
||||
@@ -737,7 +737,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
BeaconState::Capella(state) => Ok(ExecutionPayloadHeaderRefMut::Capella(
|
||||
&mut state.latest_execution_payload_header,
|
||||
)),
|
||||
BeaconState::Eip4844(state) => Ok(ExecutionPayloadHeaderRefMut::Eip4844(
|
||||
BeaconState::Deneb(state) => Ok(ExecutionPayloadHeaderRefMut::Deneb(
|
||||
&mut state.latest_execution_payload_header,
|
||||
)),
|
||||
}
|
||||
@@ -1168,7 +1168,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
BeaconState::Altair(state) => (&mut state.validators, &mut state.balances),
|
||||
BeaconState::Merge(state) => (&mut state.validators, &mut state.balances),
|
||||
BeaconState::Capella(state) => (&mut state.validators, &mut state.balances),
|
||||
BeaconState::Eip4844(state) => (&mut state.validators, &mut state.balances),
|
||||
BeaconState::Deneb(state) => (&mut state.validators, &mut state.balances),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1366,7 +1366,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
BeaconState::Altair(state) => Ok(&mut state.current_epoch_participation),
|
||||
BeaconState::Merge(state) => Ok(&mut state.current_epoch_participation),
|
||||
BeaconState::Capella(state) => Ok(&mut state.current_epoch_participation),
|
||||
BeaconState::Eip4844(state) => Ok(&mut state.current_epoch_participation),
|
||||
BeaconState::Deneb(state) => Ok(&mut state.current_epoch_participation),
|
||||
}
|
||||
} else if epoch == self.previous_epoch() {
|
||||
match self {
|
||||
@@ -1374,7 +1374,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
BeaconState::Altair(state) => Ok(&mut state.previous_epoch_participation),
|
||||
BeaconState::Merge(state) => Ok(&mut state.previous_epoch_participation),
|
||||
BeaconState::Capella(state) => Ok(&mut state.previous_epoch_participation),
|
||||
BeaconState::Eip4844(state) => Ok(&mut state.previous_epoch_participation),
|
||||
BeaconState::Deneb(state) => Ok(&mut state.previous_epoch_participation),
|
||||
}
|
||||
} else {
|
||||
Err(BeaconStateError::EpochOutOfBounds)
|
||||
@@ -1680,7 +1680,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
BeaconState::Altair(inner) => BeaconState::Altair(inner.clone()),
|
||||
BeaconState::Merge(inner) => BeaconState::Merge(inner.clone()),
|
||||
BeaconState::Capella(inner) => BeaconState::Capella(inner.clone()),
|
||||
BeaconState::Eip4844(inner) => BeaconState::Eip4844(inner.clone()),
|
||||
BeaconState::Deneb(inner) => BeaconState::Deneb(inner.clone()),
|
||||
};
|
||||
if config.committee_caches {
|
||||
*res.committee_caches_mut() = self.committee_caches().clone();
|
||||
@@ -1849,7 +1849,7 @@ impl<T: EthSpec> CompareFields for BeaconState<T> {
|
||||
(BeaconState::Altair(x), BeaconState::Altair(y)) => x.compare_fields(y),
|
||||
(BeaconState::Merge(x), BeaconState::Merge(y)) => x.compare_fields(y),
|
||||
(BeaconState::Capella(x), BeaconState::Capella(y)) => x.compare_fields(y),
|
||||
(BeaconState::Eip4844(x), BeaconState::Eip4844(y)) => x.compare_fields(y),
|
||||
(BeaconState::Deneb(x), BeaconState::Deneb(y)) => x.compare_fields(y),
|
||||
_ => panic!("compare_fields: mismatched state variants",),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ use test_random_derive::TestRandom;
|
||||
use tree_hash_derive::TreeHash;
|
||||
|
||||
/// Container of the data that identifies an individual blob.
|
||||
#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
#[derive(Serialize, Deserialize, Encode, Decode, TreeHash, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct BlobIdentifier {
|
||||
pub block_root: Hash256,
|
||||
pub index: u64,
|
||||
|
||||
@@ -162,10 +162,10 @@ pub struct ChainSpec {
|
||||
pub max_validators_per_withdrawals_sweep: u64,
|
||||
|
||||
/*
|
||||
* Eip4844 hard fork params
|
||||
* Deneb hard fork params
|
||||
*/
|
||||
pub eip4844_fork_version: [u8; 4],
|
||||
pub eip4844_fork_epoch: Option<Epoch>,
|
||||
pub deneb_fork_version: [u8; 4],
|
||||
pub deneb_fork_epoch: Option<Epoch>,
|
||||
|
||||
/*
|
||||
* Networking
|
||||
@@ -255,8 +255,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.eip4844_fork_epoch {
|
||||
Some(fork_epoch) if epoch >= fork_epoch => ForkName::Eip4844,
|
||||
match self.deneb_fork_epoch {
|
||||
Some(fork_epoch) if epoch >= fork_epoch => ForkName::Deneb,
|
||||
_ => match self.capella_fork_epoch {
|
||||
Some(fork_epoch) if epoch >= fork_epoch => ForkName::Capella,
|
||||
_ => match self.bellatrix_fork_epoch {
|
||||
@@ -277,7 +277,7 @@ impl ChainSpec {
|
||||
ForkName::Altair => self.altair_fork_version,
|
||||
ForkName::Merge => self.bellatrix_fork_version,
|
||||
ForkName::Capella => self.capella_fork_version,
|
||||
ForkName::Eip4844 => self.eip4844_fork_version,
|
||||
ForkName::Deneb => self.deneb_fork_version,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ impl ChainSpec {
|
||||
ForkName::Altair => self.altair_fork_epoch,
|
||||
ForkName::Merge => self.bellatrix_fork_epoch,
|
||||
ForkName::Capella => self.capella_fork_epoch,
|
||||
ForkName::Eip4844 => self.eip4844_fork_epoch,
|
||||
ForkName::Deneb => self.deneb_fork_epoch,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ impl ChainSpec {
|
||||
BeaconState::Altair(_) => self.inactivity_penalty_quotient_altair,
|
||||
BeaconState::Merge(_) => self.inactivity_penalty_quotient_bellatrix,
|
||||
BeaconState::Capella(_) => self.inactivity_penalty_quotient_bellatrix,
|
||||
BeaconState::Eip4844(_) => self.inactivity_penalty_quotient_bellatrix,
|
||||
BeaconState::Deneb(_) => self.inactivity_penalty_quotient_bellatrix,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ impl ChainSpec {
|
||||
BeaconState::Altair(_) => self.proportional_slashing_multiplier_altair,
|
||||
BeaconState::Merge(_) => self.proportional_slashing_multiplier_bellatrix,
|
||||
BeaconState::Capella(_) => self.proportional_slashing_multiplier_bellatrix,
|
||||
BeaconState::Eip4844(_) => self.proportional_slashing_multiplier_bellatrix,
|
||||
BeaconState::Deneb(_) => self.proportional_slashing_multiplier_bellatrix,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ impl ChainSpec {
|
||||
BeaconState::Altair(_) => self.min_slashing_penalty_quotient_altair,
|
||||
BeaconState::Merge(_) => self.min_slashing_penalty_quotient_bellatrix,
|
||||
BeaconState::Capella(_) => self.min_slashing_penalty_quotient_bellatrix,
|
||||
BeaconState::Eip4844(_) => self.min_slashing_penalty_quotient_bellatrix,
|
||||
BeaconState::Deneb(_) => self.min_slashing_penalty_quotient_bellatrix,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -637,10 +637,10 @@ impl ChainSpec {
|
||||
max_validators_per_withdrawals_sweep: 16384,
|
||||
|
||||
/*
|
||||
* Eip4844 hard fork params
|
||||
* Deneb hard fork params
|
||||
*/
|
||||
eip4844_fork_version: [0x04, 0x00, 0x00, 0x00],
|
||||
eip4844_fork_epoch: None,
|
||||
deneb_fork_version: [0x04, 0x00, 0x00, 0x00],
|
||||
deneb_fork_epoch: None,
|
||||
|
||||
/*
|
||||
* Network specific
|
||||
@@ -709,9 +709,9 @@ impl ChainSpec {
|
||||
capella_fork_version: [0x03, 0x00, 0x00, 0x01],
|
||||
capella_fork_epoch: None,
|
||||
max_validators_per_withdrawals_sweep: 16,
|
||||
// Eip4844
|
||||
eip4844_fork_version: [0x04, 0x00, 0x00, 0x01],
|
||||
eip4844_fork_epoch: None,
|
||||
// Deneb
|
||||
deneb_fork_version: [0x04, 0x00, 0x00, 0x01],
|
||||
deneb_fork_epoch: None,
|
||||
// Other
|
||||
network_id: 2, // lighthouse testnet network id
|
||||
deposit_chain_id: 5,
|
||||
@@ -874,10 +874,10 @@ impl ChainSpec {
|
||||
max_validators_per_withdrawals_sweep: 16384,
|
||||
|
||||
/*
|
||||
* Eip4844 hard fork params
|
||||
* Deneb hard fork params
|
||||
*/
|
||||
eip4844_fork_version: [0x04, 0x00, 0x00, 0x64],
|
||||
eip4844_fork_epoch: None,
|
||||
deneb_fork_version: [0x04, 0x00, 0x00, 0x64],
|
||||
deneb_fork_epoch: None,
|
||||
|
||||
/*
|
||||
* Network specific
|
||||
@@ -970,13 +970,13 @@ pub struct Config {
|
||||
#[serde(deserialize_with = "deserialize_fork_epoch")]
|
||||
pub capella_fork_epoch: Option<MaybeQuoted<Epoch>>,
|
||||
|
||||
#[serde(default = "default_eip4844_fork_version")]
|
||||
#[serde(default = "default_deneb_fork_version")]
|
||||
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
|
||||
eip4844_fork_version: [u8; 4],
|
||||
deneb_fork_version: [u8; 4],
|
||||
#[serde(default)]
|
||||
#[serde(serialize_with = "serialize_fork_epoch")]
|
||||
#[serde(deserialize_with = "deserialize_fork_epoch")]
|
||||
pub eip4844_fork_epoch: Option<MaybeQuoted<Epoch>>,
|
||||
pub deneb_fork_epoch: Option<MaybeQuoted<Epoch>>,
|
||||
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
seconds_per_slot: u64,
|
||||
@@ -1020,7 +1020,7 @@ fn default_capella_fork_version() -> [u8; 4] {
|
||||
[0xff, 0xff, 0xff, 0xff]
|
||||
}
|
||||
|
||||
fn default_eip4844_fork_version() -> [u8; 4] {
|
||||
fn default_deneb_fork_version() -> [u8; 4] {
|
||||
// This value shouldn't be used.
|
||||
[0xff, 0xff, 0xff, 0xff]
|
||||
}
|
||||
@@ -1125,9 +1125,9 @@ impl Config {
|
||||
capella_fork_epoch: spec
|
||||
.capella_fork_epoch
|
||||
.map(|epoch| MaybeQuoted { value: epoch }),
|
||||
eip4844_fork_version: spec.eip4844_fork_version,
|
||||
eip4844_fork_epoch: spec
|
||||
.eip4844_fork_epoch
|
||||
deneb_fork_version: spec.deneb_fork_version,
|
||||
deneb_fork_epoch: spec
|
||||
.deneb_fork_epoch
|
||||
.map(|epoch| MaybeQuoted { value: epoch }),
|
||||
|
||||
seconds_per_slot: spec.seconds_per_slot,
|
||||
@@ -1176,8 +1176,8 @@ impl Config {
|
||||
bellatrix_fork_version,
|
||||
capella_fork_epoch,
|
||||
capella_fork_version,
|
||||
eip4844_fork_epoch,
|
||||
eip4844_fork_version,
|
||||
deneb_fork_epoch,
|
||||
deneb_fork_version,
|
||||
seconds_per_slot,
|
||||
seconds_per_eth1_block,
|
||||
min_validator_withdrawability_delay,
|
||||
@@ -1210,8 +1210,8 @@ impl Config {
|
||||
bellatrix_fork_version,
|
||||
capella_fork_epoch: capella_fork_epoch.map(|q| q.value),
|
||||
capella_fork_version,
|
||||
eip4844_fork_epoch: eip4844_fork_epoch.map(|q| q.value),
|
||||
eip4844_fork_version,
|
||||
deneb_fork_epoch: deneb_fork_epoch.map(|q| q.value),
|
||||
deneb_fork_version,
|
||||
seconds_per_slot,
|
||||
seconds_per_eth1_block,
|
||||
min_validator_withdrawability_delay,
|
||||
|
||||
@@ -22,7 +22,7 @@ pub mod altair {
|
||||
pub mod merge {
|
||||
pub const INTERVALS_PER_SLOT: u64 = 3;
|
||||
}
|
||||
pub mod eip4844 {
|
||||
pub mod deneb {
|
||||
use crate::{Epoch, Uint256};
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
@@ -103,7 +103,7 @@ pub trait EthSpec:
|
||||
type MaxBlsToExecutionChanges: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type MaxWithdrawalsPerPayload: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
/*
|
||||
* New in Eip4844
|
||||
* New in Deneb
|
||||
*/
|
||||
type MaxBlobsPerBlock: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type FieldElementsPerBlob: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
|
||||
@@ -15,7 +15,7 @@ pub type Transactions<T> = VariableList<
|
||||
pub type Withdrawals<T> = VariableList<Withdrawal, <T as EthSpec>::MaxWithdrawalsPerPayload>;
|
||||
|
||||
#[superstruct(
|
||||
variants(Merge, Capella, Eip4844),
|
||||
variants(Merge, Capella, Deneb),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Default,
|
||||
@@ -77,16 +77,16 @@ pub struct ExecutionPayload<T: EthSpec> {
|
||||
#[serde(with = "eth2_serde_utils::quoted_u256")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub base_fee_per_gas: Uint256,
|
||||
#[superstruct(only(Eip4844))]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u256")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub excess_data_gas: Uint256,
|
||||
#[superstruct(getter(copy))]
|
||||
pub block_hash: ExecutionBlockHash,
|
||||
#[serde(with = "ssz_types::serde_utils::list_of_hex_var_list")]
|
||||
pub transactions: Transactions<T>,
|
||||
#[superstruct(only(Capella, Eip4844))]
|
||||
#[superstruct(only(Capella, Deneb))]
|
||||
pub withdrawals: Withdrawals<T>,
|
||||
#[superstruct(only(Deneb))]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u256")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub excess_data_gas: Uint256,
|
||||
}
|
||||
|
||||
impl<'a, T: EthSpec> ExecutionPayloadRef<'a, T> {
|
||||
@@ -107,7 +107,7 @@ impl<T: EthSpec> ExecutionPayload<T> {
|
||||
))),
|
||||
ForkName::Merge => ExecutionPayloadMerge::from_ssz_bytes(bytes).map(Self::Merge),
|
||||
ForkName::Capella => ExecutionPayloadCapella::from_ssz_bytes(bytes).map(Self::Capella),
|
||||
ForkName::Eip4844 => ExecutionPayloadEip4844::from_ssz_bytes(bytes).map(Self::Eip4844),
|
||||
ForkName::Deneb => ExecutionPayloadDeneb::from_ssz_bytes(bytes).map(Self::Deneb),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +137,9 @@ impl<T: EthSpec> ExecutionPayload<T> {
|
||||
|
||||
#[allow(clippy::integer_arithmetic)]
|
||||
/// Returns the maximum size of an execution payload.
|
||||
pub fn max_execution_payload_eip4844_size() -> usize {
|
||||
pub fn max_execution_payload_deneb_size() -> usize {
|
||||
// Fixed part
|
||||
ExecutionPayloadEip4844::<T>::default().as_ssz_bytes().len()
|
||||
ExecutionPayloadDeneb::<T>::default().as_ssz_bytes().len()
|
||||
// Max size of variable length `extra_data` field
|
||||
+ (T::max_extra_data_bytes() * <u8 as Encode>::ssz_fixed_len())
|
||||
// Max size of variable length `transactions` field
|
||||
@@ -161,7 +161,7 @@ impl<T: EthSpec> ForkVersionDeserialize for ExecutionPayload<T> {
|
||||
Ok(match fork_name {
|
||||
ForkName::Merge => Self::Merge(serde_json::from_value(value).map_err(convert_err)?),
|
||||
ForkName::Capella => Self::Capella(serde_json::from_value(value).map_err(convert_err)?),
|
||||
ForkName::Eip4844 => Self::Eip4844(serde_json::from_value(value).map_err(convert_err)?),
|
||||
ForkName::Deneb => Self::Deneb(serde_json::from_value(value).map_err(convert_err)?),
|
||||
ForkName::Base | ForkName::Altair => {
|
||||
return Err(serde::de::Error::custom(format!(
|
||||
"ExecutionPayload failed to deserialize: unsupported fork '{}'",
|
||||
@@ -177,7 +177,7 @@ impl<T: EthSpec> ExecutionPayload<T> {
|
||||
match self {
|
||||
ExecutionPayload::Merge(_) => ForkName::Merge,
|
||||
ExecutionPayload::Capella(_) => ForkName::Capella,
|
||||
ExecutionPayload::Eip4844(_) => ForkName::Eip4844,
|
||||
ExecutionPayload::Deneb(_) => ForkName::Deneb,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use tree_hash_derive::TreeHash;
|
||||
use BeaconStateError;
|
||||
|
||||
#[superstruct(
|
||||
variants(Merge, Capella, Eip4844),
|
||||
variants(Merge, Capella, Deneb),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Default,
|
||||
@@ -70,17 +70,17 @@ pub struct ExecutionPayloadHeader<T: EthSpec> {
|
||||
#[serde(with = "eth2_serde_utils::quoted_u256")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub base_fee_per_gas: Uint256,
|
||||
#[superstruct(only(Eip4844))]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u256")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub excess_data_gas: Uint256,
|
||||
#[superstruct(getter(copy))]
|
||||
pub block_hash: ExecutionBlockHash,
|
||||
#[superstruct(getter(copy))]
|
||||
pub transactions_root: Hash256,
|
||||
#[superstruct(only(Capella, Eip4844))]
|
||||
#[superstruct(only(Capella, Deneb))]
|
||||
#[superstruct(getter(copy))]
|
||||
pub withdrawals_root: Hash256,
|
||||
#[superstruct(only(Deneb))]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u256")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub excess_data_gas: Uint256,
|
||||
}
|
||||
|
||||
impl<T: EthSpec> ExecutionPayloadHeader<T> {
|
||||
@@ -97,9 +97,7 @@ impl<T: EthSpec> ExecutionPayloadHeader<T> {
|
||||
ForkName::Capella => {
|
||||
ExecutionPayloadHeaderCapella::from_ssz_bytes(bytes).map(Self::Capella)
|
||||
}
|
||||
ForkName::Eip4844 => {
|
||||
ExecutionPayloadHeaderEip4844::from_ssz_bytes(bytes).map(Self::Eip4844)
|
||||
}
|
||||
ForkName::Deneb => ExecutionPayloadHeaderDeneb::from_ssz_bytes(bytes).map(Self::Deneb),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,8 +134,8 @@ impl<T: EthSpec> ExecutionPayloadHeaderMerge<T> {
|
||||
}
|
||||
|
||||
impl<T: EthSpec> ExecutionPayloadHeaderCapella<T> {
|
||||
pub fn upgrade_to_eip4844(&self) -> ExecutionPayloadHeaderEip4844<T> {
|
||||
ExecutionPayloadHeaderEip4844 {
|
||||
pub fn upgrade_to_deneb(&self) -> ExecutionPayloadHeaderDeneb<T> {
|
||||
ExecutionPayloadHeaderDeneb {
|
||||
parent_hash: self.parent_hash,
|
||||
fee_recipient: self.fee_recipient,
|
||||
state_root: self.state_root,
|
||||
@@ -150,11 +148,11 @@ impl<T: EthSpec> ExecutionPayloadHeaderCapella<T> {
|
||||
timestamp: self.timestamp,
|
||||
extra_data: self.extra_data.clone(),
|
||||
base_fee_per_gas: self.base_fee_per_gas,
|
||||
// TODO: verify if this is correct
|
||||
excess_data_gas: Uint256::zero(),
|
||||
block_hash: self.block_hash,
|
||||
transactions_root: self.transactions_root,
|
||||
withdrawals_root: self.withdrawals_root,
|
||||
// TODO: verify if this is correct
|
||||
excess_data_gas: Uint256::zero(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,8 +199,8 @@ impl<'a, T: EthSpec> From<&'a ExecutionPayloadCapella<T>> for ExecutionPayloadHe
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: EthSpec> From<&'a ExecutionPayloadEip4844<T>> for ExecutionPayloadHeaderEip4844<T> {
|
||||
fn from(payload: &'a ExecutionPayloadEip4844<T>) -> Self {
|
||||
impl<'a, T: EthSpec> From<&'a ExecutionPayloadDeneb<T>> for ExecutionPayloadHeaderDeneb<T> {
|
||||
fn from(payload: &'a ExecutionPayloadDeneb<T>) -> Self {
|
||||
Self {
|
||||
parent_hash: payload.parent_hash,
|
||||
fee_recipient: payload.fee_recipient,
|
||||
@@ -216,10 +214,10 @@ impl<'a, T: EthSpec> From<&'a ExecutionPayloadEip4844<T>> for ExecutionPayloadHe
|
||||
timestamp: payload.timestamp,
|
||||
extra_data: payload.extra_data.clone(),
|
||||
base_fee_per_gas: payload.base_fee_per_gas,
|
||||
excess_data_gas: payload.excess_data_gas,
|
||||
block_hash: payload.block_hash,
|
||||
transactions_root: payload.transactions.tree_hash_root(),
|
||||
withdrawals_root: payload.withdrawals.tree_hash_root(),
|
||||
excess_data_gas: payload.excess_data_gas,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,7 +236,7 @@ impl<'a, T: EthSpec> From<&'a Self> for ExecutionPayloadHeaderCapella<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: EthSpec> From<&'a Self> for ExecutionPayloadHeaderEip4844<T> {
|
||||
impl<'a, T: EthSpec> From<&'a Self> for ExecutionPayloadHeaderDeneb<T> {
|
||||
fn from(payload: &'a Self) -> Self {
|
||||
payload.clone()
|
||||
}
|
||||
@@ -274,13 +272,11 @@ impl<T: EthSpec> TryFrom<ExecutionPayloadHeader<T>> for ExecutionPayloadHeaderCa
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<T: EthSpec> TryFrom<ExecutionPayloadHeader<T>> for ExecutionPayloadHeaderEip4844<T> {
|
||||
impl<T: EthSpec> TryFrom<ExecutionPayloadHeader<T>> for ExecutionPayloadHeaderDeneb<T> {
|
||||
type Error = BeaconStateError;
|
||||
fn try_from(header: ExecutionPayloadHeader<T>) -> Result<Self, Self::Error> {
|
||||
match header {
|
||||
ExecutionPayloadHeader::Eip4844(execution_payload_header) => {
|
||||
Ok(execution_payload_header)
|
||||
}
|
||||
ExecutionPayloadHeader::Deneb(execution_payload_header) => Ok(execution_payload_header),
|
||||
_ => Err(BeaconStateError::IncorrectStateVariant),
|
||||
}
|
||||
}
|
||||
@@ -301,7 +297,7 @@ impl<T: EthSpec> ForkVersionDeserialize for ExecutionPayloadHeader<T> {
|
||||
Ok(match fork_name {
|
||||
ForkName::Merge => Self::Merge(serde_json::from_value(value).map_err(convert_err)?),
|
||||
ForkName::Capella => Self::Capella(serde_json::from_value(value).map_err(convert_err)?),
|
||||
ForkName::Eip4844 => Self::Eip4844(serde_json::from_value(value).map_err(convert_err)?),
|
||||
ForkName::Deneb => Self::Deneb(serde_json::from_value(value).map_err(convert_err)?),
|
||||
ForkName::Base | ForkName::Altair => {
|
||||
return Err(serde::de::Error::custom(format!(
|
||||
"ExecutionPayloadHeader failed to deserialize: unsupported fork '{}'",
|
||||
|
||||
@@ -54,10 +54,10 @@ impl ForkContext {
|
||||
));
|
||||
}
|
||||
|
||||
if spec.eip4844_fork_epoch.is_some() {
|
||||
if spec.deneb_fork_epoch.is_some() {
|
||||
fork_to_digest.push((
|
||||
ForkName::Eip4844,
|
||||
ChainSpec::compute_fork_digest(spec.eip4844_fork_version, genesis_validators_root),
|
||||
ForkName::Deneb,
|
||||
ChainSpec::compute_fork_digest(spec.deneb_fork_version, genesis_validators_root),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ pub enum ForkName {
|
||||
Altair,
|
||||
Merge,
|
||||
Capella,
|
||||
Eip4844,
|
||||
Deneb,
|
||||
}
|
||||
|
||||
impl ForkName {
|
||||
@@ -22,7 +22,7 @@ impl ForkName {
|
||||
ForkName::Altair,
|
||||
ForkName::Merge,
|
||||
ForkName::Capella,
|
||||
ForkName::Eip4844,
|
||||
ForkName::Deneb,
|
||||
]
|
||||
}
|
||||
|
||||
@@ -35,35 +35,35 @@ impl ForkName {
|
||||
spec.altair_fork_epoch = None;
|
||||
spec.bellatrix_fork_epoch = None;
|
||||
spec.capella_fork_epoch = None;
|
||||
spec.eip4844_fork_epoch = None;
|
||||
spec.deneb_fork_epoch = None;
|
||||
spec
|
||||
}
|
||||
ForkName::Altair => {
|
||||
spec.altair_fork_epoch = Some(Epoch::new(0));
|
||||
spec.bellatrix_fork_epoch = None;
|
||||
spec.capella_fork_epoch = None;
|
||||
spec.eip4844_fork_epoch = None;
|
||||
spec.deneb_fork_epoch = None;
|
||||
spec
|
||||
}
|
||||
ForkName::Merge => {
|
||||
spec.altair_fork_epoch = Some(Epoch::new(0));
|
||||
spec.bellatrix_fork_epoch = Some(Epoch::new(0));
|
||||
spec.capella_fork_epoch = None;
|
||||
spec.eip4844_fork_epoch = None;
|
||||
spec.deneb_fork_epoch = None;
|
||||
spec
|
||||
}
|
||||
ForkName::Capella => {
|
||||
spec.altair_fork_epoch = Some(Epoch::new(0));
|
||||
spec.bellatrix_fork_epoch = Some(Epoch::new(0));
|
||||
spec.capella_fork_epoch = Some(Epoch::new(0));
|
||||
spec.eip4844_fork_epoch = None;
|
||||
spec.deneb_fork_epoch = None;
|
||||
spec
|
||||
}
|
||||
ForkName::Eip4844 => {
|
||||
ForkName::Deneb => {
|
||||
spec.altair_fork_epoch = Some(Epoch::new(0));
|
||||
spec.bellatrix_fork_epoch = Some(Epoch::new(0));
|
||||
spec.capella_fork_epoch = Some(Epoch::new(0));
|
||||
spec.eip4844_fork_epoch = Some(Epoch::new(0));
|
||||
spec.deneb_fork_epoch = Some(Epoch::new(0));
|
||||
spec
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ impl ForkName {
|
||||
ForkName::Altair => Some(ForkName::Base),
|
||||
ForkName::Merge => Some(ForkName::Altair),
|
||||
ForkName::Capella => Some(ForkName::Merge),
|
||||
ForkName::Eip4844 => Some(ForkName::Capella),
|
||||
ForkName::Deneb => Some(ForkName::Capella),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,8 +90,8 @@ impl ForkName {
|
||||
ForkName::Base => Some(ForkName::Altair),
|
||||
ForkName::Altair => Some(ForkName::Merge),
|
||||
ForkName::Merge => Some(ForkName::Capella),
|
||||
ForkName::Capella => Some(ForkName::Eip4844),
|
||||
ForkName::Eip4844 => None,
|
||||
ForkName::Capella => Some(ForkName::Deneb),
|
||||
ForkName::Deneb => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,9 +137,9 @@ macro_rules! map_fork_name_with {
|
||||
let (value, extra_data) = $body;
|
||||
($t::Capella(value), extra_data)
|
||||
}
|
||||
ForkName::Eip4844 => {
|
||||
ForkName::Deneb => {
|
||||
let (value, extra_data) = $body;
|
||||
($t::Eip4844(value), extra_data)
|
||||
($t::Deneb(value), extra_data)
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -154,7 +154,7 @@ impl FromStr for ForkName {
|
||||
"altair" => ForkName::Altair,
|
||||
"bellatrix" | "merge" => ForkName::Merge,
|
||||
"capella" => ForkName::Capella,
|
||||
"eip4844" => ForkName::Eip4844,
|
||||
"deneb" => ForkName::Deneb,
|
||||
_ => return Err(format!("unknown fork name: {}", fork_name)),
|
||||
})
|
||||
}
|
||||
@@ -167,7 +167,7 @@ impl Display for ForkName {
|
||||
ForkName::Altair => "altair".fmt(f),
|
||||
ForkName::Merge => "bellatrix".fmt(f),
|
||||
ForkName::Capella => "capella".fmt(f),
|
||||
ForkName::Eip4844 => "eip4844".fmt(f),
|
||||
ForkName::Deneb => "deneb".fmt(f),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn previous_and_next_fork_consistent() {
|
||||
assert_eq!(ForkName::Eip4844.next_fork(), None);
|
||||
assert_eq!(ForkName::Deneb.next_fork(), None);
|
||||
assert_eq!(ForkName::Base.previous_fork(), None);
|
||||
|
||||
for (prev_fork, fork) in ForkName::list_all().into_iter().tuple_windows() {
|
||||
|
||||
@@ -109,12 +109,12 @@ 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, BeaconBlockCapella, BeaconBlockEip4844,
|
||||
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockCapella, BeaconBlockDeneb,
|
||||
BeaconBlockMerge, BeaconBlockRef, BeaconBlockRefMut, BlindedBeaconBlock, EmptyBlock,
|
||||
};
|
||||
pub use crate::beacon_block_body::{
|
||||
BeaconBlockBody, BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyCapella,
|
||||
BeaconBlockBodyEip4844, BeaconBlockBodyMerge, BeaconBlockBodyRef, BeaconBlockBodyRefMut,
|
||||
BeaconBlockBodyDeneb, BeaconBlockBodyMerge, BeaconBlockBodyRef, BeaconBlockBodyRefMut,
|
||||
};
|
||||
pub use crate::beacon_block_header::BeaconBlockHeader;
|
||||
pub use crate::beacon_committee::{BeaconCommittee, OwnedBeaconCommittee};
|
||||
@@ -137,11 +137,11 @@ pub use crate::eth_spec::EthSpecId;
|
||||
pub use crate::execution_block_hash::ExecutionBlockHash;
|
||||
pub use crate::execution_block_header::ExecutionBlockHeader;
|
||||
pub use crate::execution_payload::{
|
||||
ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadEip4844, ExecutionPayloadMerge,
|
||||
ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadMerge,
|
||||
ExecutionPayloadRef, Transaction, Transactions, Withdrawals,
|
||||
};
|
||||
pub use crate::execution_payload_header::{
|
||||
ExecutionPayloadHeader, ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderEip4844,
|
||||
ExecutionPayloadHeader, ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderDeneb,
|
||||
ExecutionPayloadHeaderMerge, ExecutionPayloadHeaderRef, ExecutionPayloadHeaderRefMut,
|
||||
};
|
||||
pub use crate::fork::Fork;
|
||||
@@ -159,9 +159,9 @@ pub use crate::light_client_optimistic_update::LightClientOptimisticUpdate;
|
||||
pub use crate::participation_flags::ParticipationFlags;
|
||||
pub use crate::participation_list::ParticipationList;
|
||||
pub use crate::payload::{
|
||||
AbstractExecPayload, BlindedPayload, BlindedPayloadCapella, BlindedPayloadEip4844,
|
||||
AbstractExecPayload, BlindedPayload, BlindedPayloadCapella, BlindedPayloadDeneb,
|
||||
BlindedPayloadMerge, BlindedPayloadRef, BlockType, ExecPayload, FullPayload,
|
||||
FullPayloadCapella, FullPayloadEip4844, FullPayloadMerge, FullPayloadRef, OwnedExecPayload,
|
||||
FullPayloadCapella, FullPayloadDeneb, FullPayloadMerge, FullPayloadRef, OwnedExecPayload,
|
||||
};
|
||||
pub use crate::pending_attestation::PendingAttestation;
|
||||
pub use crate::preset::{AltairPreset, BasePreset, BellatrixPreset, CapellaPreset};
|
||||
@@ -173,7 +173,7 @@ pub use crate::shuffling_id::AttestationShufflingId;
|
||||
pub use crate::signed_aggregate_and_proof::SignedAggregateAndProof;
|
||||
pub use crate::signed_beacon_block::{
|
||||
SignedBeaconBlock, SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockCapella,
|
||||
SignedBeaconBlockEip4844, SignedBeaconBlockHash, SignedBeaconBlockMerge,
|
||||
SignedBeaconBlockDeneb, SignedBeaconBlockHash, SignedBeaconBlockMerge,
|
||||
SignedBlindedBeaconBlock,
|
||||
};
|
||||
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
|
||||
|
||||
@@ -81,13 +81,13 @@ pub trait AbstractExecPayload<T: EthSpec>:
|
||||
+ TryFrom<ExecutionPayloadHeader<T>>
|
||||
+ TryInto<Self::Merge>
|
||||
+ TryInto<Self::Capella>
|
||||
+ TryInto<Self::Eip4844>
|
||||
+ TryInto<Self::Deneb>
|
||||
{
|
||||
type Ref<'a>: ExecPayload<T>
|
||||
+ Copy
|
||||
+ From<&'a Self::Merge>
|
||||
+ From<&'a Self::Capella>
|
||||
+ From<&'a Self::Eip4844>;
|
||||
+ From<&'a Self::Deneb>;
|
||||
|
||||
type Merge: OwnedExecPayload<T>
|
||||
+ Into<Self>
|
||||
@@ -97,16 +97,16 @@ pub trait AbstractExecPayload<T: EthSpec>:
|
||||
+ Into<Self>
|
||||
+ for<'a> From<Cow<'a, ExecutionPayloadCapella<T>>>
|
||||
+ TryFrom<ExecutionPayloadHeaderCapella<T>>;
|
||||
type Eip4844: OwnedExecPayload<T>
|
||||
type Deneb: OwnedExecPayload<T>
|
||||
+ Into<Self>
|
||||
+ for<'a> From<Cow<'a, ExecutionPayloadEip4844<T>>>
|
||||
+ TryFrom<ExecutionPayloadHeaderEip4844<T>>;
|
||||
+ for<'a> From<Cow<'a, ExecutionPayloadDeneb<T>>>
|
||||
+ TryFrom<ExecutionPayloadHeaderDeneb<T>>;
|
||||
|
||||
fn default_at_fork(fork_name: ForkName) -> Result<Self, Error>;
|
||||
}
|
||||
|
||||
#[superstruct(
|
||||
variants(Merge, Capella, Eip4844),
|
||||
variants(Merge, Capella, Deneb),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Debug,
|
||||
@@ -145,8 +145,8 @@ pub struct FullPayload<T: EthSpec> {
|
||||
pub execution_payload: ExecutionPayloadMerge<T>,
|
||||
#[superstruct(only(Capella), partial_getter(rename = "execution_payload_capella"))]
|
||||
pub execution_payload: ExecutionPayloadCapella<T>,
|
||||
#[superstruct(only(Eip4844), partial_getter(rename = "execution_payload_eip4844"))]
|
||||
pub execution_payload: ExecutionPayloadEip4844<T>,
|
||||
#[superstruct(only(Deneb), partial_getter(rename = "execution_payload_deneb"))]
|
||||
pub execution_payload: ExecutionPayloadDeneb<T>,
|
||||
}
|
||||
|
||||
impl<T: EthSpec> From<FullPayload<T>> for ExecutionPayload<T> {
|
||||
@@ -250,7 +250,7 @@ impl<T: EthSpec> ExecPayload<T> for FullPayload<T> {
|
||||
FullPayload::Capella(ref inner) => {
|
||||
Ok(inner.execution_payload.withdrawals.tree_hash_root())
|
||||
}
|
||||
FullPayload::Eip4844(ref inner) => {
|
||||
FullPayload::Deneb(ref inner) => {
|
||||
Ok(inner.execution_payload.withdrawals.tree_hash_root())
|
||||
}
|
||||
}
|
||||
@@ -359,7 +359,7 @@ impl<'b, T: EthSpec> ExecPayload<T> for FullPayloadRef<'b, T> {
|
||||
FullPayloadRef::Capella(inner) => {
|
||||
Ok(inner.execution_payload.withdrawals.tree_hash_root())
|
||||
}
|
||||
FullPayloadRef::Eip4844(inner) => {
|
||||
FullPayloadRef::Deneb(inner) => {
|
||||
Ok(inner.execution_payload.withdrawals.tree_hash_root())
|
||||
}
|
||||
}
|
||||
@@ -382,14 +382,14 @@ impl<T: EthSpec> AbstractExecPayload<T> for FullPayload<T> {
|
||||
type Ref<'a> = FullPayloadRef<'a, T>;
|
||||
type Merge = FullPayloadMerge<T>;
|
||||
type Capella = FullPayloadCapella<T>;
|
||||
type Eip4844 = FullPayloadEip4844<T>;
|
||||
type Deneb = FullPayloadDeneb<T>;
|
||||
|
||||
fn default_at_fork(fork_name: ForkName) -> Result<Self, Error> {
|
||||
match fork_name {
|
||||
ForkName::Base | ForkName::Altair => Err(Error::IncorrectStateVariant),
|
||||
ForkName::Merge => Ok(FullPayloadMerge::default().into()),
|
||||
ForkName::Capella => Ok(FullPayloadCapella::default().into()),
|
||||
ForkName::Eip4844 => Ok(FullPayloadEip4844::default().into()),
|
||||
ForkName::Deneb => Ok(FullPayloadDeneb::default().into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -410,7 +410,7 @@ impl<T: EthSpec> TryFrom<ExecutionPayloadHeader<T>> for FullPayload<T> {
|
||||
}
|
||||
|
||||
#[superstruct(
|
||||
variants(Merge, Capella, Eip4844),
|
||||
variants(Merge, Capella, Deneb),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Debug,
|
||||
@@ -448,8 +448,8 @@ pub struct BlindedPayload<T: EthSpec> {
|
||||
pub execution_payload_header: ExecutionPayloadHeaderMerge<T>,
|
||||
#[superstruct(only(Capella), partial_getter(rename = "execution_payload_capella"))]
|
||||
pub execution_payload_header: ExecutionPayloadHeaderCapella<T>,
|
||||
#[superstruct(only(Eip4844), partial_getter(rename = "execution_payload_eip4844"))]
|
||||
pub execution_payload_header: ExecutionPayloadHeaderEip4844<T>,
|
||||
#[superstruct(only(Deneb), partial_getter(rename = "execution_payload_deneb"))]
|
||||
pub execution_payload_header: ExecutionPayloadHeaderDeneb<T>,
|
||||
}
|
||||
|
||||
impl<'a, T: EthSpec> From<BlindedPayloadRef<'a, T>> for BlindedPayload<T> {
|
||||
@@ -531,9 +531,7 @@ impl<T: EthSpec> ExecPayload<T> for BlindedPayload<T> {
|
||||
BlindedPayload::Capella(ref inner) => {
|
||||
Ok(inner.execution_payload_header.withdrawals_root)
|
||||
}
|
||||
BlindedPayload::Eip4844(ref inner) => {
|
||||
Ok(inner.execution_payload_header.withdrawals_root)
|
||||
}
|
||||
BlindedPayload::Deneb(ref inner) => Ok(inner.execution_payload_header.withdrawals_root),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,9 +619,7 @@ impl<'b, T: EthSpec> ExecPayload<T> for BlindedPayloadRef<'b, T> {
|
||||
BlindedPayloadRef::Capella(inner) => {
|
||||
Ok(inner.execution_payload_header.withdrawals_root)
|
||||
}
|
||||
BlindedPayloadRef::Eip4844(inner) => {
|
||||
Ok(inner.execution_payload_header.withdrawals_root)
|
||||
}
|
||||
BlindedPayloadRef::Deneb(inner) => Ok(inner.execution_payload_header.withdrawals_root),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -888,25 +884,25 @@ impl_exec_payload_for_fork!(
|
||||
Capella
|
||||
);
|
||||
impl_exec_payload_for_fork!(
|
||||
BlindedPayloadEip4844,
|
||||
FullPayloadEip4844,
|
||||
ExecutionPayloadHeaderEip4844,
|
||||
ExecutionPayloadEip4844,
|
||||
Eip4844
|
||||
BlindedPayloadDeneb,
|
||||
FullPayloadDeneb,
|
||||
ExecutionPayloadHeaderDeneb,
|
||||
ExecutionPayloadDeneb,
|
||||
Deneb
|
||||
);
|
||||
|
||||
impl<T: EthSpec> AbstractExecPayload<T> for BlindedPayload<T> {
|
||||
type Ref<'a> = BlindedPayloadRef<'a, T>;
|
||||
type Merge = BlindedPayloadMerge<T>;
|
||||
type Capella = BlindedPayloadCapella<T>;
|
||||
type Eip4844 = BlindedPayloadEip4844<T>;
|
||||
type Deneb = BlindedPayloadDeneb<T>;
|
||||
|
||||
fn default_at_fork(fork_name: ForkName) -> Result<Self, Error> {
|
||||
match fork_name {
|
||||
ForkName::Base | ForkName::Altair => Err(Error::IncorrectStateVariant),
|
||||
ForkName::Merge => Ok(BlindedPayloadMerge::default().into()),
|
||||
ForkName::Capella => Ok(BlindedPayloadCapella::default().into()),
|
||||
ForkName::Eip4844 => Ok(BlindedPayloadEip4844::default().into()),
|
||||
ForkName::Deneb => Ok(BlindedPayloadDeneb::default().into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -935,8 +931,8 @@ impl<T: EthSpec> From<ExecutionPayloadHeader<T>> for BlindedPayload<T> {
|
||||
execution_payload_header,
|
||||
})
|
||||
}
|
||||
ExecutionPayloadHeader::Eip4844(execution_payload_header) => {
|
||||
Self::Eip4844(BlindedPayloadEip4844 {
|
||||
ExecutionPayloadHeader::Deneb(execution_payload_header) => {
|
||||
Self::Deneb(BlindedPayloadDeneb {
|
||||
execution_payload_header,
|
||||
})
|
||||
}
|
||||
@@ -953,8 +949,8 @@ impl<T: EthSpec> From<BlindedPayload<T>> for ExecutionPayloadHeader<T> {
|
||||
BlindedPayload::Capella(blinded_payload) => {
|
||||
ExecutionPayloadHeader::Capella(blinded_payload.execution_payload_header)
|
||||
}
|
||||
BlindedPayload::Eip4844(blinded_payload) => {
|
||||
ExecutionPayloadHeader::Eip4844(blinded_payload.execution_payload_header)
|
||||
BlindedPayload::Deneb(blinded_payload) => {
|
||||
ExecutionPayloadHeader::Deneb(blinded_payload.execution_payload_header)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ impl From<SignedBeaconBlockHash> for Hash256 {
|
||||
|
||||
/// A `BeaconBlock` and a signature from its proposer.
|
||||
#[superstruct(
|
||||
variants(Base, Altair, Merge, Capella, Eip4844),
|
||||
variants(Base, Altair, Merge, Capella, Deneb),
|
||||
variant_attributes(
|
||||
derive(
|
||||
Debug,
|
||||
@@ -76,8 +76,8 @@ pub struct SignedBeaconBlock<E: EthSpec, Payload: AbstractExecPayload<E> = FullP
|
||||
pub message: BeaconBlockMerge<E, Payload>,
|
||||
#[superstruct(only(Capella), partial_getter(rename = "message_capella"))]
|
||||
pub message: BeaconBlockCapella<E, Payload>,
|
||||
#[superstruct(only(Eip4844), partial_getter(rename = "message_eip4844"))]
|
||||
pub message: BeaconBlockEip4844<E, Payload>,
|
||||
#[superstruct(only(Deneb), partial_getter(rename = "message_deneb"))]
|
||||
pub message: BeaconBlockDeneb<E, Payload>,
|
||||
pub signature: Signature,
|
||||
}
|
||||
|
||||
@@ -138,8 +138,8 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> SignedBeaconBlock<E, Payload>
|
||||
BeaconBlock::Capella(message) => {
|
||||
SignedBeaconBlock::Capella(SignedBeaconBlockCapella { message, signature })
|
||||
}
|
||||
BeaconBlock::Eip4844(message) => {
|
||||
SignedBeaconBlock::Eip4844(SignedBeaconBlockEip4844 { message, signature })
|
||||
BeaconBlock::Deneb(message) => {
|
||||
SignedBeaconBlock::Deneb(SignedBeaconBlockDeneb { message, signature })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -378,20 +378,20 @@ impl<E: EthSpec> SignedBeaconBlockCapella<E, BlindedPayload<E>> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> SignedBeaconBlockEip4844<E, BlindedPayload<E>> {
|
||||
impl<E: EthSpec> SignedBeaconBlockDeneb<E, BlindedPayload<E>> {
|
||||
pub fn into_full_block(
|
||||
self,
|
||||
execution_payload: ExecutionPayloadEip4844<E>,
|
||||
) -> SignedBeaconBlockEip4844<E, FullPayload<E>> {
|
||||
let SignedBeaconBlockEip4844 {
|
||||
execution_payload: ExecutionPayloadDeneb<E>,
|
||||
) -> SignedBeaconBlockDeneb<E, FullPayload<E>> {
|
||||
let SignedBeaconBlockDeneb {
|
||||
message:
|
||||
BeaconBlockEip4844 {
|
||||
BeaconBlockDeneb {
|
||||
slot,
|
||||
proposer_index,
|
||||
parent_root,
|
||||
state_root,
|
||||
body:
|
||||
BeaconBlockBodyEip4844 {
|
||||
BeaconBlockBodyDeneb {
|
||||
randao_reveal,
|
||||
eth1_data,
|
||||
graffiti,
|
||||
@@ -401,20 +401,20 @@ impl<E: EthSpec> SignedBeaconBlockEip4844<E, BlindedPayload<E>> {
|
||||
deposits,
|
||||
voluntary_exits,
|
||||
sync_aggregate,
|
||||
execution_payload: BlindedPayloadEip4844 { .. },
|
||||
execution_payload: BlindedPayloadDeneb { .. },
|
||||
bls_to_execution_changes,
|
||||
blob_kzg_commitments,
|
||||
},
|
||||
},
|
||||
signature,
|
||||
} = self;
|
||||
SignedBeaconBlockEip4844 {
|
||||
message: BeaconBlockEip4844 {
|
||||
SignedBeaconBlockDeneb {
|
||||
message: BeaconBlockDeneb {
|
||||
slot,
|
||||
proposer_index,
|
||||
parent_root,
|
||||
state_root,
|
||||
body: BeaconBlockBodyEip4844 {
|
||||
body: BeaconBlockBodyDeneb {
|
||||
randao_reveal,
|
||||
eth1_data,
|
||||
graffiti,
|
||||
@@ -424,7 +424,7 @@ impl<E: EthSpec> SignedBeaconBlockEip4844<E, BlindedPayload<E>> {
|
||||
deposits,
|
||||
voluntary_exits,
|
||||
sync_aggregate,
|
||||
execution_payload: FullPayloadEip4844 { execution_payload },
|
||||
execution_payload: FullPayloadDeneb { execution_payload },
|
||||
bls_to_execution_changes,
|
||||
blob_kzg_commitments,
|
||||
},
|
||||
@@ -448,14 +448,14 @@ impl<E: EthSpec> SignedBeaconBlock<E, BlindedPayload<E>> {
|
||||
(SignedBeaconBlock::Capella(block), Some(ExecutionPayload::Capella(payload))) => {
|
||||
SignedBeaconBlock::Capella(block.into_full_block(payload))
|
||||
}
|
||||
(SignedBeaconBlock::Eip4844(block), Some(ExecutionPayload::Eip4844(payload))) => {
|
||||
SignedBeaconBlock::Eip4844(block.into_full_block(payload))
|
||||
(SignedBeaconBlock::Deneb(block), Some(ExecutionPayload::Deneb(payload))) => {
|
||||
SignedBeaconBlock::Deneb(block.into_full_block(payload))
|
||||
}
|
||||
// avoid wildcard matching forks so that compiler will
|
||||
// direct us here when a new fork has been added
|
||||
(SignedBeaconBlock::Merge(_), _) => return None,
|
||||
(SignedBeaconBlock::Capella(_), _) => return None,
|
||||
(SignedBeaconBlock::Eip4844(_), _) => return None,
|
||||
(SignedBeaconBlock::Deneb(_), _) => return None,
|
||||
};
|
||||
Some(full_block)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user