Skip to content
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

feat: Multi Asset Delegation pallet fuzzing #856

Merged
merged 7 commits into from
Dec 24, 2024
Merged

feat: Multi Asset Delegation pallet fuzzing #856

merged 7 commits into from
Dec 24, 2024

Conversation

shekohex
Copy link
Contributor

@shekohex shekohex commented Dec 20, 2024

Summary of changes
Changes introduced in this pull request:

This pull request includes the addition of a new fuzzer module for the pallet-multi-asset-delegation. The most important changes include adding new dependencies, updating existing dependencies, and introducing a fuzzer for the pallet-multi-asset-delegation module.

Dependency Updates and Additions:

  • Added honggfuzz dependency to Cargo.toml for fuzz testing.
  • Added multiple optional dependencies for fuzzing in pallets/multi-asset-delegation/Cargo.toml. [1] [2]

Fuzzer Module Addition:

  • Created a new Cargo.toml for the pallet-multi-asset-delegation-fuzzer with dependencies and metadata.
  • Added call.rs file with the implementation of the fuzzer for pallet-multi-asset-delegation.

Codebase Enhancements:

  • Updated the mock and mock_evm modules to be included when the fuzzing feature is enabled.
  • Modified the BlueprintWhitelisted event to use BlueprintId instead of u32.

Run the MAD Fuzzer

  1. Install the honggfuzz CLI using cargo install honggfuzz
  2. Run the fuzzer using cargo hfuzz run mad-fuzzer
  3. Should be running for long time to catch any panics or crashes.

Reference issue to close (if applicable)

There is no task for it right now so I will add the points to this PR.

Copy link
Contributor

@drewstone drewstone left a comment

Choose a reason for hiding this comment

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

Need to also fuzz the precompile, great to see this!

@shekohex
Copy link
Contributor Author

Here is the fuzzer running for 5min with over 1M iterations!

cargo hfuzz run mad-fuzzer

Screenshot of the fuzz running

@shekohex shekohex self-assigned this Dec 23, 2024
@shekohex shekohex marked this pull request as ready for review December 23, 2024 12:29
@shekohex shekohex requested a review from 1xstj as a code owner December 23, 2024 12:29
@shekohex
Copy link
Contributor Author

Need to also fuzz the precompile, great to see this!

Working on it, will create a new PR for EVM Precompile fuzzing.

Copy link
Contributor

@drewstone drewstone left a comment

Choose a reason for hiding this comment

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

Can we add this to CI? Looks good, am curious how you're approaching the comment on checking math, etc.

@shekohex
Copy link
Contributor Author

Yup adding more checks now, maybe @1xstj could help guiding me on what are the important checks that needs to be added in the fuzzed code/state.

@shekohex shekohex requested a review from 1xstj December 24, 2024 13:20
Copy link
Contributor

@1xstj 1xstj left a comment

Choose a reason for hiding this comment

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

LG 🚀

@shekohex shekohex merged commit b1b0084 into main Dec 24, 2024
3 checks passed
@shekohex shekohex deleted the shady/mad-fuzz branch December 24, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Completed ✅
Development

Successfully merging this pull request may close these issues.

3 participants