crate-crypto / rust-verkle

Apache License 2.0
119 stars 41 forks source link

Include the length prefix for depth and extension status when serialising #35

Closed kevaundray closed 2 years ago

kevaundray commented 2 years ago

When serialising a variable length of depths and extension status, we do not need to encode the number of depths/extension status, because this matches the number of stems.We could therefore ask the user to provide the number of stems.

This however, means we will need a method which iterates over all of the keys and figures out how many stems we have. This is a linear time operation and also makes for a less than desirable UX. Instead, we can encode the length using a u32 which takes up an extra 4 bytes in the proof, a u16 may also possibly be sufficient, but has not been confirmed, so will stick with a u32.

kevaundray commented 2 years ago

Closed via https://github.com/crate-crypto/rust-verkle/commit/516f6266634143cae9bb3952c769bcba5c1c9933