Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evm: only allow owner to unpause #444

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion evm/src/NttManager/ManagerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ abstract contract ManagerBase is
_pause();
}

function unpause() public onlyOwnerOrPauser {
function unpause() public onlyOwner {
_unpause();
}

Expand Down
23 changes: 23 additions & 0 deletions evm/test/NttManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,29 @@ contract TestNttManager is Test, IRateLimiterEvents {
assertEq(nttManager.isPaused(), false);
}

function test_pausePauserUnpauseOnlyOwner() public {
// transfer pauser to another address
address pauser = address(0x123);
nttManager.transferPauserCapability(pauser);

// execute from pauser context
vm.startPrank(pauser);
assertEq(nttManager.isPaused(), false);
nttManager.pause();
assertEq(nttManager.isPaused(), true);

vm.expectRevert(
abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, pauser)
);
nttManager.unpause();

// execute from owner context
// ensures that owner can still unpause
vm.startPrank(address(this));
nttManager.unpause();
assertEq(nttManager.isPaused(), false);
}

// === deployment with invalid token
function test_brokenToken() public {
DummyToken t = new DummyTokenBroken();
Expand Down
Loading