fix check on max request size (#4250)

This commit is contained in:
realbigsean 2023-05-02 19:14:02 -04:00 committed by GitHub
parent c1d47da02d
commit 9db6b39dc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -625,7 +625,7 @@ impl<T: BeaconChainTypes> Worker<T> {
); );
// Should not send more than max request blocks // Should not send more than max request blocks
if req.count > MAX_REQUEST_BLOB_SIDECARS { if req.count * T::EthSpec::max_blobs_per_block() as u64 > MAX_REQUEST_BLOB_SIDECARS {
return self.send_error_response( return self.send_error_response(
peer_id, peer_id,
RPCResponseErrorCode::InvalidRequest, RPCResponseErrorCode::InvalidRequest,
@ -808,18 +808,6 @@ impl<T: BeaconChainTypes> Worker<T> {
.slot() .slot()
.unwrap_or_else(|_| self.chain.slot_clock.genesis_slot()); .unwrap_or_else(|_| self.chain.slot_clock.genesis_slot());
if blobs_sent < (req.count as usize) {
debug!(
self.log,
"BlobsByRange Response processed";
"peer" => %peer_id,
"msg" => "Failed to return all requested blobs",
"start_slot" => req.start_slot,
"current_slot" => current_slot,
"requested" => req.count,
"returned" => blobs_sent
);
} else {
debug!( debug!(
self.log, self.log,
"BlobsByRange Response processed"; "BlobsByRange Response processed";
@ -829,7 +817,6 @@ impl<T: BeaconChainTypes> Worker<T> {
"requested" => req.count, "requested" => req.count,
"returned" => blobs_sent "returned" => blobs_sent
); );
}
if send_response { if send_response {
// send the stream terminator // send the stream terminator