sherlock-audit / 2024-08-woofi-solana-deployment-judging

2 stars 2 forks source link

dod4ufn - deposit function redundant check that may lead to DOS #82

Open sherlock-admin3 opened 1 month ago

sherlock-admin3 commented 1 month ago

dod4ufn

Medium

deposit function redundant check that may lead to DOS

Summary

In deposit_withdraw.rs the function depositmay revert due to the call to balance.

Vulnerability Detail

The revert will be caused due to the unnecessary check to verify that the token_vault.amount is greater than woopool.unclaimed_fee, despite the fact that token_vault.amount will be increased within the deposit function.

Impact

Incorrect check within deposit leads to the function reverting.

Code Snippet

deposit instruction

Tool used

Manual Review

Recommendation

Remove the incorrect check in the line let _balance_before = balance(woopool, token_vault)?; to avoid unintended reverts.

toprince commented 1 month ago

Not valid. This check is check the one who doing the deposit, has the amount.