Skip to content

Commit a928e0b

Browse files
fix: applied the requested changes
1 parent 0ddea54 commit a928e0b

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

contracts/disputes/DisputeManager.sol

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -651,37 +651,22 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
651651
TokenUtils.pushTokens(graphToken(), dispute.fisherman, dispute.deposit);
652652

653653
// resolve related dispute if any
654-
_resolveDisputeInConflict(dispute);
654+
_drawDisputeInConflict(dispute);
655655

656656
// store dispute status
657657
dispute.status = IDisputeManager.DisputeStatus.Drawn;
658658

659659
emit DisputeDrawn(_disputeID, dispute.indexer, dispute.fisherman, dispute.deposit);
660660
}
661661

662-
/**
663-
* @dev Resolve a dispute by removing it from storage and returning a memory copy.
664-
* @param _disputeID ID of the dispute to resolve
665-
* @return Dispute
666-
*/
667-
// function _resolveDispute(bytes32 _disputeID) private returns (Dispute memory) {
668-
// require(isDisputeCreated(_disputeID), "Dispute does not exist");
669-
670-
// Dispute memory dispute = disputes[_disputeID];
671-
672-
// // Resolve dispute
673-
// delete disputes[_disputeID]; // Re-entrancy
674-
675-
// return dispute;
676-
// }
677-
678662
/**
679663
* @dev Returns whether the dispute is for a conflicting attestation or not.
680664
* @param _dispute Dispute
681665
* @return True conflicting attestation dispute
682666
*/
683667
function _isDisputeInConflict(Dispute memory _dispute) private view returns (bool) {
684668
bytes32 relatedID = _dispute.relatedDisputeID;
669+
// this is so the check returns false when rejecting the related dispute.
685670
return
686671
relatedID != 0 && disputes[relatedID].status == IDisputeManager.DisputeStatus.Pending;
687672
}
@@ -691,7 +676,7 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa
691676
* @param _dispute Dispute
692677
* @return True if resolved
693678
*/
694-
function _resolveDisputeInConflict(Dispute memory _dispute) private returns (bool) {
679+
function _drawDisputeInConflict(Dispute memory _dispute) private returns (bool) {
695680
if (_isDisputeInConflict(_dispute)) {
696681
bytes32 relatedDisputeID = _dispute.relatedDisputeID;
697682
Dispute storage relatedDispute = disputes[relatedDisputeID];

test/disputes/query.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,10 @@ describe('DisputeManager:Query', async () => {
516516
// Do
517517
await disputeManager.connect(arbitrator.signer).acceptDispute(dID1)
518518
// Check
519+
const mainDispute = await disputeManager.disputes(dID1)
520+
expect(mainDispute.status).to.eq(1) // 1 = DisputeStatus.Accepted
519521
const relatedDispute = await disputeManager.disputes(dID2)
520-
expect(relatedDispute.status).not.eq(3) // 3 = DisputeStatus.Pending
522+
expect(relatedDispute.status).to.eq(2) // 2 = DisputeStatus.Rejected
521523
})
522524

523525
it('should not allow to reject, user need to accept the related dispute ID to reject it', async function () {

0 commit comments

Comments
 (0)