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

RLP zero encoding fix. #4388

Merged
merged 16 commits into from
Oct 10, 2022
Merged

RLP zero encoding fix. #4388

merged 16 commits into from
Oct 10, 2022

Conversation

mark-terry
Copy link
Contributor

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

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

mark-terry and others added 5 commits September 13, 2022 22:25
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>
@8771
Copy link

8771 commented Sep 14, 2022

22.7.2 has been fix it
#4279

mark-terry and others added 3 commits September 20, 2022 10:07
Signed-off-by: mark-terry <mark.terry@consensys.net>
Signed-off-by: mark-terry <mark.terry@consensys.net>
@mark-terry mark-terry marked this pull request as ready for review September 20, 2022 04:12
Copy link
Contributor

@pinges pinges left a 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

CHANGELOG.md Outdated Show resolved Hide resolved
mark-terry and others added 4 commits October 4, 2022 11:10
Signed-off-by: mark-terry <36909937+mark-terry@users.noreply.github.com>
Signed-off-by: mark-terry <mark.terry@consensys.net>
CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: mark-terry <mark.terry@consensys.net>
Copy link
Contributor

@pinges pinges left a 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)));
Copy link
Contributor

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?

Copy link
Contributor Author

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>
@mark-terry mark-terry merged commit 8527fc1 into hyperledger:main Oct 10, 2022
@mark-terry mark-terry deleted the zero-encoding branch October 10, 2022 13:37
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
* RLP zero encoding fix.

Signed-off-by: mark-terry <mark.terry@consensys.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RLP encoding of 0 (zero) as 0x80
4 participants