mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-12 22:45:49 +00:00
Rewrap all comments to 100 line width (#9490)
* reformat everything again * manual formatting * last manual fix * Fix build
This commit is contained in:
@@ -12,18 +12,20 @@ fn main() {
|
||||
fuzz!(|fuzzer_data: &[u8]| {
|
||||
let result_decoded: Result<InnerTestSolutionCompact, Error> =
|
||||
<InnerTestSolutionCompact as codec::Decode>::decode(&mut &fuzzer_data[..]);
|
||||
// Ignore errors as not every random sequence of bytes can be decoded as InnerTestSolutionCompact
|
||||
// Ignore errors as not every random sequence of bytes can be decoded as
|
||||
// InnerTestSolutionCompact
|
||||
if let Ok(decoded) = result_decoded {
|
||||
// Decoding works, let's re-encode it and compare results.
|
||||
let reencoded: std::vec::Vec<u8> = decoded.encode();
|
||||
// The reencoded value may or may not be equal to the original fuzzer output. However, the
|
||||
// original decoder should be optimal (in the sense that there is no shorter encoding of
|
||||
// the same object). So let's see if the fuzzer can find something shorter:
|
||||
// The reencoded value may or may not be equal to the original fuzzer output.
|
||||
// However, the original decoder should be optimal (in the sense that there is no
|
||||
// shorter encoding of the same object). So let's see if the fuzzer can find
|
||||
// something shorter:
|
||||
if fuzzer_data.len() < reencoded.len() {
|
||||
panic!("fuzzer_data.len() < reencoded.len()");
|
||||
}
|
||||
// The reencoded value should definitely be decodable (if unwrap() fails that is a valid
|
||||
// panic/finding for the fuzzer):
|
||||
// The reencoded value should definitely be decodable (if unwrap() fails that is a
|
||||
// valid panic/finding for the fuzzer):
|
||||
let decoded2: InnerTestSolutionCompact =
|
||||
<InnerTestSolutionCompact as codec::Decode>::decode(&mut reencoded.as_slice())
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user