Skip to content

Commit

Permalink
Prohibit questionable authorized/expiry combinations
Browse files Browse the repository at this point in the history
  • Loading branch information
duncancmt committed Jan 12, 2024
1 parent 9695016 commit 116b3a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/deployer/Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ contract Deployer is TwoStepOwnable, IERC721ViewMetadata {
error FeatureNotInitialized(uint128);

function authorize(uint128 feature, address who, uint96 expiry) public onlyOwner returns (bool) {
require((who == address(0)) == (expiry == 0));
if (feature == 0) {
Panic.panic(Panic.ARITHMETIC_OVERFLOW);
}
Expand Down
6 changes: 3 additions & 3 deletions test/deployer/Deployer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ contract DeployerTest is Test {
deployer.setDescription(1, "nothing to see here");
deployer.authorize(1, auth, uint96(block.timestamp + 1 days));
vm.expectEmit(true, true, false, true, address(deployer));
emit Authorized(1, auth, 0);
assertTrue(deployer.authorize(1, auth, 0));
emit Authorized(1, address(0), 0);
assertTrue(deployer.authorize(1, address(0), 0));
(address who, uint96 expiry) = deployer.authorized(1);
assertEq(who, auth);
assertEq(who, address(0));
assertEq(expiry, 0);
}

Expand Down

0 comments on commit 116b3a1

Please sign in to comment.