Closed 0xPublicGoods closed 1 year ago
I should point out that with my Handler.t.sol file and foundry.toml settings as follows:
[invariant]
runs = 1000
depth = 128
fail_on_revert = false
These are my results, reverts were minimal:
Running 1 test for test/fuzz/InvariantsTest.t.sol:InvariantsTest
[PASS] invariant_protocolMustHaveMoreCollateralValueThankDscSupply() (runs: 1000, calls: 128000, reverts: 4)
But caught quickly with
fail_on_revert = true
invariant_protocolMustHaveMoreCollateralValueThankDscSupply() (runs: 2, calls: 173, reverts: 1)
Thank you!
I fixed it here: https://github.com/Cyfrin/foundry-defi-stablecoin-f23/commit/4b9f59ba57b77793fdbffb9ab23c34e88626c2c2
There were some formatting issues with your PR I wanted to get out of the way.
The invariant tests will ultimately fail, as we've sort of set them up in this project as such.
In DSCEngine.sol we have the params with user first, then collateral
In the current Handler file above (which I am suggesting needs editing) we are calling collateral first and user second, I found this whilst running Handler.t.sol locally at this point in the video course (https://youtu.be/wUjYK5gwNZs?t=14989). The video tests run perfectly, my local tests however, have under/overflow arithmetic errors.
I have the params in the correct order,
and these are the errors from my invariant test
This has been edited in place, no tests have been run on the repository - only my local version which is not yet finished