Return value for transferAndCall
not checked, if transactions failed the rewards token still transfer and can’t be distribute because trapped
SDLPoolCCIPControllerPrimary::distributeRewards
serves to claim and distribute rewards between secondary chains. The main problem is that the return value of the transferAndCall
function is not checked whether it was successful or not. The code is below :
Here is the scenario :
The transferAndCall
function is called with the wrapped token address, the token balance, and an empty calldata.
If the recipient contract reverts the transaction, the transferAndCall
function will return false
.
However, the code does not check the return value of the transferAndCall
function.
This means that even if the transaction is reverted, the tokens will still be transferred from the contract.
As a result, the rewards will not be distributed to the whitelisted chains.
The rewards token still transfer and can’t be distribute because trapped
Manual review
Check the return value of the transferAndCall
function.
If the transferAndCall
function reverts, do not distribute the rewards to the whitelisted chain.
You can also use a try-catch block to handle the revert.
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.