Skip to content

Commit

Permalink
testCannotGrantRoleFuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
apenzk committed Mar 2, 2025
1 parent 4f15c69 commit f7bbb89
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ contract MOVETokenDevTest is Test {

// Tests that non-admin accounts cannot grant roles by checking for the expected revert
function testCannotGrantRoleFuzz(address messenger, address receiver) public {

// repeat with new test if messenger is multisig or 0
vm.assume(messenger != multisig);
vm.assume(messenger != address(0));
Expand All @@ -151,10 +150,15 @@ contract MOVETokenDevTest is Test {
abi.encodeWithSelector(IAccessControl.AccessControlUnauthorizedAccount.selector, messenger, DEFAULT_ADMIN_ROLE)
);


// Attempt to grant MINTER_ROLE to receiver address
// This should fail since messenger doesn't have DEFAULT_ADMIN_ROLE
token.grantRole(MINTER_ROLE, receiver);
try token.grantRole(MINTER_ROLE, receiver) {
fail();
} catch Error(string memory reason) {
console.log("Revert reason:", reason);
} catch (bytes memory returnData) {
console.logBytes(returnData);
}

vm.stopPrank();
}
Expand Down

0 comments on commit f7bbb89

Please sign in to comment.