Correct Serialize implementation of BinaryString and upgrade database #276
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After doing some more detailed investigation into the issue I found in PR #275, I've identified that the issue was with our implementation of
Serializate
inBinaryString
.We're currently using
serialize_bytes
to serialize the internal buffer of it, and using<Vec<u8>>::deserialize
to deserialize it. This was fine for a while but after upgrading tormp-serde
version1.1.1
, it has broken. After giving it some thought I've realized that our implementation is outright wrong because we're assumingVec<u8>
and&[u8]
serialize the same. A lot of the time this is true, but it won't always be, so we should stop making that assumption.This PR does just that and instead makes it so we just use
Vec<u8>
's serialize and deserialize implementations. It's easy to implement aVisitor
and continue to useserialize_bytes
but that ends up being a lot of code that we don't need to have. The cost to the database does not exist (I checked) so there's no downside.I've also included a new and upgraded database so that nobody else has to go through the process of updating. This comes with a few snapshot changes but nothing surprising (I am horrified to learn we weren't tracking things like
ChildData
though).