Skip to content

Added some more fuzzers in to the source#3003

Open
personnumber3377 wants to merge 1 commit intonimiq:albatrossfrom
personnumber3377:albatross
Open

Added some more fuzzers in to the source#3003
personnumber3377 wants to merge 1 commit intonimiq:albatrossfrom
personnumber3377:albatross

Conversation

@personnumber3377
Copy link

What's in this pull request?

This pull request adds some more fuzzers to the codebase.

Pull request checklist

  • All tests pass. The project builds and runs.
  • I have resolved any merge conflicts.
  • I have resolved all clippy and rustfmt warnings.

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 }
Copy link
Member

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

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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.


// 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// The existance of error implies that contr does not exist.
// The existence of error implies that contract does not exist.


// arg[..30].try_into().unwrap()

let bullshit: &[u8] = data[..(otherdata.len())].try_into().unwrap(); // Yuck!!!
Copy link
Member

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 😉

if (err == None) {
// Contr exists
assert!(contr, "contr didn't exist, even though err == None!!!!"); // Debug.
// Now try to serialize to vec
Copy link
Member

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.

@Eligioo
Copy link
Member

Eligioo commented Oct 31, 2024

Can you squash the commits?

@personnumber3377
Copy link
Author

Hi @Eligioo !

Sorry for my late reply. How do I do that? 😅 I am quite new to git. Is it just git reset --soft main and then git add * and then git commit -m "Squashed commits" as described here ? I am a bit unsure.

Thanks in advance!

@personnumber3377
Copy link
Author

Hi! I cleaned up the code in this commit: 3f13e9e .

@Eligioo
Copy link
Member

Eligioo commented Nov 4, 2024

Hi @Eligioo !

Sorry for my late reply. How do I do that? 😅 I am quite new to git. Is it just git reset --soft main and then git add * and then git commit -m "Squashed commits" as described here ? I am a bit unsure.

Thanks in advance!

You can squash them through git rebase: https://www.youtube.com/watch?v=V5KrD7CmO4o

@jsdanielh
Copy link
Member

Squashed commits and rebased branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants