Skip to content

Commit 9941cdd

Browse files
committed
fix: add cancellableAt to indexing disputes as well
Signed-off-by: Tomás Migone <[email protected]>
1 parent 2f64c67 commit 9941cdd

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

packages/subgraph-service/contracts/DisputeManager.sol

+12-2
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ contract DisputeManager is
477477

478478
// Store dispute
479479
uint256 stakeSnapshot = _getStakeSnapshot(indexer, provision.tokens);
480+
uint256 cancellableAt = block.timestamp + disputePeriod;
480481
disputes[disputeId] = Dispute(
481482
alloc.indexer,
482483
_fisherman,
@@ -485,11 +486,20 @@ contract DisputeManager is
485486
DisputeType.IndexingDispute,
486487
IDisputeManager.DisputeStatus.Pending,
487488
block.timestamp,
488-
block.timestamp + disputePeriod,
489+
cancellableAt,
489490
stakeSnapshot
490491
);
491492

492-
emit IndexingDisputeCreated(disputeId, alloc.indexer, _fisherman, _deposit, _allocationId, _poi, stakeSnapshot);
493+
emit IndexingDisputeCreated(
494+
disputeId,
495+
alloc.indexer,
496+
_fisherman,
497+
_deposit,
498+
_allocationId,
499+
_poi,
500+
stakeSnapshot,
501+
cancellableAt
502+
);
493503

494504
return disputeId;
495505
}

packages/subgraph-service/contracts/interfaces/IDisputeManager.sol

+3-1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ interface IDisputeManager {
124124
* @param allocationId The allocation id
125125
* @param poi The POI
126126
* @param stakeSnapshot The stake snapshot of the indexer at the time of the dispute
127+
* @param cancellableAt The timestamp when the dispute can be cancelled
127128
*/
128129
event IndexingDisputeCreated(
129130
bytes32 indexed disputeId,
@@ -132,7 +133,8 @@ interface IDisputeManager {
132133
uint256 tokens,
133134
address allocationId,
134135
bytes32 poi,
135-
uint256 stakeSnapshot
136+
uint256 stakeSnapshot,
137+
uint256 cancellableAt
136138
);
137139

138140
/**

packages/subgraph-service/test/disputeManager/DisputeManager.t.sol

+3-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ contract DisputeManagerTest is SubgraphServiceSharedTest {
7676
uint256 beforeFishermanBalance = token.balanceOf(fisherman);
7777
Allocation.State memory alloc = subgraphService.getAllocation(_allocationId);
7878
uint256 stakeSnapshot = disputeManager.getStakeSnapshot(alloc.indexer);
79+
uint256 cancellableAt = block.timestamp + disputeManager.disputePeriod();
7980

8081
// Approve the dispute deposit
8182
token.approve(address(disputeManager), disputeDeposit);
@@ -88,7 +89,8 @@ contract DisputeManagerTest is SubgraphServiceSharedTest {
8889
disputeDeposit,
8990
_allocationId,
9091
_poi,
91-
stakeSnapshot
92+
stakeSnapshot,
93+
cancellableAt
9294
);
9395

9496
// Create the indexing dispute

0 commit comments

Comments
 (0)