diff --git a/src/ProxyAdminMultiSig.sol b/src/ProxyAdminMultiSig.sol index 821ec49..8d03432 100644 --- a/src/ProxyAdminMultiSig.sol +++ b/src/ProxyAdminMultiSig.sol @@ -112,6 +112,10 @@ contract ProxyAdminMultiSig is IErrors { /// @dev executes a proposal function executeProposal(uint256 proposalId) external onlyOwner { + if (!_isPendingProposal(proposalId)) { + revert NotPendingProposal(); + } + Proposal storage p = _proposals[proposalId]; if (p.approvalCount < _threshold) { revert NotEnoughApproval(); diff --git a/test/ProxyAdminMultiSig.t.sol b/test/ProxyAdminMultiSig.t.sol index 4e8207f..aeea752 100644 --- a/test/ProxyAdminMultiSig.t.sol +++ b/test/ProxyAdminMultiSig.t.sol @@ -514,13 +514,25 @@ contract MultiSigTest is IErrors, Test, Utils { vm.expectRevert(NotOwner.selector); multiSig.executeProposal(proposalId); - // case 2: not enough approval + // case 2: proposal not exist + vm.expectRevert(NotPendingProposal.selector); + vm.prank(alice); + multiSig.executeProposal(200); + + // case 3: not enough approval vm.prank(alice); multiSig.approveProposal(proposalId); vm.expectRevert(NotEnoughApproval.selector); vm.prank(bob); multiSig.executeProposal(proposalId); + + // case 4: can't execute deleted proposal + vm.prank(bob); + multiSig.deleteProposal(proposalId); + vm.expectRevert(NotPendingProposal.selector); + vm.prank(charlie); + multiSig.executeProposal(proposalId); } function testGetAllProposals() public {