Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: challenger and submitter updated to fisherman.
Browse files Browse the repository at this point in the history
MoonBoi9001 committed Sep 20, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent c16d894 commit ab36655
Showing 2 changed files with 24 additions and 24 deletions.
22 changes: 11 additions & 11 deletions packages/contracts/contracts/disputes/DisputeManager.sol
Original file line number Diff line number Diff line change
@@ -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,7 +355,7 @@ 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
// Get funds from fisherman
_pullSubmitterDeposit(_deposit);

// Create a dispute
@@ -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,13 +470,13 @@ 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
// Get funds from fisherman
_pullSubmitterDeposit(_deposit);

// Create a dispute
@@ -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,7 +621,7 @@ 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 {
@@ -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();
26 changes: 13 additions & 13 deletions packages/subgraph-service/contracts/DisputeManager.sol
Original file line number Diff line number Diff line change
@@ -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,17 +127,17 @@ 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
// Get funds from fisherman
_pullSubmitterDeposit();

// Create a dispute
@@ -146,16 +146,16 @@ 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
// Get funds from fisherman
_pullSubmitterDeposit();

// Create a dispute
@@ -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 {
// 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

0 comments on commit ab36655

Please sign in to comment.