-
Notifications
You must be signed in to change notification settings - Fork 2.7k
client/network/req-resp: Prevent request id collision #7957
Conversation
`RequestId` is a monotonically increasing integer, starting at `1`. A `RequestId` is unique for a single `RequestResponse` behaviour, but not across multiple `RequestResponse` behaviours. Thus when handling `RequestId` in the context of multiple `RequestResponse` behaviours, one needs to couple the protocol name with the `RequestId` to get a unique request identifier. This commit ensures that pending requests (`pending_requests`) and pending responses (`pending_response_arrival_time`) are tracked both by their protocol name and `RequestId`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only left minor comments / suggestions. Overall looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked the code, however, I did rerun the test. All 3 validators are running fine on my localnet for a little bit more than one day.
|
Thanks everyone for the testing and reviews! Very much appreciated. Judging by the comments / emojis / resolved conversations all suggestions have been addressed, thus I am merging here. In case there is anything else missing I am happy to create another pull request. |
|
bot merge |
|
Trying merge. |
RequestIdis a monotonically increasing integer, starting at1. ARequestIdis unique for a singleRequestResponsebehaviour, but not across multiple
RequestResponsebehaviours. Thuswhen handling
RequestIdin the context of multipleRequestResponsebehaviours, one needs to couple the protocol namewith the
RequestIdto get a unique request identifier.This commit ensures that pending requests (
pending_requests) andpending responses (
pending_response_arrival_time) are tracked both bytheir protocol name and
RequestId.Fixes paritytech/polkadot#2307.