From a8cf93df2af5396d5aeb6941080ab06c43a0fa2f Mon Sep 17 00:00:00 2001 From: hangleang Date: Sat, 22 Jun 2024 12:15:58 +0700 Subject: [PATCH 1/3] update containers ssz types based on alpha3 specs --- types/src/electra/beacon_state.rs | 2 +- types/src/electra/consts.rs | 2 +- types/src/electra/container_impls.rs | 13 ++++---- types/src/electra/containers.rs | 35 ++++++++------------ types/src/electra/spec_tests.rs | 34 +++++++++---------- types/src/preset.rs | 30 ++++++++--------- types/src/traits.rs | 49 ++++++++++++++-------------- 7 files changed, 78 insertions(+), 87 deletions(-) diff --git a/types/src/electra/beacon_state.rs b/types/src/electra/beacon_state.rs index b7e6aab..829de57 100644 --- a/types/src/electra/beacon_state.rs +++ b/types/src/electra/beacon_state.rs @@ -90,7 +90,7 @@ pub struct BeaconState { // > Deep history valid from Capella onwards pub historical_summaries: HistoricalSummaries

, #[serde(with = "serde_utils::string_or_native")] - pub deposit_receipts_start_index: u64, + pub deposit_requests_start_index: u64, #[serde(with = "serde_utils::string_or_native")] pub deposit_balance_to_consume: Gwei, #[serde(with = "serde_utils::string_or_native")] diff --git a/types/src/electra/consts.rs b/types/src/electra/consts.rs index 4e62499..2acf1d3 100644 --- a/types/src/electra/consts.rs +++ b/types/src/electra/consts.rs @@ -7,7 +7,7 @@ use crate::{ }; // Misc -pub const UNSET_DEPOSIT_RECEIPTS_START_INDEX: u64 = u64::MAX; +pub const UNSET_DEPOSIT_REQUESTS_START_INDEX: u64 = u64::MAX; pub const FULL_EXIT_REQUEST_AMOUNT: u64 = 0; pub const COMPOUNDING_WITHDRAWAL_PREFIX: &[u8] = &hex!("02"); diff --git a/types/src/electra/container_impls.rs b/types/src/electra/container_impls.rs index afbfefd..914965d 100644 --- a/types/src/electra/container_impls.rs +++ b/types/src/electra/container_impls.rs @@ -38,7 +38,6 @@ impl BeaconBlock

{ execution_payload: _, bls_to_execution_changes, blob_kzg_commitments, - consolidations, } = body; BlindedBeaconBlock { @@ -59,7 +58,6 @@ impl BeaconBlock

{ execution_payload_header, bls_to_execution_changes, blob_kzg_commitments: kzg_commitments.unwrap_or(blob_kzg_commitments), - consolidations, }, } } @@ -88,7 +86,6 @@ impl BlindedBeaconBlock

