Skip to content

Commit f92af4e

Browse files
committed
fix: remove redundant _getDelegationRatio, getDelegationRatio functions.
1 parent 57f549c commit f92af4e

File tree

7 files changed

+4
-23
lines changed

7 files changed

+4
-23
lines changed

packages/horizon/contracts/data-service/DataService.sol

-6
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,4 @@ abstract contract DataService is GraphDirectory, ProvisionManager, DataServiceV1
6969
return _getProvisionTokensRange();
7070
}
7171

72-
/**
73-
* @notice See {IDataService-getDelegationRatio}.
74-
*/
75-
function getDelegationRatio() external view returns (uint32) {
76-
return _getDelegationRatio();
77-
}
7872
}

packages/horizon/contracts/data-service/interfaces/IDataService.sol

-5
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,4 @@ interface IDataService {
161161
*/
162162
function getProvisionTokensRange() external view returns (uint256, uint256);
163163

164-
/**
165-
* @notice External getter for the delegation ratio
166-
* @return The delegation ratio
167-
*/
168-
function getDelegationRatio() external view returns (uint32);
169164
}

packages/horizon/contracts/data-service/utilities/ProvisionManager.sol

-8
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,6 @@ abstract contract ProvisionManager is Initializable, GraphDirectory, ProvisionMa
230230

231231
// -- getters --
232232

233-
/**
234-
* @notice Gets the delegation ratio.
235-
* @return The delegation ratio
236-
*/
237-
function _getDelegationRatio() internal view returns (uint32) {
238-
return delegationRatio;
239-
}
240-
241233
/**
242234
* @notice Gets the range for the provision tokens.
243235
* @return min The minimum allowed value for the provision tokens.

packages/horizon/test/data-service/DataService.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ contract DataServiceTest is HorizonStakingSharedTest {
362362
}
363363

364364
function _assert_delegationRatio(uint32 ratio) internal view {
365-
uint32 _delegationRatio = dataService.getDelegationRatio();
365+
uint32 _delegationRatio = provisionManager.delegationRatio();
366366
assertEq(_delegationRatio, ratio);
367367
}
368368

packages/horizon/test/data-service/DataServiceUpgradeable.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ contract DataServiceUpgradeableTest is GraphBaseTest {
1313

1414
// via proxy - ensure that the proxy was initialized correctly
1515
// these calls validate proxy storage was correctly initialized
16-
uint32 delegationRatio = dataService.getDelegationRatio();
16+
uint32 delegationRatio = provisionManager.delegationRatio();
1717
assertEq(delegationRatio, type(uint32).min);
1818

1919
(uint256 minTokens, uint256 maxTokens) = dataService.getProvisionTokensRange();

packages/horizon/test/data-service/extensions/DataServicePausableUpgradeable.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ contract DataServicePausableUpgradeableTest is GraphBaseTest {
1616

1717
// via proxy - ensure that the proxy was initialized correctly
1818
// these calls validate proxy storage was correctly initialized
19-
uint32 delegationRatio = dataService.getDelegationRatio();
19+
uint32 delegationRatio = provisionManager.delegationRatio();
2020
assertEq(delegationRatio, type(uint32).min);
2121

2222
(uint256 minTokens, uint256 maxTokens) = dataService.getProvisionTokensRange();

packages/subgraph-service/contracts/DisputeManager.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ contract DisputeManager is
713713
*/
714714
function _getStakeSnapshot(address _indexer, uint256 _indexerStake) private view returns (uint256) {
715715
uint256 delegatorsStake = _graphStaking().getDelegationPool(_indexer, address(subgraphService)).tokens;
716-
uint256 delegatorsStakeMax = _indexerStake * uint256(subgraphService.getDelegationRatio());
716+
uint256 delegatorsStakeMax = _indexerStake * uint256(provisionManager.delegationRatio());
717717
uint256 stakeSnapshot = _indexerStake + MathUtils.min(delegatorsStake, delegatorsStakeMax);
718718
return stakeSnapshot;
719719
}

0 commit comments

Comments
 (0)