sherlock-audit / 2024-06-velocimeter-judging

11 stars 7 forks source link

bareli - split will not work when "amount" is equal to "value" #619

Closed sherlock-admin2 closed 3 months ago

sherlock-admin2 commented 3 months ago

bareli

Medium

split will not work when "amount" is equal to "value"

Summary

when amount is equal to value then split will revert.

Vulnerability Detail

function split(uint _tokenId,uint amount) external {

    // check permission and vote
    require(attachments[_tokenId] == 0 && !voted[_tokenId], "attached");
    require(_isApprovedOrOwner(msg.sender, _tokenId));
    require(!blockedSplit[_tokenId],"split blocked");

    // save old data and totalWeight
    address _to = idToOwner[_tokenId];
    LockedBalance memory _locked = locked[_tokenId];
    uint end = _locked.end;
    uint value = uint(int256(_locked.amount));
 @>>   require(value > amount,"amount > value");

Impact

split will revert then value is equal to amount.

Code Snippet

https://github.com/sherlock-audit/2024-06-velocimeter/blob/main/v4-contracts/contracts/VotingEscrow.sol#L1229

Tool used

Manual Review

Recommendation

require(value >= amount,"amount > value");

nevillehuang commented 3 months ago

Invalid, if amount == value locked, there is nothing to split, so no issue here