Replies: 1 comment 2 replies
-
Hello @s3bc40, considering that the revert is coming from your |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey 👋
I have been struggling a lot on fuzz testing to understand why my code was breaking when in the course it was not. 99% it was on my side, but after fixing the
mintDsc
for invariant test in theHandler.t.sol
I was getting the same error over and over again.Here is the
mintDsc
handler function, just to give some context at what point I did have this error:The error: [Revert] DSCEngine__BreaksHealthFactor(702670004378033987 [7.026e17])
I have checked all the discussion to see if it was something already fixed or something I have done wrong:
Everything seemed fine, even my previous tests (unit or integration) were passing.
A lot of time my
BreakHealthFactor
was triggered in my fuzz testing, which showed some test reverted(runs: 128, calls: 16384, reverts: 12)
but not on the course : so I am curious to understand.So here is my suggestion, I do not know if it is relevant or not while testing, but I have added a check on the
HealthFactor
before doing adsce.redeemCollateral
on the boundedamountCollateral
:Now I am reaching the result on the course:
(runs: 128, calls: 16384, reverts: 0)
Is my solution is considered as cheating since I am checking the health factor before, or does it seem logical ? I am open to understand any suggestion 👍
Thanks for reading!
Beta Was this translation helpful? Give feedback.
All reactions