MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
11.7k stars 4.79k forks source link

[Bug]: Unable to send ERC-20 Approval transaction in gas-free case #22793

Open Karkunow opened 5 months ago

Karkunow commented 5 months ago

Describe the bug

While sending the gasless ERC-20 Approval transaction, the user with 0 ETH in his wallet gets "Insufficient funds for gas" error, even if he doesn't need to pay anything.

Expected behavior

We are expecting it not to throw the error "Insufficient funds for gas", because we do not charge gas for such interaction with the Aurora ERC-20 contract. And you can see clearly, that the fee is 0 ETH there.

Screenshots/Recordings

Here is the video demonstration of what is happening: https://www.youtube.com/watch?v=aNnGhvDTJmc

Here is the popup with the error:

Screenshot 2024-02-02 at 12 35 19

And here is the second one without it:

Screenshot 2024-02-02 at 13 15 31

Steps to reproduce

  1. Go to https://aurora.plus/
  2. Connect Metamask wallet and switch to AuroraMainnet [important, you need to have 0 ETH there on Aurora network].
  3. Click on "Stake" and then on "Approve my AURORA" button.
  4. Get an approval popup, click "Next"
  5. Get an error about insufficient funds.

Error messages or log output

No response

Version

11.7.5

Build type

None

Browser

Chrome, Brave

Operating system

MacOS

Hardware wallet

No response

Additional context

You can now do the next steps to trick the Metamask and do the transaction:

  1. Click outside the popup.
  2. Click on Metamask icon.
  3. See the same popup, but now it is not native one! The first popup with an error was a native one, with the window controls (like hide, and close buttons) and I could move it freely over the screen. This one I can't.
  4. Notice, it has no errors. And we can just Send the transaction.

Severity

dbrans commented 5 months ago

Hi @Karkunow, thank you for reporting this bug.

I'm having trouble following the steps you provided to reproduce this bug. The "Stake" button is disabled for me:

Image

To be clear, I have no AURORA tokens and no ETH on Aurora.

Could you advise me on what additional steps I need to follow to reproduce the bug?

Thank you!

Karkunow commented 5 months ago

@dbrans hi! yes, sorry, forgot to say that you need to have some AURORA - I can send some to your wallet, just let me know

dbrans commented 5 months ago

@dbrans hi! yes, sorry, forgot to say that you need to have some AURORA - I can send some to your wallet, just let me know

@Karkunow, could you send the AURORA to 0x2990079bcdEe240329a520d2444386FC119da21a? Thank you.

Karkunow commented 5 months ago

@Karkunow, could you send the AURORA to 0x2990079bcdEe240329a520d2444386FC119da21a? Thank you.

Done. Sent 0.1 AURORA to you. Should be enough to test.

dbrans commented 5 months ago

Hi @Karkunow, I'm trying to reproduce on 11.9.5 but I don't get an "Insufficient Funds for Gas" error. It seems to work fine (see images). I wonder if the issue has been resolved by a more recent version of MetaMask. Could you verify?

image image
Karkunow commented 4 months ago

@dbrans Just tested it and it is still reproducible. Make sure you get the native OS window first. And not the one from the extension. Here is what I get in native window on 11.9.5:

Screenshot 2024-02-22 at 13 52 24

And later, in the extension window, if I click outside of the first one and reenter:

Screenshot 2024-02-22 at 13 52 55 Screenshot 2024-02-22 at 13 55 13

No errors in it + Approve button is enabled.

dbrans commented 4 months ago

Hi @Karkunow, I confirmed on my end that I get the native OS window as you mentioned. However, I don't encounter the "insufficient funds" message that you're running into. I've attached a screen recording below for you to take a look. Could I be missing a step somewhere? Let me know!

https://github.com/MetaMask/metamask-extension/assets/507015/69956976-a058-443c-86ac-a322c8c18904

Karkunow commented 4 months ago

@dbrans I've rechecked - still have the error there.

Screenshot 2024-03-01 at 14 53 11

Metamask version 11.10.0.

Karkunow commented 4 months ago

Do you have 0 ETH on your wallet?

dbrans commented 4 months ago

@Karkunow I just realized I missed that crucial detail after switching to a new testing account, and I'm really sorry for the mix-up and the back-and-forth over the last couple weeks. Thanks for your patience.

Good news, though—I can now consistently reproduce the issue, which means we're on the right track to sorting it out.

Thanks for bearing with me, and I'll make sure we get this fixed as soon as possible. In the meantime, I'll post regular updates.

Ramyromel commented 4 months ago

Translation.. ميتا ماسك لم يحمينى من الهجمات داخل التليفون وداخل المحفظه . المعامله صعبه وجدا وتليفونى متكتف منذ يومين . حاول تساعدونى .. انا بيحصل فى تليفونى حاجات غريبه جدا

Ramyromel commented 4 months ago

Help me please 🥺

dbrans commented 4 months ago

Translation.. ميتا ماسك لم يحمينى من الهجمات داخل التليفون وداخل المحفظه . المعامله صعبه وجدا وتليفونى متكتف منذ يومين . حاول تساعدونى .. انا بيحصل فى تليفونى حاجات غريبه جدا

@Ramyromel, please go to support.MetaMask.io select “Start a conversation” and our User Safety team will assist you.

dbrans commented 4 months ago

After some investigation:

When this bug is triggered, I see an inconsistency where the "Fee details" shown on the confirmation screen don't match the "Transaction fee" displayed above. The expected fee (and fee details) is zero. This is likely causing the "insufficient funds for gas" message on that screen when the user has zero ETH in their account.

Below is an image highlighting this issue:

image

@Karkunow, I'm going to triage this bug to the right team based on these findings.

Karkunow commented 4 months ago

@dbrans glad you've managed to reproduce this! looking forward to triage.