Skip to content

Handle oversized ProgressiveLists #87

Description

@michaelsproul

In #84 we are adding progressive lists, and we check that they do not exceed 2^32 bytes when decoding. However we don't check this limit when encoding, because the encoding interface provided by ethereum_ssz is infallible (we cannot return a Result). Our options are either:

  1. Panic when encoding a list that is too long (not ideal)
  2. Statically prevent lists from becoming too long in the first place
  3. Change Encode::to_ssz_bytes to be fallible and force callers to handle this (large ripple effect)

The second option would be preferable, however checking this is slightly non-trivial. We would need to evaluate Encode::ssz_bytes_len after every push or list-growing operation, which is probably prohibitively expensive (unless the check can be made very cheap). We would also need to update push to be fallible, although this is less invasive a change (and more similar to regular VariableList).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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