Submitted by bin2chen, also found by cccz
In TapiocaOmnichainReceiver, when the user executes MSG_REMOTE_TRANSFER, if the srcChain amount request is bigger than the debited one, it overwrites the amount to credit with the amount debited and send the difference back to the user.
lzCompose() -> _remoteTransferReceiver() -> _internalRemoteTransferSendPacket().
The above code, first modify _lzSendParam.sendParam.amountLD = amountDebitedLD_
Then call _transfer(address(this), _srcChainSender, _lzSendParam.sendParam.amountLD - amountDebitedLD_);. This way the difference is always 0.
Correctly transfer() the difference first, and then modify _lzSendParam.sendParam.amountLD.
The difference token be left in the contract.
Context
LSDan (judge) decreased severity to Medium
cryptotechmaker (Tapioca) confirmed and commented:
