Skip to content

Commit

Permalink
doc: update safety comment
Browse files Browse the repository at this point in the history
  • Loading branch information
xenide committed Sep 13, 2024
1 parent 2debe47 commit 9b2992c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ReservoirPriceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ReservoirPriceOracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9b2992c

Please sign in to comment.