Repository navigation
Conversation
The spec decoder returns how many bytes it consumed. The user wrapper dropped that count, so a 9-byte buffer decoded as UInt64 1. The SSZ spec names this case extra unused bytes and requires a reject. Compare the count with the buffer size and return trailingBytes when they differ. SSZ.roundtrip still closes: decode_encode already gives a count equal to the encoding size. ReprExamples pins the 9-byte case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #118.
SSZType.deserializereturns the count of bytes it consumed.SSZ.deserializedropped that count, so a 9-byte buffer decoded as theUInt64value1. The SSZ spec names this case extra unused bytes and requires a reject.The wrapper now returns
.error .trailingByteswhen the count differs from the buffer size.SSZ.roundtripstill closes:decode_encodealready gives a count equal to the encoding size.ReprExamplespins the 9-byte case.This is the user-surface half of decoder canonicity. The schema-level half is #81.
LICENSE (LGPL version 3)