-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix BlockOutOfRangeError
in fuzz tests
#4
Comments
The two cited line numbers are during |
Closing since I haven't seen this since fixing the nonce too low issue. We can re-open if we see it pop back up. |
I found this issue again; I think it is happening between mint & approve in
|
I was able to consistently reproduce this while working on #142 and then (hopefully) fixed it by adding a sleep after the base approval step in |
# Resolved Issues Making testing more consistent to help narrow problems found when investigating #29 # Description - single preamble We had 3x duplicates of a `preamble` function that would execute a series of trades on the deployed test pool in order to simulate testing from a random state. I consolidated it into one location that is imported elsewhere. I also added some checks on upper trade bounds so that it is guaranteed to be valid, even if calc_max fails. - code cleanup This seemingly innocuous change caused a difficult-to-track Hisenbug where the ERC20 contract would throw an overflow/underflow error whenever we'd call `hyperdrive.open_long` or `hyperdrive.open_short`. This was due to lack of approval, which was due to the approval call not going through before the open call, which was due to anvil not being able to keep up with the rust calls coming in. I fixed that bug (thanks to @mcclurejt for the help!) and in the process of hunting down that bug did a bunch of code cleanup stuff like improved error messaging, variable names, organization, etc. I'm was able to consistently reproduce #4 while tracking this bug, and the fix we implemented seems to have also fixed that one. - new tests I also wrote a couple of new tests while hunting the Heisenbug. ### NOTE: I had to increase test tolerance for `fuzz_sol_calc_open_short` from 1e9 to 10e18. My best guess as to why this happened is because we're now testing a wider variety of valid states and we're hitting error modes. I know that `calculate_open_short` does not match solidity exactly, so most likely this is the source of the error. I added a comment as a reminder in #29, but for now I think we should live with the high tolerance. That being said, I encourage the reviewer to look carefully. I may have missed a change in this PR that is causing such a big error.
Looks like the error is still happening on |
Two test occasionally fail with a
BlockOutOfRangeError
message.long::open::tests::fuzz_calculate_spot_price_after_long
long::targeted::tests::test_calculate_targeted_long_with_budget
The text was updated successfully, but these errors were encountered: