mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
make blobgas nil
This commit is contained in:
parent
38c0431812
commit
073bb183da
5 changed files with 8 additions and 22 deletions
|
|
@ -24,7 +24,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common/math"
|
"github.com/ethereum/go-ethereum/common/math"
|
||||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||||
"github.com/ethereum/go-ethereum/consensus/misc"
|
"github.com/ethereum/go-ethereum/consensus/misc"
|
||||||
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
|
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
|
|
@ -167,19 +166,8 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
||||||
rnd := common.BigToHash(pre.Env.Random)
|
rnd := common.BigToHash(pre.Env.Random)
|
||||||
vmContext.Random = &rnd
|
vmContext.Random = &rnd
|
||||||
}
|
}
|
||||||
// If excessBlobGas is defined, add it to the vmContext.
|
|
||||||
if pre.Env.ExcessBlobGas != nil {
|
vmContext.ExcessBlobGas = nil
|
||||||
vmContext.ExcessBlobGas = pre.Env.ExcessBlobGas
|
|
||||||
} else {
|
|
||||||
// If it is not explicitly defined, but we have the parent values, we try
|
|
||||||
// to calculate it ourselves.
|
|
||||||
parentExcessBlobGas := pre.Env.ParentExcessBlobGas
|
|
||||||
parentBlobGasUsed := pre.Env.ParentBlobGasUsed
|
|
||||||
if parentExcessBlobGas != nil && parentBlobGasUsed != nil {
|
|
||||||
excessBlobGas := eip4844.CalcExcessBlobGas(*parentExcessBlobGas, *parentBlobGasUsed)
|
|
||||||
vmContext.ExcessBlobGas = &excessBlobGas
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If DAO is supported/enabled, we need to handle it here. In geth 'proper', it's
|
// If DAO is supported/enabled, we need to handle it here. In geth 'proper', it's
|
||||||
// done in StateProcessor.Process(block, ...), right before transactions are applied.
|
// done in StateProcessor.Process(block, ...), right before transactions are applied.
|
||||||
if chainConfig.DAOForkSupport &&
|
if chainConfig.DAOForkSupport &&
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common/prque"
|
"github.com/ethereum/go-ethereum/common/prque"
|
||||||
"github.com/ethereum/go-ethereum/common/tracing"
|
"github.com/ethereum/go-ethereum/common/tracing"
|
||||||
"github.com/ethereum/go-ethereum/consensus"
|
"github.com/ethereum/go-ethereum/consensus"
|
||||||
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
|
|
||||||
"github.com/ethereum/go-ethereum/core/blockstm"
|
"github.com/ethereum/go-ethereum/core/blockstm"
|
||||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
|
|
@ -2525,7 +2524,7 @@ func (bc *BlockChain) collectLogs(b *types.Block, removed bool) []*types.Log {
|
||||||
var blobGasPrice *big.Int
|
var blobGasPrice *big.Int
|
||||||
excessBlobGas := b.ExcessBlobGas()
|
excessBlobGas := b.ExcessBlobGas()
|
||||||
if excessBlobGas != nil {
|
if excessBlobGas != nil {
|
||||||
blobGasPrice = eip4844.CalcBlobFee(*excessBlobGas)
|
blobGasPrice = nil
|
||||||
}
|
}
|
||||||
receipts := rawdb.ReadRawReceipts(bc.db, b.Hash(), b.NumberU64())
|
receipts := rawdb.ReadRawReceipts(bc.db, b.Hash(), b.NumberU64())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -534,10 +534,10 @@ func (g *Genesis) ToBlock() *types.Block {
|
||||||
head.ExcessBlobGas = g.ExcessBlobGas
|
head.ExcessBlobGas = g.ExcessBlobGas
|
||||||
head.BlobGasUsed = g.BlobGasUsed
|
head.BlobGasUsed = g.BlobGasUsed
|
||||||
if head.ExcessBlobGas == nil {
|
if head.ExcessBlobGas == nil {
|
||||||
head.ExcessBlobGas = new(uint64)
|
head.ExcessBlobGas = nil
|
||||||
}
|
}
|
||||||
if head.BlobGasUsed == nil {
|
if head.BlobGasUsed == nil {
|
||||||
head.BlobGasUsed = new(uint64)
|
head.BlobGasUsed = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import (
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
|
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
|
|
@ -717,7 +716,7 @@ func ReadReceipts(db ethdb.Reader, hash common.Hash, number uint64, time uint64,
|
||||||
// Compute effective blob gas price.
|
// Compute effective blob gas price.
|
||||||
var blobGasPrice *big.Int
|
var blobGasPrice *big.Int
|
||||||
if header != nil && header.ExcessBlobGas != nil {
|
if header != nil && header.ExcessBlobGas != nil {
|
||||||
blobGasPrice = eip4844.CalcBlobFee(*header.ExcessBlobGas)
|
blobGasPrice = nil
|
||||||
}
|
}
|
||||||
if err := receipts.DeriveFields(config, hash, number, time, baseFee, blobGasPrice, body.Transactions); err != nil {
|
if err := receipts.DeriveFields(config, hash, number, time, baseFee, blobGasPrice, body.Transactions); err != nil {
|
||||||
log.Error("Failed to derive block receipts fields", "hash", hash, "number", number, "err", err)
|
log.Error("Failed to derive block receipts fields", "hash", hash, "number", number, "err", err)
|
||||||
|
|
|
||||||
|
|
@ -489,7 +489,7 @@ func (b *Block) ExcessBlobGas() *uint64 {
|
||||||
excessBlobGas = new(uint64)
|
excessBlobGas = new(uint64)
|
||||||
*excessBlobGas = *b.header.ExcessBlobGas
|
*excessBlobGas = *b.header.ExcessBlobGas
|
||||||
}
|
}
|
||||||
return excessBlobGas
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Block) BlobGasUsed() *uint64 {
|
func (b *Block) BlobGasUsed() *uint64 {
|
||||||
|
|
@ -498,7 +498,7 @@ func (b *Block) BlobGasUsed() *uint64 {
|
||||||
blobGasUsed = new(uint64)
|
blobGasUsed = new(uint64)
|
||||||
*blobGasUsed = *b.header.BlobGasUsed
|
*blobGasUsed = *b.header.BlobGasUsed
|
||||||
}
|
}
|
||||||
return blobGasUsed
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size returns the true RLP encoded storage size of the block, either by encoding
|
// Size returns the true RLP encoded storage size of the block, either by encoding
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue