The withdraw function returns two amountUnderlying values in the ReserveLibrary.sol contract. This causes the LendingPool.sol contract's withdraw function to not receive the correct return value, burnedScaledAmount. As a result, this leads to inconsistencies in the data passed between contracts, which could affect event emissions and data analytics downstream.
Core issue:
The withdraw function in the ReserveLibrary.sol contract returns two amountUnderlying instead of amountWithdrawn and amountUnderlying, which need to be received by the withdrawn function in the LendingPool contract.
contracts/libraries/pools/ReserveLibrary.sol:
contracts/core/pools/LendingPool/LendingPool.sol:withdraw#L252
Data Inconsistency: The returned values from ReserveLibrary.withdraw are not aligned with their intended purpose. Specifically, the amountWithdrawn value is supposed to represent the standardized amount but is instead returning the actual underlying amount. This discrepancy can result in incorrect data being propagated throughout the contract, leading to data inconsistency.
Incorrect Event Emission: In the LendingPool.sol contract, the withdraw function need to receive amountWithdrawn and emit the event Withdraw(msg.sender, amountWithdrawn), instead of the standardized amount (burnedScaledAmount).
Manual code review
It is recommended to fix return values in the withdraw function of the LendingPool.sol contract to return the correct standardized amount for amountWithdrawn:
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.