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:
Incorrect Calculations: If the ignored value contains important data, it may lead to incorrect calculations or decisions within the update function.
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.
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:
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:
If the unused return value contains important information, it should be assigned to a properly named variable and used accordingly within the function.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.