Skip to content

Commit c8aab39

Browse files
authored
evm: only allow owner to unpause (#444)
* evm: only allow owner to unpause * Extend test to assert owner can still unpause
1 parent 55dce5f commit c8aab39

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

evm/src/NttManager/ManagerBase.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ abstract contract ManagerBase is
312312
_pause();
313313
}
314314

315-
function unpause() public onlyOwnerOrPauser {
315+
function unpause() public onlyOwner {
316316
_unpause();
317317
}
318318

evm/test/NttManager.t.sol

+23
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,29 @@ contract TestNttManager is Test, IRateLimiterEvents {
231231
assertEq(nttManager.isPaused(), false);
232232
}
233233

234+
function test_pausePauserUnpauseOnlyOwner() public {
235+
// transfer pauser to another address
236+
address pauser = address(0x123);
237+
nttManager.transferPauserCapability(pauser);
238+
239+
// execute from pauser context
240+
vm.startPrank(pauser);
241+
assertEq(nttManager.isPaused(), false);
242+
nttManager.pause();
243+
assertEq(nttManager.isPaused(), true);
244+
245+
vm.expectRevert(
246+
abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, pauser)
247+
);
248+
nttManager.unpause();
249+
250+
// execute from owner context
251+
// ensures that owner can still unpause
252+
vm.startPrank(address(this));
253+
nttManager.unpause();
254+
assertEq(nttManager.isPaused(), false);
255+
}
256+
234257
// === deployment with invalid token
235258
function test_brokenToken() public {
236259
DummyToken t = new DummyTokenBroken();

0 commit comments

Comments
 (0)