mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
add IL type, gossip kind, and pubsub message
This commit is contained in:
@@ -160,6 +160,11 @@ pub trait EthSpec:
|
||||
type MaxAttestationsElectra: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type MaxWithdrawalRequestsPerPayload: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
|
||||
/*
|
||||
* FOCIL
|
||||
*/
|
||||
type MaxTransactionsPerInclusionList: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
|
||||
fn default_spec() -> ChainSpec;
|
||||
|
||||
fn spec_name() -> EthSpecId;
|
||||
@@ -374,6 +379,11 @@ pub trait EthSpec:
|
||||
fn kzg_commitments_inclusion_proof_depth() -> usize {
|
||||
Self::KzgCommitmentsInclusionProofDepth::to_usize()
|
||||
}
|
||||
|
||||
/// Returns the `MAX_TRANSACTIONS_PER_INCLUSION_LIST` constant for this specification.
|
||||
fn max_transactions_per_inclusion_list() -> usize {
|
||||
Self::MaxTransactionsPerInclusionList::to_usize()
|
||||
}
|
||||
}
|
||||
|
||||
/// Macro to inherit some type values from another EthSpec.
|
||||
@@ -438,6 +448,7 @@ impl EthSpec for MainnetEthSpec {
|
||||
type MaxAttesterSlashingsElectra = U1;
|
||||
type MaxAttestationsElectra = U8;
|
||||
type MaxWithdrawalRequestsPerPayload = U16;
|
||||
type MaxTransactionsPerInclusionList = U16;
|
||||
|
||||
fn default_spec() -> ChainSpec {
|
||||
ChainSpec::mainnet()
|
||||
@@ -503,7 +514,8 @@ impl EthSpec for MinimalEthSpec {
|
||||
PendingBalanceDepositsLimit,
|
||||
MaxConsolidationRequestsPerPayload,
|
||||
MaxAttesterSlashingsElectra,
|
||||
MaxAttestationsElectra
|
||||
MaxAttestationsElectra,
|
||||
MaxTransactionsPerInclusionList
|
||||
});
|
||||
|
||||
fn default_spec() -> ChainSpec {
|
||||
@@ -569,6 +581,7 @@ impl EthSpec for GnosisEthSpec {
|
||||
type FieldElementsPerExtBlob = U8192;
|
||||
type BytesPerCell = U2048;
|
||||
type KzgCommitmentsInclusionProofDepth = U4;
|
||||
type MaxTransactionsPerInclusionList = U16;
|
||||
|
||||
fn default_spec() -> ChainSpec {
|
||||
ChainSpec::gnosis()
|
||||
|
||||
53
consensus/types/src/inclusion_list.rs
Normal file
53
consensus/types/src/inclusion_list.rs
Normal file
@@ -0,0 +1,53 @@
|
||||
use crate::test_utils::TestRandom;
|
||||
use crate::{EthSpec, Hash256, Signature, Slot, Transaction};
|
||||
|
||||
use derivative::Derivative;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use ssz_types::VariableList;
|
||||
use test_random_derive::TestRandom;
|
||||
use tree_hash::TreeHash;
|
||||
use tree_hash_derive::TreeHash;
|
||||
|
||||
#[derive(
|
||||
Debug,
|
||||
Clone,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Encode,
|
||||
Decode,
|
||||
TreeHash,
|
||||
TestRandom,
|
||||
Derivative,
|
||||
arbitrary::Arbitrary,
|
||||
)]
|
||||
#[serde(bound = "E: EthSpec")]
|
||||
#[arbitrary(bound = "E: EthSpec")]
|
||||
#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))]
|
||||
pub struct InclusionList<E: EthSpec> {
|
||||
pub slot: Slot,
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub validator_index: u64,
|
||||
pub inclusion_list_committee_root: Hash256,
|
||||
pub transactions:
|
||||
VariableList<Transaction<E::MaxBytesPerTransaction>, E::MaxTransactionsPerInclusionList>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, Derivative, arbitrary::Arbitrary,
|
||||
)]
|
||||
#[serde(bound = "E: EthSpec")]
|
||||
#[arbitrary(bound = "E: EthSpec")]
|
||||
#[derivative(PartialEq, Eq, Hash(bound = "E: EthSpec"))]
|
||||
pub struct SignedInclusionList<E: EthSpec> {
|
||||
pub message: InclusionList<E>,
|
||||
pub signature: Signature,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
ssz_and_tree_hash_tests!(InclusionList<MainnetEthSpec>);
|
||||
}
|
||||
@@ -48,6 +48,7 @@ pub mod fork_versioned_response;
|
||||
pub mod graffiti;
|
||||
pub mod historical_batch;
|
||||
pub mod historical_summary;
|
||||
pub mod inclusion_list;
|
||||
pub mod indexed_attestation;
|
||||
pub mod light_client_bootstrap;
|
||||
pub mod light_client_finality_update;
|
||||
@@ -178,6 +179,7 @@ pub use crate::fork_name::{ForkName, InconsistentFork};
|
||||
pub use crate::fork_versioned_response::{ForkVersionDeserialize, ForkVersionedResponse};
|
||||
pub use crate::graffiti::{Graffiti, GRAFFITI_BYTES_LEN};
|
||||
pub use crate::historical_batch::HistoricalBatch;
|
||||
pub use crate::inclusion_list::{InclusionList, SignedInclusionList};
|
||||
pub use crate::indexed_attestation::{
|
||||
IndexedAttestation, IndexedAttestationBase, IndexedAttestationElectra, IndexedAttestationRef,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user