Skip to content

Commit

Permalink
fix: remove redundant _getDelegationRatio, getDelegationRatio functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonBoi9001 committed Sep 30, 2024
1 parent 3921365 commit d083c0c
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 23 deletions.
6 changes: 0 additions & 6 deletions packages/horizon/contracts/data-service/DataService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion packages/horizon/test/data-service/DataService.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion packages/subgraph-service/contracts/DisputeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d083c0c

Please sign in to comment.