Skip to content

MaxEncodedLen macro is not accurate for compact fields, and skipped fields and variants #302

@gui1117

Description

@gui1117

AFAICT MaxEncodedLen doesn't read the attributes #[codec(skip)] and #[codec(encode_as..)] and #[codec(compact)].

Thus it can result in an inaccurate len.

For instance the type:

#[derive(MaxEncodedLen, Encode)]
struct Foo(#[codec(compact)] u8);

will have max encoded len of 1 but can actually encode in 2 bytes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions