-
Notifications
You must be signed in to change notification settings - Fork 897
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
RLP zero encoding fix. #4388
RLP zero encoding fix. #4388
Conversation
Signed-off-by: mark-terry <mark.terry@consensys.net>
Signed-off-by: mark-terry <mark.terry@consensys.net>
Signed-off-by: mark-terry <mark.terry@consensys.net>
Signed-off-by: mark-terry <mark.terry@consensys.net>
22.7.2 has been fix it |
Signed-off-by: mark-terry <mark.terry@consensys.net>
Signed-off-by: mark-terry <mark.terry@consensys.net>
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.
left 2 comments. Please have a look
ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPOutput.java
Outdated
Show resolved
Hide resolved
Signed-off-by: mark-terry <36909937+mark-terry@users.noreply.github.com>
Signed-off-by: mark-terry <mark.terry@consensys.net>
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.
Please have a look at my comment.
@@ -187,7 +188,7 @@ default void writeLong(final long l) { | |||
* {@code b < 0} or {@code b > 0xFF}. | |||
*/ | |||
default void writeUnsignedByte(final int b) { | |||
writeBytes(Bytes.of(b)); | |||
processZeroByte(Long.valueOf(b), a -> writeBytes(Bytes.of(b))); |
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.
As b is an integer, could Bytes.of(b) be more than one byte long? With the other writeUnsignedXXX we are making sure that there aren't more bytes than we want (e.g. Bytes.ofUnsignedShort in writeUnsignedShort). Do we have to do something similar here as well?
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.
Within Bytes.of() there's a check to confirm whether the value fits within a byte, which throws an IllegalArgumentException if the value would be truncated.
Signed-off-by: mark-terry <mark.terry@consensys.net>
* RLP zero encoding fix. Signed-off-by: mark-terry <mark.terry@consensys.net>
Signed-off-by: mark-terry mark.terry@consensys.net
PR description
Updates the RLPOutput encoding to encode 0 as 0x80
Fixed Issue(s)
Fixes #4284
Documentation
doc-change-required
label to this PR ifupdates are required.
Changelog