From 59286323226c11154bebcc011545015d23c60d5e Mon Sep 17 00:00:00 2001 From: Eitan Seri-Levi Date: Thu, 10 Oct 2024 18:47:12 -0700 Subject: [PATCH] move max light client updates to eth spec --- beacon_node/lighthouse_network/src/rpc/methods.rs | 2 +- consensus/types/src/eth_spec.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/beacon_node/lighthouse_network/src/rpc/methods.rs b/beacon_node/lighthouse_network/src/rpc/methods.rs index f2f78ad6bb0..1c1733ece18 100644 --- a/beacon_node/lighthouse_network/src/rpc/methods.rs +++ b/beacon_node/lighthouse_network/src/rpc/methods.rs @@ -493,7 +493,7 @@ pub struct LightClientUpdatesByRangeRequest { impl LightClientUpdatesByRangeRequest { pub fn max_requested(&self) -> u64 { - MAX_REQUEST_LIGHT_CLIENT_UPDATES + E::max_light_client_updates_by_range_requests() as u64 } pub fn ssz_min_len() -> usize { diff --git a/consensus/types/src/eth_spec.rs b/consensus/types/src/eth_spec.rs index 09ef8e3c1a7..b2eef0ce674 100644 --- a/consensus/types/src/eth_spec.rs +++ b/consensus/types/src/eth_spec.rs @@ -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 */ @@ -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. @@ -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() @@ -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, @@ -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()