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 Oct 1, 2024
1 parent c114843 commit a8bb730
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
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 = ProvisionManager.delegationRatio();
uint32 _delegationRatio = 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 = ProvisionManager.delegationRatio();
uint32 delegationRatio = dataService.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 = ProvisionManager.delegationRatio();
uint32 delegationRatio = dataService.delegationRatio();
assertEq(delegationRatio, type(uint32).min);

(uint256 minTokens, uint256 maxTokens) = dataService.getProvisionTokensRange();
Expand Down
6 changes: 4 additions & 2 deletions packages/subgraph-service/contracts/DisputeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/I
import { GraphDirectory } from "@graphprotocol/horizon/contracts/utilities/GraphDirectory.sol";
import { DisputeManagerV1Storage } from "./DisputeManagerStorage.sol";
import { AttestationManager } from "./utilities/AttestationManager.sol";
import { ProvisionManager } from "@graphprotocol/packages/horizon/contracts/data-service/utilities/ProvisionManager.sol";

/*
* @title DisputeManager
Expand Down Expand Up @@ -47,7 +48,8 @@ contract DisputeManager is
GraphDirectory,
AttestationManager,
DisputeManagerV1Storage,
IDisputeManager
IDisputeManager,
ProvisionManager
{
using TokenUtils for IGraphToken;
using PPMMath for uint256;
Expand Down Expand Up @@ -713,7 +715,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(ProvisionManager.delegationRatio());
uint256 delegatorsStakeMax = _indexerStake * uint256(delegationRatio);
uint256 stakeSnapshot = _indexerStake + MathUtils.min(delegatorsStake, delegatorsStakeMax);
return stakeSnapshot;
}
Expand Down

0 comments on commit a8bb730

Please sign in to comment.