QuantAMM

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

Update Interval Check Allows Premature Updates

Summary

The UpdateWeightRunner contract contains a timing check that allows weight updates slightly earlier than intended due to using >= instead of > when comparing against the update interval. This causes updates to occur marginally more frequently than specified in the documentation.

Vulnerability Details

In the performUpdate function, there is a timing check that verifies if enough time has passed since the last update:

block.timestamp - settings.timingSettings.lastPoolUpdateRun >= settings.timingSettings.updateInterval

The documentation specifies that updates must be performed "more than updateInterval seconds ago", but the code uses >= which allows updates to occur exactly at the updateInterval time. This creates a discrepancy between the documented behavior and actual implementation.

/// @notice Run the update for the provided rule. Last update must be performed more than updateInterval seconds ago.

The impact is that:

  1. Updates can occur one block earlier than intended

  2. The system deviates from its documented specification

  3. Weight updates may happen marginally more frequently than designed

Impact

Code does not function as intended.

Medium Severity - Low impact being that funds are not directly at risk but functionality does not work as intended. High likelyhood given that anyone can call this every time the invalid logic case becomes true (every update interval).

Tools Used

Manual Review

Recommendations

Change the comparison operator from >= to > to match the documented behavior:

// ... existing code ...
block.timestamp - settings.timingSettings.lastPoolUpdateRun > settings.timingSettings.updateInterval
// ... existing code ...

This ensures that updates can only occur strictly after the intended interval has passed, aligning with the documentation and intended system behavior.

Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
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.