Skip to content

Commit

Permalink
fix: challenger and submitter updated to fisherman.
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonBoi9001 committed Sep 30, 2024
1 parent 99d9bba commit 9503f1d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
30 changes: 15 additions & 15 deletions packages/contracts/contracts/disputes/DisputeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -470,22 +470,22 @@ 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);
}

/**
* @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
*/
Expand Down Expand Up @@ -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");

Expand All @@ -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();
Expand All @@ -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);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/test/unit/disputes/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -25,7 +25,7 @@ export function createQueryDisputeID(
attestation.responseCID,
attestation.subgraphDeploymentID,
indexerAddress,
submitterAddress,
fishermanAddress,
],
)
}
Expand Down
32 changes: 16 additions & 16 deletions packages/subgraph-service/contracts/DisputeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -127,36 +127,36 @@ 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);
}

/**
* @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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9503f1d

Please sign in to comment.