From f79dc2e184e98a5fa47014a4341c64e36e0e75ec Mon Sep 17 00:00:00 2001 From: MoonBoi9001 Date: Wed, 2 Oct 2024 16:47:31 +0100 Subject: [PATCH] fix: remove redundant getDisputePeriod function --- packages/subgraph-service/contracts/DisputeManager.sol | 8 -------- packages/subgraph-service/contracts/SubgraphService.sol | 6 +++--- .../contracts/interfaces/IDisputeManager.sol | 2 -- .../test/subgraphService/SubgraphService.t.sol | 2 +- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/packages/subgraph-service/contracts/DisputeManager.sol b/packages/subgraph-service/contracts/DisputeManager.sol index 8bf0f363b..b49a0ded7 100644 --- a/packages/subgraph-service/contracts/DisputeManager.sol +++ b/packages/subgraph-service/contracts/DisputeManager.sol @@ -370,14 +370,6 @@ contract DisputeManager is return fishermanRewardCut; } - /** - * @notice Get the dispute period. - * @return Dispute period in seconds - */ - function getDisputePeriod() external view override returns (uint64) { - return disputePeriod; - } - /** * @notice Get the stake snapshot for an indexer. * @param indexer The indexer address diff --git a/packages/subgraph-service/contracts/SubgraphService.sol b/packages/subgraph-service/contracts/SubgraphService.sol index e50762453..ca4d50870 100644 --- a/packages/subgraph-service/contracts/SubgraphService.sol +++ b/packages/subgraph-service/contracts/SubgraphService.sol @@ -475,11 +475,11 @@ contract SubgraphService is /** * @notice Getter for the accepted thawing period range for provisions * @dev This override ensures {ProvisionManager} uses the thawing period from the {DisputeManager} - * @return min The minimum thawing period which is defined by {DisputeManager-getDisputePeriod} + * @return min The minimum thawing period which is defined by {DisputeManager-disputePeriod} * @return max The maximum is unbounded */ function _getThawingPeriodRange() internal view override returns (uint64 min, uint64 max) { - uint64 disputePeriod = _disputeManager().getDisputePeriod(); + uint64 disputePeriod = _disputeManager().disputePeriod(); return (disputePeriod, type(uint64).max); } @@ -549,7 +549,7 @@ contract SubgraphService is if (tokensCollected > 0) { // lock stake as economic security for fees uint256 tokensToLock = tokensCollected * stakeToFeesRatio; - uint256 unlockTimestamp = block.timestamp + _disputeManager().getDisputePeriod(); + uint256 unlockTimestamp = block.timestamp + _disputeManager().disputePeriod(); _lockStake(indexer, tokensToLock, unlockTimestamp); if (tokensCurators > 0) { diff --git a/packages/subgraph-service/contracts/interfaces/IDisputeManager.sol b/packages/subgraph-service/contracts/interfaces/IDisputeManager.sol index 95511ecc2..01cc10a25 100644 --- a/packages/subgraph-service/contracts/interfaces/IDisputeManager.sol +++ b/packages/subgraph-service/contracts/interfaces/IDisputeManager.sol @@ -216,8 +216,6 @@ interface IDisputeManager { function getVerifierCut() external view returns (uint32); - function getDisputePeriod() external view returns (uint64); - function isDisputeCreated(bytes32 disputeId) external view returns (bool); function encodeReceipt(Attestation.Receipt memory receipt) external view returns (bytes32); diff --git a/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol b/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol index e62ce8211..247acff0f 100644 --- a/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol +++ b/packages/subgraph-service/test/subgraphService/SubgraphService.t.sol @@ -325,7 +325,7 @@ contract SubgraphServiceTest is SubgraphServiceSharedTest { LinkedList.List memory claimsList = _getClaimList(_indexer); bytes32 claimId = _buildStakeClaimId(_indexer, claimsList.nonce - 1); IDataServiceFees.StakeClaim memory stakeClaim = _getStakeClaim(claimId); - uint64 disputePeriod = disputeManager.getDisputePeriod(); + uint64 disputePeriod = disputeManager.disputePeriod(); assertEq(stakeClaim.tokens, tokensToLock); assertEq(stakeClaim.createdAt, block.timestamp); assertEq(stakeClaim.releaseAt, block.timestamp + disputePeriod);