DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: medium
Invalid

Incorrect Rounding Directions

Summary

In LibDibbler.sol rounding directions are opposite of what is mentioned in code comments.

Vulnerability Details

When beanstalk is above peg the scaleSoilUp() function should round up the soil but the code does not pass in LibPRBMathRoundable.Rounding.Up variable which results in lesser soil than required & vice versa with scaleSoilDown & _scaleTemperature where both should round down but instead roundUp

Code snippets-
https://github.com/Cyfrin/2024-05-beanstalk-the-finale/blob/4e0ad0b964f74a1b4880114f4dd5b339bc69cd3e/protocol/contracts/libraries/LibDibbler.sol#L321-L331

https://github.com/Cyfrin/2024-05-beanstalk-the-finale/blob/4e0ad0b964f74a1b4880114f4dd5b339bc69cd3e/protocol/contracts/libraries/LibDibbler.sol#L349-L360

Impact

Less soil than required when above peg
More soil than required when below peg
More temperature than required

Tools Used

Manual review

Recommendations

Pass in the correct rounding variable in correct function.

Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.