Skip to content

Commit

Permalink
Do not request current child lookup peers (sigp#5724)
Browse files Browse the repository at this point in the history
* Do not request current child lookup peers

* Update tests
  • Loading branch information
dapplion authored May 13, 2024
1 parent 93e0649 commit f37ffe4
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 288 deletions.
5 changes: 4 additions & 1 deletion beacon_node/network/src/sync/block_lookups/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
block_root,
Some(block_component),
Some(parent_root),
&[peer_id],
// On a `UnknownParentBlock` or `UnknownParentBlob` event the peer is not required
// to have the rest of the block components (refer to decoupled blob gossip). Create
// the lookup with zero peers to house the block components.
&[],
cx,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,15 @@ impl<T: BeaconChainTypes> SingleBlockLookup<T> {
return Err(LookupRequestError::TooManyAttempts { cannot_process });
}

let peer_id = request
.get_state_mut()
.use_rand_available_peer()
.ok_or(LookupRequestError::NoPeers)?;
let Some(peer_id) = request.get_state_mut().use_rand_available_peer() else {
if awaiting_parent {
// Allow lookups awaiting for a parent to have zero peers. If when the parent
// resolve they still have zero peers the lookup will fail gracefully.
return Ok(());
} else {
return Err(LookupRequestError::NoPeers);
}
};

match request.make_request(id, peer_id, downloaded_block_expected_blobs, cx)? {
LookupRequestResult::RequestSent => request.get_state_mut().on_download_start()?,
Expand Down
Loading

0 comments on commit f37ffe4

Please sign in to comment.