-
Notifications
You must be signed in to change notification settings - Fork 130
[PAN-2811] Be more lenient with discovery message deserialization #1580
[PAN-2811] Be more lenient with discovery message deserialization #1580
Conversation
@@ -52,7 +52,7 @@ public static FindNeighborsPacketData readFrom(final RLPInput in) { | |||
in.enterList(); | |||
final BytesValue target = in.readBytesValue(); | |||
final long expiration = in.readLongScalar(); | |||
in.leaveList(); | |||
in.leaveList(true); |
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.
(optional) make leaveList parameter an enum. Much easier to understand what
in.leaveList(RLPInput.IgnoreRest)
does as opposed to in.leaveList(true)
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'd say either @RatanRSur's suggestion or at least leave a comment that (true) means to ignore the rest of the list, for all the leaveList(true)
calls.
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.
Third option would be to have two methods - the usual leaveList
and the new leaveListSkippingRemainingElements
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.
Changed this to leaveListLenient()
@@ -52,7 +52,7 @@ public static FindNeighborsPacketData readFrom(final RLPInput in) { | |||
in.enterList(); | |||
final BytesValue target = in.readBytesValue(); | |||
final long expiration = in.readLongScalar(); | |||
in.leaveList(); | |||
in.leaveList(true); |
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'd say either @RatanRSur's suggestion or at least leave a comment that (true) means to ignore the rest of the list, for all the leaveList(true)
calls.
PR description
EIP-8 specifies that devp2p discovery message deserialization should be lenient in order to make protocol upgrades easier. This PR updates discovery packet deserialization to be more lenient by: