miner: improve comment about blob gas limit check

This commit is contained in:
Felix Lange 2023-08-23 02:38:22 +02:00
parent d3814eb23e
commit 2179c43eac

View file

@ -749,10 +749,15 @@ func (w *worker) commitTransaction(env *environment, tx *types.Transaction) ([]*
snap = env.state.Snapshot()
gp = env.gasPool.Gas()
)
// TODO (MariusVanDerWijden): Move this check
// Checking against blob gas limit: It's kind of ugly to perform this check here, but there
// isn't really a better place right now. The blob gas limit is checked at block validation time
// and not during execution. This means core.ApplyTransaction will not return an error if the
// tx has too many blobs. So we have to explicitly check it here.
if (env.blobs+len(tx.BlobHashes()))*params.BlobTxBlobGasPerBlob > params.MaxBlobGasPerBlock {
return nil, errors.New("max data blobs reached")
}
receipt, err := core.ApplyTransaction(w.chainConfig, w.chain, &env.coinbase, env.gasPool, env.state, env.header, tx, &env.header.GasUsed, *w.chain.GetVMConfig())
if err != nil {
env.state.RevertToSnapshot(snap)