From 53e5a936fe78aa43508120e0ee961b24b0f26f61 Mon Sep 17 00:00:00 2001 From: devopsbo3 <69951731+devopsbo3@users.noreply.github.com> Date: Fri, 10 Nov 2023 12:27:53 -0600 Subject: [PATCH] Revert "core: infer blobGasUsed in chain maker (#28212)" This reverts commit 84977b0ed70bdbf625e9d528f744d0952f57d630. --- core/chain_makers.go | 8 +++++--- internal/ethapi/api_test.go | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/chain_makers.go b/core/chain_makers.go index 3608329a13..c9c880dd69 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -88,6 +88,11 @@ func (b *BlockGen) SetPoS() { b.header.Difficulty = new(big.Int) } +// SetBlobGas sets the data gas used by the blob in the generated block. +func (b *BlockGen) SetBlobGas(blobGasUsed uint64) { + b.header.BlobGasUsed = &blobGasUsed +} + // addTx adds a transaction to the generated block. If no coinbase has // been set, the block's coinbase is set to the zero address. // @@ -106,9 +111,6 @@ func (b *BlockGen) addTx(bc *BlockChain, vmConfig vm.Config, tx *types.Transacti } b.txs = append(b.txs, tx) b.receipts = append(b.receipts, receipt) - if b.header.BlobGasUsed != nil { - *b.header.BlobGasUsed += receipt.BlobGasUsed - } } // AddTx adds a transaction to the generated block. If no coinbase has diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index 59882cd6bb..846a4347a7 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -1448,6 +1448,9 @@ func setupReceiptBackend(t *testing.T, genBlocks int) (*testBackend, []common.Ha b.AddTx(tx) txHashes[i] = tx.Hash() } + if i == 5 { + b.SetBlobGas(params.BlobTxBlobGasPerBlob) + } b.SetPoS() }) return backend, txHashes