From f854a731855d03a53018c681ae78c8da61d2311a Mon Sep 17 00:00:00 2001 From: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:09:03 +0200 Subject: [PATCH] Add enough blob gas for block building (EIP-4844) (#8001) --- cmd/state/exec3/state_recon.go | 2 +- eth/stagedsync/stage_mining_exec.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/state/exec3/state_recon.go b/cmd/state/exec3/state_recon.go index 2371f235d..b7aa062cd 100644 --- a/cmd/state/exec3/state_recon.go +++ b/cmd/state/exec3/state_recon.go @@ -331,7 +331,7 @@ func (rw *ReconWorker) runTxTask(txTask *exec22.TxTask) error { rw.engine.Initialize(rw.chainConfig, rw.chain, txTask.Header, ibs, syscall) } else { - gp := new(core.GasPool).AddGas(txTask.Tx.GetGas()) + gp := new(core.GasPool).AddGas(txTask.Tx.GetGas()).AddBlobGas(txTask.Tx.GetBlobGas()) vmConfig := vm.Config{NoReceipts: true, SkipAnalysis: txTask.SkipAnalysis} ibs.SetTxContext(txTask.Tx.Hash(), txTask.BlockHash, txTask.TxIndex) msg := txTask.TxAsMessage diff --git a/eth/stagedsync/stage_mining_exec.go b/eth/stagedsync/stage_mining_exec.go index 01a79451e..bda95ca1c 100644 --- a/eth/stagedsync/stage_mining_exec.go +++ b/eth/stagedsync/stage_mining_exec.go @@ -367,6 +367,9 @@ func addTransactionsToMiningBlock(logPrefix string, current *MiningBlock, chainC header := current.Header tcount := 0 gasPool := new(core.GasPool).AddGas(header.GasLimit - header.GasUsed) + if header.BlobGasUsed != nil { + gasPool.AddBlobGas(fixedgas.MaxBlobGasPerBlock - *header.BlobGasUsed) + } signer := types.MakeSigner(&chainConfig, header.Number.Uint64(), header.Time) var coalescedLogs types.Logs