cmd/evm/internal/t8ntool: add missing blobgas max-check

This commit is contained in:
Martin Holst Swende 2023-10-23 15:21:13 +02:00
parent ad59821761
commit 3fdff6e5d3
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -205,7 +205,14 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
continue continue
} }
if tx.Type() == types.BlobTxType { if tx.Type() == types.BlobTxType {
blobGasUsed += uint64(params.BlobTxBlobGasPerBlob * len(tx.BlobHashes())) txBlobGas := uint64(params.BlobTxBlobGasPerBlob * len(tx.BlobHashes()))
if blobGasUsed+txBlobGas > params.BlobTxBlobGasPerBlob {
err := fmt.Errorf("blob gas (%d) would exceed maximum allowance %d", blobGasUsed+txBlobGas, params.MaxBlobGasPerBlock)
log.Warn("rejected tx", "index", i, "err", err)
rejectedTxs = append(rejectedTxs, &rejectedTx{i, err.Error()})
continue
}
blobGasUsed += txBlobGas
} }
msg, err := core.TransactionToMessage(tx, signer, pre.Env.BaseFee) msg, err := core.TransactionToMessage(tx, signer, pre.Env.BaseFee)
if err != nil { if err != nil {