Closed dvdplm closed 3 weeks ago
cc @daxpedda
I actually think this is an invalid issue, here's why: bincode::deserialize()
does this:
bincode::DefaultOptions::new()
.with_fixint_encoding()
.allow_trailing_bytes()
.deserialize::<U64>(&three_ser)
…but what we want here is for bincode to reject trailing bytes:
bincode::DefaultOptions::new()
.with_fixint_encoding()
.reject_trailing_bytes()
.deserialize::<U64>(&three_ser)
It's a bit of a foot gun I guess, but definitely "user error". Not sure what we should do here though. Keep the test as a warning? Add some docs somewhere?
During work on #604 I noticed that when deserializing a serialized bigger
Uint
into a smaller one, the deserialization "works", but yields a truncated number. See this test for an illustration of the current behaviour.Correct behaviour is for the deserialization to fail.