QuantAMM

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

Incorrect Block Number Usage on Arbitrum L2

Summary

The UpliftOnlyExample contract incorrectly uses block.number for timestamp tracking on Arbitrum, where it returns the L1 Ethereum block number instead of the L2 block number. This causes inaccurate timing records since Arbitrum produces blocks 3-5 times per second compared to Ethereum's 12-second intervals per block.

Vulnerability Details

In the afterUpdate function of UpliftOnlyExample.sol, the contract stores block numbers for tracking deposit timing:

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

The issue arises because:

  1. On Arbitrum, block.number returns the L1 Ethereum block number

  2. Multiple L2 transactions can occur within a single L1 block

  3. This means different deposits at different L2 times could be recorded with the same L1 block number

  4. Example timeline:

    • User A deposits at t=0 (L2 block 1000, L1 block 100)

    • User B deposits at t=5 seconds (L2 block 1015, L1 block 100)

    • Both deposits record block 100 despite occurring 5 seconds apart

This breaks the contract's timing assumptions since:

  • Ethereum produces blocks every 12 seconds

  • Arbitrum produces blocks every 0.2-0.33 seconds (3-5 per second)

Impact

Unlike all the other chains Quant on Arbitrum will have an Inability to accurately read state, impacting any logic that will be using information related to the ordering/amount of participation (time base) of the LP's

Tools Used

Manual Review

Recommendations

Replace block.number with Arbitrum's native block number tracking:

function afterUpdate(address _from, address _to, uint256 _tokenID) public {
// ... existing code ...
// Use Arbitrum's block number instead of L1 block number
if (block.chainid == ARBITRUM_CHAIN_ID) {
feeDataArray[tokenIdIndex].blockTimestampDeposit = uint32(arbSys(100).arbBlockNumber());
} else {
feeDataArray[tokenIdIndex].blockTimestampDeposit = uint32(block.number);
}
// ... rest of the function ...
}

This ensures accurate temporal tracking of deposits regardless of what chain it is on.

Updates

Lead Judging Commences

n0kto Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Other
Assigned finding tags:

invalid_Arbitrum_block_number

The real bug is that blockTimestampDeposit should use “block.timestamp” and not number.

Support

FAQs

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

Give us feedback!