MetaMask / metamask-extension

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

[Bug]: Multi RPC - swaps not being fetched when using custom RPC URL, and the destination token amount does not automatically update upon changing the input amount #26836

Open sleepytanya opened 2 months ago

sleepytanya commented 2 months ago

Describe the bug

When using a custom RPC URL, there seems to be an issue with swaps not being fetched, and the destination token amount does not automatically update upon changing the input amount

Expected behavior

-

Screenshots/Recordings

https://github.com/user-attachments/assets/ab53545f-14d7-4781-9462-ef4f8d283588

Steps to reproduce

  1. Add custom RPC for the selected network
  2. Swap using custom RPC URL

Error messages or log output

No response

Detection stage

On the development branch

Version

12.0.5

Build type

Other (please specify exactly where you obtained this build in "Additional Context" section)

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

Build https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/97568/workflows/28d6cb81-d0e8-410f-ae41-7f8b6cc5c5a9/jobs/3631842/artifacts

Severity

No response

salimtb commented 2 months ago

hey @sleepytanya , same here , not able to reproduce on the latest build. you can find it here

https://github.com/user-attachments/assets/afc48aaf-46a0-4a35-83b0-b1d6aa6223ef

bergeron commented 2 months ago

Although I can see quotes fetched after switching endpoints, it seems to require a higher minimum amount depending on the endpoint. Something to look deeper at.

https://github.com/user-attachments/assets/9c448fe0-832d-47c4-957d-2a12ea238b70

sleepytanya commented 2 months ago

I also see quotes for lower amounts are not fetched when using custom RPC URL. Here I use https://polygon.llamarpc.com:

https://github.com/user-attachments/assets/a1250fa9-1327-4b0d-b6a0-02f586a826b2

Sometimes I see quotes not fetched for different tokens on custom RPC but it appears intermittent.

https://github.com/user-attachments/assets/7c94ebbf-6845-41f8-8b47-b6f53f2f4d61

sleepytanya commented 2 months ago

I do not have exact repro steps but I encountered this error 3 times (different installs) when doing swaps from within the wallet for random tokens using custom RPC - TypeError#4: Cannot read properties of undefined (reading 'trade')

Screenshot 2024-09-04 at 10 47 25
sleepytanya commented 2 months ago

I continue to see the error from the message above, still can't tell steps but it seems like it happens while doing swaps. Sometimes 'Networks switched to' toast appears randomly, disappears by itself:

https://github.com/user-attachments/assets/aed3bb6e-d333-4aa3-9f56-e68ad9db14d3

Screenshot 2024-09-05 at 21 22 43
sleepytanya commented 2 months ago

Quotes are not fetched on alternative RPC for bigger amounts as well (https://binance.llamarpc.com):

https://github.com/user-attachments/assets/1ab08bce-93de-47e4-ba5f-502b9ce67313