kaboji
May 27, 2023, 10:49am
1
Can someone please clarify in what condition does MetaMask auto increase gasLimit by 50% (gas buffer)? Is it for all contract interactions or just erc20 transfers? Also, is there anyway to turn it off, as a user or developer?
more context
As an EVM chain developer, I am facing an issue that our gasLimit can’t be randomly altered. When MetaMask auto increase gasLimit by 50%, it might cause transaction to fail. So I hope MetaMask uses the exact value returned from eth_estimateGas
RPC, is there anyway to achieve it?
Thanks for any help in advance!
Hi @kaboji -
I’ve inquired about this, will report back what I hear!
2 Likes
Hey! Is this your GH ticket?
opened 01:20PM - 27 May 23 UTC
type-bug
type-enhancement
team-confirmations-secure-ux
### Describe the bug
when I send erc20 with MM, it uses gasLimit which 50% gr… eater than `eth_estimateGas` return. I did some grep around and it seems to be a "feature". https://github.com/MetaMask/metamask-extension/issues/8771#issuecomment-759243828
However this become a bug in our evm network, where gasLimit has some specific encoding, so can't be altered randomly. I hope to make MM use exactly what `eth_estimateGas` return.
This 50% increase is a very opinionated operation that's only required for networks that has the gas underestimation issue. So I think there should either be a way to turn it off (make it default behaviour, but optional), or force enable it ONLY for certain networks that really need it.
So my question is:
- is there a way to turn this feature off? If not, it's a feature request.
- can someone please clarify when does MM auto increase gasLimit by 50%? Is it only for token transfer, or is it for all contract calls? If it's only for token transfers, I can probably do some workaround in our network, such as "divide gasLimit by 1.5 before `eth_estimateGas` return when sending erc20"
Thanks!
### Steps to reproduce
1. start an evm network with ETH RPC locally
2. connect MM to localhost, try send erc20
3. local RPC logs show that `eth_estimateGas` returns `X`
4. on MM UI we can see `X * 1.5` as gasLimit
### Error messages or log output
_No response_
### Version
10.30.4
### Build type
None
### Browser
Chrome
### Operating system
MacOS
### Hardware wallet
_No response_
### Additional context
_No response_
2 Likes
@kaboji
There is an explanation for this. And I’m wondering what error logs do you get when a transaction fails?
Also on Infura says:
3 Likes
system
Closed
June 26, 2023, 10:50am
5
This topic was automatically closed after 30 days. New replies are no longer allowed.