@@ -59,6 +59,9 @@ contract DisputeManager is
5959 // Maximum value for fisherman reward cut in PPM
6060 uint32 public constant MAX_FISHERMAN_REWARD_CUT = 500000 ;
6161
62+ // Minimum value for dispute deposit
63+ uint256 public constant MIN_DISPUTE_DEPOSIT = 1e18 ; // 1 GRT
64+
6265 // -- Modifiers --
6366
6467 /**
@@ -174,10 +177,14 @@ contract DisputeManager is
174177 * @notice Create query disputes for two conflicting attestations.
175178 * A conflicting attestation is a proof presented by two different indexers
176179 * where for the same request on a subgraph the response is different.
177- * For this type of dispute the fisherman is not required to present a deposit
178- * as one of the attestation is considered to be right.
180+ * For this type of dispute it's safe to assume one of the attestations is incorrect
181+ * so the fisherman's deposit would not be necesarry, however to prevent spam attacks
182+ * we still require it.
179183 * Two linked disputes will be created and if the arbitrator resolve one, the other
180184 * one will be automatically resolved.
185+ * Requirements:
186+ * - fisherman must have previously approved this contract to pull `disputeDeposit` amount
187+ * of tokens from their balance.
181188 * @param attestationData1 First attestation data submitted
182189 * @param attestationData2 Second attestation data submitted
183190 * @return DisputeId1, DisputeId2
@@ -205,10 +212,23 @@ contract DisputeManager is
205212 )
206213 );
207214
215+ // Get funds from fisherman
216+ _pullFishermanDeposit ();
217+
208218 // Create the disputes
209219 // The deposit is zero for conflicting attestations
210- bytes32 dId1 = _createQueryDisputeWithAttestation (fisherman, 0 , attestation1, attestationData1);
211- bytes32 dId2 = _createQueryDisputeWithAttestation (fisherman, 0 , attestation2, attestationData2);
220+ bytes32 dId1 = _createQueryDisputeWithAttestation (
221+ fisherman,
222+ disputeDeposit / 2 ,
223+ attestation1,
224+ attestationData1
225+ );
226+ bytes32 dId2 = _createQueryDisputeWithAttestation (
227+ fisherman,
228+ disputeDeposit / 2 ,
229+ attestation2,
230+ attestationData2
231+ );
212232
213233 // Store the linked disputes to be resolved
214234 disputes[dId1].relatedDisputeId = dId2;
@@ -658,7 +678,7 @@ contract DisputeManager is
658678 * @param _disputeDeposit The dispute deposit in Graph Tokens
659679 */
660680 function _setDisputeDeposit (uint256 _disputeDeposit ) private {
661- require (_disputeDeposit != 0 , DisputeManagerInvalidDisputeDeposit (_disputeDeposit));
681+ require (_disputeDeposit >= MIN_DISPUTE_DEPOSIT , DisputeManagerInvalidDisputeDeposit (_disputeDeposit));
662682 disputeDeposit = _disputeDeposit;
663683 emit DisputeDepositSet (_disputeDeposit);
664684 }
0 commit comments