sherlock-audit / 2024-05-napier-update-judging

8 stars 7 forks source link

Drynooo - In the RsETHAdapter contract, _stake may revert #59

Closed sherlock-admin4 closed 4 months ago

sherlock-admin4 commented 5 months ago

Drynooo

medium

In the RsETHAdapter contract, _stake may revert

Summary

In RSETH_DEPOSIT_POOL, stakeAmount is allowed to be equal to minAmountToDeposit(). The check in _stake will cause this kind of stake to fail.

Vulnerability Detail

The protocol adds a possibility of reverting, making it more likely that stakes will be reverted.

Impact

This failure may cause the user to fail to call Tranche.issue at the source. Thus affecting user stake.

Code Snippet

        if (depositAmount == 0 || depositAmount < minAmountToDeposit) {
            revert InvalidAmountToDeposit();
        }
 if (stakeAmount <= RSETH_DEPOSIT_POOL.minAmountToDeposit()) revert MinAmountToDepositError();

Tool used

Manual Review

Recommendation

- if (stakeAmount <= RSETH_DEPOSIT_POOL.minAmountToDeposit()) revert MinAmountToDepositError();
+ if (stakeAmount < RSETH_DEPOSIT_POOL.minAmountToDeposit()) revert MinAmountToDepositError();

Duplicate of #46

WangSecurity commented 4 months ago

54 will be duplicated with #46, hence, this report will also be duplicated with #46.