Replies: 3 comments 30 replies
-
Hello, @z0Ldev. Which of the tests is supposed to fail? |
Beta Was this translation helpful? Give feedback.
-
Also, do well do configure your toml well. Like the Invariant section. Goodluck. |
Beta Was this translation helpful? Give feedback.
-
Hello, I’ve noticed something. Possible Reason: The upper bound for the invariant test is set too high. Initially, the pool contains 50e18 WETH. If the random number ends up being really close to that value, it essentially empties the WETH from the pool. According to the AMM mechanism, the price of WETH increases significantly (which means more pool tokens are required). As a result, when the test runs again, the if (poolTokenAmount > type(uint64).max) {
return;
} This causes the test to exit early, and Solution: The simplest solution is to set a smaller bound on outputWeth = bound(outputWeth, pool.getMinimumWethDepositAmount(), 1e18); |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've followed along from lessons 21 - 26 in the TSwap course twice and both invariant tests are passing. I don't understand how is that possible. The Handler code in the repo is not remotely close to what's shown in the tutorial. How can I get one of the tests to fail?
Here's my Handler contract
Here's my Invariant contract
Please let me know where am I going wrong at
Beta Was this translation helpful? Give feedback.
All reactions