Skip to content

Commit

Permalink
changes for latest spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ralexstokes committed Oct 23, 2024
1 parent 269ba9b commit 0d996ed
Show file tree
Hide file tree
Showing 25 changed files with 892 additions and 928 deletions.
40 changes: 21 additions & 19 deletions ethereum-consensus/src/electra/beacon_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
crypto::KzgCommitment,
electra::{
execution_payload::ExecutionPayload,
operations::{Attestation, AttesterSlashing, SignedConsolidation},
operations::{Attestation, AttesterSlashing, ExecutionRequests},
},
phase0::{Deposit, Eth1Data, ProposerSlashing, SignedVoluntaryExit},
primitives::{BlsSignature, Bytes32, Root, Slot, ValidatorIndex},
Expand All @@ -28,11 +28,11 @@ pub struct BeaconBlockBody<
const MAX_BYTES_PER_TRANSACTION: usize,
const MAX_TRANSACTIONS_PER_PAYLOAD: usize,
const MAX_WITHDRAWALS_PER_PAYLOAD: usize,
const MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
const MAX_BLS_TO_EXECUTION_CHANGES: usize,
const MAX_BLOB_COMMITMENTS_PER_BLOCK: usize,
const MAX_CONSOLIDATIONS: usize,
const MAX_DEPOSIT_REQUESTS_PER_PAYLOAD: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
const MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: usize,
> {
pub randao_reveal: BlsSignature,
pub eth1_data: Eth1Data,
Expand All @@ -50,12 +50,14 @@ pub struct BeaconBlockBody<
MAX_BYTES_PER_TRANSACTION,
MAX_TRANSACTIONS_PER_PAYLOAD,
MAX_WITHDRAWALS_PER_PAYLOAD,
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
>,
pub bls_to_execution_changes: List<SignedBlsToExecutionChange, MAX_BLS_TO_EXECUTION_CHANGES>,
pub blob_kzg_commitments: List<KzgCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK>,
pub consolidations: List<SignedConsolidation, MAX_CONSOLIDATIONS>,
pub execution_requests: ExecutionRequests<
MAX_DEPOSIT_REQUESTS_PER_PAYLOAD,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
>,
}

#[derive(
Expand All @@ -75,11 +77,11 @@ pub struct BeaconBlock<
const MAX_BYTES_PER_TRANSACTION: usize,
const MAX_TRANSACTIONS_PER_PAYLOAD: usize,
const MAX_WITHDRAWALS_PER_PAYLOAD: usize,
const MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
const MAX_BLS_TO_EXECUTION_CHANGES: usize,
const MAX_BLOB_COMMITMENTS_PER_BLOCK: usize,
const MAX_CONSOLIDATIONS: usize,
const MAX_DEPOSIT_REQUESTS_PER_PAYLOAD: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
const MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: usize,
> {
#[serde(with = "crate::serde::as_str")]
pub slot: Slot,
Expand All @@ -101,11 +103,11 @@ pub struct BeaconBlock<
MAX_BYTES_PER_TRANSACTION,
MAX_TRANSACTIONS_PER_PAYLOAD,
MAX_WITHDRAWALS_PER_PAYLOAD,
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
MAX_BLS_TO_EXECUTION_CHANGES,
MAX_BLOB_COMMITMENTS_PER_BLOCK,
MAX_CONSOLIDATIONS,
MAX_DEPOSIT_REQUESTS_PER_PAYLOAD,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
>,
}

Expand All @@ -126,11 +128,11 @@ pub struct SignedBeaconBlock<
const MAX_BYTES_PER_TRANSACTION: usize,
const MAX_TRANSACTIONS_PER_PAYLOAD: usize,
const MAX_WITHDRAWALS_PER_PAYLOAD: usize,
const MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
const MAX_BLS_TO_EXECUTION_CHANGES: usize,
const MAX_BLOB_COMMITMENTS_PER_BLOCK: usize,
const MAX_CONSOLIDATIONS: usize,
const MAX_DEPOSIT_REQUESTS_PER_PAYLOAD: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
const MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: usize,
> {
pub message: BeaconBlock<
MAX_PROPOSER_SLASHINGS,
Expand All @@ -146,11 +148,11 @@ pub struct SignedBeaconBlock<
MAX_BYTES_PER_TRANSACTION,
MAX_TRANSACTIONS_PER_PAYLOAD,
MAX_WITHDRAWALS_PER_PAYLOAD,
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
MAX_BLS_TO_EXECUTION_CHANGES,
MAX_BLOB_COMMITMENTS_PER_BLOCK,
MAX_CONSOLIDATIONS,
MAX_DEPOSIT_REQUESTS_PER_PAYLOAD,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
>,
pub signature: BlsSignature,
}
28 changes: 1 addition & 27 deletions ethereum-consensus/src/electra/beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,11 @@ use crate::{
electra::ExecutionPayloadHeader,
phase0::{BeaconBlockHeader, Checkpoint, Eth1Data, Fork, Validator, JUSTIFICATION_BITS_LENGTH},
primitives::{
BlsPublicKey, BlsSignature, Bytes32, Epoch, ExecutionAddress, Gwei, ParticipationFlags,
Root, Slot, ValidatorIndex, WithdrawalIndex,
Bytes32, Epoch, Gwei, ParticipationFlags, Root, Slot, ValidatorIndex, WithdrawalIndex,
},
ssz::prelude::*,
};

