From 40f4934359c7db33edc4e62ce039368475539fc9 Mon Sep 17 00:00:00 2001 From: MoonBoi9001 Date: Fri, 20 Sep 2024 19:29:55 +0100 Subject: [PATCH] fix: challenger and submitter updated to fisherman. --- .../contracts/disputes/DisputeManager.sol | 30 ++++++++--------- .../contracts/test/unit/disputes/common.ts | 4 +-- .../contracts/DisputeManager.sol | 32 +++++++++---------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/packages/contracts/contracts/disputes/DisputeManager.sol b/packages/contracts/contracts/disputes/DisputeManager.sol index 53bf43b1e..fed301de0 100644 --- a/packages/contracts/contracts/disputes/DisputeManager.sol +++ b/packages/contracts/contracts/disputes/DisputeManager.sol @@ -29,7 +29,7 @@ import "./IDisputeManager.sol"; * Indexers present a Proof of Indexing (POI) when they close allocations to prove * they were indexing a subgraph. The Staking contract emits that proof with the format * keccak256(indexer.address, POI). - * Any challenger can dispute the validity of a POI by submitting a dispute to this contract + * Any fisherman can dispute the validity of a POI by submitting a dispute to this contract * along with a deposit. * * Arbitration: @@ -355,8 +355,8 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa * @param _deposit Amount of tokens staked as deposit */ function createQueryDispute(bytes calldata _attestationData, uint256 _deposit) external override returns (bytes32) { - // Get funds from submitter - _pullSubmitterDeposit(_deposit); + // Get funds from fisherman + _pullFishermanDeposit(_deposit); // Create a dispute return @@ -372,7 +372,7 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa * @dev Create query disputes for two conflicting attestations. * A conflicting attestation is a proof presented by two different indexers * where for the same request on a subgraph the response is different. - * For this type of dispute the submitter is not required to present a deposit + * For this type of dispute the fisherman is not required to present a deposit * as one of the attestation is considered to be right. * Two linked disputes will be created and if the arbitrator resolve one, the other * one will be automatically resolved. @@ -470,14 +470,14 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa /** * @dev Create an indexing dispute for the arbitrator to resolve. * The disputes are created in reference to an allocationID - * This function is called by a challenger that will need to `_deposit` at + * This function is called by a fisherman that will need to `_deposit` at * least `minimumDeposit` GRT tokens. * @param _allocationID The allocation to dispute * @param _deposit Amount of tokens staked as deposit */ function createIndexingDispute(address _allocationID, uint256 _deposit) external override returns (bytes32) { - // Get funds from submitter - _pullSubmitterDeposit(_deposit); + // Get funds from fisherman + _pullFishermanDeposit(_deposit); // Create a dispute return _createIndexingDisputeWithAllocation(msg.sender, _deposit, _allocationID); @@ -485,7 +485,7 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa /** * @dev Create indexing dispute internal function. - * @param _fisherman The challenger creating the dispute + * @param _fisherman The fisherman creating the dispute * @param _deposit Amount of tokens staked as deposit * @param _allocationID Allocation disputed */ @@ -621,10 +621,10 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa } /** - * @dev Pull deposit from submitter account. + * @dev Pull deposit from fisherman account. * @param _deposit Amount of tokens to deposit */ - function _pullSubmitterDeposit(uint256 _deposit) private { + function _pullFishermanDeposit(uint256 _deposit) private { // Ensure that fisherman has staked at least the minimum amount require(_deposit >= minimumDeposit, "Dispute deposit is under minimum required"); @@ -633,17 +633,17 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa } /** - * @dev Make the staking contract slash the indexer and reward the challenger. - * Give the challenger a reward equal to the fishermanRewardPercentage of slashed amount + * @dev Make the staking contract slash the indexer and reward the fisherman. + * Give the fisherman a reward equal to the fishermanRewardPercentage of slashed amount * @param _indexer Address of the indexer - * @param _challenger Address of the challenger + * @param _fisherman Address of the fisherman * @param _disputeType Type of dispute * @return slashAmount Dispute slash amount * @return rewardsAmount Dispute rewards amount */ function _slashIndexer( address _indexer, - address _challenger, + address _fisherman, DisputeType _disputeType ) private returns (uint256 slashAmount, uint256 rewardsAmount) { IStaking staking = staking(); @@ -660,7 +660,7 @@ contract DisputeManager is DisputeManagerV1Storage, GraphUpgradeable, IDisputeMa // Have staking contract slash the indexer and reward the fisherman // Give the fisherman a reward equal to the fishermanRewardPercentage of slashed amount - staking.slash(_indexer, slashAmount, rewardsAmount, _challenger); + staking.slash(_indexer, slashAmount, rewardsAmount, _fisherman); } /** diff --git a/packages/contracts/test/unit/disputes/common.ts b/packages/contracts/test/unit/disputes/common.ts index 37d77fd5a..f72f3c6cf 100644 --- a/packages/contracts/test/unit/disputes/common.ts +++ b/packages/contracts/test/unit/disputes/common.ts @@ -16,7 +16,7 @@ export interface Dispute { export function createQueryDisputeID( attestation: Attestation, indexerAddress: string, - submitterAddress: string, + fishermanAddress: string, ): string { return solidityKeccak256( ['bytes32', 'bytes32', 'bytes32', 'address', 'address'], @@ -25,7 +25,7 @@ export function createQueryDisputeID( attestation.responseCID, attestation.subgraphDeploymentID, indexerAddress, - submitterAddress, + fishermanAddress, ], ) } diff --git a/packages/subgraph-service/contracts/DisputeManager.sol b/packages/subgraph-service/contracts/DisputeManager.sol index 4fe8aa4c6..38a702084 100644 --- a/packages/subgraph-service/contracts/DisputeManager.sol +++ b/packages/subgraph-service/contracts/DisputeManager.sol @@ -34,7 +34,7 @@ import { AttestationManager } from "./utilities/AttestationManager.sol"; * Indexers present a Proof of Indexing (POI) when they close allocations to prove * they were indexing a subgraph. The Staking contract emits that proof with the format * keccak256(indexer.address, POI). - * Any challenger can dispute the validity of a POI by submitting a dispute to this contract + * Any fisherman can dispute the validity of a POI by submitting a dispute to this contract * along with a deposit. * * Arbitration: @@ -127,18 +127,18 @@ contract DisputeManager is * @notice Create an indexing dispute for the arbitrator to resolve. * 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. + * This function is called by a fisherman and it will pull `disputeDeposit` GRT tokens. * * Requirements: - * - Challenger must have previously approved this contract to pull `disputeDeposit` amount + * - fisherman 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) { - // Get funds from submitter - _pullSubmitterDeposit(); + // Get funds from fisherman + _pullFishermanDeposit(); // Create a dispute return _createIndexingDisputeWithAllocation(msg.sender, disputeDeposit, allocationId, poi); @@ -146,17 +146,17 @@ 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. + * This function is called by a fisherman and it will pull `disputeDeposit` GRT tokens. * * * Requirements: - * - Challenger must have previously approved this contract to pull `disputeDeposit` amount + * - fisherman must have previously approved this contract to pull `disputeDeposit` amount * of tokens from their balance. * - * @param attestationData Attestation bytes submitted by the challenger + * @param attestationData Attestation bytes submitted by the fisherman */ function createQueryDispute(bytes calldata attestationData) external override returns (bytes32) { - // Get funds from submitter - _pullSubmitterDeposit(); + // Get funds from fisherman + _pullFishermanDeposit(); // Create a dispute return @@ -172,7 +172,7 @@ contract DisputeManager is * @notice Create query disputes for two conflicting attestations. * A conflicting attestation is a proof presented by two different indexers * where for the same request on a subgraph the response is different. - * For this type of dispute the submitter is not required to present a deposit + * For this type of dispute the fisherman is not required to present a deposit * as one of the attestation is considered to be right. * Two linked disputes will be created and if the arbitrator resolve one, the other * one will be automatically resolved. @@ -515,7 +515,7 @@ contract DisputeManager is /** * @notice Create indexing dispute internal function. - * @param _fisherman The challenger creating the dispute + * @param _fisherman The fisherman creating the dispute * @param _deposit Amount of tokens staked as deposit * @param _allocationId Allocation disputed * @param _poi The POI being disputed @@ -590,16 +590,16 @@ contract DisputeManager is } /** - * @notice Pull `disputeDeposit` from submitter account. + * @notice Pull `disputeDeposit` from fisherman account. */ - function _pullSubmitterDeposit() private { + function _pullFishermanDeposit() private { // Transfer tokens to deposit from fisherman to this contract _graphToken().pullTokens(msg.sender, disputeDeposit); } /** - * @notice Make the subgraph service contract slash the indexer and reward the challenger. - * Give the challenger a reward equal to the fishermanRewardPercentage of slashed amount + * @notice Make the subgraph service contract slash the indexer and reward the fisherman. + * Give the fisherman a reward equal to the fishermanRewardPercentage of slashed amount * @param _indexer Address of the indexer * @param _tokensSlash Amount of tokens to slash from the indexer * @param _tokensStakeSnapshot Snapshot of the indexer's stake at the time of the dispute creation