Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cantina audit findings #25

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from
135 changes: 69 additions & 66 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,79 +1,82 @@
QueryProcessorTest:testFindNearestSample_CanFindExactValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 69293044, ~: 77954902)
QueryProcessorTest:testFindNearestSample_CanFindIntermediateValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 68012389, ~: 77774179)
QueryProcessorTest:testFindNearestSample_CanFindExactValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 68323943, ~: 75988137)
QueryProcessorTest:testFindNearestSample_CanFindIntermediateValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 68199477, ~: 76057768)
QueryProcessorTest:testFindNearestSample_NotInitialized() (gas: 1056944146)
QueryProcessorTest:testFindNearestSample_OneSample(uint256) (runs: 256, μ: 80623, ~: 80652)
QueryProcessorTest:testFindNearestSample_OneSample(uint256) (runs: 256, μ: 80620, ~: 80652)
QueryProcessorTest:testGetInstantValue() (gas: 124418)
QueryProcessorTest:testGetInstantValue_NotInitialized(uint256) (runs: 256, μ: 19400, ~: 19400)
QueryProcessorTest:testGetInstantValue_NotInitialized_BeyondBufferSize(uint8,uint16) (runs: 256, μ: 69204583, ~: 69204518)
QueryProcessorTest:testGetPastAccumulator_BufferEmpty(uint8) (runs: 256, μ: 26911, ~: 26984)
QueryProcessorTest:testGetPastAccumulator_ExactMatch(uint32,uint256,uint256,uint16) (runs: 256, μ: 72113529, ~: 81319251)
QueryProcessorTest:testGetPastAccumulator_ExactMatch_LatestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 69463960, ~: 78425849)
QueryProcessorTest:testGetPastAccumulator_ExactMatch_OldestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 69493894, ~: 78457616)
QueryProcessorTest:testGetPastAccumulator_ExtrapolatesBeyondLatest(uint32,uint256,uint256,uint256) (runs: 256, μ: 67986036, ~: 77745180)
QueryProcessorTest:testGetPastAccumulator_InterpolatesBetweenPastAccumulators(uint32,uint256,uint256,uint256) (runs: 256, μ: 68020346, ~: 77780471)
QueryProcessorTest:testGetPastAccumulator_InvalidAgo(uint32,uint256,uint256,uint256) (runs: 256, μ: 67977605, ~: 77737553)
QueryProcessorTest:testGetPastAccumulator_QueryTooOld(uint32,uint256,uint256,uint256) (runs: 256, μ: 67989141, ~: 77747128)
QueryProcessorTest:testGetTimeWeightedAverage(uint32,uint256,uint256,uint256,uint256) (runs: 256, μ: 103407330, ~: 109858182)
QueryProcessorTest:testGetInstantValue_NotInitialized_BeyondBufferSize(uint8,uint16) (runs: 256, μ: 69204594, ~: 69204518)
QueryProcessorTest:testGetPastAccumulator_BufferEmpty(uint8) (runs: 256, μ: 26912, ~: 26984)
QueryProcessorTest:testGetPastAccumulator_ExactMatch(uint32,uint256,uint256,uint16) (runs: 256, μ: 71558938, ~: 80209438)
QueryProcessorTest:testGetPastAccumulator_ExactMatch_LatestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 70393014, ~: 80445450)
QueryProcessorTest:testGetPastAccumulator_ExactMatch_OldestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 70423032, ~: 80477217)
QueryProcessorTest:testGetPastAccumulator_ExtrapolatesBeyondLatest(uint32,uint256,uint256,uint256) (runs: 256, μ: 68173090, ~: 76029150)
QueryProcessorTest:testGetPastAccumulator_InterpolatesBetweenPastAccumulators(uint32,uint256,uint256,uint256) (runs: 256, μ: 68207434, ~: 76064060)
QueryProcessorTest:testGetPastAccumulator_InvalidAgo(uint32,uint256,uint256,uint256) (runs: 256, μ: 68164662, ~: 76020502)
QueryProcessorTest:testGetPastAccumulator_QueryTooOld(uint32,uint256,uint256,uint256) (runs: 256, μ: 68176191, ~: 76030758)
QueryProcessorTest:testGetTimeWeightedAverage(uint32,uint256,uint256,uint256,uint256) (runs: 256, μ: 106049443, ~: 111585898)
QueryProcessorTest:testGetTimeWeightedAverage_BadSecs() (gas: 10981)
ReservoirPriceOracleTest:testClearRoute() (gas: 52209)
ReservoirPriceOracleTest:testClearRoute_AllWordsCleared() (gas: 159642)
ReservoirPriceOracleTest:testDesignatePair() (gas: 29089)
ReservoirPriceOracleTest:testDesignatePair_IncorrectPair() (gas: 21129)
ReservoirPriceOracleTest:testDesignatePair_NotOwner() (gas: 17515)
ReservoirPriceOracleTest:testDesignatePair_TokenOrderReversed() (gas: 30670)
ReservoirPriceOracleTest:testGetQuote(uint256,uint256) (runs: 256, μ: 33680, ~: 33783)
ReservoirPriceOracleTest:testGetQuote_AmountInTooLarge() (gas: 13019)
ReservoirPriceOracleTest:testGetQuote_BaseIsVault(uint256) (runs: 256, μ: 401362, ~: 401124)
ReservoirPriceOracleTest:testGetQuote_ComplicatedDecimals() (gas: 10361941)
ReservoirPriceOracleTest:testGetQuote_ERC4626AssetFails() (gas: 21434)
ReservoirPriceOracleTest:testGetQuote_Inverse(uint256,uint256) (runs: 256, μ: 35858, ~: 36022)
ReservoirPriceOracleTest:testGetQuote_MultipleHops() (gas: 111597)
ReservoirPriceOracleTest:testGetQuote_MultipleHops_Inverse() (gas: 111891)
ReservoirPriceOracleTest:testGetQuote_MultipleHops_PriceZero() (gas: 122213)
ReservoirPriceOracleTest:testGetQuote_NoFallbackOracle() (gas: 20830)
ReservoirPriceOracleTest:testGetQuote_PriceZero() (gas: 15942)
ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_1HopRoute(uint256,uint256,address,address,uint8,uint8) (runs: 256, μ: 5316105, ~: 5316096)
ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_2HopRoute(uint256,uint256,uint256,address,address,address,uint8,uint8,uint8) (runs: 256, μ: 10503666, ~: 10503746)
ReservoirPriceOracleTest:testGetQuote_SameBaseQuote(uint256,address) (runs: 256, μ: 8972, ~: 8972)
ReservoirPriceOracleTest:testGetQuote_UseFallback() (gas: 38232)
ReservoirPriceOracleTest:testGetQuote_ZeroIn() (gas: 36638)
ReservoirPriceOracleTest:testGetQuotes(uint256,uint256) (runs: 256, μ: 26236, ~: 26339)
ReservoirPriceOracleTest:testClearRoute() (gas: 52308)
ReservoirPriceOracleTest:testClearRoute_AllWordsCleared() (gas: 160205)
ReservoirPriceOracleTest:testDesignatePair() (gas: 29133)
ReservoirPriceOracleTest:testDesignatePair_IncorrectPair() (gas: 21151)
ReservoirPriceOracleTest:testDesignatePair_NotOwner() (gas: 17537)
ReservoirPriceOracleTest:testDesignatePair_TokenOrderReversed() (gas: 30736)
ReservoirPriceOracleTest:testGetQuote(uint256,uint256) (runs: 256, μ: 33678, ~: 33784)
ReservoirPriceOracleTest:testGetQuote_AmountInTooLarge() (gas: 12996)
ReservoirPriceOracleTest:testGetQuote_BaseIsVault(uint256) (runs: 256, μ: 401348, ~: 401113)
ReservoirPriceOracleTest:testGetQuote_ComplicatedDecimals() (gas: 10362257)
ReservoirPriceOracleTest:testGetQuote_ERC4626AssetFails() (gas: 21411)
ReservoirPriceOracleTest:testGetQuote_Inverse(uint256,uint256) (runs: 256, μ: 35859, ~: 36022)
ReservoirPriceOracleTest:testGetQuote_MultipleHops() (gas: 111665)
ReservoirPriceOracleTest:testGetQuote_MultipleHops_Inverse() (gas: 111959)
ReservoirPriceOracleTest:testGetQuote_MultipleHops_PriceZero() (gas: 122258)
ReservoirPriceOracleTest:testGetQuote_NoFallbackOracle() (gas: 20807)
ReservoirPriceOracleTest:testGetQuote_PriceZero() (gas: 15919)
ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_1HopRoute(uint256,uint256,address,address,uint8,uint8) (runs: 256, μ: 5229794, ~: 5229817)
ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_2HopRoute(uint256,uint256,uint256,address,address,address,uint8,uint8,uint8) (runs: 256, μ: 10377268, ~: 10377453)
ReservoirPriceOracleTest:testGetQuote_SameBaseQuote(uint256,address) (runs: 256, μ: 8949, ~: 8949)
ReservoirPriceOracleTest:testGetQuote_UseFallback() (gas: 38209)
ReservoirPriceOracleTest:testGetQuote_ZeroIn() (gas: 36616)
ReservoirPriceOracleTest:testGetQuotes(uint256,uint256) (runs: 256, μ: 26257, ~: 26363)
ReservoirPriceOracleTest:testName() (gas: 9355)
ReservoirPriceOracleTest:testPriceCache_Inverted() (gas: 22028)
ReservoirPriceOracleTest:testSetFallbackOracle_NotOwner() (gas: 10993)
ReservoirPriceOracleTest:testSetRoute() (gas: 60992)
ReservoirPriceOracleTest:testSetRoute_InvalidDecimals() (gas: 761313)
ReservoirPriceOracleTest:testSetRoute_InvalidRewardThreshold() (gas: 37234)
ReservoirPriceOracleTest:testSetRoute_InvalidRewardThresholdLength() (gas: 18050)
ReservoirPriceOracleTest:testSetRoute_InvalidRoute() (gas: 20151)
ReservoirPriceOracleTest:testSetRoute_InvalidRouteLength() (gas: 19209)
ReservoirPriceOracleTest:testSetRoute_MultipleHops() (gas: 201150)
ReservoirPriceOracleTest:testSetRoute_NotSorted() (gas: 13029)
ReservoirPriceOracleTest:testSetRoute_OverwriteExisting() (gas: 169526)
ReservoirPriceOracleTest:testSetRoute_SameToken() (gas: 12975)
ReservoirPriceOracleTest:testSetRoute() (gas: 61093)
ReservoirPriceOracleTest:testSetRoute_InvalidDecimals() (gas: 763490)
ReservoirPriceOracleTest:testSetRoute_InvalidRewardThreshold() (gas: 41588)
ReservoirPriceOracleTest:testSetRoute_InvalidRewardThresholdLength() (gas: 18107)
ReservoirPriceOracleTest:testSetRoute_InvalidRoute() (gas: 20265)
ReservoirPriceOracleTest:testSetRoute_InvalidRouteLength() (gas: 19311)
ReservoirPriceOracleTest:testSetRoute_MultipleHops() (gas: 201713)
ReservoirPriceOracleTest:testSetRoute_NotSorted() (gas: 13074)
ReservoirPriceOracleTest:testSetRoute_OverwriteExisting() (gas: 173601)
ReservoirPriceOracleTest:testSetRoute_SameToken() (gas: 13020)
ReservoirPriceOracleTest:testUndesignatePair() (gas: 30263)
ReservoirPriceOracleTest:testUndesignatePair_NotOwner() (gas: 15315)
ReservoirPriceOracleTest:testUpdatePrice_AboveThresholdBelowMaxReward(uint256) (runs: 256, μ: 164770, ~: 164790)
ReservoirPriceOracleTest:testUpdatePrice_BelowThreshold(uint256) (runs: 256, μ: 149645, ~: 149316)
ReservoirPriceOracleTest:testUpdatePrice_BeyondMaxReward(uint256) (runs: 256, μ: 162201, ~: 162226)
ReservoirPriceOracleTest:testUpdatePrice_FirstUpdate() (gas: 153384)
ReservoirPriceOracleTest:testUpdatePrice_IntermediateRoutes() (gas: 11080585)
ReservoirPriceOracleTest:testUpdatePrice_NoPath() (gas: 15986)
ReservoirPriceOracleTest:testUpdatePrice_PriceOutOfRange() (gas: 5374104)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_ContractNoReceive() (gas: 152500)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_InsufficientReward(uint256) (runs: 256, μ: 210828, ~: 211040)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_ZeroRecipient() (gas: 146179)
ReservoirPriceOracleTest:testUpdatePrice_WriteToNonSimpleRoute() (gas: 498183)
ReservoirPriceOracleTest:testUpdateRewardGasAmount() (gas: 19038)
ReservoirPriceOracleTest:testUpdateRewardGasAmount_NotOwner() (gas: 10953)
ReservoirPriceOracleTest:testUpdateTwapPeriod(uint256) (runs: 256, μ: 21613, ~: 21687)
ReservoirPriceOracleTest:testUpdateTwapPeriod_InvalidTwapPeriod(uint256) (runs: 256, μ: 17688, ~: 17994)
ReservoirPriceOracleTest:testValidatePair_NoDesignatedPair() (gas: 119204)
ReservoirPriceOracleTest:testWritePriceCache(uint256) (runs: 256, μ: 30001, ~: 29763)
ReservoirPriceOracleTest:testUndesignatePair_NotOwner() (gas: 15271)
ReservoirPriceOracleTest:testUpdatePrice_AboveThresholdBelowMaxReward(uint256) (runs: 256, μ: 162359, ~: 162386)
ReservoirPriceOracleTest:testUpdatePrice_BelowThreshold(uint256) (runs: 256, μ: 149778, ~: 149810)
ReservoirPriceOracleTest:testUpdatePrice_BeyondMaxReward(uint256) (runs: 256, μ: 159660, ~: 159609)
ReservoirPriceOracleTest:testUpdatePrice_FirstUpdate() (gas: 153341)
ReservoirPriceOracleTest:testUpdatePrice_IntermediateRoutes() (gas: 11082517)
ReservoirPriceOracleTest:testUpdatePrice_NoPath() (gas: 15942)
ReservoirPriceOracleTest:testUpdatePrice_PriceOutOfRange() (gas: 5374183)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_ContractNoReceive() (gas: 150457)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_InsufficientReward(uint256) (runs: 256, μ: 208788, ~: 208867)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_ZeroRecipient() (gas: 144136)
ReservoirPriceOracleTest:testUpdatePrice_WriteToNonSimpleRoute() (gas: 502310)
ReservoirPriceOracleTest:testUpdateRewardGasAmount() (gas: 19117)
ReservoirPriceOracleTest:testUpdateRewardGasAmount_NotOwner() (gas: 11010)
ReservoirPriceOracleTest:testUpdateTwapPeriod(uint256) (runs: 256, μ: 21674, ~: 21756)
ReservoirPriceOracleTest:testUpdateTwapPeriod_InvalidTwapPeriod(uint256) (runs: 256, μ: 17851, ~: 18066)
ReservoirPriceOracleTest:testValidatePair_NoDesignatedPair() (gas: 119138)
ReservoirPriceOracleTest:testWritePriceCache(uint256) (runs: 256, μ: 30010, ~: 29775)
RoutesLibTest:testGetDecimalDifference() (gas: 3966)
RoutesLibTest:testIsCompositeRoute() (gas: 4332)
RoutesLibTest:testPackSimplePrice(int8,uint256) (runs: 256, μ: 8083, ~: 7862)
RoutesLibTest:testPackSimplePrice(int8,uint64,uint256) (runs: 256, μ: 8167, ~: 7915)
SamplesTest:testAccumulator() (gas: 3930)
SamplesTest:testAccumulator_BadVariableRequest() (gas: 3355)
SamplesTest:testInstant() (gas: 3880)
SamplesTest:testInstant_BadVariableRequest() (gas: 3376)
SamplesTest:testInstant_BadVariableRequest() (gas: 3376)
UtilsTest:testCalcPercentageDiff_Double(uint256) (runs: 256, μ: 7055, ~: 6836)
UtilsTest:testCalcPercentageDiff_Half(uint256) (runs: 256, μ: 7230, ~: 7432)
UtilsTest:testCalcPercentageDiff_NoDiff(uint256) (runs: 256, μ: 6836, ~: 6622)
Loading
Loading