Submitted by ladboy233
The protocol aims to integrate with layerzero v2. To leverage layerzero infrastructure to send out cross-chain message, the user has to pay the native fee. If the user underpays the message fee, transaction reverts. If the user overpays the message fee, the excessive fee is refunded back.
However, in the current implementation, the refund address is not compose correctly.
In MagnetarBaseModule.sol, there is a function:
First, we are creating a temp TapiocaOmnichainEngineHelper contract, then calling prepareLzCall to compose the data type. The function is long, but the important thing is that the refundAddress is set to address(msg.sender).
Who is msg.sender?
In this case:
However, that is not what we want. The refunded fee should go to original msg.sender who triggered the withdraw and paid the native fee.
A simple POC can be ran:
If we run the code with:
We are getting:
Then, because the refund address is incorrectly set to contract, the original user lose refund layerzero fee. Consider that users always need to overpay the fee to send messsage. The cumulative loss of refund fee will be high and make the user lose fees.
Set the layerzero refund address to a user input address:
Token-Transfer
0xRektora (Tapioca) confirmed
cryptotechmaker (Tapioca) commented:
For this audit, 10 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by immeas received the top score from the judge.
The following wardens also submitted reports: GalloDaSballo, KIntern_NA, ronnyx2017, carrotsmuggler, bin2chen, deadrxsezzz, rvierdiiev, cccz, and ladboy233.
