-
Notifications
You must be signed in to change notification settings - Fork 537
Closed
Description
While working on improving the strictness of the RLP decoder in
go-ethereum (ethereum/go-ethereum#711), a few questions have popped up:
Minimal Size
In any context (also for non-scalars), the following encodings
are invalid because their size is not minimal:
| non-canonical encoding | should be |
|---|---|
| 8102 | 02 |
| B800 | 80 |
| B90000 | 80 |
| BA0002FFFF... | B902FFFF... |
The paper doesn't seem to resolve this ambiguity. Should it?
Encoding of fixed-size values
Some ethereum values (such as addresses) have a fixed bit width.
go-ethereum currently accepts byte arrays of smaller size and pads the
resulting value with zero bytes.
Example: when decoding into [20]byte, the input 8101 would be accepted and
would produce {1, 0, 0, 0, ...} as the result.
Should the encoding of fixed size types be restricted so the full number
of bytes must be encoded?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels