Clean up homogeneous composite sedes length pre-conditions
updated the issue: 2020, June 18th
What was wrong?
As https://github.com/ethereum/eth2.0-specs/issues/1863 pointed out, it seems
https://github.com/ethereum/py-ssz/blob/7e9c1079dc503902484003fa6f46f4b8c69c8e1e/ssz/sedes/basic.py#L177-L180
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.~~
- Remove
HomogeneousProperCompositeSedes.__init_() - Update vector types' (
VectorandBitvector)__init__()with illegal conditionmax_length < 1. - Add list types' (
ListandBitlist)__init__()with illegal conditionmax_length < 0.
@hwwhww I think the __inti__()s for Bitvector and Vector have the override mentioned in 2. above? :)
https://github.com/ethereum/py-ssz/blob/7e9c1079dc503902484003fa6f46f4b8c69c8e1e/ssz/sedes/bitvector.py#L19-L22
https://github.com/ethereum/py-ssz/blob/7e9c1079dc503902484003fa6f46f4b8c69c8e1e/ssz/sedes/vector.py#L25-L32
@booleanfunction
You're right, sorry! Fixing the suggested proposal:
- ~~Replace
HomogeneousProperCompositeSedes.__init_()with abstractmethod.~~ RemoveHomogeneousProperCompositeSedes.__init_() - Update vector types' (
VectorandBitvector)__init__()with illegal conditionmax_length < 1. - Add list types' (
ListandBitlist)__init__()with illegal conditionmax_length < 0.
I think this is more clear than overriding?
@hwwhww that seems like a good way to do it :)