Hex encoding/decoding built on the SIMD-accelerated faster-hex crate, a drop-in
replacement for the hex crate: import this module and hex::encode/hex::decode
call sites keep working. See benchmark results in
https://github.com/ChainSafe/forest/pull/7395.
This method will attempt to de-serialize given bytes using the regular
serde_ipld_dagcbor::from_slice. Due to a historical issue in Lotus (see more in
FIP-0027, we must still
support strings with invalid UTF-8 bytes. On a failure, it
will retry the operation using the fallback that will de-serialize
strings with invalid UTF-8 bytes as bytes.
Limit the number of bytes that are used for pre-allocating Vec<Cid>s. This follows what serde is
doing internally with serde::private::size_hint::cautious().
The limit is set to 1 MiB, which is a reasonable upper bound for most use cases.