{ execution_payload_header: _, bls_to_execution_changes, blob_kzg_commitments, - consolidations, } = body; let body = BeaconBlockBody { @@ -104,7 +101,6 @@ impl BlindedBeaconBlock

{ execution_payload, bls_to_execution_changes, blob_kzg_commitments, - consolidations, }; BeaconBlock { @@ -143,15 +139,17 @@ impl From<&ExecutionPayload

> for ExecutionPayloadHeader

{ ref withdrawals, blob_gas_used, excess_blob_gas, - ref deposit_receipts, + ref deposit_requests, ref withdrawal_requests, + ref consolidation_requests, } = *payload; let extra_data = extra_data.clone_arc(); let transactions_root = transactions.hash_tree_root(); let withdrawals_root = withdrawals.hash_tree_root(); - let deposit_receipts_root = deposit_receipts.hash_tree_root(); + let deposit_requests_root = deposit_requests.hash_tree_root(); let withdrawal_requests_root = withdrawal_requests.hash_tree_root(); + let consolidation_requests_root = consolidation_requests.hash_tree_root(); Self { parent_hash, @@ -171,8 +169,9 @@ impl From<&ExecutionPayload

> for ExecutionPayloadHeader

{ withdrawals_root, blob_gas_used, excess_blob_gas, - deposit_receipts_root, + deposit_requests_root, withdrawal_requests_root, + consolidation_requests_root, } } } diff --git a/types/src/electra/containers.rs b/types/src/electra/containers.rs index fd5822c..a7f3dc0 100644 --- a/types/src/electra/containers.rs +++ b/types/src/electra/containers.rs @@ -41,8 +41,8 @@ pub struct AggregateAndProof { pub struct Attestation { pub aggregation_bits: BitList, pub data: AttestationData, - pub committee_bits: BitVector, pub signature: AggregateSignatureBytes, + pub committee_bits: BitVector, } #[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize, Ssz)] @@ -80,7 +80,6 @@ pub struct BeaconBlockBody { pub bls_to_execution_changes: ContiguousList, pub blob_kzg_commitments: ContiguousList, - pub consolidations: ContiguousList, } #[derive(Clone, Debug, Deserialize, Serialize, Ssz)] @@ -111,23 +110,11 @@ pub struct BlindedBeaconBlockBody { pub bls_to_execution_changes: ContiguousList, pub blob_kzg_commitments: ContiguousList, - pub consolidations: ContiguousList, } #[derive(Clone, Copy, PartialEq, Eq, Default, Debug, Deserialize, Serialize, Ssz)] #[serde(deny_unknown_fields)] -pub struct Consolidation { - #[serde(with = "serde_utils::string_or_native")] - pub source_index: ValidatorIndex, - #[serde(with = "serde_utils::string_or_native")] - pub target_index: ValidatorIndex, - #[serde(with = "serde_utils::string_or_native")] - pub epoch: Epoch, -} - -#[derive(Clone, Copy, PartialEq, Eq, Default, Debug, Deserialize, Serialize, Ssz)] -#[serde(deny_unknown_fields)] -pub struct DepositReceipt { +pub struct DepositRequest { pub pubkey: PublicKeyBytes, pub withdrawal_credentials: H256, #[serde(with = "serde_utils::string_or_native")] @@ -139,7 +126,7 @@ pub struct DepositReceipt { #[derive(Clone, Copy, PartialEq, Eq, Default, Debug, Deserialize, Serialize, Ssz)] #[serde(deny_unknown_fields)] -pub struct ExecutionLayerWithdrawalRequest { +pub struct WithdrawalRequest { pub source_address: ExecutionAddress, pub validator_pubkey: PublicKeyBytes, #[serde(with = "serde_utils::string_or_native")] @@ -176,9 +163,11 @@ pub struct ExecutionPayload { pub blob_gas_used: Gas, #[serde(with = "serde_utils::string_or_native")] pub excess_blob_gas: Gas, - pub deposit_receipts: ContiguousList, + pub deposit_requests: ContiguousList, pub withdrawal_requests: - ContiguousList, + ContiguousList, + pub consolidation_requests: + ContiguousList } #[derive(Clone, PartialEq, Eq, Default, Debug, Deserialize, Serialize, Ssz)] @@ -209,8 +198,9 @@ pub struct ExecutionPayloadHeader { pub blob_gas_used: Gas, #[serde(with = "serde_utils::string_or_native")] pub excess_blob_gas: Gas, - pub deposit_receipts_root: H256, + pub deposit_requests_root: H256, pub withdrawal_requests_root: H256, + pub consolidation_requests_root: H256, } #[derive(Clone, PartialEq, Eq, Default, Debug, Deserialize, Serialize, Ssz)] @@ -323,7 +313,8 @@ pub struct SignedBlindedBeaconBlock { #[derive(Clone, Copy, PartialEq, Eq, Default, Debug, Deserialize, Serialize, Ssz)] #[serde(deny_unknown_fields)] -pub struct SignedConsolidation { - pub message: Consolidation, - pub signature: SignatureBytes, +pub struct ConsolidationRequest { + pub source_address: ExecutionAddress, + pub source_pubkey: PublicKeyBytes, + pub target_pubkey: PublicKeyBytes, } diff --git a/types/src/electra/spec_tests.rs b/types/src/electra/spec_tests.rs index 3a45cf8..1e50869 100644 --- a/types/src/electra/spec_tests.rs +++ b/types/src/electra/spec_tests.rs @@ -123,9 +123,9 @@ tests_for_type! { } tests_for_type! { - Consolidation, - "consensus-spec-tests/tests/mainnet/electra/ssz_static/Consolidation/*/*", - "consensus-spec-tests/tests/minimal/electra/ssz_static/Consolidation/*/*", + ConsolidationRequest, + "consensus-spec-tests/tests/mainnet/electra/ssz_static/ConsolidationRequest/*/*", + "consensus-spec-tests/tests/minimal/electra/ssz_static/ConsolidationRequest/*/*", } tests_for_type! { @@ -153,9 +153,9 @@ tests_for_type! { } tests_for_type! { - DepositReceipt, - "consensus-spec-tests/tests/mainnet/electra/ssz_static/DepositReceipt/*/*", - "consensus-spec-tests/tests/minimal/electra/ssz_static/DepositReceipt/*/*", + DepositRequest, + "consensus-spec-tests/tests/mainnet/electra/ssz_static/DepositRequest/*/*", + "consensus-spec-tests/tests/minimal/electra/ssz_static/DepositRequest/*/*", } tests_for_type! { @@ -164,12 +164,6 @@ tests_for_type! { "consensus-spec-tests/tests/minimal/electra/ssz_static/Eth1Data/*/*", } -tests_for_type! { - ExecutionLayerWithdrawalRequest, - "consensus-spec-tests/tests/mainnet/electra/ssz_static/ExecutionLayerWithdrawalRequest/*/*", - "consensus-spec-tests/tests/minimal/electra/ssz_static/ExecutionLayerWithdrawalRequest/*/*", -} - tests_for_type! { ExecutionPayload<_>, "consensus-spec-tests/tests/mainnet/electra/ssz_static/ExecutionPayload/*/*", @@ -302,11 +296,11 @@ tests_for_type! { "consensus-spec-tests/tests/minimal/electra/ssz_static/SignedBLSToExecutionChange/*/*", } -tests_for_type! { - SignedConsolidation, - "consensus-spec-tests/tests/mainnet/electra/ssz_static/SignedConsolidation/*/*", - "consensus-spec-tests/tests/minimal/electra/ssz_static/SignedConsolidation/*/*", -} +// tests_for_type! { +// SignedConsolidation, +// "consensus-spec-tests/tests/mainnet/electra/ssz_static/SignedConsolidation/*/*", +// "consensus-spec-tests/tests/minimal/electra/ssz_static/SignedConsolidation/*/*", +// } tests_for_type! { SignedContributionAndProof<_>, @@ -373,3 +367,9 @@ tests_for_type! { "consensus-spec-tests/tests/mainnet/electra/ssz_static/Withdrawal/*/*", "consensus-spec-tests/tests/minimal/electra/ssz_static/Withdrawal/*/*", } + +tests_for_type! { + WithdrawalRequest, + "consensus-spec-tests/tests/mainnet/electra/ssz_static/WithdrawalRequest/*/*", + "consensus-spec-tests/tests/minimal/electra/ssz_static/WithdrawalRequest/*/*", +} diff --git a/types/src/preset.rs b/types/src/preset.rs index a3a0b87..297bd65 100644 --- a/types/src/preset.rs +++ b/types/src/preset.rs @@ -29,8 +29,8 @@ use crate::{ }, electra::containers::{ Attestation as ElectraAttestation, AttesterSlashing as ElectraAttesterSlashing, - DepositReceipt, ExecutionLayerWithdrawalRequest, PendingBalanceDeposit, - PendingConsolidation, PendingPartialWithdrawal, SignedConsolidation, + DepositRequest, WithdrawalRequest, PendingBalanceDeposit, + PendingConsolidation, PendingPartialWithdrawal, ConsolidationRequest, }, phase0::{ containers::{ @@ -128,9 +128,9 @@ pub trait Preset: Copy + Eq + Ord + Hash + Default + Debug + Send + Sync + 'stat + Debug + Send + Sync; - type MaxConsolidations: MerkleElements + Eq + Debug + Send + Sync; - type MaxDepositReceiptsPerPayload: MerkleElements + Eq + Debug + Send + Sync; - type MaxWithdrawalRequestsPerPayload: MerkleElements + type MaxConsolidationRequestsPerPayload: MerkleElements + Eq + Debug + Send + Sync; + type MaxDepositRequestsPerPayload: MerkleElements + Eq + Debug + Send + Sync; + type MaxWithdrawalRequestsPerPayload: MerkleElements + Eq + Debug + Send @@ -288,8 +288,8 @@ impl Preset for Mainnet { // Electra type MaxAttestationsElectra = U8; type MaxAttesterSlashingsElectra = U1; - type MaxConsolidations = U1; - type MaxDepositReceiptsPerPayload = U8192; + type MaxConsolidationRequestsPerPayload = U1; + type MaxDepositRequestsPerPayload = U8192; type MaxWithdrawalRequestsPerPayload = U16; type PendingBalanceDepositsLimit = U134217728; type PendingConsolidationsLimit = U262144; @@ -361,7 +361,7 @@ impl Preset for Minimal { // Electra type MaxAttestationsElectra; type MaxAttesterSlashingsElectra; - type MaxConsolidations; + type MaxConsolidationRequestsPerPayload; type PendingBalanceDepositsLimit; } @@ -384,7 +384,7 @@ impl Preset for Minimal { type KzgCommitmentInclusionProofDepth = U9; // Electra - type MaxDepositReceiptsPerPayload = U4; + type MaxDepositRequestsPerPayload = U4; type MaxWithdrawalRequestsPerPayload = U2; type PendingConsolidationsLimit = U64; type PendingPartialWithdrawalsLimit = U64; @@ -464,8 +464,8 @@ impl Preset for Medalla { // Electra type MaxAttestationsElectra; type MaxAttesterSlashingsElectra; - type MaxConsolidations; - type MaxDepositReceiptsPerPayload; + type MaxConsolidationRequestsPerPayload; + type MaxDepositRequestsPerPayload; type MaxWithdrawalRequestsPerPayload; type PendingBalanceDepositsLimit; type PendingConsolidationsLimit; @@ -861,9 +861,9 @@ pub struct ElectraPreset { #[serde(with = "serde_utils::string_or_native")] max_attester_slashings_electra: u64, #[serde(with = "serde_utils::string_or_native")] - max_consolidations: u64, + max_consolidation_requests_per_payload: u64, #[serde(with = "serde_utils::string_or_native")] - max_deposit_receipts_per_payload: u64, + max_deposit_requests_per_payload: u64, #[serde(with = "serde_utils::string_or_native")] max_withdrawal_requests_per_payload: u64, #[serde(with = "serde_utils::string_or_native")] @@ -880,8 +880,8 @@ impl ElectraPreset { Self { max_attestations_electra: P::MaxAttestationsElectra::U64, max_attester_slashings_electra: P::MaxAttesterSlashingsElectra::U64, - max_consolidations: P::MaxConsolidations::U64, - max_deposit_receipts_per_payload: P::MaxDepositReceiptsPerPayload::U64, + max_consolidation_requests_per_payload: P::MaxConsolidationRequestsPerPayload::U64, + max_deposit_requests_per_payload: P::MaxDepositRequestsPerPayload::U64, max_withdrawal_requests_per_payload: P::MaxWithdrawalRequestsPerPayload::U64, pending_balance_deposits_limit: P::PendingBalanceDepositsLimit::U64, pending_consolidations_limit: P::PendingConsolidationsLimit::U64, diff --git a/types/src/traits.rs b/types/src/traits.rs index 064d41e..2f67fc6 100644 --- a/types/src/traits.rs +++ b/types/src/traits.rs @@ -79,10 +79,10 @@ use crate::{ Attestation as ElectraAttestation, AttesterSlashing as ElectraAttesterSlashing, BeaconBlock as ElectraBeaconBlock, BeaconBlockBody as ElectraBeaconBlockBody, BlindedBeaconBlock as ElectraBlindedBeaconBlock, - BlindedBeaconBlockBody as ElectraBlindedBeaconBlockBody, DepositReceipt, - ExecutionLayerWithdrawalRequest, ExecutionPayload as ElectraExecutionPayload, + BlindedBeaconBlockBody as ElectraBlindedBeaconBlockBody, DepositRequest, + WithdrawalRequest, ExecutionPayload as ElectraExecutionPayload, ExecutionPayloadHeader as ElectraExecutionPayloadHeader, - IndexedAttestation as ElectraIndexedAttestation, SignedConsolidation, + IndexedAttestation as ElectraIndexedAttestation, ConsolidationRequest }, }, nonstandard::Phase, @@ -578,7 +578,7 @@ impl PostCapellaBeaconState

for ElectraBeaconState

{ } pub trait PostElectraBeaconState: PostCapellaBeaconState

{ - fn deposit_receipts_start_index(&self) -> u64; + fn deposit_requests_start_index(&self) -> u64; fn deposit_balance_to_consume(&self) -> Gwei; fn exit_balance_to_consume(&self) -> Gwei; fn earliest_exit_epoch(&self) -> Epoch; @@ -588,7 +588,7 @@ pub trait PostElectraBeaconState: PostCapellaBeaconState

{ fn pending_partial_withdrawals(&self) -> &PendingPartialWithdrawals

; fn pending_consolidations(&self) -> &PendingConsolidations

; - fn deposit_receipts_start_index_mut(&mut self) -> &mut u64; + fn deposit_requests_start_index_mut(&mut self) -> &mut u64; fn deposit_balance_to_consume_mut(&mut self) -> &mut Gwei; fn exit_balance_to_consume_mut(&mut self) -> &mut Gwei; fn earliest_exit_epoch_mut(&mut self) -> &mut Epoch; @@ -621,7 +621,7 @@ pub trait PostElectraBeaconState: PostCapellaBeaconState

{ impl PostElectraBeaconState

for implementor { #[duplicate_item( field return_type; - [deposit_receipts_start_index] [u64]; + [deposit_requests_start_index] [u64]; [deposit_balance_to_consume] [Gwei]; [exit_balance_to_consume] [Gwei]; [earliest_exit_epoch] [Epoch]; @@ -644,7 +644,7 @@ impl PostElectraBeaconState

for implementor { #[duplicate_item( field method return_type; - [deposit_receipts_start_index] [deposit_receipts_start_index_mut] [u64]; + [deposit_requests_start_index] [deposit_requests_start_index_mut] [u64]; [deposit_balance_to_consume] [deposit_balance_to_consume_mut] [Gwei]; [exit_balance_to_consume] [exit_balance_to_consume_mut] [Gwei]; [earliest_exit_epoch] [earliest_exit_epoch_mut] [Epoch]; @@ -1242,7 +1242,6 @@ pub trait PostElectraBeaconBlockBody: PostDenebBeaconBlockBody

{ fn attester_slashings( &self, ) -> &ContiguousList, P::MaxAttesterSlashingsElectra>; - fn consolidations(&self) -> &ContiguousList; } impl PostElectraBeaconBlockBody

for ElectraBeaconBlockBody

{ @@ -1255,10 +1254,6 @@ impl PostElectraBeaconBlockBody

for ElectraBeaconBlockBody

{ ) -> &ContiguousList, P::MaxAttesterSlashingsElectra> { &self.attester_slashings } - - fn consolidations(&self) -> &ContiguousList { - &self.consolidations - } } impl PostElectraBeaconBlockBody

for ElectraBlindedBeaconBlockBody

{ @@ -1271,10 +1266,6 @@ impl PostElectraBeaconBlockBody

for ElectraBlindedBeaconBlockBody< ) -> &ContiguousList, P::MaxAttesterSlashingsElectra> { &self.attester_slashings } - - fn consolidations(&self) -> &ContiguousList { - &self.consolidations - } } pub trait ExecutionPayload: SszHash { @@ -1474,39 +1465,49 @@ impl PostCapellaExecutionPayloadHeader

for ElectraExecutionPayload } pub trait PostElectraExecutionPayload: PostCapellaExecutionPayload

{ - fn deposit_receipts(&self) -> &ContiguousList; + fn deposit_requests(&self) -> &ContiguousList; fn withdrawal_requests( &self, - ) -> &ContiguousList; + ) -> &ContiguousList; + fn consolidation_requests(&self) -> &ContiguousList; } impl PostElectraExecutionPayload

for ElectraExecutionPayload

{ - fn deposit_receipts(&self) -> &ContiguousList { - &self.deposit_receipts + fn deposit_requests(&self) -> &ContiguousList { + &self.deposit_requests } fn withdrawal_requests( &self, - ) -> &ContiguousList { + ) -> &ContiguousList { &self.withdrawal_requests } + + fn consolidation_requests(&self) -> &ContiguousList { + &self.consolidation_requests + } } pub trait PostElectraExecutionPayloadHeader: PostCapellaExecutionPayloadHeader

{ - fn deposit_receipts_root(&self) -> H256; + fn deposit_requests_root(&self) -> H256; fn withdrawal_requests_root(&self) -> H256; + fn consolidation_requests_root(&self) -> H256; } impl PostElectraExecutionPayloadHeader

for ElectraExecutionPayloadHeader

{ - fn deposit_receipts_root(&self) -> H256 { - self.deposit_receipts_root + fn deposit_requests_root(&self) -> H256 { + self.deposit_requests_root } fn withdrawal_requests_root(&self) -> H256 { self.withdrawal_requests_root } + + fn consolidation_requests_root(&self) -> H256 { + self.consolidation_requests_root + } } pub trait Attestation { From 7981f4553ba76ec2098a0ea4c058de02f1450a0e Mon Sep 17 00:00:00 2001 From: hangleang Date: Sat, 22 Jun 2024 12:41:59 +0700 Subject: [PATCH 2/3] update `upgrade_to_electra` function --- execution_engine/src/types.rs | 93 +++++++++++++++++++++++++-------- helper_functions/src/fork.rs | 8 +-- helper_functions/src/signing.rs | 5 +- 3 files changed, 78 insertions(+), 28 deletions(-) diff --git a/execution_engine/src/types.rs b/execution_engine/src/types.rs index 49151f2..397b8cb 100644 --- a/execution_engine/src/types.rs +++ b/execution_engine/src/types.rs @@ -19,8 +19,7 @@ use types::{ primitives::{Blob, KzgCommitment, KzgProof}, }, electra::containers::{ - DepositReceipt, ExecutionLayerWithdrawalRequest, - ExecutionPayload as ElectraExecutionPayload, + ConsolidationRequest, DepositRequest, ExecutionPayload as ElectraExecutionPayload, WithdrawalRequest }, nonstandard::{Phase, WithBlobsAndMev}, phase0::primitives::{ @@ -392,9 +391,11 @@ pub struct ExecutionPayloadV4 { #[serde(with = "serde_utils::prefixed_hex_quantity")] pub excess_blob_gas: Gas, #[serde(rename = "depositRequests")] - pub deposit_receipts: ContiguousList, + pub deposit_requests: ContiguousList, pub withdrawal_requests: ContiguousList, + pub consolidation_requests: + ContiguousList, } impl From> for ExecutionPayloadV4

{ @@ -417,13 +418,15 @@ impl From> for ExecutionPayloadV4

{ withdrawals, blob_gas_used, excess_blob_gas, - deposit_receipts, + deposit_requests, withdrawal_requests, + consolidation_requests, } = payload; let withdrawals = withdrawals.map(Into::into); - let deposit_receipts = deposit_receipts.map(Into::into); + let deposit_requests = deposit_requests.map(Into::into); let withdrawal_requests = withdrawal_requests.map(Into::into); + let consolidation_requests = consolidation_requests.map(Into::into); Self { parent_hash, @@ -443,8 +446,9 @@ impl From> for ExecutionPayloadV4

{ withdrawals, blob_gas_used, excess_blob_gas, - deposit_receipts, + deposit_requests, withdrawal_requests, + consolidation_requests, } } } @@ -469,13 +473,15 @@ impl From> for ElectraExecutionPayload

{ withdrawals, blob_gas_used, excess_blob_gas, - deposit_receipts, + deposit_requests, withdrawal_requests, + consolidation_requests, } = payload; let withdrawals = withdrawals.map(Into::into); - let deposit_receipts = deposit_receipts.map(Into::into); + let deposit_requests = deposit_requests.map(Into::into); let withdrawal_requests = withdrawal_requests.map(Into::into); + let consolidation_requests = consolidation_requests.map(Into::into); Self { parent_hash, @@ -495,15 +501,16 @@ impl From> for ElectraExecutionPayload

{ withdrawals, blob_gas_used, excess_blob_gas, - deposit_receipts, + deposit_requests, withdrawal_requests, + consolidation_requests, } } } #[derive(Deserialize, Serialize)] #[serde(bound = "", rename_all = "camelCase")] -pub struct DepositReceiptV1 { +pub struct DepositRequestV1 { pub pubkey: PublicKeyBytes, pub withdrawal_credentials: H256, #[serde(with = "serde_utils::prefixed_hex_quantity")] @@ -513,15 +520,15 @@ pub struct DepositReceiptV1 { pub index: u64, } -impl From for DepositReceiptV1 { - fn from(deposit_receipt: DepositReceipt) -> Self { - let DepositReceipt { +impl From for DepositRequestV1 { + fn from(deposit_request: DepositRequest) -> Self { + let DepositRequest { pubkey, withdrawal_credentials, amount, signature, index, - } = deposit_receipt; + } = deposit_request; Self { pubkey, @@ -533,15 +540,15 @@ impl From for DepositReceiptV1 { } } -impl From for DepositReceipt { - fn from(deposit_receipt: DepositReceiptV1) -> Self { - let DepositReceiptV1 { +impl From for DepositRequest { + fn from(deposit_request: DepositRequestV1) -> Self { + let DepositRequestV1 { pubkey, withdrawal_credentials, amount, signature, index, - } = deposit_receipt; + } = deposit_request; Self { pubkey, @@ -562,13 +569,13 @@ pub struct WithdrawalRequestV1 { pub amount: Gwei, } -impl From for WithdrawalRequestV1 { - fn from(execution_layer_withdrawal_request: ExecutionLayerWithdrawalRequest) -> Self { - let ExecutionLayerWithdrawalRequest { +impl From for WithdrawalRequestV1 { + fn from(withdrawal_request: WithdrawalRequest) -> Self { + let WithdrawalRequest { source_address, validator_pubkey, amount, - } = execution_layer_withdrawal_request; + } = withdrawal_request; Self { source_address, @@ -578,7 +585,7 @@ impl From for WithdrawalRequestV1 { } } -impl From for ExecutionLayerWithdrawalRequest { +impl From for WithdrawalRequest { fn from(withdrawal_request: WithdrawalRequestV1) -> Self { let WithdrawalRequestV1 { source_address, @@ -594,6 +601,46 @@ impl From for ExecutionLayerWithdrawalRequest { } } +#[derive(Deserialize, Serialize)] +#[serde(bound = "", rename_all = "camelCase")] +pub struct ConsolidationRequestV1 { + pub source_address: ExecutionAddress, + pub source_public_key: PublicKeyBytes, + pub target_public_key: PublicKeyBytes, +} + +impl From for ConsolidationRequestV1 { + fn from(consolidation_request: ConsolidationRequest) -> Self { + let ConsolidationRequest { + source_address, + source_pubkey, + target_pubkey, + } = consolidation_request; + + Self { + source_address, + source_public_key: source_pubkey, + target_public_key: target_pubkey, + } + } +} + +impl From for ConsolidationRequest { + fn from(consolidation_request: ConsolidationRequestV1) -> Self { + let ConsolidationRequestV1 { + source_address, + source_public_key, + target_public_key, + } = consolidation_request; + + Self { + source_address, + source_pubkey: source_public_key, + target_pubkey: target_public_key, + } + } +} + /// [`BlobsBundleV1`](https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/experimental/blob-extension.md#blobsbundlev1) #[derive(Deserialize, Serialize)] #[serde(bound = "", rename_all = "camelCase")] diff --git a/helper_functions/src/fork.rs b/helper_functions/src/fork.rs index 3051ae8..1bd3651 100644 --- a/helper_functions/src/fork.rs +++ b/helper_functions/src/fork.rs @@ -22,7 +22,7 @@ use types::{ }, electra::{ beacon_state::BeaconState as ElectraBeaconState, - consts::UNSET_DEPOSIT_RECEIPTS_START_INDEX, + consts::UNSET_DEPOSIT_REQUESTS_START_INDEX, containers::ExecutionPayloadHeader as ElectraExecutionPayloadHeader, }, phase0::{ @@ -585,9 +585,11 @@ pub fn upgrade_to_electra( blob_gas_used, excess_blob_gas, // > [New in Electra:EIP6110] - deposit_receipts_root: H256::default(), + deposit_requests_root: H256::default(), // > [New in Electra:EIP7002] withdrawal_requests_root: H256::default(), + // > [New in Electra:EIP7251] + consolidation_requests_root: H256::default(), }; let earliest_exit_epoch = validators @@ -640,7 +642,7 @@ pub fn upgrade_to_electra( next_withdrawal_validator_index, // > Deep history valid from Capella onwards historical_summaries, - deposit_receipts_start_index: UNSET_DEPOSIT_RECEIPTS_START_INDEX, + deposit_requests_start_index: UNSET_DEPOSIT_REQUESTS_START_INDEX, deposit_balance_to_consume: 0, exit_balance_to_consume: 0, earliest_exit_epoch, diff --git a/helper_functions/src/signing.rs b/helper_functions/src/signing.rs index 90e5cc8..9734bed 100644 --- a/helper_functions/src/signing.rs +++ b/helper_functions/src/signing.rs @@ -30,7 +30,7 @@ use types::{ consts::DOMAIN_CONSOLIDATION, containers::{ AggregateAndProof as ElectraAggregateAndProof, BeaconBlock as ElectraBeaconBlock, - Consolidation, + ConsolidationRequest, }, }, phase0::{ @@ -371,8 +371,9 @@ impl SignForSingleFork

for BlobSidecar

{ } } +// TODO: change specs // -impl SignForAllForksWithGenesis

for Consolidation { +impl SignForAllForksWithGenesis

for ConsolidationRequest { const DOMAIN_TYPE: DomainType = DOMAIN_CONSOLIDATION; const SIGNATURE_KIND: SignatureKind = SignatureKind::Consolidation; } From a3e459166af0bdde088f71627169e584483cbfb9 Mon Sep 17 00:00:00 2001 From: hangleang Date: Tue, 25 Jun 2024 18:33:49 +0700 Subject: [PATCH 3/3] [WIP] complete on electra specs with fail tests --- helper_functions/src/accessors.rs | 3 +- helper_functions/src/misc.rs | 8 +- .../src/electra/block_processing.rs | 239 +++++++----------- .../src/electra/epoch_processing.rs | 36 ++- types/src/traits.rs | 9 + validator/src/validator.rs | 2 - 6 files changed, 143 insertions(+), 154 deletions(-) diff --git a/helper_functions/src/accessors.rs b/helper_functions/src/accessors.rs index e557825..d35ff73 100644 --- a/helper_functions/src/accessors.rs +++ b/helper_functions/src/accessors.rs @@ -587,7 +587,8 @@ fn get_next_sync_committee_indices( .expect("candidate_index was produced by enumerating active validators") .effective_balance; - (effective_balance * max_random_byte >= P::MAX_EFFECTIVE_BALANCE * random_byte) + // > [Modified in Electra:EIP7251] + (effective_balance * max_random_byte >= P::MAX_EFFECTIVE_BALANCE_ELECTRA * random_byte) .then_some(candidate_index) }) .take(P::SyncCommitteeSize::USIZE) diff --git a/helper_functions/src/misc.rs b/helper_functions/src/misc.rs index bb9505d..626ac89 100644 --- a/helper_functions/src/misc.rs +++ b/helper_functions/src/misc.rs @@ -176,7 +176,8 @@ pub(crate) fn compute_proposer_index( .expect("candidate_index was produced by enumerating active validators") .effective_balance; - (effective_balance * max_random_byte >= P::MAX_EFFECTIVE_BALANCE * random_byte) + // > [Modified in Electra:EIP7251] + (effective_balance * max_random_byte >= P::MAX_EFFECTIVE_BALANCE_ELECTRA * random_byte) .then_some(candidate_index) }) .ok_or(Error::FailedToSelectProposer) @@ -438,10 +439,7 @@ pub fn electra_kzg_commitment_inclusion_proof( body.execution_payload().hash_tree_root(), ); - proof[depth - 2] = hashing::hash_256_256( - hashing::hash_256_256(body.consolidations().hash_tree_root(), ZERO_HASHES[0]), - ZERO_HASHES[1], - ); + proof[depth - 2] = ZERO_HASHES[2]; proof[depth - 1] = hashing::hash_256_256( hashing::hash_256_256( diff --git a/transition_functions/src/electra/block_processing.rs b/transition_functions/src/electra/block_processing.rs index 33fafb4..2ad4510 100644 --- a/transition_functions/src/electra/block_processing.rs +++ b/transition_functions/src/electra/block_processing.rs @@ -46,11 +46,11 @@ use types::{ config::Config, electra::{ beacon_state::BeaconState as ElectraBeaconState, - consts::{FULL_EXIT_REQUEST_AMOUNT, UNSET_DEPOSIT_RECEIPTS_START_INDEX}, + consts::{FULL_EXIT_REQUEST_AMOUNT, UNSET_DEPOSIT_REQUESTS_START_INDEX}, containers::{ - Attestation, BeaconBlock, BeaconBlockBody, DepositReceipt, - ExecutionLayerWithdrawalRequest, ExecutionPayloadHeader, PendingBalanceDeposit, - PendingConsolidation, PendingPartialWithdrawal, SignedConsolidation, + Attestation, BeaconBlock, BeaconBlockBody, DepositRequest, + WithdrawalRequest, ExecutionPayloadHeader, PendingBalanceDeposit, + PendingConsolidation, PendingPartialWithdrawal, ConsolidationRequest, }, }, nonstandard::{smallvec, AttestationEpoch, SlashingKind}, @@ -126,8 +126,10 @@ pub fn custom_process_block( unphased::process_block_header(state, block)?; + // > [Modified in Electra:EIP7251] process_withdrawals(state, &block.body.execution_payload)?; + // > [Modified in Electra:EIP6110] process_execution_payload( config, state, @@ -143,18 +145,22 @@ pub fn custom_process_block( unphased::process_randao(config, state, &block.body, &mut verifier)?; unphased::process_eth1_data(state, &block.body)?; + // > [Modified in Electra:EIP6110:EIP7002:EIP7549:EIP7251] process_operations(config, state, &block.body, &mut verifier, &mut slot_report)?; - for withdrawal_request in &block.body.execution_payload.withdrawal_requests { - process_execution_layer_withdrawal_request(config, state, *withdrawal_request)?; + // > [New in Electra:EIP6110] + for deposit_request in &block.body.execution_payload.deposit_requests { + process_deposit_request(config, state, *deposit_request, &mut slot_report)?; } - for deposit_receipt in &block.body.execution_payload.deposit_receipts { - process_deposit_receipt(config, state, *deposit_receipt, &mut slot_report)?; + // > [New in Electra:EIP7002:EIP7251] + for withdrawal_request in &block.body.execution_payload.withdrawal_requests { + process_withdrawal_request(config, state, *withdrawal_request)?; } - for signed_consolidation in &block.body.consolidations { - process_consolidation(config, state, *signed_consolidation)?; + // > [New in Electra:EIP7251] + for consolidation_request in &block.body.execution_payload.consolidation_requests { + process_consolidation_request(config, state, *consolidation_request)?; } altair::process_sync_aggregate( @@ -432,7 +438,7 @@ pub fn process_operations( let eth1_deposit_index_limit = state .eth1_data() .deposit_count - .min(state.deposit_receipts_start_index()); + .min(state.deposit_requests_start_index()); let in_block = body.deposits().len().try_into()?; @@ -474,6 +480,7 @@ pub fn process_operations( )?; } + // TODO: update on https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.1/specs/electra/beacon-chain.md#modified-process_attestation // Parallel iteration with Rayon has some overhead, which is most noticeable when the active // thread pool is busy. `ParallelIterator::collect` appears to wait for worker threads to become // available even if the current thread is itself a worker thread. This tends to happen when @@ -888,7 +895,7 @@ fn validate_voluntary_exit_with_verifier( verifier, )?; - // > Only exit validator if it has no pending withdrawals in the queue + // > [New in Electra:EIP7251] Only exit validator if it has no pending withdrawals in the queue ensure!( get_pending_balance_to_withdraw(state, signed_voluntary_exit.message.validator_index) == 0, Error::

::VoluntaryExitWithPendingWithdrawals, @@ -897,12 +904,12 @@ fn validate_voluntary_exit_with_verifier( Ok(()) } -fn process_execution_layer_withdrawal_request( +fn process_withdrawal_request( config: &Config, state: &mut impl PostElectraBeaconState

, - execution_layer_withdrawal_request: ExecutionLayerWithdrawalRequest, + withdrawal_request: WithdrawalRequest, ) -> Result<()> { - let amount = execution_layer_withdrawal_request.amount; + let amount = withdrawal_request.amount; let is_full_exit_request = amount == FULL_EXIT_REQUEST_AMOUNT; // > If partial withdrawal queue is full, only full exits are processed @@ -913,7 +920,7 @@ fn process_execution_layer_withdrawal_request( } // > Verify pubkey exists - let request_pubkey = execution_layer_withdrawal_request.validator_pubkey; + let request_pubkey = withdrawal_request.validator_pubkey; let Some(index) = index_of_public_key(state, request_pubkey) else { return Ok(()); }; @@ -928,7 +935,7 @@ fn process_execution_layer_withdrawal_request( .index(H256::len_bytes() - ExecutionAddress::len_bytes()..) .pipe(ExecutionAddress::from_slice); let is_correct_source_address = - source_address == execution_layer_withdrawal_request.source_address; + source_address == withdrawal_request.source_address; if !(has_correct_credential && is_correct_source_address) { return Ok(()); @@ -986,23 +993,23 @@ fn process_execution_layer_withdrawal_request( Ok(()) } -fn process_deposit_receipt( +fn process_deposit_request( config: &Config, state: &mut impl PostElectraBeaconState

, - deposit_receipt: DepositReceipt, + deposit_request: DepositRequest, mut slot_report: impl SlotReport, ) -> Result<()> { - let DepositReceipt { + let DepositRequest { pubkey, withdrawal_credentials, amount, signature, index, - } = deposit_receipt; + } = deposit_request; - // > Set deposit receipt start index - if state.deposit_receipts_start_index() == UNSET_DEPOSIT_RECEIPTS_START_INDEX { - *state.deposit_receipts_start_index_mut() = index; + // > Set deposit request start index + if state.deposit_requests_start_index() == UNSET_DEPOSIT_REQUESTS_START_INDEX { + *state.deposit_requests_start_index_mut() = index; } let deposit = Deposit { @@ -1026,122 +1033,72 @@ fn process_deposit_receipt( Ok(()) } -pub fn process_consolidation( +pub fn process_consolidation_request( config: &Config, state: &mut impl PostElectraBeaconState

, - signed_consolidation: SignedConsolidation, + consolidation_request: ConsolidationRequest, ) -> Result<()> { - // > If the pending consolidations queue is full, no consolidations are allowed in the block - ensure!( - state.pending_consolidations().len_usize() < P::PendingConsolidationsLimit::USIZE, - Error::

::PendingConsolidationQueueFull, - ); + let ConsolidationRequest { + source_address, + source_pubkey, + target_pubkey, + } = consolidation_request; + + // > If the pending consolidations queue is full, consolidation requests are ignored + if state.pending_consolidations().len_usize() == P::PendingConsolidationsLimit::USIZE { + return Ok(()); + } - // > If there is too little available consolidation churn limit, no consolidations are allowed in the block - ensure!( - get_consolidation_churn_limit(config, state) > P::MIN_ACTIVATION_BALANCE, - Error::

::TooLittleAvailableConsolidationChurnLimit, - ); + // > If there is too little available consolidation churn limit, consolidation requests are ignored + if get_consolidation_churn_limit(config, state) <= P::MIN_ACTIVATION_BALANCE { + return Ok(()); + } - let consolidation = signed_consolidation.message; + // > Verify pubkeys exists + let Some(source_index) = index_of_public_key(state, source_pubkey) else { + return Ok(()); + }; + let Some(target_index) = index_of_public_key(state, target_pubkey) else { + return Ok(()); + }; + + let source_validator = state.validators().get(source_index)?; + let target_validator = state.validators().get(target_index)?; // > Verify that source != target, so a consolidation cannot be used as an exit. - ensure!( - consolidation.source_index != consolidation.target_index, - Error::

::ConsolidationIsUsedAsExit, - ); + if source_index == target_index { + return Ok(()); + } - let source_validator = state.validators().get(consolidation.source_index)?; - let target_validator = state.validators().get(consolidation.target_index)?; - let current_epoch = get_current_epoch(state); + // > Verify source withdrawal credentials + let has_correct_credential = has_execution_withdrawal_credential(source_validator); + let prefix_len = H256::len_bytes() - ExecutionAddress::len_bytes(); + let computed_source_address = ExecutionAddress::from_slice(&source_validator.withdrawal_credentials[prefix_len..]); + if !(has_correct_credential && computed_source_address == source_address) { + return Ok(()); + } - // > Verify the source and the target are active - ensure!( - is_active_validator(source_validator, current_epoch), - Error::

::ValidatorNotActive { - index: consolidation.source_index, - validator: source_validator.clone(), - current_epoch, - }, - ); + // > Verify that target has execution withdrawal credentials + if !has_execution_withdrawal_credential(target_validator) { + return Ok(()); + } - ensure!( - is_active_validator(target_validator, current_epoch), - Error::

::ValidatorNotActive { - index: consolidation.target_index, - validator: target_validator.clone(), - current_epoch, - }, - ); + // > Verify the source and the target are active + let current_epoch = get_current_epoch(state); + if !is_active_validator(source_validator, current_epoch) { + return Ok(()); + } + if !is_active_validator(target_validator, current_epoch) { + return Ok(()); + } // > Verify exits for source and target have not been initiated - ensure!( - source_validator.exit_epoch == FAR_FUTURE_EPOCH, - Error::

::ValidatorExitAlreadyInitiated { - index: consolidation.source_index, - exit_epoch: source_validator.exit_epoch, - }, - ); - - ensure!( - target_validator.exit_epoch == FAR_FUTURE_EPOCH, - Error::

::ValidatorExitAlreadyInitiated { - index: consolidation.target_index, - exit_epoch: target_validator.exit_epoch, - }, - ); - - // > Consolidations must specify an epoch when they become valid; they are not valid before then - ensure!( - current_epoch >= consolidation.epoch, - Error::

::ConsolidationEpochInvalid { - epoch: consolidation.epoch, - current_epoch, - }, - ); - - // > Verify the source and the target have Execution layer withdrawal credentials - ensure!( - has_execution_withdrawal_credential(source_validator), - Error::

::NoExecutionWithdrawalCredentials { - index: consolidation.source_index, - withdrawal_credentials: source_validator.withdrawal_credentials, - } - ); - - ensure!( - has_execution_withdrawal_credential(target_validator), - Error::

::NoExecutionWithdrawalCredentials { - index: consolidation.target_index, - withdrawal_credentials: target_validator.withdrawal_credentials, - } - ); - - // > Verify the same withdrawal address - let prefix_len = H256::len_bytes() - ExecutionAddress::len_bytes(); - let source_address = - ExecutionAddress::from_slice(&source_validator.withdrawal_credentials[prefix_len..]); - let target_address = - ExecutionAddress::from_slice(&target_validator.withdrawal_credentials[prefix_len..]); - - ensure!( - source_address == target_address, - Error::

::ConsolidationWithdrawalAddressMismatch { - source_address, - target_address, - }, - ); - - // > Verify consolidation is signed by the source and the target - SingleVerifier.verify_aggregate( - signed_consolidation.message.signing_root(config, state), - signed_consolidation.signature, - [ - source_validator.pubkey.decompress()?, - target_validator.pubkey.decompress()?, - ], - SignatureKind::Consolidation, - )?; + if source_validator.exit_epoch != FAR_FUTURE_EPOCH { + return Ok(()); + } + if target_validator.exit_epoch != FAR_FUTURE_EPOCH { + return Ok(()); + } // > Initiate source validator exit and append pending consolidation let exit_epoch = compute_consolidation_epoch_and_update_churn( @@ -1149,7 +1106,7 @@ pub fn process_consolidation( state, source_validator.effective_balance, ); - let source_validator = state.validators_mut().get_mut(consolidation.source_index)?; + let source_validator = state.validators_mut().get_mut(source_index)?; source_validator.exit_epoch = exit_epoch; source_validator.withdrawable_epoch = @@ -1158,8 +1115,8 @@ pub fn process_consolidation( state .pending_consolidations_mut() .push(PendingConsolidation { - source_index: consolidation.source_index, - target_index: consolidation.target_index, + source_index: source_index, + target_index: target_index, })?; Ok(()) @@ -1371,19 +1328,19 @@ mod spec_tests { } processing_tests! { - process_deposit_receipt, - |config, state, deposit_receipt, _| process_deposit_receipt(config, state, deposit_receipt, NullSlotReport), - "deposit_receipt", - "consensus-spec-tests/tests/mainnet/electra/operations/deposit_receipt/*/*", - "consensus-spec-tests/tests/minimal/electra/operations/deposit_receipt/*/*", + process_deposit_request, + |config, state, deposit_request, _| process_deposit_request(config, state, deposit_request, NullSlotReport), + "deposit_request", + "consensus-spec-tests/tests/mainnet/electra/operations/deposit_request/*/*", + "consensus-spec-tests/tests/minimal/electra/operations/deposit_request/*/*", } processing_tests! { - process_execution_layer_withdrawal_request, - |config, state, withdrawal_request, _| process_execution_layer_withdrawal_request(config, state, withdrawal_request), - "execution_layer_withdrawal_request", - "consensus-spec-tests/tests/mainnet/electra/operations/execution_layer_withdrawal_request/*/*", - "consensus-spec-tests/tests/minimal/electra/operations/execution_layer_withdrawal_request/*/*", + process_withdrawal_request, + |config, state, withdrawal_request, _| process_withdrawal_request(config, state, withdrawal_request), + "withdrawal_request", + "consensus-spec-tests/tests/mainnet/electra/operations/withdrawal_request/*/*", + "consensus-spec-tests/tests/minimal/electra/operations/withdrawal_request/*/*", } validation_tests! { diff --git a/transition_functions/src/electra/epoch_processing.rs b/transition_functions/src/electra/epoch_processing.rs index 252c2f3..fae32be 100644 --- a/transition_functions/src/electra/epoch_processing.rs +++ b/transition_functions/src/electra/epoch_processing.rs @@ -20,6 +20,7 @@ use types::{ electra::beacon_state::BeaconState, preset::Preset, traits::{BeaconState as _, PostElectraBeaconState}, + phase0::consts::FAR_FUTURE_EPOCH, }; use super::epoch_intermediates; @@ -211,15 +212,33 @@ fn process_pending_balance_deposits( let mut processed_amount = 0; let mut next_deposit_index = 0; + let mut deposits_to_postpone = vec![]; for deposit in &state.pending_balance_deposits().clone() { - if processed_amount + deposit.amount > available_for_processing { - break; + let validator = state.validators().get(deposit.index)?; + + // > Validator is exiting, postpone the deposit until after withdrawable epoch + if validator.exit_epoch < FAR_FUTURE_EPOCH { + if get_current_epoch(state) <= validator.withdrawable_epoch { + deposits_to_postpone.push(*deposit); + } else { + // > Deposited balance will never become active. Increase balance but do not consume churn + increase_balance(balance(state, deposit.index)?, deposit.amount); + } + } else { + // > Validator is not exiting, attempt to process deposit + + // > Deposit does not fit in the churn, no more deposit processing in this epoch. + if processed_amount + deposit.amount > available_for_processing { + break; + } else { + // > Deposit fits in the churn, process it. Increase balance and consume churn. + increase_balance(balance(state, deposit.index)?, deposit.amount); + processed_amount += deposit.amount; + } } - increase_balance(balance(state, deposit.index)?, deposit.amount); - - processed_amount += deposit.amount; + // > Regardless of how the deposit was handled, we move on in the queue. next_deposit_index += 1; } @@ -237,6 +256,13 @@ fn process_pending_balance_deposits( *state.deposit_balance_to_consume_mut() = available_for_processing - processed_amount; } + *state.pending_balance_deposits_mut() = PersistentList::try_from_iter( + state + .pending_balance_deposits() + .into_iter() + .copied() + .chain(deposits_to_postpone.into_iter()), + )?; Ok(()) } diff --git a/types/src/traits.rs b/types/src/traits.rs index 2f67fc6..feeb0e3 100644 --- a/types/src/traits.rs +++ b/types/src/traits.rs @@ -1242,6 +1242,7 @@ pub trait PostElectraBeaconBlockBody: PostDenebBeaconBlockBody

{ fn attester_slashings( &self, ) -> &ContiguousList, P::MaxAttesterSlashingsElectra>; + fn consolidation_requests_root(&self) -> H256; } impl PostElectraBeaconBlockBody

for ElectraBeaconBlockBody

{ @@ -1254,6 +1255,10 @@ impl PostElectraBeaconBlockBody

for ElectraBeaconBlockBody

{ ) -> &ContiguousList, P::MaxAttesterSlashingsElectra> { &self.attester_slashings } + + fn consolidation_requests_root(&self) -> H256 { + self.execution_payload.consolidation_requests.hash_tree_root() + } } impl PostElectraBeaconBlockBody

for ElectraBlindedBeaconBlockBody

{ @@ -1266,6 +1271,10 @@ impl PostElectraBeaconBlockBody

for ElectraBlindedBeaconBlockBody< ) -> &ContiguousList, P::MaxAttesterSlashingsElectra> { &self.attester_slashings } + + fn consolidation_requests_root(&self) -> H256 { + self.execution_payload_header.consolidation_requests_root + } } pub trait ExecutionPayload: SszHash { diff --git a/validator/src/validator.rs b/validator/src/validator.rs index 570889f..fa047cb 100644 --- a/validator/src/validator.rs +++ b/validator/src/validator.rs @@ -1298,8 +1298,6 @@ impl Validator { execution_payload: ElectraExecutionPayload::default(), bls_to_execution_changes, blob_kzg_commitments, - // TODO(feature/electra): implement this - consolidations: ContiguousList::default(), }, }) }