hats-finance / OLD-Accumulated-finance-0x75278bcc0fa7c9e3af98654bce195eaf3bb6a784

MIT License
0 stars 0 forks source link

Function delegate does not allow a max uint128 value #16

Open hats-bug-reporter[bot] opened 1 week ago

hats-bug-reporter[bot] commented 1 week ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0x05b6731bdb31118e59013f46850da948193808c0efaa6ef930f3a14b8547cce1 Severity: low

Description:

Description

Inside stRoseMinter.sol.delegate the following check is made:

    function delegate(StakingAddress to, uint128 amount) public onlyOwner 
    returns (uint64) {

=> require(amount < type(uint128).max, ">MaxUint128");

This checks ensures that the specified amount does not exceed MaxUint128 as the message states >MaxUint128.

But since only < is used instead of <= this require statement will fail if the amount == uint128.max

This goes against the provided message error message and the intended flow

While no impact or DoS occurs this issue does fall under the Low categorisation

Recommendation

- require(amount < type(uint128).max, ">MaxUint128");
+ require(amount <= type(uint128).max, ">MaxUint128");
0xRizwan commented 1 week ago

Intended design by protocol. Practically, its bit difficult to delegate type(uint128).max amount to staking address.

whoismxuse commented 1 week ago

the error message states that it fails due to >uint128.max which means == uint128.max should not fail. These issues are marked as a LOW.