Skip to content

Commit

Permalink
test: Add ghost variables and inline assertions (SC-485) (#17)
Browse files Browse the repository at this point in the history
* feat: first test working

* feat: use larger numbers:

* feat: test with initial burn amount passing

* feat: update tests to work with updated burn logic, move conversion functions around and use previews

* feat: remove todos

* fix: update to remove console and update comment

* feat: get swap tests working

* feat: get all swap tests working

* fix: update for three assets in logic

* feat: all tests passing

* fix: rm commented out test

* feat: add preview swap tests

* feat: move logic out of single use internal and use conversion rate everywhere

* feat: move divRoundUp out of single use internal

* feat: add full coverage for conversion tests

* feat: add more preview cases

* feat: refactor PSM to use three assets

* fix: rm comment

* feat: add interface, natspec, events, referral code, tests passing

* fix: update to rm consolegp

* feat: add events testing

* feat: make precisions internal and add state var natspec

* feat: finish natspec

* feat: add readme

* feat: add referral code note

* fix: update constructor test

* fix: update links

* fix: reformatting

* fix: update testing section

* fix: improve overview

* feat: add emojis

* feat: remove all share burn logic, get all non inflation attack tests to pass

* fix: cleanup diff

* fix: update to use initial deposit instead of burn

* feat: add readme section explaining attack

* fix: minimize diff

* fix: address bartek comments

* feat: update all tests to work with new interfaces

* feat: add deposit failure mode tests

* feat: update to add assertions for return in deposit

* feat: add withdraw failure tests

* feat: update to address comments outside sharesToBurn

* feat: update inflation attack test and readme

* fix: update readme

* feat: update test to constrain deposit/withdraw

* feat: update to add both cases

* feat: update per review

* feat: update to use underscore bound, fix test

* fix: typo

* feat: add overrides, remove referrals, update referral type

* fix: update expect emit

* feat: update name and remove todos

* feat: move files and set up structure

* feat: update to rename files, contracts, and errors

* fix: rm dup file, update toml

* feat: get deposits working

* chore: refactor into proper inheritance structure

* feat: get all functions working with reverts

* feat: update conversion

* feat: get swaps working without reverts

* feat: add fully working deposit/withdraw/swaps, invariant_B failing

* ci: update for ci

* fix: update name

* chore: rm basly cased file

* chore: re add

* fix: re add invariant

* ci: experiment with 2 million total calls

* ci: add show progress flag

* fix: move file back

* ci: update verbosity

* ci: add PR profile

* fix: rm redundant files

* feat: update from review changes

* feat: add afterInvariant hook

* fix: update invariant

* fix: add fuzz failure

* chore: rm indexing comment

* feat: refactor structure

* feat: both invariants working

* fix: update comment

* feat: add rate setting logic

* fix: update toml

* fix: rm redundant files from merge

* fix: update tolerances

* feat: update to add seeding as part of invariants

* fix: update toml

* fix: rm redundant files from merge

* fix: update tolerances

* fix: rm invariant logs

* fix: update tolerance

* forge install: xchain-dsr-oracle

v1.0.0

* feat: setup timebased handler, refactor rate provider structure

* feat: tests passing

* feat: add first inline assertions

* feat: tests passing with inline assertions

* feat: all tests passing

* fix: increase tolerance

* feat: gaa

* feat: update swap to swapExactAmountIn

* feat: add preview test coverage

* feat: add new function

* chore: first cleanup

* fix: test names

* feat: tests passing

* fix: update tolerances, tests passing

* feat: add ge assertions

* fix: refactor invariants to use loops

* feat: update to get aggregate ghost variables working

* feat: update to add more invariants

* feat: create new file, failure tests passing

* fix: update dsr value, change chi approach

* ci: update ci params

* fix: increase invariant D tolerance

* ci: add coverage backgp

* fix: update rho usage

* feat: get new swap tests passing

* feat: set up initial test

* feat: refactor code to add returns

* feat: add return value assertions

* feat: working fuzz test

* feat: add swap exact out, show that rounding is against user

* fix: update natspec

* feat: refactor to round up on swap exact out

* feat: all tests passing

* fix: merge conflicts

* fix: cleanup

* feat: invariant tests passing

* fix: update tolerances

* feat: update tolerances

* fix: update tolerance

* fix: increase fuzz tolerance

* fix: first fixes, failint tests

* fix; update to match for before/after assertions

* fix: update to show invariant_F failure

* feat: add more assertions, make invariant helpers more efficient

* feat: update to fix invariant F

* fix: rm old todos, reduce rates and warping to reflect more realistic scenarios

* fix: remove negative tolerances in swap handler

* foix: increase hook tolerances

* fix: udpate comment

* fix: typo
  • Loading branch information
lucas-manuel authored Jul 29, 2024
1 parent 19b7f03 commit 7d1d7bc
Show file tree
Hide file tree
Showing 10 changed files with 615 additions and 96 deletions.
3 changes: 3 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ runs = 1000
runs = 20
depth = 1000
shrink_run_limit = 1000
fail_on_revert = true

[profile.pr.invariant]
runs = 200
depth = 1000
shrink_run_limit = 50_000

[profile.pr.fuzz]
runs = 100_000

[profile.master.invariant]
runs = 200
depth = 10_000
shrink_run_limit = 100_000

[profile.master.fuzz]
runs = 1_000_000
Expand Down
Loading

0 comments on commit 7d1d7bc

Please sign in to comment.