wormhole-foundation / wormhole-connect

Wormhole Connect brings all the functionality and utility of Wormhole right into your application and removes all of the complexity.
https://connect-in-style.wormhole.com/
Other
77 stars 56 forks source link

[Bug] Error with Eth Safe -> BSC EOA transfer "Error: insufficient funds for intrinsic transaction cost" #2238

Closed tonyjin closed 1 month ago

tonyjin commented 2 months ago

Description and context

Cannot initiate a transfer of wstETH from an Eth Safe multisig connected via Wallet Connect destined for a BSC EOA. This is a bug report that affects Lido.

Steps to reproduce

  1. Connect an Eth Safe multisig via WalletConnect
  2. Attempt to transfer wstETH from the multisig to another address (I tried both using the source multisig and another EOA as the destination)
  3. The first txn for token approval should trigger a Safe transaction in the second window and succeed after submitting
  4. The actual transfer fails with "Error: insufficient funds for intrinsic transaction cost" even though the multisig wallet has plenty of Eth to initiate the transfer. Error:

    Error: insufficient funds for intrinsic transaction cost [ See: https://links.ethers.org/v5-errors-INSUFFICIENT_FUNDS ] (error={"code":-32000,"message":"insufficient funds for gas * price + value: address 0xE5d827d3DD322e2499a103913B7D2971E413D363 have 0 want 131841354346523"}, method="estimateGas", transaction={"from":"0xE5d827d3DD322e2499a103913B7D2971E413D363","to":"0xb948a93827d68a82F6513Ad178964Da487fe2BD9","value":{"type":"BigNumber","hex":"0x77e8b517b01b"},"data":"0xb293f97f00000000000000000000000000000000000000000000000000005af3107a4000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000049887a216375fded17dc1aaad4920c377726561400000000000000000000000049887a216375fded17dc1aaad4920c3777265614000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000040100010000000000000000000000000000000000000000000000000000000000","accessList":null}, code=INSUFFICIENT_FUNDS, version=providers/5.7.2)

Screenshot 2024-07-09 at 3 48 21 PM

Expected behavior

I expect the actual transfer of wstETH to trigger a transaction in the Safe window as it did for the token approval and the transfer to initiate successfully upon approval.

M-Picco commented 1 month ago

Based on my tests, the error seems to pop up when the multisig address doesn't have enough funds to pay for the transaction, not in terms of gas, but on the value sent to pay for the relays (this value is fetched from the manager contract through the quoteDeliveryPrice method). I haven't yet looked into how the Safe contract works, but it seems that the transaction value is delegated to the multisig, so it's not the signer who pays this actual value. This happens both for manual and automatic NTT transfers.

In the screenshot attached to the ticket, the multisig address 0xE5d8... has 0 ETH, while the tx expects it to have ~0.0001318 ETH available.

I suppose a possible action item would be to check whether the sending address has enough funds to cover both the gas and value of the tx and display a warning if the condition is not met.

tonyjin commented 1 month ago

You're right. I thought I had retested this after adding ETH to my multisig, but when I tried again today the transfer was successful. We could use a better error message but I'll close this out.