QuantAMM

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

Inconsistent Block Time Recording Between Deposit and Transfer

Summary

The contract inconsistently records timing information, using block.timestamp for initial deposits but block.number for transfers, which could lead to incorrect timing-based logic.

Vulnerability Details

In addLiquidityProportional, the contract records the deposit time using block.timestamp:

poolsFeeData[pool][msg.sender].push(
FeeData({
tokenID: tokenID,
amount: exactBptAmountOut,
lpTokenDepositValue: depositValue,
blockTimestampDeposit: uint40(block.timestamp), // Uses timestamp
upliftFeeBps: upliftFeeBps
})
);

However, in afterUpdate during transfers, it uses block.number:

if (_to != address(0)) {
feeDataArray[tokenIdIndex].lpTokenDepositValue = lpTokenDepositValueNow;
feeDataArray[tokenIdIndex].blockTimestampDeposit = uint32(block.number); // Uses block number
feeDataArray[tokenIdIndex].upliftFeeBps = upliftFeeBps;
}

This inconsistency creates two issues:

  • Data corruption: The same field stores different types of values (timestamps vs block numbers)

  • Semantic confusion: The variable name suggests timestamp but sometimes contains block number

While this timing information isn't currently used for critical calculations in the contract, it creates a confusing state that could lead to bugs if timing logic is added in future updates.

Impact

Low- While not immediately exploitable, this inconsistency corrupts timing data and could lead to issues if timing-based features are added. The inconsistency also makes it impossible to reliably track how long positions have been held.

Tools Used

Manual Review

Recommendations

Be consistent with timing information. Choose either block numbers or timestamps

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!