Skip to content

Add fuzz tests for admin revoke_role with random addresses - #639

Open
enny791 wants to merge 5 commits into
BCPathway:mainfrom
enny791:test/fuzz-revoke-role-random-addresses
Open

Add fuzz tests for admin revoke_role with random addresses#639
enny791 wants to merge 5 commits into
BCPathway:mainfrom
enny791:test/fuzz-revoke-role-random-addresses

Conversation

@enny791

@enny791 enny791 commented Jul 29, 2026

Copy link
Copy Markdown

Closes #505

This PR adds robust fuzz coverage for the admin contract\u2019s 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 added 2 commits July 29, 2026 18:29
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`.
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

enny791 added 3 commits July 30, 2026 11:42
- 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
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.

[Testing] Fuzz: revoke_role with random addresses

1 participant