The EnrootFacet
exhibits a potential issue related to a length mismatch between the stems
and amounts
arrays in the enrootDeposits
and removeDepositsFromAccount
functions. The absence of a length check may lead to unexpected behavior or runtime errors.
Runtime Errors: The absence of a length check in the provided code may lead to runtime errors during the execution of the enrootDeposits
and removeDepositsFromAccount
functions if the lengths of the stems
and amounts
arrays are not the same.
Unexpected Behavior: In scenarios where the lengths of stems
and amounts
arrays differ, the contract might not execute the intended logic correctly.
User experience: User will get frustrated if he is not getting a proper error message on revert.
Assume the unripeBean
is whitelisted and unripe token
Copy the below test and run forge test --match-test testEnrootDeposits -vvvv
cmd
Result if amount < steps
:
Result if amount > steps
:
Add a quick check at the start of the enrootDeposits
function to make sure the lengths of the stems
and amounts
lists are the same.
After investigating further, it turns out this function is also used in _withdrawDeposits
, which already has a similar check. So, it makes sense to suggest adding this length check directly to the shared LibSilo
library. This way, every time _removeDepositsFromAccount
is called, it will automatically handle the check, making the code cleaner and avoiding repetition.
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.