Skip to content

Commit 4d29843

Browse files
committed
Update constants manager
1 parent 7c57e0e commit 4d29843

File tree

5 files changed

+342
-44
lines changed

5 files changed

+342
-44
lines changed

contracts/sfc/ConstantsManager.sol

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ contract ConstantsManager is Ownable {
2626
uint256 public baseRewardPerSecond;
2727
uint256 public offlinePenaltyThresholdBlocksNum;
2828
uint256 public offlinePenaltyThresholdTime;
29-
uint256 public targetGasPowerPerSecond;
30-
uint256 public gasPriceBalancingCounterweight;
3129

3230
// The number of epochs to calculate the average uptime ratio from, acceptable bound [10, 87600].
3331
// Is also the minimum number of epochs necessary for deactivation of offline validators.
@@ -81,14 +79,14 @@ contract ConstantsManager is Ownable {
8179
}
8280

8381
function updateBurntFeeShare(uint256 v) external virtual onlyOwner {
84-
if (v > Decimal.unit() / 2) {
82+
if (v + treasuryFeeShare > Decimal.unit()) {
8583
revert ValueTooLarge();
8684
}
8785
burntFeeShare = v;
8886
}
8987

9088
function updateTreasuryFeeShare(uint256 v) external virtual onlyOwner {
91-
if (v > Decimal.unit() / 2) {
89+
if (v + burntFeeShare > Decimal.unit()) {
9290
revert ValueTooLarge();
9391
}
9492
treasuryFeeShare = v;
@@ -115,9 +113,6 @@ contract ConstantsManager is Ownable {
115113
}
116114

117115
function updateBaseRewardPerSecond(uint256 v) external virtual onlyOwner {
118-
if (v < 0.5 * 1e18) {
119-
revert ValueTooSmall();
120-
}
121116
if (v > 32 * 1e18) {
122117
revert ValueTooLarge();
123118
}
@@ -144,26 +139,6 @@ contract ConstantsManager is Ownable {
144139
offlinePenaltyThresholdBlocksNum = v;
145140
}
146141

147-
function updateTargetGasPowerPerSecond(uint256 v) external virtual onlyOwner {
148-
if (v < 1000000) {
149-
revert ValueTooSmall();
150-
}
151-
if (v > 500000000) {
152-
revert ValueTooLarge();
153-
}
154-
targetGasPowerPerSecond = v;
155-
}
156-
157-
function updateGasPriceBalancingCounterweight(uint256 v) external virtual onlyOwner {
158-
if (v < 100) {
159-
revert ValueTooSmall();
160-
}
161-
if (v > 10 * 86400) {
162-
revert ValueTooLarge();
163-
}
164-
gasPriceBalancingCounterweight = v;
165-
}
166-
167142
function updateAverageUptimeEpochWindow(uint32 v) external virtual onlyOwner {
168143
if (v < 10) {
169144
// needs to be long enough to allow permissible downtime for validators maintenance

contracts/sfc/NetworkInitializer.sol

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,16 @@ contract NetworkInitializer {
2525
NodeDriverAuth(_auth).initialize(_sfc, _driver, _owner);
2626

2727
ConstantsManager consts = new ConstantsManager(address(this));
28-
consts.updateMinSelfStake(500000 * 1e18);
28+
consts.updateMinSelfStake(500_000 * 1e18);
2929
consts.updateMaxDelegatedRatio(16 * Decimal.unit());
3030
consts.updateValidatorCommission((15 * Decimal.unit()) / 100);
31-
consts.updateBurntFeeShare((20 * Decimal.unit()) / 100);
32-
consts.updateTreasuryFeeShare((10 * Decimal.unit()) / 100);
31+
consts.updateBurntFeeShare(0);
32+
consts.updateTreasuryFeeShare((90 * Decimal.unit()) / 100);
3333
consts.updateWithdrawalPeriodEpochs(3);
3434
consts.updateWithdrawalPeriodTime(60 * 60 * 24 * 7);
35-
consts.updateBaseRewardPerSecond(2668658453701531600);
35+
consts.updateBaseRewardPerSecond(1_000);
3636
consts.updateOfflinePenaltyThresholdTime(5 days);
37-
consts.updateOfflinePenaltyThresholdBlocksNum(1000);
38-
consts.updateTargetGasPowerPerSecond(2000000);
39-
consts.updateGasPriceBalancingCounterweight(3600);
37+
consts.updateOfflinePenaltyThresholdBlocksNum(1_000);
4038
consts.updateAverageUptimeEpochWindow(100);
4139
consts.updateMinAverageUptime(0); // check disabled by default
4240
consts.transferOwnership(_owner);

contracts/test/UnitTestConstantsManager.sol

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,7 @@ contract UnitTestConstantsManager is ConstantsManager {
1414
baseRewardPerSecond = v;
1515
}
1616

17-
function updateGasPriceBalancingCounterweight(uint256 v) external override onlyOwner {
18-
gasPriceBalancingCounterweight = v;
19-
}
20-
2117
function updateOfflinePenaltyThresholdTime(uint256 v) external override onlyOwner {
2218
offlinePenaltyThresholdTime = v;
2319
}
24-
25-
function updateTargetGasPowerPerSecond(uint256 v) external override onlyOwner {
26-
targetGasPowerPerSecond = v;
27-
}
2820
}

contracts/test/UnitTestSFC.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ contract UnitTestNetworkInitializer {
7272
consts.updateBaseRewardPerSecond(6183414351851851852);
7373
consts.updateOfflinePenaltyThresholdTime(3 days);
7474
consts.updateOfflinePenaltyThresholdBlocksNum(1000);
75-
consts.updateTargetGasPowerPerSecond(2000000);
76-
consts.updateGasPriceBalancingCounterweight(6 * 60 * 60);
7775
consts.updateAverageUptimeEpochWindow(10);
7876
consts.updateMinAverageUptime(0); // check disabled by default
7977
consts.transferOwnership(_owner);

0 commit comments

Comments
 (0)