ethereum / remix-project

Remix is a browser-based compiler and IDE that enables users to build Ethereum contracts with Solidity language and to debug transactions.
https://remix-ide.readthedocs.io
MIT License
2.43k stars 933 forks source link

EstimateGas error for some chain with minimum gas tip setting #4869

Open chenquanyu opened 3 months ago

chenquanyu commented 3 months ago

I encountered this "Gas estimation failed" error popup when I deployed a contract using remix on an evm chain with fixed base fee (3gwei) and minimum gastip (1gwei) settings.

image

Press F12 to see the error details: "50000000 gas failed: transaction price too low: address 0xcBBECa26e89011E32BA25610520B20741b809007, gastipcap 0, gasfeecap 4000000000"

After digging into the remix code, I found that gasfeecap is set to a magic ratio of basefee (4/3), and the comment says that this is to avoid metamask issues https://github.com/MetaMask/metamask-extension/issues/11824. The comments under this issue indicate that this issue has been resolved in 2021. I think estimateGas should use the gastipcap and gasfeecap of the transaction itself, or use nil.

See https://github.com/ethereum/remix-project/blob/86034e4011892eb38264a26880020e271954a05f/libs/remix-lib/src/execution/txRunnerWeb3.ts#L130C18-L130C31 image

### Tasks
Aniket-Engg commented 3 months ago

cc: @yann300