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:
- Panic when encoding a list that is too long (not ideal)
- Statically prevent lists from becoming too long in the first place
- 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).
In #84 we are adding progressive lists, and we check that they do not exceed
2^32bytes when decoding. However we don't check this limit when encoding, because the encoding interface provided byethereum_sszis infallible (we cannot return aResult). Our options are either:Encode::to_ssz_bytesto 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_lenafter everypushor list-growing operation, which is probably prohibitively expensive (unless the check can be made very cheap). We would also need to updatepushto be fallible, although this is less invasive a change (and more similar to regularVariableList).