Skip to content

Commit

Permalink
move max light client updates to eth spec
Browse files Browse the repository at this point in the history
  • Loading branch information
eserilev committed Oct 11, 2024
1 parent 38423f3 commit 5928632
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/src/rpc/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ pub struct LightClientUpdatesByRangeRequest {

impl LightClientUpdatesByRangeRequest {
pub fn max_requested<E: EthSpec>(&self) -> u64 {
MAX_REQUEST_LIGHT_CLIENT_UPDATES
E::max_light_client_updates_by_range_requests() as u64
}

pub fn ssz_min_len() -> usize {
Expand Down
8 changes: 8 additions & 0 deletions consensus/types/src/eth_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ pub trait EthSpec:
type SyncCommitteeSize: Unsigned + Clone + Sync + Send + Debug + PartialEq;
/// The number of `sync_committee` subnets.
type SyncCommitteeSubnetCount: Unsigned + Clone + Sync + Send + Debug + PartialEq;
type MaxLightClientUpdates: Unsigned + Clone + Sync + Send + Debug + PartialEq;
/*
* New in Bellatrix
*/
Expand Down Expand Up @@ -374,6 +375,10 @@ pub trait EthSpec:
fn kzg_commitments_inclusion_proof_depth() -> usize {
Self::KzgCommitmentsInclusionProofDepth::to_usize()
}

fn max_light_client_updates_by_range_requests() -> usize {
Self::MaxLightClientUpdates::to_usize()
}
}

/// Macro to inherit some type values from another EthSpec.
Expand Down Expand Up @@ -438,6 +443,7 @@ impl EthSpec for MainnetEthSpec {
type MaxAttesterSlashingsElectra = U1;
type MaxAttestationsElectra = U8;
type MaxWithdrawalRequestsPerPayload = U16;
type MaxLightClientUpdates = U128;

fn default_spec() -> ChainSpec {
ChainSpec::mainnet()
Expand Down Expand Up @@ -477,6 +483,7 @@ impl EthSpec for MinimalEthSpec {
type FieldElementsPerExtBlob = U8192;
type BytesPerCell = U2048;
type KzgCommitmentsInclusionProofDepth = U4;
type MaxLightClientUpdates = U128;

params_from_eth_spec!(MainnetEthSpec {
JustificationBitsLength,
Expand Down Expand Up @@ -569,6 +576,7 @@ impl EthSpec for GnosisEthSpec {
type FieldElementsPerExtBlob = U8192;
type BytesPerCell = U2048;
type KzgCommitmentsInclusionProofDepth = U4;
type MaxLightClientUpdates = U128;

fn default_spec() -> ChainSpec {
ChainSpec::gnosis()
Expand Down

0 comments on commit 5928632

Please sign in to comment.