QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Valid

Using Block.number instead of Block.timestamp

Summary

The UpliftOnlyExample contract incorrectly stores block numbers instead of timestamps in the blockTimestampDeposit variable during LP position transfers. This mismatch between the variable's intended purpose (tracking deposit time) and its actual stored value (block number) leads to invalid temporal tracking of LP positions.

Vulnerability Details

In the afterUpdate function of UpliftOnlyExample.sol, the contract incorrectly stores block numbers when it should store timestamps:

feeDataArray[tokenIdIndex].blockTimestampDeposit = uint32(block.number);

The issue manifests as follows:

  1. Transfer Impact:

    • When positions are transferred, the new timestamp becomes a block number

    • This invalidates any time-based calculations for transferred positions

    • The contract can no longer accurately track how long positions have been held once a transfer occurs

Impact

Loss of yield - Incorrect temporal tracking leads to inaccurate fee calculations and yield attribution for transferred LP positions, directly affecting user returns and protocol revenue.

Tools Used

Manual Review

Recommendations

Update the afterUpdate function to store timestamps instead of block numbers:

function afterUpdate(address _from, address _to, uint256 _tokenID) public {
// ... existing code ...
// Store timestamp instead of block number
feeDataArray[tokenIdIndex].blockTimestampDeposit = uint32(block.timestamp);
// ... rest of the function ...
}

This ensures:

  1. Accurate temporal tracking of LP positions

  2. Consistent time-based calculations

  3. Valid transfer preservation

Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding_afterUpdate_blockNumber_instead_of_timestamp

Likelihood: Medium/High, any NFT transfer will change this variable. Impact: Informational/Very Low. This variable is unused and won’t impact anything, but the array is public and its getter will return a variable with inconsistencies.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!