Open hats-bug-reporter[bot] opened 3 months ago
for now, I will judge these submissions as well
@0xmahdirostami
Solidity version 0.8.19 will prevent overflows in these places.
And the token of this contract in the context of the project is FNX, which does not provide for the supply of more than int128.max. (fnx deciamls = 18).
Therefore, in my opinion, this submission is not valid
After re-evaluating the issue and taking into account the locked time, the block time, and the total supply of the 18-decimal token, it appears that this issue may not be valid as the downcasting here seems to be safe. (The max value of int128 is at order of ~1e38)
Github username: -- Twitter username: -- Submission hash (on-chain): 0x8f6669292fda0a615d8ce64a263d71792b026d6e4b8649085f99716ce40c7217 Severity: medium
Description: Description\ Due to
int128
used to represent the locked amount of given tokens,onAttachToManagedNFT
can overflow when amounts of bothtokendId
andmanagedTokenId
are being summed:There is no validation whether the sum is less than int128 max and if it’s bigger the number become negative, indicating no voting power (bias will remain unchanged in
_checkpoint
, since there is check for positivenew_locked::amount
):Attack Scenario\ User holding significant amount intentionally can brick managed token with big amount in
locked[managedTokenId].amount
by simply attaching his token to it, then after the vote delay passes he can again perform this action on another managed token.Or many issue can arise even unintentionally when multiple tokens with significant amount decide to manage to one token.
Attachments
int258
or apply check whether the summed amount of 2 tokens do not exceed the max amount.