From 68140fa0363ba62fdb9b4b82a3a09872fe93b1a5 Mon Sep 17 00:00:00 2001 From: Jimmy Chen Date: Wed, 28 Jun 2023 16:46:20 +1000 Subject: [PATCH] Update max block request limit to `MAX_REQUEST_BLOCKS_DENEB` to ensure this doesn't cause incompatibilities with other clients. --- .../src/beacon_processor/worker/rpc_methods.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/beacon_node/network/src/beacon_processor/worker/rpc_methods.rs b/beacon_node/network/src/beacon_processor/worker/rpc_methods.rs index faf6325488..0cffa634c8 100644 --- a/beacon_node/network/src/beacon_processor/worker/rpc_methods.rs +++ b/beacon_node/network/src/beacon_processor/worker/rpc_methods.rs @@ -5,7 +5,7 @@ use crate::sync::SyncMessage; use beacon_chain::{BeaconChainError, BeaconChainTypes, HistoricalBlockError, WhenSlotSkipped}; use itertools::process_results; use lighthouse_network::rpc::methods::{ - BlobsByRangeRequest, BlobsByRootRequest, MAX_REQUEST_BLOB_SIDECARS, + BlobsByRangeRequest, BlobsByRootRequest, MAX_REQUEST_BLOB_SIDECARS, MAX_REQUEST_BLOCKS_DENEB, }; use lighthouse_network::rpc::StatusMessage; use lighthouse_network::rpc::*; @@ -384,8 +384,15 @@ impl Worker { ); // Should not send more than max request blocks - if *req.count() > MAX_REQUEST_BLOCKS { - *req.count_mut() = MAX_REQUEST_BLOCKS; + // TODO: We should switch the limit to `MAX_REQUEST_BLOCKS` at the fork, + // or maybe consider switching the max value given the fork context. + if *req.count() > MAX_REQUEST_BLOCKS_DENEB { + return self.send_error_response( + peer_id, + RPCResponseErrorCode::InvalidRequest, + "Request exceeded `MAX_REQUEST_BLOCKS_DENEB`".into(), + request_id, + ); } let forwards_block_root_iter = match self