Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 1 count block request to return 0 blocks #5554

Merged
merged 2 commits into from
Apr 12, 2024

Conversation

dapplion
Copy link
Collaborator

Issue Addressed

Noted the following bug in ReqResp logic:

  • We issue a ReqResp request for blocks where the count of requested elements is 1
  • The peer does not have the requested element and returns 0 elements
  • We consider that a protocol violation with RPCError::IncompleteStream

Not having a block or blob is tolerated as per the req resp spec. It's the downstream caller that should decide if the peer should have or not that specific element.

Proposed Changes

Rename expected_responses to max_responses, as for multiple responses that what the number really represents. The peer is allow to return less than the request count of elements, including 0.

Add a new function expect_exactly_one_response to differentiate those request where closing the stream before the first element is actually a protocol violation (e.g. status method)

I have reversed some of the if else cases, (from if !condition A else B to if condition B else A, but the actual logic is unchanged.

Additional Info

Please provide any additional information. For example, future considerations
or information useful for reviewers.

Copy link
Member

@pawanjay176 pawanjay176 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. LGTM

beacon_node/lighthouse_network/src/rpc/outbound.rs Outdated Show resolved Hide resolved
beacon_node/lighthouse_network/src/rpc/rate_limiter.rs Outdated Show resolved Hide resolved
beacon_node/lighthouse_network/src/rpc/handler.rs Outdated Show resolved Hide resolved
@realbigsean realbigsean added the ready-for-merge This PR is ready to merge. label Apr 11, 2024
@realbigsean
Copy link
Member

@Mergifyio queue

Copy link

mergify bot commented Apr 12, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 5fdd3b3

mergify bot added a commit that referenced this pull request Apr 12, 2024
mergify bot added a commit that referenced this pull request Apr 12, 2024
@mergify mergify bot merged commit 5fdd3b3 into sigp:unstable Apr 12, 2024
29 checks passed
@dapplion dapplion deleted the reqresp-expected-responses branch April 12, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge This PR is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants