The following code hits an unreachable!() call in keyvalues-serde
use std::collections::BTreeMap;
fn main() {
let _ = keyvalues_serde::to_string(&BTreeMap::<(), ()>::new());
}
Using an unreachable!() was very naive in hindsite. It's pretty trivial to feed the serializer a data format that doesn't match what VDF can represent. The library should return an error here indicating that it doesn't match the expected format
In this case it almost matched the expected format expect it didn't provide a top level key. This will likely be the most common error to see, so we should ideally try to detect this case and emit an error mentioning the _with_key() family of functions that should do the trick for most people
The following code hits an
unreachable!()
call inkeyvalues-serde
Using an
unreachable!()
was very naive in hindsite. It's pretty trivial to feed the serializer a data format that doesn't match what VDF can represent. The library should return an error here indicating that it doesn't match the expected formatIn this case it almost matched the expected format expect it didn't provide a top level key. This will likely be the most common error to see, so we should ideally try to detect this case and emit an error mentioning the
_with_key()
family of functions that should do the trick for most people