#[derive(
Default, Debug, Clone, SimpleSerialize, PartialEq, Eq, serde::Serialize, serde::Deserialize,
)]
pub struct DepositReceipt {
#[serde(rename = "pubkey")]
pub public_key: BlsPublicKey,
pub withdrawal_credentials: Bytes32,
#[serde(with = "crate::serde::as_str")]
pub amount: Gwei,
pub signature: BlsSignature,
#[serde(with = "crate::serde::as_str")]
pub index: u64,
}

#[derive(
Default, Debug, Clone, SimpleSerialize, PartialEq, Eq, serde::Serialize, serde::Deserialize,
)]
Expand Down Expand Up @@ -56,17 +41,6 @@ pub struct PendingConsolidation {
pub target_index: ValidatorIndex,
}

#[derive(
Default, Debug, Clone, SimpleSerialize, PartialEq, Eq, serde::Serialize, serde::Deserialize,
)]
pub struct ExecutionLayerWithdrawalRequest {
pub source_address: ExecutionAddress,
#[serde(rename = "pubkey")]
pub validator_public_key: BlsPublicKey,
#[serde(with = "crate::serde::as_str")]
pub amount: Gwei,
}

#[derive(
Default, Debug, SimpleSerialize, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize,
)]
Expand Down
28 changes: 21 additions & 7 deletions ethereum-consensus/src/electra/blinded_beacon_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
capella::SignedBlsToExecutionChange,
crypto::KzgCommitment,
electra::{
operations::{Attestation, AttesterSlashing, SignedConsolidation},
operations::{Attestation, AttesterSlashing, ExecutionRequests},
ExecutionPayloadHeader,
},
phase0::{Deposit, Eth1Data, ProposerSlashing, SignedVoluntaryExit},
Expand All @@ -27,7 +27,9 @@ pub struct BlindedBeaconBlockBody<
const MAX_EXTRA_DATA_BYTES: usize,
const MAX_BLS_TO_EXECUTION_CHANGES: usize,
const MAX_BLOB_COMMITMENTS_PER_BLOCK: usize,
const MAX_CONSOLIDATIONS: usize,
const MAX_DEPOSIT_REQUESTS_PER_PAYLOAD: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
const MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: usize,
> {
pub randao_reveal: BlsSignature,
pub eth1_data: Eth1Data,
Expand All @@ -43,7 +45,11 @@ pub struct BlindedBeaconBlockBody<
ExecutionPayloadHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub bls_to_execution_changes: List<SignedBlsToExecutionChange, MAX_BLS_TO_EXECUTION_CHANGES>,
pub blob_kzg_commitments: List<KzgCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK>,
pub consolidations: List<SignedConsolidation, MAX_CONSOLIDATIONS>,
pub execution_requests: ExecutionRequests<
MAX_DEPOSIT_REQUESTS_PER_PAYLOAD,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
>,
}

#[derive(
Expand All @@ -62,7 +68,9 @@ pub struct BlindedBeaconBlock<
const MAX_EXTRA_DATA_BYTES: usize,
const MAX_BLS_TO_EXECUTION_CHANGES: usize,
const MAX_BLOB_COMMITMENTS_PER_BLOCK: usize,
const MAX_CONSOLIDATIONS: usize,
const MAX_DEPOSIT_REQUESTS_PER_PAYLOAD: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
const MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: usize,
> {
#[serde(with = "crate::serde::as_str")]
pub slot: Slot,
Expand All @@ -83,7 +91,9 @@ pub struct BlindedBeaconBlock<
MAX_EXTRA_DATA_BYTES,
MAX_BLS_TO_EXECUTION_CHANGES,
MAX_BLOB_COMMITMENTS_PER_BLOCK,
MAX_CONSOLIDATIONS,
MAX_DEPOSIT_REQUESTS_PER_PAYLOAD,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
>,
}

Expand All @@ -103,7 +113,9 @@ pub struct SignedBlindedBeaconBlock<
const MAX_EXTRA_DATA_BYTES: usize,
const MAX_BLS_TO_EXECUTION_CHANGES: usize,
const MAX_BLOB_COMMITMENTS_PER_BLOCK: usize,
const MAX_CONSOLIDATIONS: usize,
const MAX_DEPOSIT_REQUESTS_PER_PAYLOAD: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
const MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: usize,
> {
pub message: BlindedBeaconBlock<
MAX_PROPOSER_SLASHINGS,
Expand All @@ -118,7 +130,9 @@ pub struct SignedBlindedBeaconBlock<
MAX_EXTRA_DATA_BYTES,
MAX_BLS_TO_EXECUTION_CHANGES,
MAX_BLOB_COMMITMENTS_PER_BLOCK,
MAX_CONSOLIDATIONS,
MAX_DEPOSIT_REQUESTS_PER_PAYLOAD,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
>,
pub signature: BlsSignature,
}
Loading

0 comments on commit 0d996ed

Please sign in to comment.