Skip to content

Clean up homogeneous composite sedes length pre-conditions #116

@hwwhww

Description

@hwwhww

updated the issue: 2020, June 18th

What was wrong?

As ethereum/consensus-specs#1863 pointed out, it seems

py-ssz/ssz/sedes/basic.py

Lines 177 to 180 in 7e9c107

if max_length < 1:
raise ValueError(
f"(Maximum) length of homogenous composites must be at least 1, got {max_length}"
)

is only for Vector, and then override it in List. It made the illegal condition unclear.

How can it be fixed?

1. Use illegal condition max_length < 0 for HomogeneousProperCompositeSedes (wow it's so long)
2. Override vector types' (Vector and Bitvector) __init__() with illegal condition max_length < 1.

  1. Remove HomogeneousProperCompositeSedes.__init_()
  2. Update vector types' (Vector and Bitvector) __init__() with illegal condition max_length < 1.
  3. Add list types' (List and Bitlist) __init__() with illegal condition max_length < 0.

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