UniStaker Infrastructure - nnez's results

Staking infrastructure to empower Uniswap Governance.

General Information

Platform: Code4rena

Start Date: 23/02/2024

Pot Size: $92,000 USDC

Total HM: 0

Participants: 47

Period: 10 days

Judge: 0xTheC0der

Id: 336

League: ETH

Uniswap Foundation

Findings Distribution

Researcher Performance

Rank: 17/47

Findings: 1

Award: $694.30

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

694.2987 USDC - $694.30

Labels

bug
grade-b
QA (Quality Assurance)
satisfactory
:robot:_34_group
duplicate-45
Q-20

External Links

Lines of code

https://github.com/code-423n4/2024-02-uniswap-foundation/blob/main/src/V3FactoryOwner.sol#L193-L194

Vulnerability details

Description

When calling V3FactoryOwner.sol#claimFees, the _amount0 and _amount1 return from calling _pool#collectProtocol must be equal or greater than amount(0,1)Requested or else the transaction would revert.

However, in the actual implementation of V3Pool (https://github.com/Uniswap/v3-core/blob/main/contracts/UniswapV3Pool.sol#L848)

if (amount0 > 0) { if (amount0 == protocolFees.token0) amount0--; // ensure that the slot is not cleared, for gas savings ... ...

The actual pool#collectProtocol would try to save gas and subtract _amount0 and _amount1 by 1 to prevent storage clearance in the case that the requested amount is equal to current collected protocol fee.

Therefore, calling V3FactoryOwner.sol#claimFees with maximum requested amount will always fail because the return _amount0 and _amount1 will always be off by 1

The mitigation depends on how you view this issue. (1) Adding note in comment section about this certain case OR (2) Allow off-by-one slippage in claimFees function

Assessed type

Other

#0 - c4-judge

2024-03-07T12:41:35Z

MarioPoneder marked the issue as duplicate of #34

#1 - c4-judge

2024-03-14T01:38:05Z

MarioPoneder marked the issue as satisfactory

#2 - c4-judge

2024-03-26T23:00:01Z

MarioPoneder marked the issue as grade-b

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