From 0c71bb1a9cc3b6f48051adc4d603f8f632b77fbb Mon Sep 17 00:00:00 2001 From: "A.L." Date: Tue, 11 Jun 2024 16:58:34 +0200 Subject: [PATCH] test: ensure address not existing contract --- .gas-snapshot | 50 ++++++++++++++-------------- test/unit/ReservoirPriceOracle.t.sol | 2 ++ 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 2c51c92..ecbc10e 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,22 +1,22 @@ FlagsLibTest:testGetDecimalDifference() (gas: 3974) FlagsLibTest:testIsCompositeRoute() (gas: 4341) FlagsLibTest:testPackSimplePrice(int8,uint256) (runs: 256, μ: 7791, ~: 7555) -QueryProcessorTest:testFindNearestSample_CanFindExactValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 65405445, ~: 73998750) -QueryProcessorTest:testFindNearestSample_CanFindIntermediateValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 64633234, ~: 73958177) +QueryProcessorTest:testFindNearestSample_CanFindExactValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 64954402, ~: 72638370) +QueryProcessorTest:testFindNearestSample_CanFindIntermediateValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 65183381, ~: 74353868) QueryProcessorTest:testFindNearestSample_NotInitialized() (gas: 8937393461068805977) -QueryProcessorTest:testFindNearestSample_OneSample(uint256) (runs: 256, μ: 80327, ~: 80360) +QueryProcessorTest:testFindNearestSample_OneSample(uint256) (runs: 256, μ: 80330, ~: 80360) QueryProcessorTest:testGetInstantValue() (gas: 124248) QueryProcessorTest:testGetInstantValue_NotInitialized(uint256) (runs: 256, μ: 19397, ~: 19397) -QueryProcessorTest:testGetInstantValue_NotInitialized_BeyondBufferSize(uint8,uint16) (runs: 256, μ: 68389672, ~: 68389600) -QueryProcessorTest:testGetPastAccumulator_BufferEmpty(uint8) (runs: 256, μ: 27030, ~: 27087) -QueryProcessorTest:testGetPastAccumulator_ExactMatch(uint32,uint256,uint256,uint16) (runs: 256, μ: 71734889, ~: 79217705) -QueryProcessorTest:testGetPastAccumulator_ExactMatch_LatestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 69735120, ~: 78064819) -QueryProcessorTest:testGetPastAccumulator_ExactMatch_OldestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 69765138, ~: 78096419) -QueryProcessorTest:testGetPastAccumulator_ExtrapolatesBeyondLatest(uint32,uint256,uint256,uint256) (runs: 256, μ: 64606927, ~: 73929867) -QueryProcessorTest:testGetPastAccumulator_InterpolatesBetweenPastAccumulators(uint32,uint256,uint256,uint256) (runs: 256, μ: 64641047, ~: 73964185) -QueryProcessorTest:testGetPastAccumulator_InvalidAgo(uint32,uint256,uint256,uint256) (runs: 256, μ: 64598512, ~: 73921235) -QueryProcessorTest:testGetPastAccumulator_QueryTooOld(uint32,uint256,uint256,uint256) (runs: 256, μ: 64610136, ~: 73931119) -QueryProcessorTest:testGetTimeWeightedAverage(uint32,uint256,uint256,uint256,uint256) (runs: 256, μ: 103846182, ~: 110904990) +QueryProcessorTest:testGetInstantValue_NotInitialized_BeyondBufferSize(uint8,uint16) (runs: 256, μ: 68389670, ~: 68389600) +QueryProcessorTest:testGetPastAccumulator_BufferEmpty(uint8) (runs: 256, μ: 27026, ~: 27087) +QueryProcessorTest:testGetPastAccumulator_ExactMatch(uint32,uint256,uint256,uint16) (runs: 256, μ: 71445048, ~: 79233749) +QueryProcessorTest:testGetPastAccumulator_ExactMatch_LatestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 70305328, ~: 78329546) +QueryProcessorTest:testGetPastAccumulator_ExactMatch_OldestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 70335354, ~: 78361146) +QueryProcessorTest:testGetPastAccumulator_ExtrapolatesBeyondLatest(uint32,uint256,uint256,uint256) (runs: 256, μ: 65156996, ~: 74325443) +QueryProcessorTest:testGetPastAccumulator_InterpolatesBetweenPastAccumulators(uint32,uint256,uint256,uint256) (runs: 256, μ: 65191146, ~: 74359876) +QueryProcessorTest:testGetPastAccumulator_InvalidAgo(uint32,uint256,uint256,uint256) (runs: 256, μ: 65148574, ~: 74317294) +QueryProcessorTest:testGetPastAccumulator_QueryTooOld(uint32,uint256,uint256,uint256) (runs: 256, μ: 65160165, ~: 74326834) +QueryProcessorTest:testGetTimeWeightedAverage(uint32,uint256,uint256,uint256,uint256) (runs: 256, μ: 103403746, ~: 113055688) QueryProcessorTest:testGetTimeWeightedAverage_BadSecs() (gas: 10995) ReservoirPriceOracleTest:testClearRoute() (gas: 52319) ReservoirPriceOracleTest:testClearRoute_AllWordsCleared() (gas: 155404) @@ -27,26 +27,26 @@ ReservoirPriceOracleTest:testDesignatePair_TokenOrderReversed() (gas: 30740) ReservoirPriceOracleTest:testGasBountyAvailable(uint256) (runs: 256, μ: 9885, ~: 9881) ReservoirPriceOracleTest:testGasBountyAvailable_Zero() (gas: 8939) ReservoirPriceOracleTest:testGetLargestSafeQueryWindow() (gas: 8412) -ReservoirPriceOracleTest:testGetLatest(uint32) (runs: 256, μ: 92853, ~: 92787) +ReservoirPriceOracleTest:testGetLatest(uint32) (runs: 256, μ: 92856, ~: 92787) ReservoirPriceOracleTest:testGetLatest_Inverted() (gas: 96864) ReservoirPriceOracleTest:testGetPastAccumulators() (gas: 196417) ReservoirPriceOracleTest:testGetPastAccumulators_Inverted() (gas: 156850) -ReservoirPriceOracleTest:testGetQuote(uint256,uint256) (runs: 256, μ: 35789, ~: 35904) +ReservoirPriceOracleTest:testGetQuote(uint256,uint256) (runs: 256, μ: 35792, ~: 35904) ReservoirPriceOracleTest:testGetQuote_AmountInTooLarge() (gas: 12985) -ReservoirPriceOracleTest:testGetQuote_BaseIsVault(uint256) (runs: 256, μ: 363876, ~: 363634) +ReservoirPriceOracleTest:testGetQuote_BaseIsVault(uint256) (runs: 256, μ: 445074, ~: 444837) ReservoirPriceOracleTest:testGetQuote_ComplicatedDecimals() (gas: 10353280) -ReservoirPriceOracleTest:testGetQuote_Inverse(uint256,uint256) (runs: 256, μ: 37975, ~: 38148) +ReservoirPriceOracleTest:testGetQuote_Inverse(uint256,uint256) (runs: 256, μ: 37978, ~: 38149) ReservoirPriceOracleTest:testGetQuote_MultipleHops() (gas: 114609) ReservoirPriceOracleTest:testGetQuote_MultipleHops_Inverse() (gas: 114842) ReservoirPriceOracleTest:testGetQuote_MultipleHops_PriceZero() (gas: 127427) ReservoirPriceOracleTest:testGetQuote_NoFallbackOracle() (gas: 16112) ReservoirPriceOracleTest:testGetQuote_PriceZero() (gas: 16519) -ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_1HopRoute(uint256,uint256,address,address,uint8,uint8) (runs: 256, μ: 5328071, ~: 5328117) -ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_2HopRoute(uint256,uint256,uint256,address,address,address,uint8,uint8,uint8) (runs: 256, μ: 10493941, ~: 10493960) +ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_1HopRoute(uint256,uint256,address,address,uint8,uint8) (runs: 256, μ: 5328074, ~: 5328117) +ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_2HopRoute(uint256,uint256,uint256,address,address,address,uint8,uint8,uint8) (runs: 256, μ: 10493915, ~: 10493914) ReservoirPriceOracleTest:testGetQuote_SameBaseQuote(uint256,address) (runs: 256, μ: 8985, ~: 8985) ReservoirPriceOracleTest:testGetQuote_UseFallback() (gas: 37825) ReservoirPriceOracleTest:testGetQuote_ZeroIn() (gas: 39322) -ReservoirPriceOracleTest:testGetQuotes(uint256,uint256) (runs: 256, μ: 33345, ~: 33460) +ReservoirPriceOracleTest:testGetQuotes(uint256,uint256) (runs: 256, μ: 33348, ~: 33460) ReservoirPriceOracleTest:testGetTimeWeightedAverage() (gas: 142014) ReservoirPriceOracleTest:testGetTimeWeightedAverage_Inverted() (gas: 121185) ReservoirPriceOracleTest:testSetFallbackOracle_NotOwner() (gas: 11003) @@ -59,9 +59,9 @@ ReservoirPriceOracleTest:testSetRoute_OverwriteExisting() (gas: 162732) ReservoirPriceOracleTest:testSetRoute_SameToken() (gas: 12070) ReservoirPriceOracleTest:testUndesignatePair() (gas: 30318) ReservoirPriceOracleTest:testUndesignatePair_NotOwner() (gas: 15288) -ReservoirPriceOracleTest:testUpdatePriceDeviationThreshold(uint256) (runs: 256, μ: 21398, ~: 21152) +ReservoirPriceOracleTest:testUpdatePriceDeviationThreshold(uint256) (runs: 256, μ: 21390, ~: 21152) ReservoirPriceOracleTest:testUpdatePrice_BeyondThreshold() (gas: 216785) -ReservoirPriceOracleTest:testUpdatePrice_BeyondThreshold_InsufficientReward(uint256) (runs: 256, μ: 205839, ~: 206053) +ReservoirPriceOracleTest:testUpdatePrice_BeyondThreshold_InsufficientReward(uint256) (runs: 256, μ: 205829, ~: 205771) ReservoirPriceOracleTest:testUpdatePrice_BeyondThreshold_ZeroRecipient() (gas: 198455) ReservoirPriceOracleTest:testUpdatePrice_FirstUpdate() (gas: 205996) ReservoirPriceOracleTest:testUpdatePrice_IntermediateRoutes() (gas: 15872304) @@ -69,9 +69,9 @@ ReservoirPriceOracleTest:testUpdatePrice_PriceOutOfRange() (gas: 5355619) ReservoirPriceOracleTest:testUpdatePrice_WithinThreshold() (gas: 207028) ReservoirPriceOracleTest:testUpdateRewardGasAmount() (gas: 19033) ReservoirPriceOracleTest:testUpdateRewardGasAmount_NotOwner() (gas: 11006) -ReservoirPriceOracleTest:testUpdateTwapPeriod(uint256) (runs: 256, μ: 21823, ~: 21892) -ReservoirPriceOracleTest:testUpdateTwapPeriod_InvalidTwapPeriod(uint256) (runs: 256, μ: 17891, ~: 18147) -ReservoirPriceOracleTest:testWritePriceCache(uint256) (runs: 256, μ: 30063, ~: 29821) +ReservoirPriceOracleTest:testUpdateTwapPeriod(uint256) (runs: 256, μ: 21815, ~: 21892) +ReservoirPriceOracleTest:testUpdateTwapPeriod_InvalidTwapPeriod(uint256) (runs: 256, μ: 17894, ~: 18208) +ReservoirPriceOracleTest:testWritePriceCache(uint256) (runs: 256, μ: 30058, ~: 29821) SamplesTest:testAccumulator() (gas: 3959) SamplesTest:testAccumulator_BadVariableRequest() (gas: 3523) SamplesTest:testInstant() (gas: 3909) diff --git a/test/unit/ReservoirPriceOracle.t.sol b/test/unit/ReservoirPriceOracle.t.sol index 111bdb4..484bcb5 100644 --- a/test/unit/ReservoirPriceOracle.t.sol +++ b/test/unit/ReservoirPriceOracle.t.sol @@ -72,6 +72,8 @@ contract ReservoirPriceOracleTest is BaseTest { _addressSet.add(address(_tokenD)); _addressSet.add(address(_factory)); _addressSet.add(address(_oracle)); + _addressSet.add(address(_pair)); + _addressSet.add(address(this)); } // solhint-disable-next-line no-empty-blocks