From 45409ae9fe052cfbbee69640d1d585118977026e Mon Sep 17 00:00:00 2001 From: lightclient Date: Fri, 10 Jan 2025 08:53:21 -0700 Subject: [PATCH] all: fix review comments Co-authored-by: lightclient Co-authored-by: Marius van der Wijden --- cmd/evm/internal/t8ntool/execution.go | 2 +- .../tracetest/testdata/prestate_tracer/setcode_tx.json | 2 +- miner/worker.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/evm/internal/t8ntool/execution.go b/cmd/evm/internal/t8ntool/execution.go index c798e34abb57..4f55f7470382 100644 --- a/cmd/evm/internal/t8ntool/execution.go +++ b/cmd/evm/internal/t8ntool/execution.go @@ -239,7 +239,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig, txBlobGas := uint64(0) if tx.Type() == types.BlobTxType { txBlobGas = uint64(params.BlobTxBlobGasPerBlob * len(tx.BlobHashes())) - if used, max := uint64(len(tx.BlobHashes())+1), chainConfig.MaxBlobsPerBlock(pre.Env.Number); used > max { + if used, max := blobGasUsed+txBlobGas, chainConfig.MaxBlobsPerBlock(pre.Env.Number)*params.BlobTxBlobGasPerBlob; used > max { err := fmt.Errorf("blob gas (%d) would exceed maximum allowance %d", used, max) log.Warn("rejected tx", "index", i, "err", err) rejectedTxs = append(rejectedTxs, &rejectedTx{i, err.Error()}) diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer/setcode_tx.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer/setcode_tx.json index af683a252390..881382081239 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer/setcode_tx.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer/setcode_tx.json @@ -59,7 +59,7 @@ "target": 3, "max": 6 }, - "prauge": { + "prague": { "target": 3, "max": 6 } diff --git a/miner/worker.go b/miner/worker.go index 811876b45bfb..7cb514c09361 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -369,8 +369,8 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran // blobs or not, however the max check panics when called on a chain without // a defined schedule, so we need to verify it's safe to call. if miner.chainConfig.IsCancun(env.header.Number, env.header.Time) { - if left := miner.chainConfig.MaxBlobsPerBlock(env.header.Time) - uint64(env.blobs); left < ltx.BlobGas { - log.Trace("Not enough blob space left for transaction", "hash", ltx.Hash, "left", left, "needed", ltx.BlobGas) + if left := int(miner.chainConfig.MaxBlobsPerBlock(env.header.Time)) - env.blobs; left < len(ltx.Tx.BlobHashes()) { + log.Trace("Not enough blob space left for transaction", "hash", ltx.Hash, "left", left, "needed", len(ltx.Tx.BlobHashes())) txs.Pop() continue }