Currently there are numerous unsafe unwrap()s everywhere, the the codebase should be refactor like such
[ ] - Remove all assert conditions, and instead return a result with an error matching what condition check failed. (So debugging isn't 64 != 39, but invalid root length, etc)
[x] - Use contextual specific errors for internal functions (ie SerializationError on internal conversion functions) then on public facing errors wrap them in VerkleError with an all encompassing error. (This saves on passing an enum on every return in memory, and only for public functions where it is needed)
[ ] - Refactor use of .try_into().unwrap() with either safety comments, or more robust conversions
[ ] - Handle Option returns to either return a Result or safety comments if assumptions can be made
Currently there are numerous unsafe
unwrap()
s everywhere, the the codebase should be refactor like suchassert
conditions, and instead return a result with an error matching what condition check failed. (So debugging isn't 64 != 39, but invalid root length, etc)SerializationError
on internal conversion functions) then on public facing errors wrap them inVerkleError
with an all encompassing error. (This saves on passing an enum on every return in memory, and only for public functions where it is needed).try_into().unwrap()
with either safety comments, or more robust conversionsOption
returns to either return a Result or safety comments if assumptions can be made