Conversation
If a `gasPrice` was specified in a transaction sent via a dapp, we would include it in our `eth_estimateGas` call, causing it to fail if the user had insufficient balance (for either the transaction amount or the gas fee). This resulted in the fallback gas estimate being used; the block gas limit. The block gas limit is quite a bit larger than most transactions need, so this resulted in wildly inflated gas costs being shown on our confirmation screen. The `gasPrice` has been removed from the `txParams` object we pass to `eth_estimateGas`, so now it won't perform any balance checks anymore. This ensures that we'll get a valid gas estimate, as long as geth is able to simulate the contract execution properly. Fixes #9967
160ac44 to
505441c
Compare
|
Looks good. Should we also do this in the |
Builds ready [505441c]
Page Load Metrics (381 ± 45 ms)
|
|
This function is the one used in |
|
Do the reproduction steps in #9967 produce a transaction that is in fact valid? I see strange errors in the background console when I try it. I can't reproduce while specifying a recipient. |
|
Specifically, I think I'm getting this warning, which just says |
rekmarks
left a comment
There was a problem hiding this comment.
I still get a gas limit of 79500 with this call, which to my mind cannot produce a valid transaction:
await ethereum.request({ method: 'eth_sendTransaction', params: [{ from: window.ethereum.selectedAddress, gasPrice: '0x1000' }] })|
That call was intended to reproduce the inflated gas limit; I didn't test that it produced a valid transaction. I don't think it matters as far as this bug is concerned. It sounds like you may have found a separate bug (i.e. maybe we're missing validation, and a I'm not sure what those |
If a
gasPricewas specified in a transaction sent via a dapp, we would include it in oureth_estimateGascall, causing it to fail if the user had insufficient balance (for either the transaction amount or the gas fee). This resulted in the fallback gas estimate being used; the block gas limit. The block gas limit is quite a bit larger than most transactions need, so this resulted in wildly inflated gas costs being shown on our confirmation screen.The
gasPricehas been removed from thetxParamsobject we pass toeth_estimateGas, so now it won't perform any balance checks anymore. This ensures that we'll get a valid gas estimate, as long as geth is able to simulate the contract execution properly.Fixes #9967
Manual testing steps:
Follow the reproduction steps listed in #9967, and observe that the initial value set for gas limit is not absurdly high (it was
79500when I tested it).