From 12b0e73023813a4096cff7c9561d12f0769e9812 Mon Sep 17 00:00:00 2001 From: "A.L." Date: Mon, 8 Jul 2024 21:25:54 +0200 Subject: [PATCH] fix: rm test case that wastes all gas --- test/mock/GasBuster.sol | 11 ----------- test/unit/ReservoirPriceOracle.t.sol | 26 -------------------------- 2 files changed, 37 deletions(-) delete mode 100644 test/mock/GasBuster.sol diff --git a/test/mock/GasBuster.sol b/test/mock/GasBuster.sol deleted file mode 100644 index 40588d9..0000000 --- a/test/mock/GasBuster.sol +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.0; - -contract GasBuster { - // Allow the contract to receive ETH - receive() external payable { - while (true) { // solhint-disable-line no-empty-blocks - // This loop will continue until all gas is consumed - } - } -} diff --git a/test/unit/ReservoirPriceOracle.t.sol b/test/unit/ReservoirPriceOracle.t.sol index c1a3001..6082106 100644 --- a/test/unit/ReservoirPriceOracle.t.sol +++ b/test/unit/ReservoirPriceOracle.t.sol @@ -20,7 +20,6 @@ import { EnumerableSetLib } from "lib/solady/src/utils/EnumerableSetLib.sol"; import { Constants } from "src/libraries/Constants.sol"; import { MockFallbackOracle } from "test/mock/MockFallbackOracle.sol"; import { StubERC4626 } from "test/mock/StubERC4626.sol"; -import { GasBuster } from "test/mock/GasBuster.sol"; contract ReservoirPriceOracleTest is BaseTest { using Utils for *; @@ -622,31 +621,6 @@ contract ReservoirPriceOracleTest is BaseTest { assertEq(lPriceAB, 0); // composite price is not stored in the cache } - function testUpdatePrice_RecipientOutOfGas() external { - // arrange - GasBuster lGasBuster = new GasBuster(); - - _writePriceCache(address(_tokenA), address(_tokenB), 5e18); - deal(address(_oracle), 1 ether); - - skip(1); - _pair.sync(); - skip(_oracle.twapPeriod() * 2); - _tokenA.mint(address(_pair), 2e18); - _pair.swap(2e18, true, address(this), ""); - - // act - _oracle.updatePrice(address(_tokenB), address(_tokenA), address(lGasBuster)); - - // assert - (uint256 lPrice,) = _oracle.priceCache(address(_tokenA), address(_tokenB)); - assertEq(lPrice, 98_918_868_099_219_913_512); - (lPrice,) = _oracle.priceCache(address(_tokenB), address(_tokenA)); - assertEq(lPrice, 0); - assertEq(address(lGasBuster).balance, 0); - assertEq(address(_oracle).balance, 1 ether); - } - function testSetRoute() public { // arrange address lToken0 = address(_tokenB);