QuantAMM

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

Hardcoded Deposit Limit Creates DoS Risk

Summary

The protocol uses a hardcoded limit of 100 deposits per user per pool, which could lead to denial of service conditions across different chains due to varying gas costs and block gas limits.

Vulnerability Details

In the UpliftOnlyExample contract, there is a hardcoded limit of 100 deposits per user per pool:

if (poolsFeeData[pool][msg.sender].length > 100) {
revert TooManyDeposits(pool, msg.sender);
}

This creates several issues:

  • Gas costs per opcode can change over time with network upgrades

  • block gas limits can change over time with chain upgrades

  • The protocol is designed to be deployed across multiple chains making changes in gas costs a more likely occurrence and more likely to become a problem

  • A fixed limit may become too low as conditions change

The hardcoded value fails to account for:

  1. Chain-specific gas dynamics

  2. Network upgrades that modify opcode costs

  3. Different economic conditions across chains

  4. Future scalability needs

Impact

DOS

The expected limit may be unattainable due to gas costs and block gas limits changing over time. Preventing users from accessing some of there positions.

Tools Used

Manual Review

Recommendations

Replace the hardcoded limit with a configurable parameter:

// Add state variable
uint256 public maxDepositsPerUser;
// Add setter function with access control
function setMaxDepositsPerUser(uint256 _maxDeposits) external onlyOwner {
maxDepositsPerUser = _maxDeposits;
}
// Use dynamic limit instead of hardcoded value
if (poolsFeeData[pool][msg.sender].length > maxDepositsPerUser) {
revert TooManyDeposits(pool, msg.sender);
}

This allows:

  • Chain-specific deposit limits

  • Adjustment as gas costs change

  • Different limits for different economic conditions

  • Future scalability through parameter updates

Updates

Lead Judging Commences

n0kto Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

Informational or Gas / Admin is trusted / Pool creation is trusted / User mistake / Suppositions

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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