Timeline for How come I need to specify a higher gasLimit than estimateGas?
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 8, 2016 at 12:04 | comment | added | Chevdor | Well, I understand that we should not but I have a counter example. Look at the following: testnet.etherscan.io/tx/… I pass 325k and all it OK because the call needs 323161. Now the exact same call but I pass 324k gas instead. For the record 324k > 323161 :) testnet.etherscan.io/tx/… and this last one fails. | |
Apr 15, 2016 at 15:29 | comment | added | Péter Szilágyi | Actually, I've just checked the code and it was already fixed a while ago. So while it's not in the stable branch yet, on develop it should work fine. Please report if it doesn't for you. | |
Apr 15, 2016 at 11:24 | comment | added | Péter Szilágyi | Ah, this is a very good point. I think estimateGas didn't take into account refunds (i.e. you free up some storage space), which could cause it to underestimate the actual requirement. See github.com/ethereum/go-ethereum/issues/2395 | |
Apr 14, 2016 at 16:07 | comment | added | Ales | One possible explanation: as miner execute operations for contract they sometimes (eg. for external calls) estimate how much gas the operation would be needed (and maybe add some safety margin), check if there is enough gas, and only then proceed with said operation if enough gas is available. If this is true, then gasLimit must always be larger than amount of gas that is actually required and will be used in the end. | |
Apr 14, 2016 at 16:02 | comment | added | Ales | @eth yes thats seem most likely since gasLimit==cumulativeGasUsed for these txs. But I would like to understand the reason for this | |
Apr 14, 2016 at 15:43 | comment | added | eth♦ | @Ales It does look like you're running out of gas, so you may need to debug with the EVM or simpler is to check a blockchain explorer that simulates the EVM: ethereum.stackexchange.com/q/1179/42 | |
Apr 14, 2016 at 14:30 | comment | added | Ales | Contract logic shouldn't be a problem (gas usage is constant), meaning cumulativeGasUsed is stable. Thats why i'm wondering, if is specify 70k gasLimit everything is ok (but only 40k is used), and if I specify 50k all gas is spent and tx is not processed. | |
Apr 14, 2016 at 14:18 | history | answered | Péter Szilágyi | CC BY-SA 3.0 |