mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-19 21:04:41 +00:00
Deneb PR feedback updates (#4716)
* move length update outside of if let in LRU cache * add comment and use hex for G1_POINT_AT_INFINITY * remove some misleading comments from `ssz_snappy` * make sure we can't overflow on blobs by range requests with large counts * downgrade gossip verification internal availability check error * change blob rpc responses from BlockingFnWithManualSendOnIdle to BlockingFn * remove unnecessary collect in blobs by range response * add a comment to blobs by range response start slot logic * typo persist_data_availabilty_checker -> persist_data_availability_checker * unify cheap_state_advance_to_obtain_committees
This commit is contained in:
@@ -1186,7 +1186,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
| AvailabilityCheckError::MissingBlobs
|
||||
| AvailabilityCheckError::StoreError(_)
|
||||
| AvailabilityCheckError::DecodeError(_) => {
|
||||
crit!(
|
||||
warn!(
|
||||
self.log,
|
||||
"Internal availability check error";
|
||||
"error" => ?err,
|
||||
|
||||
@@ -562,9 +562,8 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
request: BlobsByRangeRequest,
|
||||
) -> Result<(), Error<T::EthSpec>> {
|
||||
let processor = self.clone();
|
||||
let process_fn = move |send_idle_on_drop| {
|
||||
processor.handle_blobs_by_range_request(send_idle_on_drop, peer_id, request_id, request)
|
||||
};
|
||||
let process_fn =
|
||||
move || processor.handle_blobs_by_range_request(peer_id, request_id, request);
|
||||
|
||||
self.try_send(BeaconWorkEvent {
|
||||
drop_during_sync: false,
|
||||
@@ -580,9 +579,8 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
request: BlobsByRootRequest,
|
||||
) -> Result<(), Error<T::EthSpec>> {
|
||||
let processor = self.clone();
|
||||
let process_fn = move |send_idle_on_drop| {
|
||||
processor.handle_blobs_by_root_request(send_idle_on_drop, peer_id, request_id, request)
|
||||
};
|
||||
let process_fn =
|
||||
move || processor.handle_blobs_by_root_request(peer_id, request_id, request);
|
||||
|
||||
self.try_send(BeaconWorkEvent {
|
||||
drop_during_sync: false,
|
||||
|
||||
@@ -220,7 +220,6 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
/// Handle a `BlobsByRoot` request from the peer.
|
||||
pub fn handle_blobs_by_root_request(
|
||||
self: Arc<Self>,
|
||||
send_on_drop: SendOnDrop,
|
||||
peer_id: PeerId,
|
||||
request_id: PeerRequestId,
|
||||
request: BlobsByRootRequest,
|
||||
@@ -286,7 +285,6 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
if send_response {
|
||||
self.send_response(peer_id, Response::BlobsByRoot(None), request_id);
|
||||
}
|
||||
drop(send_on_drop);
|
||||
}
|
||||
|
||||
/// Handle a `BlocksByRoot` request from the peer.
|
||||
@@ -607,7 +605,6 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
/// Handle a `BlobsByRange` request from the peer.
|
||||
pub fn handle_blobs_by_range_request(
|
||||
self: Arc<Self>,
|
||||
send_on_drop: SendOnDrop,
|
||||
peer_id: PeerId,
|
||||
request_id: PeerRequestId,
|
||||
req: BlobsByRangeRequest,
|
||||
@@ -619,7 +616,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
);
|
||||
|
||||
// Should not send more than max request blocks
|
||||
if req.count * T::EthSpec::max_blobs_per_block() as u64 > MAX_REQUEST_BLOB_SIDECARS {
|
||||
if req.max_blobs_requested::<T::EthSpec>() > MAX_REQUEST_BLOB_SIDECARS {
|
||||
return self.send_error_response(
|
||||
peer_id,
|
||||
RPCResponseErrorCode::InvalidRequest,
|
||||
@@ -711,13 +708,16 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
}
|
||||
};
|
||||
|
||||
// Pick out the required blocks, ignoring skip-slots.
|
||||
// Use `WhenSlotSkipped::Prev` to get the most recent block root prior to
|
||||
// `request_start_slot` in order to check whether the `request_start_slot` is a skip.
|
||||
let mut last_block_root = req.start_slot.checked_sub(1).and_then(|prev_slot| {
|
||||
self.chain
|
||||
.block_root_at_slot(Slot::new(prev_slot), WhenSlotSkipped::Prev)
|
||||
.ok()
|
||||
.flatten()
|
||||
});
|
||||
|
||||
// Pick out the required blocks, ignoring skip-slots.
|
||||
let maybe_block_roots = process_results(forwards_block_root_iter, |iter| {
|
||||
iter.take_while(|(_, slot)| slot.as_u64() < req.start_slot.saturating_add(req.count))
|
||||
// map skip slots to None
|
||||
@@ -745,7 +745,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
};
|
||||
|
||||
// remove all skip slots
|
||||
let block_roots = block_roots.into_iter().flatten().collect::<Vec<_>>();
|
||||
let block_roots = block_roots.into_iter().flatten();
|
||||
|
||||
let mut blobs_sent = 0;
|
||||
let mut send_response = true;
|
||||
@@ -806,7 +806,5 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
id: request_id,
|
||||
});
|
||||
}
|
||||
|
||||
drop(send_on_drop);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user