Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
added check to not decrement dispute counter on resolved disputes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramarti committed Feb 16, 2024
1 parent add40cd commit 3bcab65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions contracts/modules/dispute-module/DisputeModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ contract DisputeModule is IDisputeModule, BaseModule, Governable, ReentrancyGuar
/// @param _disputeId The dispute id
function resolveDispute(uint256 _disputeId) external {
Dispute memory dispute = disputes[_disputeId];

if (dispute.currentTag == IN_DISPUTE) revert Errors.DisputeModule__NotAbleToResolve();
if (dispute.currentTag == IN_DISPUTE || dispute.currentTag == bytes32(0)) revert Errors.DisputeModule__NotAbleToResolve();
if (msg.sender != dispute.disputeInitiator) revert Errors.DisputeModule__NotDisputeInitiator();

successfulDisputesPerIp[dispute.targetIpId]--;
Expand Down
5 changes: 5 additions & 0 deletions test/foundry/modules/dispute/DisputeModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@ contract DisputeModuleTest is BaseTest {
vm.startPrank(ipAccount1);
vm.expectRevert(Errors.DisputeModule__NotAbleToResolve.selector);
disputeModule.resolveDispute(1);

// Also if the dispute is already resolved or non-existent
vm.startPrank(ipAccount1);
vm.expectRevert(Errors.DisputeModule__NotAbleToResolve.selector);
disputeModule.resolveDispute(2);
}

function test_DisputeModule_resolveDispute() public {
Expand Down

0 comments on commit 3bcab65

Please sign in to comment.