Add fuzz tests for admin revoke_role with random addresses - #639
Open
enny791 wants to merge 5 commits into
Open
Conversation
Closes BCPathway#505 - Add proptest dev-dependency to contracts/admin/Cargo.toml - Add fuzz_revoke_role.rs property tests for revoke_role random-address coverage - Include generated fuzz test snapshots and regression input
Closes BCPathway#505 This PR adds robust fuzz coverage for the `admin` contract's `revoke_role` flow using random addresses and all valid role variants. Changes included: - Added `proptest` dev-dependency to `contracts/admin/Cargo.toml` - Added `contracts/admin/src/fuzz_revoke_role.rs` with property-based tests for: - unknown random address revoke returns `RoleNotHeld` - grant then revoke then second revoke behavior - revoking one role preserves other roles held by the same address - revoking a never-granted role while another role is held returns `RoleNotHeld` - Added regression input file `contracts/admin/proptest-regressions/fuzz_revoke_role.txt` - Added generated fuzz test snapshots under `contracts/admin/test_snapshots/fuzz_revoke_role/` The new tests were verified with `cargo test -p bc-forge-admin --all-targets` and `cargo clippy -p bc-forge-admin --all-targets -- -D warnings`.
|
@enny791 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! 🚀 |
- Resolved 64 add/add conflicts in fuzz_mint test snapshot JSON files - All conflicts were in auto-generated i128 random values (hi/lo) - Resolved by accepting PR branch versions (ours) - All token and admin tests pass: 27+104 passed, 0 failed
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.
Closes #505
This PR adds robust fuzz coverage for the
admincontract\u2019srevoke_roleflow using random addresses and all valid role variants.Changes included:
proptestdev-dependency tocontracts/admin/Cargo.tomlcontracts/admin/src/fuzz_revoke_role.rswith property-based tests for:RoleNotHeldRoleNotHeldcontracts/admin/proptest-regressions/fuzz_revoke_role.txtcontracts/admin/test_snapshots/fuzz_revoke_role/The new tests were verified with
cargo test -p bc-forge-admin --all-targetsandcargo clippy -p bc-forge-admin --all-targets -- -D warnings.