One of the fuzz tests in the pre-existing Fuzzing.t.sol actually fails if you are lucky, or you do enough runs! This first occurred in Refinance during my test funds, but the code that causes this is found in borrow
and giveLoan
functions as well:
Failing tests:
This was the testFuzz_refinance test. This can be verified by subsituting the two args for the inputs in the testFuzz_refinance()
yourself.
The part of the fuzz test that failed was:
This occurs when a rounding error underestimates the loanRatio of the debts. The fuzz tests do not run enough times which makes it miss this error and breaking of the fuzzing invariants that the protocol thought couldn't be broken.
The loanRatio can be slightly surpassed/broken by calling refinance() given the correct inputs. A malicious user could use this to create a borrow which is slightly worth more than what is lent in the right circumstances.
Foundry Fuzz testing
Round up in division to ensure the loan ratio cannot be broken.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.