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

Audit fix: Redundant nonce check #194

Closed
Closed
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
6 changes: 1 addition & 5 deletions contracts/committees/TiebreakerCoreCommittee.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ enum ProposalType {
/// @notice This contract allows a committee to vote on and execute proposals for scheduling and resuming sealable addresses
/// @dev Inherits from HashConsensus for voting mechanisms and ProposalsList for proposal management
contract TiebreakerCoreCommittee is ITiebreakerCoreCommittee, HashConsensus, ProposalsList {
error ResumeSealableNonceMismatch();
error ProposalDoesNotExist(uint256 proposalId);
error InvalidSealable(address sealable);

Expand Down Expand Up @@ -120,10 +119,7 @@ contract TiebreakerCoreCommittee is ITiebreakerCoreCommittee, HashConsensus, Pro
if (sealable == address(0)) {
revert InvalidSealable(sealable);
}

if (nonce != _sealableResumeNonces[sealable]) {
revert ResumeSealableNonceMismatch();
}

(bytes memory proposalData, bytes32 key) = _encodeSealableResume(sealable, nonce);
_vote(key, true);
_pushProposal(key, uint256(ProposalType.ResumeSealable), proposalData);
Expand Down
8 changes: 0 additions & 8 deletions test/unit/committees/TiebreakerCore.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ contract TiebreakerCoreUnitTest is UnitTest {
assertFalse(isExecuted);
}

function test_sealableResume_RevertOn_NonceMismatch() external {
uint256 wrongNonce = 999;

vm.prank(committeeMembers[0]);
vm.expectRevert(abi.encodeWithSelector(TiebreakerCoreCommittee.ResumeSealableNonceMismatch.selector));
tiebreakerCore.sealableResume(sealable, wrongNonce);
}

function test_sealableResume_RevertOn_SealableZeroAddress() external {
vm.prank(committeeMembers[0]);
vm.expectRevert(abi.encodeWithSelector(TiebreakerCoreCommittee.InvalidSealable.selector, address(0)));
Expand Down