Platform: Code4rena
Start Date: 23/05/2022
Pot Size: $75,000 USDC
Total HM: 23
Participants: 75
Period: 7 days
Judge: GalloDaSballo
Total Solo HM: 13
Id: 130
League: ETH
Rank: 9/75
Findings: 1
Award: $2,912.92
🌟 Selected for report: 0
🚀 Solo Findings: 0
VotingEscrew _burn
function does not remove the token from the token's delegate token list.
Wrong voting results. Delegate's votes will be inflated.
When minting a token, it is added to the owner's delegate using _moveTokenDelegates
:
function _mint(address _to, uint _tokenId) internal returns (bool) { assert(_to != address(0)); _moveTokenDelegates(address(0), delegates(_to), _tokenId); _addTokenTo(_to, _tokenId); emit Transfer(address(0), _to, _tokenId); return true; }
_moveTokenDelegates
is also called when transferring tokens.
But when burning a token, the token is not removed from the delegate's list:
function _burn(uint _tokenId) internal { require(_isApprovedOrOwner(msg.sender, _tokenId), "caller is not owner nor approved"); address owner = ownerOf(_tokenId); approve(address(0), _tokenId); // TODO add delegates _removeTokenFrom(msg.sender, _tokenId); emit Transfer(owner, address(0), _tokenId); }
Therefore, the token would stay live at the delegate's token list, and will be counted towards the vote count, althought it is burned.
Add to the burn function:
_moveTokenDelegates(delegates(owner), address(0), _tokenId);
#0 - pooltypes
2022-06-13T18:34:11Z
Duplicate of #129
#1 - GalloDaSballo
2022-07-01T01:13:17Z
Dup of #129