Velodrome Finance contest - kenzo's results

A base layer AMM on Optimism, inspired by Solidly.

General Information

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

Velodrome Finance

Findings Distribution

Researcher Performance

Rank: 9/75

Findings: 1

Award: $2,912.92

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: IllIllI

Also found by: kenzo

Labels

bug
duplicate
3 (High Risk)

Awards

2912.922 USDC - $2,912.92

External Links

Lines of code

https://github.com/code-423n4/2022-05-velodrome/blob/main/contracts/contracts/VotingEscrow.sol#L517:#L528

Vulnerability details

VotingEscrew _burn function does not remove the token from the token's delegate token list.

Impact

Wrong voting results. Delegate's votes will be inflated.

Proof of Concept

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

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter