Skip to content
Merged
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
24 changes: 13 additions & 11 deletions packages/subgraph-service/contracts/DisputeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,15 @@ contract DisputeManager is
* The disputes are created in reference to an allocationId and specifically
* a POI for that allocation.
* This function is called by a challenger and it will pull `disputeDeposit` GRT tokens.
*
*
* Requirements:
* - Challenger must have previously approved this contract to pull `disputeDeposit` amount
* - Challenger must have previously approved this contract to pull `disputeDeposit` amount
* of tokens from their balance.
*
*
* @param allocationId The allocation to dispute
* @param poi The Proof of Indexing (POI) being disputed
*/
function createIndexingDispute(
address allocationId,
bytes32 poi
) external override returns (bytes32) {
function createIndexingDispute(address allocationId, bytes32 poi) external override returns (bytes32) {
// Get funds from submitter
_pullSubmitterDeposit();

Expand All @@ -150,11 +147,11 @@ contract DisputeManager is
/**
* @notice Create a query dispute for the arbitrator to resolve.
* This function is called by a challenger and it will pull `disputeDeposit` GRT tokens.
*
*
* * Requirements:
* - Challenger must have previously approved this contract to pull `disputeDeposit` amount
* - Challenger must have previously approved this contract to pull `disputeDeposit` amount
* of tokens from their balance.
*
*
* @param attestationData Attestation bytes submitted by the challenger
*/
function createQueryDispute(bytes calldata attestationData) external override returns (bytes32) {
Expand Down Expand Up @@ -296,6 +293,8 @@ contract DisputeManager is

// store dispute status
dispute.status = IDisputeManager.DisputeStatus.Cancelled;

emit DisputeCancelled(disputeId, dispute.indexer, dispute.fisherman, dispute.deposit);
}

/**
Expand Down Expand Up @@ -668,7 +667,10 @@ contract DisputeManager is
* @param _fishermanRewardCut Reward as a percentage of indexer stake
*/
function _setFishermanRewardCut(uint32 _fishermanRewardCut) private {
require(_fishermanRewardCut <= MAX_FISHERMAN_REWARD_CUT, DisputeManagerInvalidFishermanReward(_fishermanRewardCut));
require(
_fishermanRewardCut <= MAX_FISHERMAN_REWARD_CUT,
DisputeManagerInvalidFishermanReward(_fishermanRewardCut)
);
fishermanRewardCut = _fishermanRewardCut;
emit FishermanRewardCutSet(_fishermanRewardCut);
}
Expand Down
15 changes: 13 additions & 2 deletions packages/subgraph-service/contracts/interfaces/IDisputeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,17 @@ interface IDisputeManager {
*/
event DisputeLinked(bytes32 indexed disputeId1, bytes32 indexed disputeId2);

/**
* @dev Emitted when a dispute is cancelled by the fisherman.
* The event emits the amount `tokens` returned to the fisherman.
*/
event DisputeCancelled(
bytes32 indexed disputeId,
address indexed indexer,
address indexed fisherman,
uint256 tokens
);

// -- Errors --

error DisputeManagerNotArbitrator();
Expand Down Expand Up @@ -213,10 +224,10 @@ interface IDisputeManager {

function getAttestationIndexer(Attestation.State memory attestation) external view returns (address);

function getStakeSnapshot(address indexer) external view returns (uint256);

function areConflictingAttestations(
Attestation.State memory attestation1,
Attestation.State memory attestation2
) external pure returns (bool);

function getStakeSnapshot(address indexer) external view returns (uint256);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ library Attestation {
uint256 private constant SIG_S_OFFSET = RECEIPT_SIZE_BYTES + SIG_R_LENGTH;
uint256 private constant SIG_V_OFFSET = RECEIPT_SIZE_BYTES + SIG_R_LENGTH + SIG_S_LENGTH;
uint256 private constant SIG_SIZE_BYTES = SIG_R_LENGTH + SIG_S_LENGTH + SIG_V_LENGTH;

uint256 private constant ATTESTATION_SIZE_BYTES = RECEIPT_SIZE_BYTES + SIG_SIZE_BYTES;

uint256 private constant UINT8_BYTE_LENGTH = 1;
Expand Down
6 changes: 3 additions & 3 deletions packages/subgraph-service/test/SubgraphBaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ abstract contract SubgraphBaseTest is Utils, Constants {
SubgraphService subgraphService;
DisputeManager disputeManager;
IHorizonStaking staking;
IGraphPayments graphPayments;
GraphPayments graphPayments;
IPaymentsEscrow escrow;
ITAPCollector tapCollector;
TAPCollector tapCollector;

HorizonStaking private stakingBase;
HorizonStakingExtension private stakingExtension;
Expand Down Expand Up @@ -196,7 +196,7 @@ abstract contract SubgraphBaseTest is Utils, Constants {
controller.setPaused(false);
}

function createUser(string memory name) private returns (address) {
function createUser(string memory name) internal returns (address) {
address user = makeAddr(name);
vm.deal({ account: user, newBalance: 100 ether });
deal({ token: address(token), to: user, give: 10_000_000_000 ether });
Expand Down
Loading
Loading