In the LiquidationKeeper.sol contract, there is a critical mismatch between the data encoding in the checkUpkeep()
function and the data decoding in the performUpkeep()
function. This mismatch prevents the liquidation process from functioning correctly.
The checkUpkeep()
function encodes the performData
as follows:
This encoding includes both the accountsToBeLiquidated
array and the address of the LiquidationKeeper contract.
When checkUpkeep()
returns upkeepNeeded == true
, the Keeper will then call performUpkeep(bytes calldata peformData)
with extraData
as the peformData
parameter.
However, in the performUpkeep()
function, the decoding is performed as:
This decoding attempt only extracts the accountsToBeLiquidated
array, ignoring the additional address that was encoded. Due to this mismatch, the following liquidateAccounts()
call will fail on this line:
Note: the liquidateAccounts.t.sol tests are actually ensuring liquidateAccounts()
reverts in case of an account that does not exists. But due to this bug, it will always revert.
The root cause of this issue lies in the inconsistency between the data structures used for encoding and decoding. This inconsistency breaks the critical link between the checkUpkeep()
and performUpkeep()
functions, rendering the liquidation process inoperable.
The liquidation process will consistently fail, as the performUpkeep()
function cannot correctly decode the input data.
The Chainlink Keeper network calls checkUpkeep()
.
checkUpkeep()
identifies accounts to be liquidated and encodes them along with the keeper's address:
The Chainlink Keeper network calls performUpkeep()
with the encoded data.
performUpkeep()
attempts to decode the data, but fails due to the mismatch:
The function reverts or produces incorrect results, failing to perform the necessary liquidations.
To resolve this issue, ensure that the encoding and decoding operations in checkUpkeep()
and performUpkeep()
are consistent. There are two potential approaches:
Remove the keeper address from the encoded data in checkUpkeep()
:
Update the decoding in performUpkeep()
to include the keeper address:
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.