Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: medium
Invalid

FeeConversionKeeper::checkUpkeep could be unusable

Summary

Currently FeeConversionKeeper::checkUpkeep is iterating through all of the live markets by engine and then for every market is iterating through the all of the fees for the current market . If the number of markets is extremely huge and same is applicable for the fees, the function will end up to be unsuable.

Vulnerability Details

The issue lies in the nested iteration structure of the function:

  1. It iterates through all live markets in the engine.

  2. For each market, it iterates through all fees associated with that market.

This results in a quadratic complexity (O(n*m), where n is the number of markets and m is the number of fees per market). As the number of markets and fees grows, the function will consume an impractical amount of gas and may even exceed block gas limits, rendering it unusable.

Impact

  • High Gas Costs: The function will become prohibitively expensive to execute as the number of markets and fees increases.

  • Block Gas Limit Exceeded: For extremely large datasets, the function may fail entirely due to exceeding the block gas limit.

Tools Used

Manual review

Recommendations

Make the function configurable to iterate through subset of markets, such as from index to index. Make the function pageable.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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