Base on this answer related to How Ethereum estimate the gas for running a contract?:
Which brings the second point. geth gets its estimate by simulating the transaction itself, based on the latest block. There is essentially no other way to do so.
Based on that: miners are able to simulate the transactions before they accept them. Since all miners are using GPU this should be pretty fast for them and all miner's have the latest block.
The image is take from Ethereum white-paper:
6.Let TX be the block's transaction list, with n transactions. For all i in 0...n-1, set S[i+1] = APPLY(S[i],TX[i]). If any application returns an error, or if the total gas consumed in the block up until this point exceeds the GASLIMIT, return an error.
In the simulation if a miner detects an exceeds the GASLIMIT
for a transaction(Tx), for example for the Tx[1]
on the image Tx[1]
could be discarded.
Example:
for(i=0->n-1)
if(i!=1)
set S[i+1] = APPLY(S[i],TX[i])
This would save sender to pay additional GAS-fee
for his Tx that will return an error due to GASLIMIT
, with the help of the simulation on the miner-side.
[Q] Why miners do not simulate their list of transactions to detect a gas exceed and discard those Txs that exceed gas?
Thank you for your valuable time and help.