From 9b2992cb335ee91ca6e64bb02b8652947646c957 Mon Sep 17 00:00:00 2001 From: "A.L." Date: Fri, 13 Sep 2024 17:17:22 +0100 Subject: [PATCH] doc: update safety comment --- src/ReservoirPriceOracle.sol | 3 ++- test/unit/ReservoirPriceOracle.t.sol | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ReservoirPriceOracle.sol b/src/ReservoirPriceOracle.sol index a6178b3..084f17f 100644 --- a/src/ReservoirPriceOracle.sol +++ b/src/ReservoirPriceOracle.sol @@ -164,7 +164,8 @@ contract ReservoirPriceOracle is IPriceOracle, Owned(msg.sender), ReentrancyGuar } _writePriceCache(lToken0, lToken1, lNewPrice); - // SAFETY: This will not overflow for, and hops are limited by `MAX_ROUTE_LENGTH` + // SAFETY: This will not overflow even if reward gas amount is set to the block gas limit (30M at time if writing), + // and hops are limited by `MAX_ROUTE_LENGTH`. unchecked { rTotalReward += _calculateReward(lPrevPrice, lNewPrice, lRewardThreshold); } diff --git a/test/unit/ReservoirPriceOracle.t.sol b/test/unit/ReservoirPriceOracle.t.sol index a9ad44c..8a2c2b6 100644 --- a/test/unit/ReservoirPriceOracle.t.sol +++ b/test/unit/ReservoirPriceOracle.t.sol @@ -705,7 +705,7 @@ contract ReservoirPriceOracleTest is BaseTest { skip(_oracle.twapPeriod()); lReward = _oracle.updatePrice(address(_tokenA), address(_tokenB), address(this)); - assertGt(lReward, _oracle.rewardGasAmount() * 3); // ensure that rewards have accumulated + assertGt(lReward, _oracle.rewardGasAmount() * 3); // ensure that rewards have been aggregated across routes } function testSetRoute() public {