mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Add New Containers
This commit is contained in:
@@ -160,6 +160,11 @@ pub trait EthSpec:
|
|||||||
type MaxAttestationsElectra: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
type MaxAttestationsElectra: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||||
type MaxWithdrawalRequestsPerPayload: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
type MaxWithdrawalRequestsPerPayload: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* New in EIP-7736
|
||||||
|
*/
|
||||||
|
type PTCSize: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||||
|
|
||||||
fn default_spec() -> ChainSpec;
|
fn default_spec() -> ChainSpec;
|
||||||
|
|
||||||
fn spec_name() -> EthSpecId;
|
fn spec_name() -> EthSpecId;
|
||||||
@@ -438,6 +443,7 @@ impl EthSpec for MainnetEthSpec {
|
|||||||
type MaxAttesterSlashingsElectra = U1;
|
type MaxAttesterSlashingsElectra = U1;
|
||||||
type MaxAttestationsElectra = U8;
|
type MaxAttestationsElectra = U8;
|
||||||
type MaxWithdrawalRequestsPerPayload = U16;
|
type MaxWithdrawalRequestsPerPayload = U16;
|
||||||
|
type PTCSize = U512;
|
||||||
|
|
||||||
fn default_spec() -> ChainSpec {
|
fn default_spec() -> ChainSpec {
|
||||||
ChainSpec::mainnet()
|
ChainSpec::mainnet()
|
||||||
@@ -503,7 +509,8 @@ impl EthSpec for MinimalEthSpec {
|
|||||||
PendingBalanceDepositsLimit,
|
PendingBalanceDepositsLimit,
|
||||||
MaxConsolidationRequestsPerPayload,
|
MaxConsolidationRequestsPerPayload,
|
||||||
MaxAttesterSlashingsElectra,
|
MaxAttesterSlashingsElectra,
|
||||||
MaxAttestationsElectra
|
MaxAttestationsElectra,
|
||||||
|
PTCSize
|
||||||
});
|
});
|
||||||
|
|
||||||
fn default_spec() -> ChainSpec {
|
fn default_spec() -> ChainSpec {
|
||||||
@@ -569,6 +576,7 @@ impl EthSpec for GnosisEthSpec {
|
|||||||
type FieldElementsPerExtBlob = U8192;
|
type FieldElementsPerExtBlob = U8192;
|
||||||
type BytesPerCell = U2048;
|
type BytesPerCell = U2048;
|
||||||
type KzgCommitmentsInclusionProofDepth = U4;
|
type KzgCommitmentsInclusionProofDepth = U4;
|
||||||
|
type PTCSize = U512;
|
||||||
|
|
||||||
fn default_spec() -> ChainSpec {
|
fn default_spec() -> ChainSpec {
|
||||||
ChainSpec::gnosis()
|
ChainSpec::gnosis()
|
||||||
|
|||||||
50
consensus/types/src/execution_payload_envelope.rs
Normal file
50
consensus/types/src/execution_payload_envelope.rs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::*;
|
||||||
|
use beacon_block_body::KzgCommitments;
|
||||||
|
use derivative::Derivative;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use superstruct::superstruct;
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[superstruct(
|
||||||
|
variants(EIP7732),
|
||||||
|
variant_attributes(
|
||||||
|
derive(
|
||||||
|
Debug,
|
||||||
|
Clone,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
TreeHash,
|
||||||
|
TestRandom,
|
||||||
|
Derivative,
|
||||||
|
arbitrary::Arbitrary
|
||||||
|
),
|
||||||
|
derivative(PartialEq, Hash(bound = "E: EthSpec")),
|
||||||
|
serde(bound = "E: EthSpec", deny_unknown_fields),
|
||||||
|
arbitrary(bound = "E: EthSpec")
|
||||||
|
),
|
||||||
|
cast_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant"),
|
||||||
|
partial_getter_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant")
|
||||||
|
)]
|
||||||
|
#[derive(
|
||||||
|
Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Derivative, arbitrary::Arbitrary,
|
||||||
|
)]
|
||||||
|
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
|
||||||
|
#[serde(bound = "E: EthSpec", untagged)]
|
||||||
|
#[arbitrary(bound = "E: EthSpec")]
|
||||||
|
#[ssz(enum_behaviour = "transparent")]
|
||||||
|
#[tree_hash(enum_behaviour = "transparent")]
|
||||||
|
pub struct ExecutionPayloadEnvelope<E: EthSpec> {
|
||||||
|
#[superstruct(only(EIP7732), partial_getter(rename = "payload_eip7732"))]
|
||||||
|
pub payload: ExecutionPayloadEIP7732<E>,
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub builder_index: u64,
|
||||||
|
pub beacon_block_root: Hash256,
|
||||||
|
pub blob_kzg_commitments: KzgCommitments<E>,
|
||||||
|
pub payment_withheld: bool,
|
||||||
|
pub state_root: Hash256,
|
||||||
|
}
|
||||||
34
consensus/types/src/indexed_payload_attestation.rs
Normal file
34
consensus/types/src/indexed_payload_attestation.rs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::*;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
TestRandom,
|
||||||
|
TreeHash,
|
||||||
|
Debug,
|
||||||
|
Clone,
|
||||||
|
PartialEq,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
)]
|
||||||
|
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
|
||||||
|
#[arbitrary(bound = "E: EthSpec")]
|
||||||
|
pub struct IndexedPayloadAttestation<E: EthSpec> {
|
||||||
|
#[serde(with = "ssz_types::serde_utils::quoted_u64_var_list")]
|
||||||
|
pub attesting_indices: VariableList<u64, E::PTCSize>,
|
||||||
|
pub data: PayloadAttestationData,
|
||||||
|
signature: AggregateSignature,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(IndexedPayloadAttestation<MainnetEthSpec>);
|
||||||
|
}
|
||||||
@@ -42,6 +42,7 @@ pub mod eth_spec;
|
|||||||
pub mod execution_bid;
|
pub mod execution_bid;
|
||||||
pub mod execution_block_hash;
|
pub mod execution_block_hash;
|
||||||
pub mod execution_payload;
|
pub mod execution_payload;
|
||||||
|
pub mod execution_payload_envelope;
|
||||||
pub mod execution_payload_header;
|
pub mod execution_payload_header;
|
||||||
pub mod fork;
|
pub mod fork;
|
||||||
pub mod fork_data;
|
pub mod fork_data;
|
||||||
@@ -51,10 +52,15 @@ pub mod graffiti;
|
|||||||
pub mod historical_batch;
|
pub mod historical_batch;
|
||||||
pub mod historical_summary;
|
pub mod historical_summary;
|
||||||
pub mod indexed_attestation;
|
pub mod indexed_attestation;
|
||||||
|
pub mod indexed_payload_attestation;
|
||||||
pub mod light_client_bootstrap;
|
pub mod light_client_bootstrap;
|
||||||
pub mod light_client_finality_update;
|
pub mod light_client_finality_update;
|
||||||
pub mod light_client_optimistic_update;
|
pub mod light_client_optimistic_update;
|
||||||
pub mod light_client_update;
|
pub mod light_client_update;
|
||||||
|
pub mod payload;
|
||||||
|
pub mod payload_attestation;
|
||||||
|
pub mod payload_attestation_data;
|
||||||
|
pub mod payload_attestation_message;
|
||||||
pub mod pending_attestation;
|
pub mod pending_attestation;
|
||||||
pub mod pending_balance_deposit;
|
pub mod pending_balance_deposit;
|
||||||
pub mod pending_consolidation;
|
pub mod pending_consolidation;
|
||||||
@@ -69,6 +75,8 @@ pub mod signed_beacon_block;
|
|||||||
pub mod signed_beacon_block_header;
|
pub mod signed_beacon_block_header;
|
||||||
pub mod signed_bls_to_execution_change;
|
pub mod signed_bls_to_execution_change;
|
||||||
pub mod signed_contribution_and_proof;
|
pub mod signed_contribution_and_proof;
|
||||||
|
pub mod signed_execution_bid;
|
||||||
|
pub mod signed_execution_payload_envelope;
|
||||||
pub mod signed_voluntary_exit;
|
pub mod signed_voluntary_exit;
|
||||||
pub mod signing_data;
|
pub mod signing_data;
|
||||||
pub mod sync_committee_subscription;
|
pub mod sync_committee_subscription;
|
||||||
@@ -86,7 +94,6 @@ pub mod execution_block_header;
|
|||||||
pub mod execution_requests;
|
pub mod execution_requests;
|
||||||
pub mod fork_context;
|
pub mod fork_context;
|
||||||
pub mod participation_flags;
|
pub mod participation_flags;
|
||||||
pub mod payload;
|
|
||||||
pub mod preset;
|
pub mod preset;
|
||||||
pub mod slot_epoch;
|
pub mod slot_epoch;
|
||||||
pub mod subnet_id;
|
pub mod subnet_id;
|
||||||
@@ -169,6 +176,9 @@ pub use crate::execution_payload::{
|
|||||||
ExecutionPayloadEIP7732, ExecutionPayloadElectra, ExecutionPayloadRef, Transaction,
|
ExecutionPayloadEIP7732, ExecutionPayloadElectra, ExecutionPayloadRef, Transaction,
|
||||||
Transactions, Withdrawals,
|
Transactions, Withdrawals,
|
||||||
};
|
};
|
||||||
|
pub use crate::execution_payload_envelope::{
|
||||||
|
ExecutionPayloadEnvelope, ExecutionPayloadEnvelopeEIP7732,
|
||||||
|
};
|
||||||
pub use crate::execution_payload_header::{
|
pub use crate::execution_payload_header::{
|
||||||
ExecutionPayloadHeader, ExecutionPayloadHeaderBellatrix, ExecutionPayloadHeaderCapella,
|
ExecutionPayloadHeader, ExecutionPayloadHeaderBellatrix, ExecutionPayloadHeaderCapella,
|
||||||
ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderRef,
|
ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderRef,
|
||||||
@@ -185,6 +195,7 @@ pub use crate::historical_batch::HistoricalBatch;
|
|||||||
pub use crate::indexed_attestation::{
|
pub use crate::indexed_attestation::{
|
||||||
IndexedAttestation, IndexedAttestationBase, IndexedAttestationElectra, IndexedAttestationRef,
|
IndexedAttestation, IndexedAttestationBase, IndexedAttestationElectra, IndexedAttestationRef,
|
||||||
};
|
};
|
||||||
|
pub use crate::indexed_payload_attestation::IndexedPayloadAttestation;
|
||||||
pub use crate::light_client_bootstrap::{
|
pub use crate::light_client_bootstrap::{
|
||||||
LightClientBootstrap, LightClientBootstrapAltair, LightClientBootstrapCapella,
|
LightClientBootstrap, LightClientBootstrapAltair, LightClientBootstrapCapella,
|
||||||
LightClientBootstrapDeneb, LightClientBootstrapElectra,
|
LightClientBootstrapDeneb, LightClientBootstrapElectra,
|
||||||
@@ -213,6 +224,9 @@ pub use crate::payload::{
|
|||||||
FullPayload, FullPayloadBellatrix, FullPayloadCapella, FullPayloadDeneb, FullPayloadElectra,
|
FullPayload, FullPayloadBellatrix, FullPayloadCapella, FullPayloadDeneb, FullPayloadElectra,
|
||||||
FullPayloadRef, OwnedExecPayload,
|
FullPayloadRef, OwnedExecPayload,
|
||||||
};
|
};
|
||||||
|
pub use crate::payload_attestation::PayloadAttestation;
|
||||||
|
pub use crate::payload_attestation_data::PayloadAttestationData;
|
||||||
|
pub use crate::payload_attestation_message::PayloadAttestationMessage;
|
||||||
pub use crate::pending_attestation::PendingAttestation;
|
pub use crate::pending_attestation::PendingAttestation;
|
||||||
pub use crate::pending_balance_deposit::PendingBalanceDeposit;
|
pub use crate::pending_balance_deposit::PendingBalanceDeposit;
|
||||||
pub use crate::pending_consolidation::PendingConsolidation;
|
pub use crate::pending_consolidation::PendingConsolidation;
|
||||||
@@ -238,6 +252,8 @@ pub use crate::signed_beacon_block::{
|
|||||||
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
|
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
|
||||||
pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange;
|
pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange;
|
||||||
pub use crate::signed_contribution_and_proof::SignedContributionAndProof;
|
pub use crate::signed_contribution_and_proof::SignedContributionAndProof;
|
||||||
|
pub use crate::signed_execution_bid::SignedExecutionBid;
|
||||||
|
pub use crate::signed_execution_payload_envelope::SignedExecutionPayloadEnvelope;
|
||||||
pub use crate::signed_voluntary_exit::SignedVoluntaryExit;
|
pub use crate::signed_voluntary_exit::SignedVoluntaryExit;
|
||||||
pub use crate::signing_data::{SignedRoot, SigningData};
|
pub use crate::signing_data::{SignedRoot, SigningData};
|
||||||
pub use crate::slot_epoch::{Epoch, Slot};
|
pub use crate::slot_epoch::{Epoch, Slot};
|
||||||
|
|||||||
34
consensus/types/src/payload_attestation.rs
Normal file
34
consensus/types/src/payload_attestation.rs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::*;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
TestRandom,
|
||||||
|
TreeHash,
|
||||||
|
Debug,
|
||||||
|
Clone,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
)]
|
||||||
|
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
|
||||||
|
#[arbitrary(bound = "E: EthSpec")]
|
||||||
|
pub struct PayloadAttestation<E: EthSpec> {
|
||||||
|
pub aggregation_bits: BitList<E::PTCSize>,
|
||||||
|
pub slot: Slot,
|
||||||
|
pub payload_status: u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(PayloadAttestation<MainnetEthSpec>);
|
||||||
|
}
|
||||||
32
consensus/types/src/payload_attestation_data.rs
Normal file
32
consensus/types/src/payload_attestation_data.rs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::*;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
TestRandom,
|
||||||
|
TreeHash,
|
||||||
|
Debug,
|
||||||
|
Clone,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
)]
|
||||||
|
pub struct PayloadAttestationData {
|
||||||
|
pub beacon_block_root: Hash256,
|
||||||
|
pub slot: Slot,
|
||||||
|
pub payload_status: u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(PayloadAttestationData);
|
||||||
|
}
|
||||||
32
consensus/types/src/payload_attestation_message.rs
Normal file
32
consensus/types/src/payload_attestation_message.rs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::*;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
TestRandom,
|
||||||
|
TreeHash,
|
||||||
|
Debug,
|
||||||
|
Clone,
|
||||||
|
PartialEq,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
)]
|
||||||
|
pub struct PayloadAttestationMessage {
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub validator_index: u64,
|
||||||
|
pub data: PayloadAttestationData,
|
||||||
|
pub signature: AggregateSignature,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(PayloadAttestationMessage);
|
||||||
|
}
|
||||||
30
consensus/types/src/signed_execution_bid.rs
Normal file
30
consensus/types/src/signed_execution_bid.rs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::*;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
TestRandom,
|
||||||
|
TreeHash,
|
||||||
|
Debug,
|
||||||
|
Clone,
|
||||||
|
PartialEq,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
)]
|
||||||
|
pub struct SignedExecutionBid {
|
||||||
|
pub message: ExecutionBid,
|
||||||
|
pub signature: Signature,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(SignedExecutionBid);
|
||||||
|
}
|
||||||
44
consensus/types/src/signed_execution_payload_envelope.rs
Normal file
44
consensus/types/src/signed_execution_payload_envelope.rs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::*;
|
||||||
|
use derivative::Derivative;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use superstruct::superstruct;
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[superstruct(
|
||||||
|
variants(EIP7732),
|
||||||
|
variant_attributes(
|
||||||
|
derive(
|
||||||
|
Debug,
|
||||||
|
Clone,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
TreeHash,
|
||||||
|
TestRandom,
|
||||||
|
Derivative,
|
||||||
|
arbitrary::Arbitrary
|
||||||
|
),
|
||||||
|
derivative(PartialEq, Hash(bound = "E: EthSpec")),
|
||||||
|
serde(bound = "E: EthSpec", deny_unknown_fields),
|
||||||
|
arbitrary(bound = "E: EthSpec")
|
||||||
|
),
|
||||||
|
cast_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant"),
|
||||||
|
partial_getter_error(ty = "Error", expr = "BeaconStateError::IncorrectStateVariant")
|
||||||
|
)]
|
||||||
|
#[derive(
|
||||||
|
Debug, Clone, Serialize, Encode, Deserialize, TreeHash, Derivative, arbitrary::Arbitrary,
|
||||||
|
)]
|
||||||
|
#[derivative(PartialEq, Hash(bound = "E: EthSpec"))]
|
||||||
|
#[serde(bound = "E: EthSpec", untagged)]
|
||||||
|
#[arbitrary(bound = "E: EthSpec")]
|
||||||
|
#[ssz(enum_behaviour = "transparent")]
|
||||||
|
#[tree_hash(enum_behaviour = "transparent")]
|
||||||
|
pub struct SignedExecutionPayloadEnvelope<E: EthSpec> {
|
||||||
|
#[superstruct(only(EIP7732), partial_getter(rename = "message_eip7732"))]
|
||||||
|
pub message: ExecutionPayloadEnvelopeEIP7732<E>,
|
||||||
|
pub signature: Signature,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user