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

feat: update solc version #20

Merged
merged 11 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 72 additions & 72 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
QueryProcessorTest:testFindNearestSample_CanFindExactValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 65090324, ~: 74975370)
QueryProcessorTest:testFindNearestSample_CanFindIntermediateValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 64771162, ~: 74583507)
QueryProcessorTest:testFindNearestSample_NotInitialized() (gas: 1056945756)
QueryProcessorTest:testFindNearestSample_OneSample(uint256) (runs: 256, μ: 80327, ~: 80360)
QueryProcessorTest:testGetInstantValue() (gas: 124248)
QueryProcessorTest:testGetInstantValue_NotInitialized(uint256) (runs: 256, μ: 19397, ~: 19397)
QueryProcessorTest:testGetInstantValue_NotInitialized_BeyondBufferSize(uint8,uint16) (runs: 256, μ: 68389670, ~: 68389600)
QueryProcessorTest:testGetPastAccumulator_BufferEmpty(uint8) (runs: 256, μ: 27016, ~: 27087)
QueryProcessorTest:testGetPastAccumulator_ExactMatch(uint32,uint256,uint256,uint16) (runs: 256, μ: 70591497, ~: 80271384)
QueryProcessorTest:testGetPastAccumulator_ExactMatch_LatestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 69164823, ~: 77928090)
QueryProcessorTest:testGetPastAccumulator_ExactMatch_OldestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 69194817, ~: 77959690)
QueryProcessorTest:testGetPastAccumulator_ExtrapolatesBeyondLatest(uint32,uint256,uint256,uint256) (runs: 256, μ: 64744868, ~: 74555386)
QueryProcessorTest:testGetPastAccumulator_InterpolatesBetweenPastAccumulators(uint32,uint256,uint256,uint256) (runs: 256, μ: 64778894, ~: 74589515)
QueryProcessorTest:testGetPastAccumulator_InvalidAgo(uint32,uint256,uint256,uint256) (runs: 256, μ: 64736471, ~: 74546552)
QueryProcessorTest:testGetPastAccumulator_QueryTooOld(uint32,uint256,uint256,uint256) (runs: 256, μ: 64748015, ~: 74556435)
QueryProcessorTest:testGetTimeWeightedAverage(uint32,uint256,uint256,uint256,uint256) (runs: 256, μ: 102669133, ~: 112352230)
QueryProcessorTest:testGetTimeWeightedAverage_BadSecs() (gas: 10995)
ReservoirPriceOracleTest:testClearRoute() (gas: 52339)
ReservoirPriceOracleTest:testClearRoute_AllWordsCleared() (gas: 159879)
ReservoirPriceOracleTest:testDesignatePair() (gas: 29068)
ReservoirPriceOracleTest:testDesignatePair_IncorrectPair() (gas: 21155)
ReservoirPriceOracleTest:testDesignatePair_NotOwner() (gas: 17553)
ReservoirPriceOracleTest:testDesignatePair_TokenOrderReversed() (gas: 30639)
ReservoirPriceOracleTest:testGetQuote(uint256,uint256) (runs: 256, μ: 34001, ~: 34118)
ReservoirPriceOracleTest:testGetQuote_AmountInTooLarge() (gas: 12963)
ReservoirPriceOracleTest:testGetQuote_BaseIsVault(uint256) (runs: 256, μ: 411282, ~: 411040)
ReservoirPriceOracleTest:testGetQuote_ComplicatedDecimals() (gas: 10354017)
ReservoirPriceOracleTest:testGetQuote_Inverse(uint256,uint256) (runs: 256, μ: 36138, ~: 36254)
ReservoirPriceOracleTest:testGetQuote_MultipleHops() (gas: 111841)
ReservoirPriceOracleTest:testGetQuote_MultipleHops_Inverse() (gas: 112163)
ReservoirPriceOracleTest:testGetQuote_MultipleHops_PriceZero() (gas: 122567)
ReservoirPriceOracleTest:testGetQuote_NoFallbackOracle() (gas: 20820)
ReservoirPriceOracleTest:testGetQuote_PriceZero() (gas: 15958)
ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_1HopRoute(uint256,uint256,address,address,uint8,uint8) (runs: 256, μ: 5329100, ~: 5329104)
ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_2HopRoute(uint256,uint256,uint256,address,address,address,uint8,uint8,uint8) (runs: 256, μ: 10496290, ~: 10496408)
ReservoirPriceOracleTest:testGetQuote_SameBaseQuote(uint256,address) (runs: 256, μ: 8941, ~: 8941)
ReservoirPriceOracleTest:testGetQuote_UseFallback() (gas: 38334)
ReservoirPriceOracleTest:testGetQuote_ZeroIn() (gas: 36975)
ReservoirPriceOracleTest:testGetQuotes(uint256,uint256) (runs: 256, μ: 26512, ~: 26629)
ReservoirPriceOracleTest:testPriceCache_Inverted() (gas: 22001)
ReservoirPriceOracleTest:testSetFallbackOracle_NotOwner() (gas: 10938)
ReservoirPriceOracleTest:testSetRoute() (gas: 61093)
ReservoirPriceOracleTest:testSetRoute_InvalidRewardThreshold() (gas: 37330)
ReservoirPriceOracleTest:testSetRoute_InvalidRoute() (gas: 20154)
ReservoirPriceOracleTest:testSetRoute_InvalidRouteLength() (gas: 19294)
ReservoirPriceOracleTest:testSetRoute_MultipleHops() (gas: 201309)
ReservoirPriceOracleTest:testSetRoute_NotSorted() (gas: 13028)
ReservoirPriceOracleTest:testSetRoute_OverwriteExisting() (gas: 169666)
ReservoirPriceOracleTest:testSetRoute_SameToken() (gas: 13041)
ReservoirPriceOracleTest:testUndesignatePair() (gas: 30256)
ReservoirPriceOracleTest:testUndesignatePair_NotOwner() (gas: 15355)
ReservoirPriceOracleTest:testUpdatePrice_AboveThresholdBelowMaxReward(uint256) (runs: 256, μ: 165939, ~: 165959)
ReservoirPriceOracleTest:testUpdatePrice_BelowThreshold(uint256) (runs: 256, μ: 150797, ~: 150473)
ReservoirPriceOracleTest:testUpdatePrice_BeyondMaxReward(uint256) (runs: 256, μ: 163444, ~: 163469)
ReservoirPriceOracleTest:testUpdatePrice_FirstUpdate() (gas: 154418)
ReservoirPriceOracleTest:testUpdatePrice_IntermediateRoutes() (gas: 16111065)
ReservoirPriceOracleTest:testUpdatePrice_PriceOutOfRange() (gas: 5353482)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_ContractNoReceive() (gas: 153582)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_InsufficientReward(uint256) (runs: 256, μ: 212147, ~: 212363)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_ZeroRecipient() (gas: 147250)
ReservoirPriceOracleTest:testUpdateRewardGasAmount() (gas: 19039)
ReservoirPriceOracleTest:testUpdateRewardGasAmount_NotOwner() (gas: 10940)
ReservoirPriceOracleTest:testUpdateTwapPeriod(uint256) (runs: 256, μ: 21687, ~: 21778)
ReservoirPriceOracleTest:testUpdateTwapPeriod_InvalidTwapPeriod(uint256) (runs: 256, μ: 17825, ~: 18120)
ReservoirPriceOracleTest:testWritePriceCache(uint256) (runs: 256, μ: 30219, ~: 29977)
RoutesLibTest:testGetDecimalDifference() (gas: 3974)
RoutesLibTest:testIsCompositeRoute() (gas: 4341)
RoutesLibTest:testPackSimplePrice(int8,uint256) (runs: 256, μ: 8200, ~: 7962)
SamplesTest:testAccumulator() (gas: 3959)
SamplesTest:testAccumulator_BadVariableRequest() (gas: 3523)
SamplesTest:testInstant() (gas: 3909)
SamplesTest:testInstant_BadVariableRequest() (gas: 3566)
QueryProcessorTest:testFindNearestSample_CanFindExactValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 65806302, ~: 74826166)
QueryProcessorTest:testFindNearestSample_CanFindIntermediateValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 64996916, ~: 74226210)
QueryProcessorTest:testFindNearestSample_NotInitialized() (gas: 1056944892)
QueryProcessorTest:testFindNearestSample_OneSample(uint256) (runs: 256, μ: 80136, ~: 80169)
QueryProcessorTest:testGetInstantValue() (gas: 123891)
QueryProcessorTest:testGetInstantValue_NotInitialized(uint256) (runs: 256, μ: 19378, ~: 19378)
QueryProcessorTest:testGetInstantValue_NotInitialized_BeyondBufferSize(uint8,uint16) (runs: 256, μ: 68260435, ~: 68260368)
QueryProcessorTest:testGetPastAccumulator_BufferEmpty(uint8) (runs: 256, μ: 26902, ~: 26962)
QueryProcessorTest:testGetPastAccumulator_ExactMatch(uint32,uint256,uint256,uint16) (runs: 256, μ: 71271543, ~: 80081087)
QueryProcessorTest:testGetPastAccumulator_ExactMatch_LatestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 67118170, ~: 76073918)
QueryProcessorTest:testGetPastAccumulator_ExactMatch_OldestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 67147892, ~: 76105399)
QueryProcessorTest:testGetPastAccumulator_ExtrapolatesBeyondLatest(uint32,uint256,uint256,uint256) (runs: 256, μ: 64971065, ~: 74197796)
QueryProcessorTest:testGetPastAccumulator_InterpolatesBetweenPastAccumulators(uint32,uint256,uint256,uint256) (runs: 256, μ: 65004847, ~: 74232436)
QueryProcessorTest:testGetPastAccumulator_InvalidAgo(uint32,uint256,uint256,uint256) (runs: 256, μ: 64962680, ~: 74189873)
QueryProcessorTest:testGetPastAccumulator_QueryTooOld(uint32,uint256,uint256,uint256) (runs: 256, μ: 64974173, ~: 74199723)
QueryProcessorTest:testGetTimeWeightedAverage(uint32,uint256,uint256,uint256,uint256) (runs: 256, μ: 107958222, ~: 115516665)
QueryProcessorTest:testGetTimeWeightedAverage_BadSecs() (gas: 10981)
ReservoirPriceOracleTest:testClearRoute() (gas: 52216)
ReservoirPriceOracleTest:testClearRoute_AllWordsCleared() (gas: 159654)
ReservoirPriceOracleTest:testDesignatePair() (gas: 29038)
ReservoirPriceOracleTest:testDesignatePair_IncorrectPair() (gas: 21133)
ReservoirPriceOracleTest:testDesignatePair_NotOwner() (gas: 17541)
ReservoirPriceOracleTest:testDesignatePair_TokenOrderReversed() (gas: 30605)
ReservoirPriceOracleTest:testGetQuote(uint256,uint256) (runs: 256, μ: 33681, ~: 33805)
ReservoirPriceOracleTest:testGetQuote_AmountInTooLarge() (gas: 12950)
ReservoirPriceOracleTest:testGetQuote_BaseIsVault(uint256) (runs: 256, μ: 401378, ~: 401124)
ReservoirPriceOracleTest:testGetQuote_ComplicatedDecimals() (gas: 10127860)
ReservoirPriceOracleTest:testGetQuote_Inverse(uint256,uint256) (runs: 256, μ: 35804, ~: 35867)
ReservoirPriceOracleTest:testGetQuote_MultipleHops() (gas: 111603)
ReservoirPriceOracleTest:testGetQuote_MultipleHops_Inverse() (gas: 111924)
ReservoirPriceOracleTest:testGetQuote_MultipleHops_PriceZero() (gas: 122238)
ReservoirPriceOracleTest:testGetQuote_NoFallbackOracle() (gas: 20788)
ReservoirPriceOracleTest:testGetQuote_PriceZero() (gas: 15930)
ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_1HopRoute(uint256,uint256,address,address,uint8,uint8) (runs: 256, μ: 5198032, ~: 5198035)
ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_2HopRoute(uint256,uint256,uint256,address,address,address,uint8,uint8,uint8) (runs: 256, μ: 10269567, ~: 10269655)
ReservoirPriceOracleTest:testGetQuote_SameBaseQuote(uint256,address) (runs: 256, μ: 8927, ~: 8927)
ReservoirPriceOracleTest:testGetQuote_UseFallback() (gas: 38250)
ReservoirPriceOracleTest:testGetQuote_ZeroIn() (gas: 36635)
ReservoirPriceOracleTest:testGetQuotes(uint256,uint256) (runs: 256, μ: 26203, ~: 26327)
ReservoirPriceOracleTest:testPriceCache_Inverted() (gas: 21949)
ReservoirPriceOracleTest:testSetFallbackOracle_NotOwner() (gas: 10928)
ReservoirPriceOracleTest:testSetRoute() (gas: 61014)
ReservoirPriceOracleTest:testSetRoute_InvalidRewardThreshold() (gas: 37278)
ReservoirPriceOracleTest:testSetRoute_InvalidRoute() (gas: 20106)
ReservoirPriceOracleTest:testSetRoute_InvalidRouteLength() (gas: 19253)
ReservoirPriceOracleTest:testSetRoute_MultipleHops() (gas: 201105)
ReservoirPriceOracleTest:testSetRoute_NotSorted() (gas: 13006)
ReservoirPriceOracleTest:testSetRoute_OverwriteExisting() (gas: 169491)
ReservoirPriceOracleTest:testSetRoute_SameToken() (gas: 13019)
ReservoirPriceOracleTest:testUndesignatePair() (gas: 30215)
ReservoirPriceOracleTest:testUndesignatePair_NotOwner() (gas: 15344)
ReservoirPriceOracleTest:testUpdatePrice_AboveThresholdBelowMaxReward(uint256) (runs: 256, μ: 163637, ~: 163657)
ReservoirPriceOracleTest:testUpdatePrice_BelowThreshold(uint256) (runs: 256, μ: 148532, ~: 148476)
ReservoirPriceOracleTest:testUpdatePrice_BeyondMaxReward(uint256) (runs: 256, μ: 161152, ~: 161177)
ReservoirPriceOracleTest:testUpdatePrice_FirstUpdate() (gas: 152255)
ReservoirPriceOracleTest:testUpdatePrice_IntermediateRoutes() (gas: 15927172)
ReservoirPriceOracleTest:testUpdatePrice_PriceOutOfRange() (gas: 5288225)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_ContractNoReceive() (gas: 151436)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_InsufficientReward(uint256) (runs: 256, μ: 209567, ~: 209771)
ReservoirPriceOracleTest:testUpdatePrice_RewardEligible_ZeroRecipient() (gas: 145106)
ReservoirPriceOracleTest:testUpdateRewardGasAmount() (gas: 19027)
ReservoirPriceOracleTest:testUpdateRewardGasAmount_NotOwner() (gas: 10930)
ReservoirPriceOracleTest:testUpdateTwapPeriod(uint256) (runs: 256, μ: 21571, ~: 21656)
ReservoirPriceOracleTest:testUpdateTwapPeriod_InvalidTwapPeriod(uint256) (runs: 256, μ: 17706, ~: 17994)
ReservoirPriceOracleTest:testWritePriceCache(uint256) (runs: 256, μ: 30061, ~: 29807)
RoutesLibTest:testGetDecimalDifference() (gas: 3966)
RoutesLibTest:testIsCompositeRoute() (gas: 4332)
RoutesLibTest:testPackSimplePrice(int8,uint256) (runs: 256, μ: 8097, ~: 7862)
SamplesTest:testAccumulator() (gas: 3952)
SamplesTest:testAccumulator_BadVariableRequest() (gas: 3355)
SamplesTest:testInstant() (gas: 3902)
SamplesTest:testInstant_BadVariableRequest() (gas: 3398)
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/Vectorized/solady
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ For direct usages of the oracle, refer to
[IReservoirPriceOracle.sol](src/interfaces/IReservoirPriceOracle.sol) for
methods to obtain raw data from the AMM pairs.

## EVM Compatibility

Currently the `ReservoirPriceOracle` contract makes use of the transient storage
supported since the Cancun fork via OZ's `ReentrancyGuardTransient` lib.
At the time of writing only ETH mainnet is supported.
If deployment to other chains where transient storage is not yet supported,
we can revert to using solady's `ReentrancyGuard` for the most gas efficient
implementation.

## Usage

### Install
Expand Down
3 changes: 2 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[profile.default]
solc = "0.8.26"
solc = "0.8.28"
evm_version = "cancun"
bytecode_hash = "ipfs"
optimizer_runs = 1_000_000
libs = ['lib']
Expand Down
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at 69c8de
2 changes: 1 addition & 1 deletion lib/solady
Submodule solady updated 145 files
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"markdownlint": "0.34.0",
"markdownlint-cli": "0.31.1",
"prettier": "3.3.1",
"solhint": "5.0.1",
"solhint": "5.0.3",
"ts-node": "10.8.1"
}
}
3 changes: 2 additions & 1 deletion src/.solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"compiler-version": ["error", ">=0.8.0"],
"func-visibility": ["error", { "ignoreConstructors": true }],
"not-rely-on-time": "off",
"no-inline-assembly": "off"
"no-inline-assembly": "off",
"gas-custom-errors": "off"
}
}
Loading