* Made the compat fuzzer ignore any LimitExceeded error
* Switched from deserialize to deserialize_from
Co-authored-by: Victor Koenders <git@trangar.com>
* Fixed an issue where serde would decode a sequence with an u32 instead of a usize
* Added serde to the `the_same` test for roundtrips, fixed several issues.
* Fixed backwards compatibility for result, ipv4addr and ipv6addr
* Processed feedback
* Fuzz for compatibility with bincode v1
* Make AllTypes recursive
* Revert round trip test (add recursion to it too)
* Update fuzzer lockfile
* Adjust compat fuzzer to be stricter
* data doesn't need to be a &&[u8]
* Added a basic compatibility test to compare bincode 1 and bincode 2 output
* Moved compatibility to the /compatibility/ crate, made bincode-derive support `#[bincode(crate = "bincode_2")]`
* Added decode/deserialize test to test_same
* Added random test cases to compatibility/src/sway.rs
* Added test for bincode_1::options().with_fixint_encoding() and bincode_2::config::legacy(). Added rand license
* Added comments on why the configs are chosen
* Return an error if a decoded slice length doesn't fit into usize
Bincode encodes a slice length, which is an usize, as an u64. When such
an encoded slice length needs to be decoded it again uses an u64 but
critically it truncates it into an usize.
An usize is architecture dependent, it is the size how many bytes it takes to
reference any location in memory. The most common sizes for an usize are 64, 32,
and 16 bit.
This might lead to silent data loss if the architecture that encoded the
slice differs from the architecture that decoded the slice, i.e. if we
go from a 64 bit architecture to a 32 or 16 bit one.
Since bincode aims to be suitable for storage, aiming to support the
exchange of data between different architectures silently truncating
such slice lenghts should be avoided.
This patch changes the behaviour to error out if we try to decode an
slice lenght that can't fit into the current usize type.
* Remove another two usize truncations
* Rename the error variant if the usize doesn't fit anymore
Co-authored-by: Trangar <victor.koenders@gmail.com>
* Fixed an error in bincode derive where it would implement the wrong trait if a generic parameter is present
* Reorganized the derive tests, added a roundtrip test for an enum with generics
* I didn't forget cargo fmt I swear
* Simplified some paths
* Added a guide on how to migrate from bincode 1 to 2
* Removed unneeded dependency on bincode 1
* Processed feedback
* Added a link to the migration guide, added `#[cfg(doc)]` to the doc modules
* Moved Configuration::standard() and ::legacy() to the config module
* Fixed issue with config that would overwrite the limit, added a checklist on adding config variables