Skip to content

Commit 7fa3cb9

Browse files
committed
fix: default value for delegation ratio (OZ L-06)
Signed-off-by: Tomás Migone <[email protected]>
1 parent 02cac66 commit 7fa3cb9

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import { ProvisionManagerV1Storage } from "./ProvisionManagerStorage.sol";
1919
* The parameters are:
2020
* - Provision parameters (thawing period and verifier cut)
2121
* - Provision tokens
22+
*
23+
* Note that default values for all provision parameters provide the most permissive configuration, it's
24+
* highly recommended to override them at the data service level.
25+
*
2226
* @custom:security-contact Please email [email protected] if you find any
2327
* bugs. We may have an active bug bounty program.
2428
*/
@@ -43,6 +47,9 @@ abstract contract ProvisionManager is Initializable, GraphDirectory, ProvisionMa
4347
/// @notice The default maximum provision tokens.
4448
uint256 internal constant DEFAULT_MAX_PROVISION_TOKENS = type(uint256).max;
4549

50+
/// @notice The default delegation ratio.
51+
uint32 internal constant DEFAULT_DELEGATION_RATIO = type(uint32).max;
52+
4653
/**
4754
* @notice Emitted when the provision tokens range is set.
4855
* @param min The minimum allowed value for the provision tokens.
@@ -138,6 +145,7 @@ abstract contract ProvisionManager is Initializable, GraphDirectory, ProvisionMa
138145
_setProvisionTokensRange(DEFAULT_MIN_PROVISION_TOKENS, DEFAULT_MAX_PROVISION_TOKENS);
139146
_setVerifierCutRange(DEFAULT_MIN_VERIFIER_CUT, DEFAULT_MAX_VERIFIER_CUT);
140147
_setThawingPeriodRange(DEFAULT_MIN_THAWING_PERIOD, DEFAULT_MAX_THAWING_PERIOD);
148+
_setDelegationRatio(DEFAULT_DELEGATION_RATIO);
141149
}
142150

143151
/**

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ contract DataServiceTest is HorizonStakingSharedTest {
2020
}
2121

2222
function test_Constructor_WhenTheContractIsDeployedWithAValidController() external view {
23-
_assert_delegationRatio(type(uint32).min);
23+
_assert_delegationRatio(type(uint32).max);
2424
_assert_provisionTokens_range(type(uint256).min, type(uint256).max);
2525
_assert_verifierCut_range(type(uint32).min, uint32(PPMMath.MAX_PPM));
2626
_assert_thawingPeriod_range(type(uint64).min, type(uint64).max);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ contract DataServiceUpgradeableTest is GraphBaseTest {
1414
// via proxy - ensure that the proxy was initialized correctly
1515
// these calls validate proxy storage was correctly initialized
1616
uint32 delegationRatio = dataService.getDelegationRatio();
17-
assertEq(delegationRatio, type(uint32).min);
17+
assertEq(delegationRatio, type(uint32).max);
1818

1919
(uint256 minTokens, uint256 maxTokens) = dataService.getProvisionTokensRange();
2020
assertEq(minTokens, type(uint256).min);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ contract DataServicePausableUpgradeableTest is GraphBaseTest {
1717
// via proxy - ensure that the proxy was initialized correctly
1818
// these calls validate proxy storage was correctly initialized
1919
uint32 delegationRatio = dataService.getDelegationRatio();
20-
assertEq(delegationRatio, type(uint32).min);
20+
assertEq(delegationRatio, type(uint32).max);
2121

2222
(uint256 minTokens, uint256 maxTokens) = dataService.getProvisionTokensRange();
2323
assertEq(minTokens, type(uint256).min);

0 commit comments

Comments
 (0)