feat(contract): implement cargo-fuzz testing for register and execute (#98)#132
Merged
ayomideadeniran merged 1 commit intoSoroLabs:mainfrom Mar 29, 2026
Merged
Conversation
…Labs#98) - Add fuzz/fuzz_targets/fuzz_register.rs: fuzzes register() with randomized interval and gas_balance; asserts zero-interval always panics and valid intervals never panic - Add fuzz/fuzz_targets/fuzz_execute.rs: fuzzes execute() with randomized interval, ledger timestamp, and gas_balance to surface unexpected panics in the execution path - Add rlib to contract crate-type so the fuzz harness can link against it - Fix pre-existing missing closing brace in resume_task() - Document how to run fuzzers locally in contract/README.md
|
@MarcusDavidG Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Pr under review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #98
Implements fuzz testing for the SoroTask smart contract using
cargo-fuzz(libFuzzer), targeting the two core functions:registerandexecute.Changes
New:
contract/fuzz/fuzz_targets/fuzz_register.rs— drivesregister()with randomizedintervalandgas_balancebytes. Asserts thatinterval == 0always panics withInvalidIntervaland that any non-zero interval never causes an unexpected panic.fuzz_targets/fuzz_execute.rs— drivesexecute()with randomizedinterval, ledger timestamp, andgas_balance. Catches any unexpected panics outside of the known error variants.Modified:
contract/Cargo.tomlrlibtocrate-typeso the fuzz harness can link against the contract as a library.Fixed:
contract/src/lib.rsresume_task()that was causing a compile error.Updated:
contract/README.mdHow to run