Added some more fuzzers in to the source#3003
Added some more fuzzers in to the source#3003personnumber3377 wants to merge 1 commit intonimiq:albatrossfrom
Conversation
fuzz/Cargo.toml
Outdated
| nimiq-primitives = { workspace = true, features = ["key-nibbles", "serde-derive", "trie"] } | ||
| nimiq-serde = { workspace = true } | ||
| nimiq-bls = { workspace = true } | ||
| nimiq-keys = { workspace = true } |
There was a problem hiding this comment.
Usually we try to keep dependency names in alphabetical order
fuzz/src/bin/staking_contract.rs
Outdated
| use nimiq_account::StakingContract; | ||
| let res = StakingContract::deserialize_from_vec(data); // err I think is of type DeserializeError | ||
|
|
||
| // Now check if contr exists. If it does (aka. the original data was a valid staking contract) then try to serialize it back to a vector, then check if the original vector and the new vector are the same, if they aren't then there is a bug in the parsing logic. |
There was a problem hiding this comment.
| // Now check if contr exists. If it does (aka. the original data was a valid staking contract) then try to serialize it back to a vector, then check if the original vector and the new vector are the same, if they aren't then there is a bug in the parsing logic. | |
| // Now check if contract exists. If it does (aka. the original data was a valid staking contract) then try to serialize it back to a vector, then check if the original vector and the new vector are the same, if they aren't then there is a bug in the parsing logic. |
fuzz/src/bin/staking_contract.rs
Outdated
|
|
||
| // Now check if contr exists. If it does (aka. the original data was a valid staking contract) then try to serialize it back to a vector, then check if the original vector and the new vector are the same, if they aren't then there is a bug in the parsing logic. | ||
|
|
||
| // The existance of error implies that contr does not exist. |
There was a problem hiding this comment.
| // The existance of error implies that contr does not exist. | |
| // The existence of error implies that contract does not exist. |
fuzz/src/bin/staking_contract.rs
Outdated
|
|
||
| // arg[..30].try_into().unwrap() | ||
|
|
||
| let bullshit: &[u8] = data[..(otherdata.len())].try_into().unwrap(); // Yuck!!! |
There was a problem hiding this comment.
Please use a proper name for the variable 😉
fuzz/src/bin/staking_contract.rs
Outdated
| if (err == None) { | ||
| // Contr exists | ||
| assert!(contr, "contr didn't exist, even though err == None!!!!"); // Debug. | ||
| // Now try to serialize to vec |
There was a problem hiding this comment.
Please clean up the code in general. Redundant/commented code, test sections, etc.
|
Can you squash the commits? |
|
Hi! I cleaned up the code in this commit: 3f13e9e . |
You can squash them through |
|
Squashed commits and rebased branch |
What's in this pull request?
This pull request adds some more fuzzers to the codebase.
Pull request checklist
clippyandrustfmtwarnings.