Skip to content

Commit

Permalink
Merge pull request #346 from ralexstokes/light-client-types
Browse files Browse the repository at this point in the history
Add latest light client types and implement spec tests for them
  • Loading branch information
ralexstokes authored Mar 27, 2024
2 parents 7c82a6c + 0f51efc commit 6c60739
Show file tree
Hide file tree
Showing 20 changed files with 260 additions and 55 deletions.
11 changes: 0 additions & 11 deletions ethereum-consensus/src/altair/light_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,3 @@ pub struct LightClientOptimisticUpdate<const SYNC_COMMITTEE_SIZE: usize> {
pub sync_aggregate: SyncAggregate<SYNC_COMMITTEE_SIZE>,
pub signature_slot: Slot,
}

#[derive(Default, Debug, Clone)]
pub struct LightClientStore<const SYNC_COMMITTEE_SIZE: usize> {
pub finalized_header: LightClientHeader,
pub current_sync_committee: SyncCommittee<SYNC_COMMITTEE_SIZE>,
pub next_sync_committee: SyncCommittee<SYNC_COMMITTEE_SIZE>,
pub best_valid_update: Option<LightClientUpdate<SYNC_COMMITTEE_SIZE>>,
pub optimistic_header: LightClientHeader,
pub previous_max_active_participants: u64,
pub current_max_active_participants: u64,
}
13 changes: 5 additions & 8 deletions ethereum-consensus/src/altair/presets/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ pub const PRESET: Preset = Preset {
pub type SyncAggregate = spec::SyncAggregate<SYNC_COMMITTEE_SIZE>;
pub type SyncCommittee = spec::SyncCommittee<SYNC_COMMITTEE_SIZE>;

pub type LightClientUpdate = crate::altair::light_client::LightClientUpdate<SYNC_COMMITTEE_SIZE>;
pub type LightClientBootstrap =
crate::altair::light_client::LightClientBootstrap<SYNC_COMMITTEE_SIZE>;
pub type LightClientFinalityUpdate =
crate::altair::light_client::LightClientFinalityUpdate<SYNC_COMMITTEE_SIZE>;
pub type LightClientOptimisticUpdate =
crate::altair::light_client::LightClientOptimisticUpdate<SYNC_COMMITTEE_SIZE>;

pub type BeaconState = spec::BeaconState<
SLOTS_PER_HISTORICAL_ROOT,
HISTORICAL_ROOTS_LIMIT,
Expand Down Expand Up @@ -89,3 +81,8 @@ pub type SignedBeaconBlock = spec::SignedBeaconBlock<
pub type SyncCommitteeContribution = spec::SyncCommitteeContribution<SYNC_SUBCOMMITTEE_SIZE>;
pub type ContributionAndProof = spec::ContributionAndProof<SYNC_SUBCOMMITTEE_SIZE>;
pub type SignedContributionAndProof = spec::SignedContributionAndProof<SYNC_SUBCOMMITTEE_SIZE>;

pub type LightClientBootstrap = spec::LightClientBootstrap<SYNC_COMMITTEE_SIZE>;
pub type LightClientUpdate = spec::LightClientUpdate<SYNC_COMMITTEE_SIZE>;
pub type LightClientFinalityUpdate = spec::LightClientFinalityUpdate<SYNC_COMMITTEE_SIZE>;
pub type LightClientOptimisticUpdate = spec::LightClientOptimisticUpdate<SYNC_COMMITTEE_SIZE>;
13 changes: 5 additions & 8 deletions ethereum-consensus/src/altair/presets/minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ pub const PRESET: Preset = Preset {
pub type SyncAggregate = spec::SyncAggregate<SYNC_COMMITTEE_SIZE>;
pub type SyncCommittee = spec::SyncCommittee<SYNC_COMMITTEE_SIZE>;

pub type LightClientUpdate = crate::altair::light_client::LightClientUpdate<SYNC_COMMITTEE_SIZE>;
pub type LightClientBootstrap =
crate::altair::light_client::LightClientBootstrap<SYNC_COMMITTEE_SIZE>;
pub type LightClientFinalityUpdate =
crate::altair::light_client::LightClientFinalityUpdate<SYNC_COMMITTEE_SIZE>;
pub type LightClientOptimisticUpdate =
crate::altair::light_client::LightClientOptimisticUpdate<SYNC_COMMITTEE_SIZE>;

pub type BeaconState = spec::BeaconState<
SLOTS_PER_HISTORICAL_ROOT,
HISTORICAL_ROOTS_LIMIT,
Expand Down Expand Up @@ -89,3 +81,8 @@ pub type SignedBeaconBlock = spec::SignedBeaconBlock<
pub type SyncCommitteeContribution = spec::SyncCommitteeContribution<SYNC_SUBCOMMITTEE_SIZE>;
pub type ContributionAndProof = spec::ContributionAndProof<SYNC_SUBCOMMITTEE_SIZE>;
pub type SignedContributionAndProof = spec::SignedContributionAndProof<SYNC_SUBCOMMITTEE_SIZE>;

pub type LightClientBootstrap = spec::LightClientBootstrap<SYNC_COMMITTEE_SIZE>;
pub type LightClientUpdate = spec::LightClientUpdate<SYNC_COMMITTEE_SIZE>;
pub type LightClientFinalityUpdate = spec::LightClientFinalityUpdate<SYNC_COMMITTEE_SIZE>;
pub type LightClientOptimisticUpdate = spec::LightClientOptimisticUpdate<SYNC_COMMITTEE_SIZE>;
6 changes: 3 additions & 3 deletions ethereum-consensus/src/altair/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ pub use crate::{
},
light_client::{
LightClientBootstrap, LightClientFinalityUpdate, LightClientHeader,
LightClientOptimisticUpdate, LightClientStore, LightClientUpdate,
CURRENT_SYNC_COMMITTEE_INDEX, CURRENT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2,
FINALIZED_ROOT_INDEX, FINALIZED_ROOT_INDEX_FLOOR_LOG_2, NEXT_SYNC_COMMITTEE_INDEX,
LightClientOptimisticUpdate, LightClientUpdate, CURRENT_SYNC_COMMITTEE_INDEX,
CURRENT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2, FINALIZED_ROOT_INDEX,
FINALIZED_ROOT_INDEX_FLOOR_LOG_2, NEXT_SYNC_COMMITTEE_INDEX,
NEXT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2,
},
sync::{SyncAggregate, SyncCommittee},
Expand Down
11 changes: 6 additions & 5 deletions ethereum-consensus/src/bellatrix/presets/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ use crate::bellatrix::spec;
pub use crate::{
altair::presets::mainnet::{
AggregateAndProof, Attestation, AttesterSlashing, ContributionAndProof, HistoricalBatch,
IndexedAttestation, LightClientUpdate, PendingAttestation, SignedAggregateAndProof,
SignedContributionAndProof, SyncAggregate, SyncCommittee, SyncCommitteeContribution,
EPOCHS_PER_HISTORICAL_VECTOR, EPOCHS_PER_SLASHINGS_VECTOR, ETH1_DATA_VOTES_BOUND,
HISTORICAL_ROOTS_LIMIT, MAX_ATTESTATIONS, MAX_ATTESTER_SLASHINGS, MAX_DEPOSITS,
MAX_PROPOSER_SLASHINGS, MAX_VALIDATORS_PER_COMMITTEE, MAX_VOLUNTARY_EXITS,
IndexedAttestation, LightClientBootstrap, LightClientFinalityUpdate,
LightClientOptimisticUpdate, LightClientUpdate, PendingAttestation,
SignedAggregateAndProof, SignedContributionAndProof, SyncAggregate, SyncCommittee,
SyncCommitteeContribution, EPOCHS_PER_HISTORICAL_VECTOR, EPOCHS_PER_SLASHINGS_VECTOR,
ETH1_DATA_VOTES_BOUND, HISTORICAL_ROOTS_LIMIT, MAX_ATTESTATIONS, MAX_ATTESTER_SLASHINGS,
MAX_DEPOSITS, MAX_PROPOSER_SLASHINGS, MAX_VALIDATORS_PER_COMMITTEE, MAX_VOLUNTARY_EXITS,
SLOTS_PER_HISTORICAL_ROOT, SYNC_COMMITTEE_SIZE, VALIDATOR_REGISTRY_LIMIT,
},
bellatrix::presets::Preset,
Expand Down
11 changes: 6 additions & 5 deletions ethereum-consensus/src/bellatrix/presets/minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ use crate::bellatrix::spec;
pub use crate::{
altair::presets::minimal::{
AggregateAndProof, Attestation, AttesterSlashing, ContributionAndProof, HistoricalBatch,
IndexedAttestation, LightClientUpdate, PendingAttestation, SignedAggregateAndProof,
SignedContributionAndProof, SyncAggregate, SyncCommittee, SyncCommitteeContribution,
EPOCHS_PER_HISTORICAL_VECTOR, EPOCHS_PER_SLASHINGS_VECTOR, ETH1_DATA_VOTES_BOUND,
HISTORICAL_ROOTS_LIMIT, MAX_ATTESTATIONS, MAX_ATTESTER_SLASHINGS, MAX_DEPOSITS,
MAX_PROPOSER_SLASHINGS, MAX_VALIDATORS_PER_COMMITTEE, MAX_VOLUNTARY_EXITS,
IndexedAttestation, LightClientBootstrap, LightClientFinalityUpdate,
LightClientOptimisticUpdate, LightClientUpdate, PendingAttestation,
SignedAggregateAndProof, SignedContributionAndProof, SyncAggregate, SyncCommittee,
SyncCommitteeContribution, EPOCHS_PER_HISTORICAL_VECTOR, EPOCHS_PER_SLASHINGS_VECTOR,
ETH1_DATA_VOTES_BOUND, HISTORICAL_ROOTS_LIMIT, MAX_ATTESTATIONS, MAX_ATTESTER_SLASHINGS,
MAX_DEPOSITS, MAX_PROPOSER_SLASHINGS, MAX_VALIDATORS_PER_COMMITTEE, MAX_VOLUNTARY_EXITS,
SLOTS_PER_HISTORICAL_ROOT, SYNC_COMMITTEE_SIZE, VALIDATOR_REGISTRY_LIMIT,
},
bellatrix::presets::Preset,
Expand Down
6 changes: 3 additions & 3 deletions ethereum-consensus/src/bellatrix/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ pub use crate::{
},
light_client::{
LightClientBootstrap, LightClientFinalityUpdate, LightClientHeader,
LightClientOptimisticUpdate, LightClientStore, LightClientUpdate,
CURRENT_SYNC_COMMITTEE_INDEX, CURRENT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2,
FINALIZED_ROOT_INDEX, FINALIZED_ROOT_INDEX_FLOOR_LOG_2, NEXT_SYNC_COMMITTEE_INDEX,
LightClientOptimisticUpdate, LightClientUpdate, CURRENT_SYNC_COMMITTEE_INDEX,
CURRENT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2, FINALIZED_ROOT_INDEX,
FINALIZED_ROOT_INDEX_FLOOR_LOG_2, NEXT_SYNC_COMMITTEE_INDEX,
NEXT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2,
},
sync::{SyncAggregate, SyncCommittee},
Expand Down
71 changes: 71 additions & 0 deletions ethereum-consensus/src/capella/light_client.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
use crate::{
altair::light_client::{
CURRENT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2, FINALIZED_ROOT_INDEX_FLOOR_LOG_2,
NEXT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2,
},
capella::{
execution_payload::ExecutionPayloadHeader, BeaconBlockHeader, SyncAggregate, SyncCommittee,
},
primitives::{Bytes32, Slot},
ssz::prelude::*,
};

pub const EXECUTION_PAYLOAD_INDEX: usize = 25;
pub const EXECUTION_PAYLOAD_INDEX_FLOOR_LOG_2: usize = 4;

#[derive(Default, Debug, Clone, SimpleSerialize, serde::Serialize, serde::Deserialize)]
pub struct LightClientHeader<const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> {
pub beacon: BeaconBlockHeader,
pub execution: ExecutionPayloadHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub execution_branch: Vector<Bytes32, EXECUTION_PAYLOAD_INDEX_FLOOR_LOG_2>,
}

#[derive(Default, Debug, Clone, SimpleSerialize, serde::Serialize, serde::Deserialize)]
pub struct LightClientBootstrap<
const SYNC_COMMITTEE_SIZE: usize,
const BYTES_PER_LOGS_BLOOM: usize,
const MAX_EXTRA_DATA_BYTES: usize,
> {
pub header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub current_sync_committee: SyncCommittee<SYNC_COMMITTEE_SIZE>,
pub current_sync_committee_branch: Vector<Bytes32, CURRENT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2>,
}

#[derive(Default, Debug, Clone, SimpleSerialize, serde::Serialize, serde::Deserialize)]
pub struct LightClientUpdate<
const SYNC_COMMITTEE_SIZE: usize,
const BYTES_PER_LOGS_BLOOM: usize,
const MAX_EXTRA_DATA_BYTES: usize,
> {
pub attested_header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub next_sync_committee: SyncCommittee<SYNC_COMMITTEE_SIZE>,
pub next_sync_committee_branch: Vector<Bytes32, NEXT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2>,
pub finalized_header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub finality_branch: Vector<Bytes32, FINALIZED_ROOT_INDEX_FLOOR_LOG_2>,
pub sync_aggregate: SyncAggregate<SYNC_COMMITTEE_SIZE>,
pub signature_slot: Slot,
}

#[derive(Default, Debug, Clone, SimpleSerialize, serde::Serialize, serde::Deserialize)]
pub struct LightClientFinalityUpdate<
const SYNC_COMMITTEE_SIZE: usize,
const BYTES_PER_LOGS_BLOOM: usize,
const MAX_EXTRA_DATA_BYTES: usize,
> {
pub attested_header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub finalized_header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub finality_branch: Vector<Bytes32, FINALIZED_ROOT_INDEX_FLOOR_LOG_2>,
pub sync_aggregate: SyncAggregate<SYNC_COMMITTEE_SIZE>,
pub signature_slot: Slot,
}

#[derive(Default, Debug, Clone, SimpleSerialize, serde::Serialize, serde::Deserialize)]
pub struct LightClientOptimisticUpdate<
const SYNC_COMMITTEE_SIZE: usize,
const BYTES_PER_LOGS_BLOOM: usize,
const MAX_EXTRA_DATA_BYTES: usize,
> {
pub attested_header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub sync_aggregate: SyncAggregate<SYNC_COMMITTEE_SIZE>,
pub signature_slot: Slot,
}
1 change: 1 addition & 0 deletions ethereum-consensus/src/capella/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub mod execution_payload;
pub mod fork;
pub mod genesis;
pub mod helpers;
pub mod light_client;
pub mod presets;
pub mod spec;
pub mod withdrawal;
Expand Down
18 changes: 17 additions & 1 deletion ethereum-consensus/src/capella/presets/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::capella::spec;
pub use crate::{
bellatrix::presets::mainnet::{
AggregateAndProof, Attestation, AttesterSlashing, ContributionAndProof, HistoricalBatch,
IndexedAttestation, LightClientUpdate, PendingAttestation, SignedAggregateAndProof,
IndexedAttestation, PendingAttestation, SignedAggregateAndProof,
SignedContributionAndProof, SyncAggregate, SyncCommittee, SyncCommitteeContribution,
BYTES_PER_LOGS_BLOOM, EPOCHS_PER_HISTORICAL_VECTOR, EPOCHS_PER_SLASHINGS_VECTOR,
ETH1_DATA_VOTES_BOUND, HISTORICAL_ROOTS_LIMIT, MAX_ATTESTATIONS, MAX_ATTESTER_SLASHINGS,
Expand Down Expand Up @@ -135,3 +135,19 @@ pub type SignedBeaconBlock = spec::SignedBeaconBlock<
MAX_WITHDRAWALS_PER_PAYLOAD,
MAX_BLS_TO_EXECUTION_CHANGES,
>;

pub type LightClientHeader = spec::LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>;
pub type LightClientBootstrap =
spec::LightClientBootstrap<SYNC_COMMITTEE_SIZE, BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>;
pub type LightClientUpdate =
spec::LightClientUpdate<SYNC_COMMITTEE_SIZE, BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>;
pub type LightClientFinalityUpdate = spec::LightClientFinalityUpdate<
SYNC_COMMITTEE_SIZE,
BYTES_PER_LOGS_BLOOM,
MAX_EXTRA_DATA_BYTES,
>;
pub type LightClientOptimisticUpdate = spec::LightClientOptimisticUpdate<
SYNC_COMMITTEE_SIZE,
BYTES_PER_LOGS_BLOOM,
MAX_EXTRA_DATA_BYTES,
>;
18 changes: 17 additions & 1 deletion ethereum-consensus/src/capella/presets/minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::capella::spec;
pub use crate::{
bellatrix::presets::minimal::{
AggregateAndProof, Attestation, AttesterSlashing, ContributionAndProof, HistoricalBatch,
IndexedAttestation, LightClientUpdate, PendingAttestation, SignedAggregateAndProof,
IndexedAttestation, PendingAttestation, SignedAggregateAndProof,
SignedContributionAndProof, SyncAggregate, SyncCommittee, SyncCommitteeContribution,
BYTES_PER_LOGS_BLOOM, EPOCHS_PER_HISTORICAL_VECTOR, EPOCHS_PER_SLASHINGS_VECTOR,
ETH1_DATA_VOTES_BOUND, HISTORICAL_ROOTS_LIMIT, MAX_ATTESTATIONS, MAX_ATTESTER_SLASHINGS,
Expand Down Expand Up @@ -135,3 +135,19 @@ pub type SignedBeaconBlock = spec::SignedBeaconBlock<
MAX_WITHDRAWALS_PER_PAYLOAD,
MAX_BLS_TO_EXECUTION_CHANGES,
>;

pub type LightClientHeader = spec::LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>;
pub type LightClientBootstrap =
spec::LightClientBootstrap<SYNC_COMMITTEE_SIZE, BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>;
pub type LightClientUpdate =
spec::LightClientUpdate<SYNC_COMMITTEE_SIZE, BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>;
pub type LightClientFinalityUpdate = spec::LightClientFinalityUpdate<
SYNC_COMMITTEE_SIZE,
BYTES_PER_LOGS_BLOOM,
MAX_EXTRA_DATA_BYTES,
>;
pub type LightClientOptimisticUpdate = spec::LightClientOptimisticUpdate<
SYNC_COMMITTEE_SIZE,
BYTES_PER_LOGS_BLOOM,
MAX_EXTRA_DATA_BYTES,
>;
7 changes: 5 additions & 2 deletions ethereum-consensus/src/capella/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ pub use crate::{
TIMELY_TARGET_WEIGHT, WEIGHT_DENOMINATOR,
},
light_client::{
LightClientBootstrap, LightClientFinalityUpdate, LightClientHeader,
LightClientOptimisticUpdate, LightClientStore, LightClientUpdate,
CURRENT_SYNC_COMMITTEE_INDEX, CURRENT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2,
FINALIZED_ROOT_INDEX, FINALIZED_ROOT_INDEX_FLOOR_LOG_2, NEXT_SYNC_COMMITTEE_INDEX,
NEXT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2,
Expand Down Expand Up @@ -40,6 +38,11 @@ pub use crate::{
has_eth1_withdrawal_credential, is_fully_withdrawable_validator,
is_partially_withdrawable_validator,
},
light_client::{
LightClientBootstrap, LightClientFinalityUpdate, LightClientHeader,
LightClientOptimisticUpdate, LightClientUpdate, EXECUTION_PAYLOAD_INDEX,
EXECUTION_PAYLOAD_INDEX_FLOOR_LOG_2,
},
withdrawal::Withdrawal,
},
error::*,
Expand Down
69 changes: 69 additions & 0 deletions ethereum-consensus/src/deneb/light_client.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
use crate::{
altair::light_client::{
CURRENT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2, FINALIZED_ROOT_INDEX_FLOOR_LOG_2,
NEXT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2,
},
capella::EXECUTION_PAYLOAD_INDEX_FLOOR_LOG_2,
deneb::{
execution_payload::ExecutionPayloadHeader, BeaconBlockHeader, SyncAggregate, SyncCommittee,
},
primitives::{Bytes32, Slot},
ssz::prelude::*,
};

#[derive(Default, Debug, Clone, SimpleSerialize, serde::Serialize, serde::Deserialize)]
pub struct LightClientHeader<const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> {
pub beacon: BeaconBlockHeader,
pub execution: ExecutionPayloadHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub execution_branch: Vector<Bytes32, EXECUTION_PAYLOAD_INDEX_FLOOR_LOG_2>,
}

#[derive(Default, Debug, Clone, SimpleSerialize, serde::Serialize, serde::Deserialize)]
pub struct LightClientBootstrap<
const SYNC_COMMITTEE_SIZE: usize,
const BYTES_PER_LOGS_BLOOM: usize,
const MAX_EXTRA_DATA_BYTES: usize,
> {
pub header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub current_sync_committee: SyncCommittee<SYNC_COMMITTEE_SIZE>,
pub current_sync_committee_branch: Vector<Bytes32, CURRENT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2>,
}

#[derive(Default, Debug, Clone, SimpleSerialize, serde::Serialize, serde::Deserialize)]
pub struct LightClientUpdate<
const SYNC_COMMITTEE_SIZE: usize,
const BYTES_PER_LOGS_BLOOM: usize,
const MAX_EXTRA_DATA_BYTES: usize,
> {
pub attested_header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub next_sync_committee: SyncCommittee<SYNC_COMMITTEE_SIZE>,
pub next_sync_committee_branch: Vector<Bytes32, NEXT_SYNC_COMMITTEE_INDEX_FLOOR_LOG_2>,
pub finalized_header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub finality_branch: Vector<Bytes32, FINALIZED_ROOT_INDEX_FLOOR_LOG_2>,
pub sync_aggregate: SyncAggregate<SYNC_COMMITTEE_SIZE>,
pub signature_slot: Slot,
}

#[derive(Default, Debug, Clone, SimpleSerialize, serde::Serialize, serde::Deserialize)]
pub struct LightClientFinalityUpdate<
const SYNC_COMMITTEE_SIZE: usize,
const BYTES_PER_LOGS_BLOOM: usize,
const MAX_EXTRA_DATA_BYTES: usize,
> {
pub attested_header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub finalized_header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub finality_branch: Vector<Bytes32, FINALIZED_ROOT_INDEX_FLOOR_LOG_2>,
pub sync_aggregate: SyncAggregate<SYNC_COMMITTEE_SIZE>,
pub signature_slot: Slot,
}

#[derive(Default, Debug, Clone, SimpleSerialize, serde::Serialize, serde::Deserialize)]
pub struct LightClientOptimisticUpdate<
const SYNC_COMMITTEE_SIZE: usize,
const BYTES_PER_LOGS_BLOOM: usize,
const MAX_EXTRA_DATA_BYTES: usize,
> {
pub attested_header: LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>,
pub sync_aggregate: SyncAggregate<SYNC_COMMITTEE_SIZE>,
pub signature_slot: Slot,
}
1 change: 1 addition & 0 deletions ethereum-consensus/src/deneb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub mod execution_payload;
pub mod fork;
pub mod genesis;
pub mod helpers;
pub mod light_client;
pub mod networking;
pub mod polynomial_commitments;
pub mod presets;
Expand Down
18 changes: 17 additions & 1 deletion ethereum-consensus/src/deneb/presets/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::deneb::spec;
pub use crate::{
capella::presets::mainnet::{
AggregateAndProof, Attestation, AttesterSlashing, ContributionAndProof, HistoricalBatch,
IndexedAttestation, LightClientUpdate, PendingAttestation, SignedAggregateAndProof,
IndexedAttestation, PendingAttestation, SignedAggregateAndProof,
SignedContributionAndProof, SyncAggregate, SyncCommittee, SyncCommitteeContribution,
BYTES_PER_LOGS_BLOOM, EPOCHS_PER_HISTORICAL_VECTOR, EPOCHS_PER_SLASHINGS_VECTOR,
ETH1_DATA_VOTES_BOUND, HISTORICAL_ROOTS_LIMIT, MAX_ATTESTATIONS, MAX_ATTESTER_SLASHINGS,
Expand Down Expand Up @@ -152,3 +152,19 @@ pub type SignedBeaconBlock = spec::SignedBeaconBlock<
pub type Blob = spec::Blob<BYTES_PER_BLOB>;
pub type BlobSidecar = spec::BlobSidecar<BYTES_PER_BLOB, KZG_COMMITMENT_INCLUSION_PROOF_DEPTH>;
pub type BlobsBundle = spec::BlobsBundle<BYTES_PER_BLOB>;

pub type LightClientHeader = spec::LightClientHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>;
pub type LightClientBootstrap =
spec::LightClientBootstrap<SYNC_COMMITTEE_SIZE, BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>;
pub type LightClientUpdate =
spec::LightClientUpdate<SYNC_COMMITTEE_SIZE, BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>;
pub type LightClientFinalityUpdate = spec::LightClientFinalityUpdate<
SYNC_COMMITTEE_SIZE,
BYTES_PER_LOGS_BLOOM,
MAX_EXTRA_DATA_BYTES,
>;
pub type LightClientOptimisticUpdate = spec::LightClientOptimisticUpdate<
SYNC_COMMITTEE_SIZE,
BYTES_PER_LOGS_BLOOM,
MAX_EXTRA_DATA_BYTES,
>;
Loading

0 comments on commit 6c60739

Please sign in to comment.