sherlock-audit / 2024-09-orderly-network-solana-contract-judging

0 stars 0 forks source link

Orbiting Tweed Shell - Native fee cannot be paid because the `withdraw` function is not payable #141

Open sherlock-admin4 opened 4 days ago

sherlock-admin4 commented 4 days ago

Orbiting Tweed Shell

Medium

Native fee cannot be paid because the withdraw function is not payable

Summary

The _nativeFee is paid in Ether and it is expected the Ether to be passed to the withdraw function, however the function is not payable, which prevents it from receiving Ether (msg.value). This limitation impacts the function's ability to transfer funds to pay required messaging fees and will make the transaction revert.

Root Cause

The _lzSend function, invoked within withdraw, requires Ether to pay the native messaging fee. This fee is determined within _payNative, which verifies that either msg.value or the contract’s balance is sufficient to cover _nativeFee. Since withdraw lacks the payable modifier, the caller cannot set msg.value.

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

When the contract's balance is insufficient, _nativeFee cannot be paid because the withdraw function is not payable.

PoC

No response

Mitigation

Make the withdraw function payable