-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added some more fuzzers in to the source #3003
base: albatross
Are you sure you want to change the base?
Conversation
fuzz/Cargo.toml
Outdated
@@ -19,6 +19,11 @@ afl = { version = "0.15.11", optional = true } | |||
nimiq-collections = { workspace = true } | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
What's in this pull request?
This pull request adds some more fuzzers to the codebase.
Pull request checklist
clippy
andrustfmt
warnings.