Skip to content

Commit 32be063

Browse files
authored
Support LightClientFinalityUpdate and LightClientOptimisticUpdate rpcs (#3849)
* add light client optimistic and finality update rpc * Arc the updates in the response * add conditional advertisement for both LightClientOptimisticUpdate and LightClientFinalityUpdate * alter display for inboundrequest light client optimistic and finality updates * remove LightClientOptimistic/FinalityReuest struct and some minor fixes * rebase * failing rpc_test for LightClientBootstrap and beginning of MockLib2pLightClient * minor change * added MockRPCHandler by importing everything except OutboundRequest. Need to implement the ConnectionHandler trait now should be copy pastable * almost there but ran into issue where needed to implement BaseOutboundRequest. * failing but running with a light client service of sorts * small test change * changed Protocol::LightClientBootstrap response limit * deleted some stuff from ConnectionHandler Implementation for the mock light client if you need to make something with multiple requests work maybe check here * deleted purging expired inbound/outbound streams code * deleted drive inbound streams that need to be processed * removed unused imports * made things private again * deleted inject_fully_negotiated_inbound * made more things private again * more * turned the logger off in the test * added failing test for new rpc * add rate limit for new rpcs * change InboundUpgrade function to use new rpcs. fmt. add test for LightClientFinalityUpdate * rebasing fix * add LightClientUpdate to handle_rpc functions * added context bytes * fmt * use correct unsed_tcp4_port function * fix for recent config changes and adding context_bytes for the light client protocols * fix clippy complaint * Merge branch 'unstable' into lc-reqresp # Conflicts: # beacon_node/beacon_processor/src/lib.rs # beacon_node/lighthouse_network/src/peer_manager/mod.rs # beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs # beacon_node/lighthouse_network/src/rpc/config.rs # beacon_node/lighthouse_network/src/rpc/methods.rs # beacon_node/lighthouse_network/src/rpc/mod.rs # beacon_node/lighthouse_network/src/rpc/outbound.rs # beacon_node/lighthouse_network/src/rpc/protocol.rs # beacon_node/lighthouse_network/src/rpc/rate_limiter.rs # beacon_node/lighthouse_network/src/rpc/self_limiter.rs # beacon_node/lighthouse_network/src/service/api_types.rs # beacon_node/lighthouse_network/tests/common/mod.rs # beacon_node/lighthouse_network/tests/rpc_tests.rs # beacon_node/network/src/network_beacon_processor/rpc_methods.rs # beacon_node/network/src/router.rs * Error handling updates and various cleanups. * Moar minor clean ups. * Do not ban peer for rate limiting light client requests * Merge branch 'unstable' into lc-reqresp. Also removed the mock light client tests to make it compile (See #4940). # Conflicts: # beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs # beacon_node/lighthouse_network/src/rpc/methods.rs # beacon_node/lighthouse_network/src/rpc/mod.rs # beacon_node/lighthouse_network/src/rpc/protocol.rs # beacon_node/lighthouse_network/src/service/api_types.rs # beacon_node/lighthouse_network/tests/common/mod.rs # beacon_node/network/src/network_beacon_processor/rpc_methods.rs # beacon_node/network/src/router.rs # consensus/types/src/light_client_bootstrap.rs # consensus/types/src/light_client_finality_update.rs # consensus/types/src/light_client_optimistic_update.rs * Remove unnecessary changes * Add missing light client queue handling. * Merge branch 'unstable' into lc-reqresp * Merge branch 'unstable' into lc-reqresp # Conflicts: # beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs # beacon_node/lighthouse_network/src/service/api_types.rs # consensus/types/src/light_client_finality_update.rs # consensus/types/src/light_client_optimistic_update.rs * Add context bytes for light client RPC responses. * Add RPC limits for light client object. * Fix lint * Fix incorrect light client max size computation. * Merge branch 'unstable' into lc-reqresp # Conflicts: # beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs # beacon_node/lighthouse_network/src/rpc/protocol.rs # beacon_node/lighthouse_network/src/service/api_types.rs * Remove unwanted local changes. * Merge branch 'unstable' into lc-reqresp * Replace `unimplemented` electra code path with deneb values.
1 parent 1b88d29 commit 32be063

File tree

19 files changed

+612
-70
lines changed

19 files changed

+612
-70
lines changed

beacon_node/beacon_processor/src/lib.rs

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,14 @@ const MAX_BLS_TO_EXECUTION_CHANGE_QUEUE_LEN: usize = 16_384;
187187
/// will be stored before we start dropping them.
188188
const MAX_LIGHT_CLIENT_BOOTSTRAP_QUEUE_LEN: usize = 1_024;
189189

190+
/// The maximum number of queued `LightClientOptimisticUpdateRequest` objects received from the network RPC that
191+
/// will be stored before we start dropping them.
192+
const MAX_LIGHT_CLIENT_OPTIMISTIC_UPDATE_QUEUE_LEN: usize = 512;
193+
194+
/// The maximum number of queued `LightClientFinalityUpdateRequest` objects received from the network RPC that
195+
/// will be stored before we start dropping them.
196+
const MAX_LIGHT_CLIENT_FINALITY_UPDATE_QUEUE_LEN: usize = 512;
197+
190198
/// The maximum number of priority-0 (highest priority) messages that will be queued before
191199
/// they begin to be dropped.
192200
const MAX_API_REQUEST_P0_QUEUE_LEN: usize = 1_024;
@@ -243,6 +251,8 @@ pub const BLOCKS_BY_ROOTS_REQUEST: &str = "blocks_by_roots_request";
243251
pub const BLOBS_BY_RANGE_REQUEST: &str = "blobs_by_range_request";
244252
pub const BLOBS_BY_ROOTS_REQUEST: &str = "blobs_by_roots_request";
245253
pub const LIGHT_CLIENT_BOOTSTRAP_REQUEST: &str = "light_client_bootstrap";
254+
pub const LIGHT_CLIENT_FINALITY_UPDATE_REQUEST: &str = "light_client_finality_update_request";
255+
pub const LIGHT_CLIENT_OPTIMISTIC_UPDATE_REQUEST: &str = "light_client_optimistic_update_request";
246256
pub const UNKNOWN_BLOCK_ATTESTATION: &str = "unknown_block_attestation";
247257
pub const UNKNOWN_BLOCK_AGGREGATE: &str = "unknown_block_aggregate";
248258
pub const UNKNOWN_LIGHT_CLIENT_UPDATE: &str = "unknown_light_client_update";
@@ -620,6 +630,8 @@ pub enum Work<E: EthSpec> {
620630
BlobsByRootsRequest(BlockingFn),
621631
GossipBlsToExecutionChange(BlockingFn),
622632
LightClientBootstrapRequest(BlockingFn),
633+
LightClientOptimisticUpdateRequest(BlockingFn),
634+
LightClientFinalityUpdateRequest(BlockingFn),
623635
ApiRequestP0(BlockingOrAsync),
624636
ApiRequestP1(BlockingOrAsync),
625637
}
@@ -659,6 +671,8 @@ impl<E: EthSpec> Work<E> {
659671
Work::BlobsByRangeRequest(_) => BLOBS_BY_RANGE_REQUEST,
660672
Work::BlobsByRootsRequest(_) => BLOBS_BY_ROOTS_REQUEST,
661673
Work::LightClientBootstrapRequest(_) => LIGHT_CLIENT_BOOTSTRAP_REQUEST,
674+
Work::LightClientOptimisticUpdateRequest(_) => LIGHT_CLIENT_OPTIMISTIC_UPDATE_REQUEST,
675+
Work::LightClientFinalityUpdateRequest(_) => LIGHT_CLIENT_FINALITY_UPDATE_REQUEST,
662676
Work::UnknownBlockAttestation { .. } => UNKNOWN_BLOCK_ATTESTATION,
663677
Work::UnknownBlockAggregate { .. } => UNKNOWN_BLOCK_AGGREGATE,
664678
Work::GossipBlsToExecutionChange(_) => GOSSIP_BLS_TO_EXECUTION_CHANGE,
@@ -820,7 +834,11 @@ impl<E: EthSpec> BeaconProcessor<E> {
820834
let mut gossip_bls_to_execution_change_queue =
821835
FifoQueue::new(MAX_BLS_TO_EXECUTION_CHANGE_QUEUE_LEN);
822836

823-
let mut lcbootstrap_queue = FifoQueue::new(MAX_LIGHT_CLIENT_BOOTSTRAP_QUEUE_LEN);
837+
let mut lc_bootstrap_queue = FifoQueue::new(MAX_LIGHT_CLIENT_BOOTSTRAP_QUEUE_LEN);
838+
let mut lc_optimistic_update_queue =
839+
FifoQueue::new(MAX_LIGHT_CLIENT_OPTIMISTIC_UPDATE_QUEUE_LEN);
840+
let mut lc_finality_update_queue =
841+
FifoQueue::new(MAX_LIGHT_CLIENT_FINALITY_UPDATE_QUEUE_LEN);
824842

825843
let mut api_request_p0_queue = FifoQueue::new(MAX_API_REQUEST_P0_QUEUE_LEN);
826844
let mut api_request_p1_queue = FifoQueue::new(MAX_API_REQUEST_P1_QUEUE_LEN);
@@ -1137,9 +1155,14 @@ impl<E: EthSpec> BeaconProcessor<E> {
11371155
// Handle backfill sync chain segments.
11381156
} else if let Some(item) = backfill_chain_segment.pop() {
11391157
self.spawn_worker(item, idle_tx);
1140-
// This statement should always be the final else statement.
1141-
} else if let Some(item) = lcbootstrap_queue.pop() {
1158+
// Handle light client requests.
1159+
} else if let Some(item) = lc_bootstrap_queue.pop() {
11421160
self.spawn_worker(item, idle_tx);
1161+
} else if let Some(item) = lc_optimistic_update_queue.pop() {
1162+
self.spawn_worker(item, idle_tx);
1163+
} else if let Some(item) = lc_finality_update_queue.pop() {
1164+
self.spawn_worker(item, idle_tx);
1165+
// This statement should always be the final else statement.
11431166
} else {
11441167
// Let the journal know that a worker is freed and there's nothing else
11451168
// for it to do.
@@ -1249,7 +1272,13 @@ impl<E: EthSpec> BeaconProcessor<E> {
12491272
blbrange_queue.push(work, work_id, &self.log)
12501273
}
12511274
Work::LightClientBootstrapRequest { .. } => {
1252-
lcbootstrap_queue.push(work, work_id, &self.log)
1275+
lc_bootstrap_queue.push(work, work_id, &self.log)
1276+
}
1277+
Work::LightClientOptimisticUpdateRequest { .. } => {
1278+
lc_optimistic_update_queue.push(work, work_id, &self.log)
1279+
}
1280+
Work::LightClientFinalityUpdateRequest { .. } => {
1281+
lc_finality_update_queue.push(work, work_id, &self.log)
12531282
}
12541283
Work::UnknownBlockAttestation { .. } => {
12551284
unknown_block_attestation_queue.push(work)
@@ -1480,7 +1509,9 @@ impl<E: EthSpec> BeaconProcessor<E> {
14801509
| Work::GossipLightClientOptimisticUpdate(process_fn)
14811510
| Work::Status(process_fn)
14821511
| Work::GossipBlsToExecutionChange(process_fn)
1483-
| Work::LightClientBootstrapRequest(process_fn) => {
1512+
| Work::LightClientBootstrapRequest(process_fn)
1513+
| Work::LightClientOptimisticUpdateRequest(process_fn)
1514+
| Work::LightClientFinalityUpdateRequest(process_fn) => {
14841515
task_spawner.spawn_blocking(process_fn)
14851516
}
14861517
};

beacon_node/lighthouse_network/src/peer_manager/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,11 @@ impl<E: EthSpec> PeerManager<E> {
553553
Protocol::BlocksByRange => PeerAction::MidToleranceError,
554554
Protocol::BlocksByRoot => PeerAction::MidToleranceError,
555555
Protocol::BlobsByRange => PeerAction::MidToleranceError,
556-
Protocol::LightClientBootstrap => PeerAction::LowToleranceError,
556+
// Lighthouse does not currently make light client requests; therefore, this
557+
// is an unexpected scenario. We do not ban the peer for rate limiting.
558+
Protocol::LightClientBootstrap => return,
559+
Protocol::LightClientOptimisticUpdate => return,
560+
Protocol::LightClientFinalityUpdate => return,
557561
Protocol::BlobsByRoot => PeerAction::MidToleranceError,
558562
Protocol::Goodbye => PeerAction::LowToleranceError,
559563
Protocol::MetaData => PeerAction::LowToleranceError,
@@ -575,6 +579,8 @@ impl<E: EthSpec> PeerManager<E> {
575579
Protocol::BlobsByRoot => return,
576580
Protocol::Goodbye => return,
577581
Protocol::LightClientBootstrap => return,
582+
Protocol::LightClientOptimisticUpdate => return,
583+
Protocol::LightClientFinalityUpdate => return,
578584
Protocol::MetaData => PeerAction::Fatal,
579585
Protocol::Status => PeerAction::Fatal,
580586
}
@@ -592,6 +598,8 @@ impl<E: EthSpec> PeerManager<E> {
592598
Protocol::BlobsByRange => PeerAction::MidToleranceError,
593599
Protocol::BlobsByRoot => PeerAction::MidToleranceError,
594600
Protocol::LightClientBootstrap => return,
601+
Protocol::LightClientOptimisticUpdate => return,
602+
Protocol::LightClientFinalityUpdate => return,
595603
Protocol::Goodbye => return,
596604
Protocol::MetaData => return,
597605
Protocol::Status => return,

beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs

Lines changed: 81 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ use std::io::{Read, Write};
1515
use std::marker::PhantomData;
1616
use std::sync::Arc;
1717
use tokio_util::codec::{Decoder, Encoder};
18-
use types::ChainSpec;
1918
use types::{
20-
BlobSidecar, EthSpec, ForkContext, ForkName, Hash256, LightClientBootstrap,
21-
RuntimeVariableList, SignedBeaconBlock, SignedBeaconBlockAltair, SignedBeaconBlockBase,
22-
SignedBeaconBlockCapella, SignedBeaconBlockDeneb, SignedBeaconBlockElectra,
23-
SignedBeaconBlockMerge,
19+
BlobSidecar, ChainSpec, EthSpec, ForkContext, ForkName, Hash256, LightClientBootstrap,
20+
LightClientFinalityUpdate, LightClientOptimisticUpdate, RuntimeVariableList, SignedBeaconBlock,
21+
SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockCapella,
22+
SignedBeaconBlockDeneb, SignedBeaconBlockElectra, SignedBeaconBlockMerge,
2423
};
2524
use unsigned_varint::codec::Uvi;
2625

@@ -72,6 +71,8 @@ impl<E: EthSpec> Encoder<RPCCodedResponse<E>> for SSZSnappyInboundCodec<E> {
7271
RPCResponse::BlobsByRange(res) => res.as_ssz_bytes(),
7372
RPCResponse::BlobsByRoot(res) => res.as_ssz_bytes(),
7473
RPCResponse::LightClientBootstrap(res) => res.as_ssz_bytes(),
74+
RPCResponse::LightClientOptimisticUpdate(res) => res.as_ssz_bytes(),
75+
RPCResponse::LightClientFinalityUpdate(res) => res.as_ssz_bytes(),
7576
RPCResponse::Pong(res) => res.data.as_ssz_bytes(),
7677
RPCResponse::MetaData(res) =>
7778
// Encode the correct version of the MetaData response based on the negotiated version.
@@ -387,32 +388,51 @@ fn context_bytes<E: EthSpec>(
387388
// Add the context bytes if required
388389
if protocol.has_context_bytes() {
389390
if let RPCCodedResponse::Success(rpc_variant) = resp {
390-
if let RPCResponse::BlocksByRange(ref_box_block)
391-
| RPCResponse::BlocksByRoot(ref_box_block) = rpc_variant
392-
{
393-
return match **ref_box_block {
394-
// NOTE: If you are adding another fork type here, be sure to modify the
395-
// `fork_context.to_context_bytes()` function to support it as well!
396-
SignedBeaconBlock::Electra { .. } => {
397-
fork_context.to_context_bytes(ForkName::Electra)
398-
}
399-
SignedBeaconBlock::Deneb { .. } => {
400-
fork_context.to_context_bytes(ForkName::Deneb)
401-
}
402-
SignedBeaconBlock::Capella { .. } => {
403-
fork_context.to_context_bytes(ForkName::Capella)
404-
}
405-
SignedBeaconBlock::Merge { .. } => {
406-
fork_context.to_context_bytes(ForkName::Merge)
407-
}
408-
SignedBeaconBlock::Altair { .. } => {
409-
fork_context.to_context_bytes(ForkName::Altair)
410-
}
411-
SignedBeaconBlock::Base { .. } => Some(fork_context.genesis_context_bytes()),
412-
};
413-
}
414-
if let RPCResponse::BlobsByRange(_) | RPCResponse::BlobsByRoot(_) = rpc_variant {
415-
return fork_context.to_context_bytes(ForkName::Deneb);
391+
match rpc_variant {
392+
RPCResponse::BlocksByRange(ref_box_block)
393+
| RPCResponse::BlocksByRoot(ref_box_block) => {
394+
return match **ref_box_block {
395+
// NOTE: If you are adding another fork type here, be sure to modify the
396+
// `fork_context.to_context_bytes()` function to support it as well!
397+
SignedBeaconBlock::Electra { .. } => {
398+
fork_context.to_context_bytes(ForkName::Electra)
399+
}
400+
SignedBeaconBlock::Deneb { .. } => {
401+
fork_context.to_context_bytes(ForkName::Deneb)
402+
}
403+
SignedBeaconBlock::Capella { .. } => {
404+
fork_context.to_context_bytes(ForkName::Capella)
405+
}
406+
SignedBeaconBlock::Merge { .. } => {
407+
fork_context.to_context_bytes(ForkName::Merge)
408+
}
409+
SignedBeaconBlock::Altair { .. } => {
410+
fork_context.to_context_bytes(ForkName::Altair)
411+
}
412+
SignedBeaconBlock::Base { .. } => {
413+
Some(fork_context.genesis_context_bytes())
414+
}
415+
};
416+
}
417+
RPCResponse::BlobsByRange(_) | RPCResponse::BlobsByRoot(_) => {
418+
return fork_context.to_context_bytes(ForkName::Deneb);
419+
}
420+
RPCResponse::LightClientBootstrap(lc_bootstrap) => {
421+
return lc_bootstrap
422+
.map_with_fork_name(|fork_name| fork_context.to_context_bytes(fork_name));
423+
}
424+
RPCResponse::LightClientOptimisticUpdate(lc_optimistic_update) => {
425+
return lc_optimistic_update
426+
.map_with_fork_name(|fork_name| fork_context.to_context_bytes(fork_name));
427+
}
428+
RPCResponse::LightClientFinalityUpdate(lc_finality_update) => {
429+
return lc_finality_update
430+
.map_with_fork_name(|fork_name| fork_context.to_context_bytes(fork_name));
431+
}
432+
// These will not pass the has_context_bytes() check
433+
RPCResponse::Status(_) | RPCResponse::Pong(_) | RPCResponse::MetaData(_) => {
434+
return None;
435+
}
416436
}
417437
}
418438
}
@@ -500,6 +520,12 @@ fn handle_rpc_request<E: EthSpec>(
500520
root: Hash256::from_ssz_bytes(decoded_buffer)?,
501521
}),
502522
)),
523+
SupportedProtocol::LightClientOptimisticUpdateV1 => {
524+
Ok(Some(InboundRequest::LightClientOptimisticUpdate))
525+
}
526+
SupportedProtocol::LightClientFinalityUpdateV1 => {
527+
Ok(Some(InboundRequest::LightClientFinalityUpdate))
528+
}
503529
// MetaData requests return early from InboundUpgrade and do not reach the decoder.
504530
// Handle this case just for completeness.
505531
SupportedProtocol::MetaDataV2 => {
@@ -596,6 +622,30 @@ fn handle_rpc_response<E: EthSpec>(
596622
),
597623
)),
598624
},
625+
SupportedProtocol::LightClientOptimisticUpdateV1 => match fork_name {
626+
Some(fork_name) => Ok(Some(RPCResponse::LightClientOptimisticUpdate(Arc::new(
627+
LightClientOptimisticUpdate::from_ssz_bytes(decoded_buffer, fork_name)?,
628+
)))),
629+
None => Err(RPCError::ErrorResponse(
630+
RPCResponseErrorCode::InvalidRequest,
631+
format!(
632+
"No context bytes provided for {:?} response",
633+
versioned_protocol
634+
),
635+
)),
636+
},
637+
SupportedProtocol::LightClientFinalityUpdateV1 => match fork_name {
638+
Some(fork_name) => Ok(Some(RPCResponse::LightClientFinalityUpdate(Arc::new(
639+
LightClientFinalityUpdate::from_ssz_bytes(decoded_buffer, fork_name)?,
640+
)))),
641+
None => Err(RPCError::ErrorResponse(
642+
RPCResponseErrorCode::InvalidRequest,
643+
format!(
644+
"No context bytes provided for {:?} response",
645+
versioned_protocol
646+
),
647+
)),
648+
},
599649
// MetaData V2 responses have no context bytes, so behave similarly to V1 responses
600650
SupportedProtocol::MetaDataV2 => Ok(Some(RPCResponse::MetaData(MetaData::V2(
601651
MetaDataV2::from_ssz_bytes(decoded_buffer)?,

beacon_node/lighthouse_network/src/rpc/config.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ pub struct RateLimiterConfig {
9292
pub(super) blobs_by_range_quota: Quota,
9393
pub(super) blobs_by_root_quota: Quota,
9494
pub(super) light_client_bootstrap_quota: Quota,
95+
pub(super) light_client_optimistic_update_quota: Quota,
96+
pub(super) light_client_finality_update_quota: Quota,
9597
}
9698

9799
impl RateLimiterConfig {
@@ -104,6 +106,8 @@ impl RateLimiterConfig {
104106
pub const DEFAULT_BLOBS_BY_RANGE_QUOTA: Quota = Quota::n_every(768, 10);
105107
pub const DEFAULT_BLOBS_BY_ROOT_QUOTA: Quota = Quota::n_every(128, 10);
106108
pub const DEFAULT_LIGHT_CLIENT_BOOTSTRAP_QUOTA: Quota = Quota::one_every(10);
109+
pub const DEFAULT_LIGHT_CLIENT_OPTIMISTIC_UPDATE_QUOTA: Quota = Quota::one_every(10);
110+
pub const DEFAULT_LIGHT_CLIENT_FINALITY_UPDATE_QUOTA: Quota = Quota::one_every(10);
107111
}
108112

109113
impl Default for RateLimiterConfig {
@@ -118,6 +122,9 @@ impl Default for RateLimiterConfig {
118122
blobs_by_range_quota: Self::DEFAULT_BLOBS_BY_RANGE_QUOTA,
119123
blobs_by_root_quota: Self::DEFAULT_BLOBS_BY_ROOT_QUOTA,
120124
light_client_bootstrap_quota: Self::DEFAULT_LIGHT_CLIENT_BOOTSTRAP_QUOTA,
125+
light_client_optimistic_update_quota:
126+
Self::DEFAULT_LIGHT_CLIENT_OPTIMISTIC_UPDATE_QUOTA,
127+
light_client_finality_update_quota: Self::DEFAULT_LIGHT_CLIENT_FINALITY_UPDATE_QUOTA,
121128
}
122129
}
123130
}
@@ -164,6 +171,8 @@ impl FromStr for RateLimiterConfig {
164171
let mut blobs_by_range_quota = None;
165172
let mut blobs_by_root_quota = None;
166173
let mut light_client_bootstrap_quota = None;
174+
let mut light_client_optimistic_update_quota = None;
175+
let mut light_client_finality_update_quota = None;
167176

168177
for proto_def in s.split(';') {
169178
let ProtocolQuota { protocol, quota } = proto_def.parse()?;
@@ -180,6 +189,14 @@ impl FromStr for RateLimiterConfig {
180189
Protocol::LightClientBootstrap => {
181190
light_client_bootstrap_quota = light_client_bootstrap_quota.or(quota)
182191
}
192+
Protocol::LightClientOptimisticUpdate => {
193+
light_client_optimistic_update_quota =
194+
light_client_optimistic_update_quota.or(quota)
195+
}
196+
Protocol::LightClientFinalityUpdate => {
197+
light_client_finality_update_quota =
198+
light_client_finality_update_quota.or(quota)
199+
}
183200
}
184201
}
185202
Ok(RateLimiterConfig {
@@ -196,6 +213,10 @@ impl FromStr for RateLimiterConfig {
196213
blobs_by_root_quota: blobs_by_root_quota.unwrap_or(Self::DEFAULT_BLOBS_BY_ROOT_QUOTA),
197214
light_client_bootstrap_quota: light_client_bootstrap_quota
198215
.unwrap_or(Self::DEFAULT_LIGHT_CLIENT_BOOTSTRAP_QUOTA),
216+
light_client_optimistic_update_quota: light_client_optimistic_update_quota
217+
.unwrap_or(Self::DEFAULT_LIGHT_CLIENT_OPTIMISTIC_UPDATE_QUOTA),
218+
light_client_finality_update_quota: light_client_finality_update_quota
219+
.unwrap_or(Self::DEFAULT_LIGHT_CLIENT_FINALITY_UPDATE_QUOTA),
199220
})
200221
}
201222
}

0 commit comments

Comments
 (0)