Skip to content

Commit 29b8373

Browse files
committed
fix: use safe math for minDripInterval
1 parent 641777f commit 29b8373

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

contracts/l2/reservoir/IL2Reservoir.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface IL2Reservoir is IReservoir {
2727
* @param _issuanceBase Base value for token issuance (approximation for token supply times L2 rewards fraction)
2828
* @param _issuanceRate Rewards issuance rate, using fixed point at 1e18, and including a +1
2929
* @param _nonce Incrementing nonce to ensure messages are received in order
30-
* @param _keeperReward Keeper reward to distribute between keeper that called drip and keeper that redeemed the retryable tx
30+
* @param _keeperReward Keeper reward to distribute between keeper that called drip and keeper that redeemed the retryable tx
3131
* @param _l1Keeper Address of the keeper that called drip in L1
3232
*/
3333
function receiveDrip(

contracts/l2/reservoir/L2Reservoir.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ contract L2Reservoir is L2ReservoirV2Storage, Reservoir, IL2Reservoir {
135135
* @param _issuanceBase Base value for token issuance (approximation for token supply times L2 rewards fraction)
136136
* @param _issuanceRate Rewards issuance rate, using fixed point at 1e18, and including a +1
137137
* @param _nonce Incrementing nonce to ensure messages are received in order
138-
* @param _keeperReward Keeper reward to distribute between keeper that called drip and keeper that redeemed the retryable tx
138+
* @param _keeperReward Keeper reward to distribute between keeper that called drip and keeper that redeemed the retryable tx
139139
* @param _l1Keeper Address of the keeper that called drip in L1
140140
*/
141141
function receiveDrip(
@@ -168,7 +168,7 @@ contract L2Reservoir is L2ReservoirV2Storage, Reservoir, IL2Reservoir {
168168
grt.transfer(redeemer, _l2KeeperReward);
169169
grt.transfer(_l1Keeper, _keeperReward.sub(_l2KeeperReward));
170170
} else {
171-
// In an auto-redeem, we just send all the rewards to teh L1 keeper:
171+
// In an auto-redeem, we just send all the rewards to the L1 keeper:
172172
grt.transfer(_l1Keeper, _keeperReward);
173173
}
174174

contracts/reservoir/L1Reservoir.sol

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ contract L1Reservoir is L1ReservoirV2Storage, Reservoir {
7373
* to the drip function, that also requires the initial supply snapshot to be taken
7474
* using initialSnapshot. For this reason, issuanceRate and l2RewardsFraction
7575
* are not initialized here and instead need a call to setIssuanceRate and setL2RewardsFraction.
76+
* The same applies to minDripInterval (set through setMinDripInterval) and dripRewardPerBlock
77+
* (set through setDripRewardPerBlock).
7678
* On the other hand, the l2ReservoirAddress is not expected to be known at initialization
7779
* time and must therefore be set using setL2ReservoirAddress.
7880
* The RewardsManager's address might also not be available in the controller at initialization
@@ -292,7 +294,10 @@ contract L1Reservoir is L1ReservoirV2Storage, Reservoir {
292294
uint256 _l2MaxSubmissionCost,
293295
address _keeperRewardBeneficiary
294296
) private {
295-
require(block.number > lastRewardsUpdateBlock + minDripInterval, "WAIT_FOR_MIN_INTERVAL");
297+
require(
298+
block.number > lastRewardsUpdateBlock.add(minDripInterval),
299+
"WAIT_FOR_MIN_INTERVAL"
300+
);
296301

297302
uint256 mintedRewardsTotal = getNewGlobalRewards(rewardsMintedUntilBlock);
298303
uint256 mintedRewardsActual = getNewGlobalRewards(block.number);

0 commit comments

Comments
 (0)