Skip to content

RLP Strictness Questions #116

@fjl

Description

@fjl

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions