Skip to content

Commit 251fc5a

Browse files
authored
fix: write instant price to oracle and don't write liquidity data
* wip: write instant prices and do not write liquidity data * feat: introduce safecast safeguards * test: rm references to oracle liquidity variable * fix: rm prevClampedPrice storage variable * fix: impl of accumulators * ci: update optimized hash * test: prove max and min output of toLowResLog * fix: casting * test: fix breaking tests * docs: add natspec for _calcSpotAndLogPrice * fix: rm `SafeCastLib` import * docs: update comment with minimum value of log value * fix: move _computeLiquidity function into `StableMintBurn` where it is only needed * test: refactor case to check for price instead of liq * test: update storage slot for `vm.store` * test: fix `testOracle_SimplePrices` * fix: instant prices for the first oracle write * refactor: use more concise representation * test: fix SimplePrices * docs: improve comments for tests * docs: add attribution to balancer for StableOracleMath * refactor: move duplicated tests into OracleWriterTest * test: refactor for different way of reading clamped price * test: rm unused variables * test: refactor for new way of obtaining clamped price * fix: rm unused variable * fix: add `view` modifier to _calcSpotAndLogPrice * fix: update impl of _updateAndUnlock * lint: forge fmt * fix: update impl for updating instant prices in the same timestamp * ci: update hashes * fix: overflow when dealing with very large numbers * test: fix too large bounds that lead to multiplication overflow * fix: math issue in `StableOracleMath::calcLogPrice` where nominator or denominator can be zero * ci: update hashes * test: rm unused test case * gas: update gas snapshot * fix: small gas optimization * test: add assumption that new start time is greater than 1 * test: fix offset in testWriteObservations * refactor: move shared tests under one * refactor: move shared tests under one * fix: update impl to not write instant prices for subsequent activity in the same block * test: shift indexes after change in impl * refactor: collapse same test case under one * docs: update comment for updating oracle * test: refactor oracle tests for new impl of not updating instant prices every single time * test: update oracle indexes * ci: update hashes * gas: update gas snapshot * test: update comment * fix: use bitwise AND * ci: update hashes * fix: undo optimization * ci: update hashes * fix: impl shortcut for checking condition in `_updateAndUnlock` * docs: update docs * ci: update hashes * test: update comments * test: generalize `testOracle_OverflowAccPrice` for both curves * gas: update snapshot * test: oracle manipulation scenario * docs: update NatSpec comments * ci: update hashes * fix: revert back to writing instant prices for all updates * docs: add comments * test: fix broken tests due to oracle offset * ci: update hashes * ci: set gas limit to max * fix: reduce oracle buffer size * chore: import `Buffer.sol` verbatim from balancer * chore: upgrade solidity version * fix: set buffer size to 2048 * fix: add unchecked * fix: use `next()` to get next oracle index * test: fix expected value * test: add tests for `Buffer` * ci: update hashes * feat: introduce max change per trade * feat: introduce max change per trade * feat: implementing per trade limited price * feat: insert assert statement * test: fix expected emit log * fix: underflow problem for price reduction case * test: add tests for different clamp scenarios * test: rm blank line * docs: update comment * fix: update impl to clamp the rate of change * test: more cases * test: show how long it takes for a pair to recover from malicious mint * lint: forge fmt * test: update case with diff parameters * lint: fix * lint: fix * lint: fix * fix: PR comments * lint: forge fmt * ci: update hashes * ci: update hashes * gas: update snapshot
1 parent 69c7c52 commit 251fc5a

35 files changed

+2110
-2943
lines changed

.gas-snapshot

Lines changed: 205 additions & 209 deletions
Large diffs are not rendered by default.

foundry.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ solc = "0.8.23"
33
#via_ir = true
44
bytecode_hash = "ipfs"
55
optimizer_runs = 1_000_000
6+
gas_limit = "18446744073709551615"
67
libs = ['lib']
78
remappings = [
89
"@openzeppelin/=lib/openzeppelin-contracts/contracts/",

0 commit comments

Comments
 (0)