ralexstokes / ssz-rs

Implementation of ethereum's `ssz`
Apache License 2.0
102 stars 40 forks source link

harden "entrypoints" to SSZ layer #41

Closed ralexstokes closed 1 year ago

ralexstokes commented 1 year ago

there are several ways to construct valid SSZ objects, e.g. from deserializing some bytes, or using a FromIterator implementation.

let's make sure that any way to consume or produce bytes from this library only allows for valid SSZ. in particular, this means making sure there is no Rust facility to construct "invalid" instances

ralexstokes commented 1 year ago

things to check:

~e.g. https://github.com/ralexstokes/ssz-rs/pull/40/files#diff-650705487933fbad8f64e7e0f19f7dd097808e6c997c95bbfc22e19726d191d2R333~

ralexstokes commented 1 year ago

this was handled in #55

the idea is to only allow a few entry points for the custom types, see the docs here https://github.com/ralexstokes/ssz-rs#custom-types