Skip to content

Commit

Permalink
cmd/evm/internal/t8ntool: add missing blobgas max-check
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Oct 23, 2023
1 parent ad59821 commit 3fdff6e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,14 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
continue
}
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)
if err != nil {
Expand Down

0 comments on commit 3fdff6e

Please sign in to comment.