From d083c0c37bd977f238514541444f18c27a540123 Mon Sep 17 00:00:00 2001 From: MoonBoi9001 Date: Mon, 30 Sep 2024 20:51:14 +0100 Subject: [PATCH] fix: remove redundant _getDelegationRatio, getDelegationRatio functions. --- packages/horizon/contracts/data-service/DataService.sol | 6 ------ .../contracts/data-service/interfaces/IDataService.sol | 5 ----- .../contracts/data-service/utilities/ProvisionManager.sol | 8 -------- packages/horizon/test/data-service/DataService.t.sol | 2 +- .../test/data-service/DataServiceUpgradeable.t.sol | 2 +- .../extensions/DataServicePausableUpgradeable.t.sol | 2 +- packages/subgraph-service/contracts/DisputeManager.sol | 2 +- 7 files changed, 4 insertions(+), 23 deletions(-) diff --git a/packages/horizon/contracts/data-service/DataService.sol b/packages/horizon/contracts/data-service/DataService.sol index 8a06ad4ea..b663d6864 100644 --- a/packages/horizon/contracts/data-service/DataService.sol +++ b/packages/horizon/contracts/data-service/DataService.sol @@ -69,10 +69,4 @@ abstract contract DataService is GraphDirectory, ProvisionManager, DataServiceV1 return _getProvisionTokensRange(); } - /** - * @notice See {IDataService-getDelegationRatio}. - */ - function getDelegationRatio() external view returns (uint32) { - return _getDelegationRatio(); - } } diff --git a/packages/horizon/contracts/data-service/interfaces/IDataService.sol b/packages/horizon/contracts/data-service/interfaces/IDataService.sol index 3eec64c04..b800994d3 100644 --- a/packages/horizon/contracts/data-service/interfaces/IDataService.sol +++ b/packages/horizon/contracts/data-service/interfaces/IDataService.sol @@ -161,9 +161,4 @@ interface IDataService { */ function getProvisionTokensRange() external view returns (uint256, uint256); - /** - * @notice External getter for the delegation ratio - * @return The delegation ratio - */ - function getDelegationRatio() external view returns (uint32); } diff --git a/packages/horizon/contracts/data-service/utilities/ProvisionManager.sol b/packages/horizon/contracts/data-service/utilities/ProvisionManager.sol index d1cf94287..0a60168b8 100644 --- a/packages/horizon/contracts/data-service/utilities/ProvisionManager.sol +++ b/packages/horizon/contracts/data-service/utilities/ProvisionManager.sol @@ -230,14 +230,6 @@ abstract contract ProvisionManager is Initializable, GraphDirectory, ProvisionMa // -- getters -- - /** - * @notice Gets the delegation ratio. - * @return The delegation ratio - */ - function _getDelegationRatio() internal view returns (uint32) { - return delegationRatio; - } - /** * @notice Gets the range for the provision tokens. * @return min The minimum allowed value for the provision tokens. diff --git a/packages/horizon/test/data-service/DataService.t.sol b/packages/horizon/test/data-service/DataService.t.sol index c535c6dea..9d78a1101 100644 --- a/packages/horizon/test/data-service/DataService.t.sol +++ b/packages/horizon/test/data-service/DataService.t.sol @@ -362,7 +362,7 @@ contract DataServiceTest is HorizonStakingSharedTest { } function _assert_delegationRatio(uint32 ratio) internal view { - uint32 _delegationRatio = dataService.getDelegationRatio(); + uint32 _delegationRatio = provisionManager.delegationRatio(); assertEq(_delegationRatio, ratio); } diff --git a/packages/horizon/test/data-service/DataServiceUpgradeable.t.sol b/packages/horizon/test/data-service/DataServiceUpgradeable.t.sol index be33173f8..2ec5ea91c 100644 --- a/packages/horizon/test/data-service/DataServiceUpgradeable.t.sol +++ b/packages/horizon/test/data-service/DataServiceUpgradeable.t.sol @@ -13,7 +13,7 @@ contract DataServiceUpgradeableTest is GraphBaseTest { // via proxy - ensure that the proxy was initialized correctly // these calls validate proxy storage was correctly initialized - uint32 delegationRatio = dataService.getDelegationRatio(); + uint32 delegationRatio = provisionManager.delegationRatio(); assertEq(delegationRatio, type(uint32).min); (uint256 minTokens, uint256 maxTokens) = dataService.getProvisionTokensRange(); diff --git a/packages/horizon/test/data-service/extensions/DataServicePausableUpgradeable.t.sol b/packages/horizon/test/data-service/extensions/DataServicePausableUpgradeable.t.sol index 6e58810c1..bb99aca86 100644 --- a/packages/horizon/test/data-service/extensions/DataServicePausableUpgradeable.t.sol +++ b/packages/horizon/test/data-service/extensions/DataServicePausableUpgradeable.t.sol @@ -16,7 +16,7 @@ contract DataServicePausableUpgradeableTest is GraphBaseTest { // via proxy - ensure that the proxy was initialized correctly // these calls validate proxy storage was correctly initialized - uint32 delegationRatio = dataService.getDelegationRatio(); + uint32 delegationRatio = provisionManager.delegationRatio(); assertEq(delegationRatio, type(uint32).min); (uint256 minTokens, uint256 maxTokens) = dataService.getProvisionTokensRange(); diff --git a/packages/subgraph-service/contracts/DisputeManager.sol b/packages/subgraph-service/contracts/DisputeManager.sol index c69370010..c84677837 100644 --- a/packages/subgraph-service/contracts/DisputeManager.sol +++ b/packages/subgraph-service/contracts/DisputeManager.sol @@ -713,7 +713,7 @@ contract DisputeManager is */ function _getStakeSnapshot(address _indexer, uint256 _indexerStake) private view returns (uint256) { uint256 delegatorsStake = _graphStaking().getDelegationPool(_indexer, address(subgraphService)).tokens; - uint256 delegatorsStakeMax = _indexerStake * uint256(subgraphService.getDelegationRatio()); + uint256 delegatorsStakeMax = _indexerStake * uint256(provisionManager.delegationRatio()); uint256 stakeSnapshot = _indexerStake + MathUtils.min(delegatorsStake, delegatorsStakeMax); return stakeSnapshot; }