DeFiHardhat
12,000 USDC
View results
Submission Details
Severity: low
Invalid

Unused return value in `MultiFlowPump::update` can lead to incorrect behavior, wasted gas, and can cause severe contract disruption

Description: In the update function of the MultiFlowPump contract, the return value of the readLastReserves() function is not fully utilized. The first return value, which likely represents the number of reserves, is ignored and not assigned to any variable. This can lead to incorrect behavior if the unused return value contains critical information needed for further processing.

Impact:
Ignoring the return value of readLastReserves() can have several consequences:

  1. Incorrect Calculations: If the ignored value contains important data, it may lead to incorrect calculations or decisions within the update function.

  2. Wasted Computation and Gas Consumption: If the readLastReserves() function performs computations or has side effects to generate the unused return value, those operations will be wasted, resulting in unnecessary gas consumption.

  3. The code becomes less readable and maintainable, as it is not clear why the return value is being discarded.

Proof of Concept:
The following line of code in the update function demonstrates the unused return value:

(, pumpState.lastTimestamp, pumpState.lastReserves) = slot.readLastReserves();

The first return value is not assigned to any variable and is effectively ignored.

Recommended Mitigation:

To address this issue, it is recommended to handle the unused return value appropriately. If the value is not needed, it should be assigned to a variable with an underscore prefix to indicate that it is intentionally ignored. For example:

(uint8 _numberOfReserves, pumpState.lastTimestamp, pumpState.lastReserves) = slot.readLastReserves();

If the unused return value contains important information, it should be assigned to a properly named variable and used accordingly within the function.

Updates

Lead Judging Commences

giovannidisiena Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational/Invalid

Support

FAQs

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