Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions core/txpool/blobpool/blobpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
type blobTxMeta struct {
hash common.Hash // Transaction hash to maintain the lookup table
vhashes []common.Hash // Blob versioned hashes to maintain the lookup table
version byte // Blob transaction version to determine proof type

id uint64 // Storage ID in the pool's persistent store
storageSize uint32 // Byte size in the pool's persistent store
Expand All @@ -115,10 +116,16 @@

// newBlobTxMeta retrieves the indexed metadata fields from a blob transaction
// and assembles a helper struct to track in memory.
// Requires the transaction to have a sidecar (or that we introduce a special version tag for no-sidecar).
func newBlobTxMeta(id uint64, size uint64, storageSize uint32, tx *types.Transaction) *blobTxMeta {
if tx.BlobTxSidecar() == nil {
// This should never happen, as the pool only admits blob transactions with a sidecar
panic("missing blob tx sidecar")
}
meta := &blobTxMeta{
hash: tx.Hash(),
vhashes: tx.BlobHashes(),
version: tx.BlobTxSidecar().Version,
id: id,
storageSize: storageSize,
size: size,
Expand Down Expand Up @@ -1680,7 +1687,16 @@
pending := make(map[common.Address][]*txpool.LazyTransaction, len(p.index))
for addr, txs := range p.index {
lazies := make([]*txpool.LazyTransaction, 0, len(txs))
for _, tx := range txs {

Check failure on line 1690 in core/txpool/blobpool/blobpool.go

View workflow job for this annotation

GitHub Actions / Lint

unnecessary leading newline (whitespace)

// Skip v0 or v1 blob transactions if not requested
if filter.OnlyBlobV0Txs && tx.version != types.BlobSidecarVersion0 {
break // skip the rest because of nonce ordering
}
if filter.OnlyBlobV1Txs && tx.version != types.BlobSidecarVersion1 {
break // skip the rest because of nonce ordering
}

// If transaction filtering was requested, discard badly priced ones
if filter.MinTip != nil && filter.BaseFee != nil {
if tx.execFeeCap.Lt(filter.BaseFee) {
Expand Down
2 changes: 1 addition & 1 deletion core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ func (pool *LegacyPool) ContentFrom(addr common.Address) ([]*types.Transaction,
func (pool *LegacyPool) Pending(filter txpool.PendingFilter) map[common.Address][]*txpool.LazyTransaction {
// If only blob transactions are requested, this pool is unsuitable as it
// contains none, don't even bother.
if filter.OnlyBlobTxs {
if filter.OnlyBlobV0Txs || filter.OnlyBlobV1Txs {
return nil
}
pool.mu.Lock()
Expand Down
5 changes: 3 additions & 2 deletions core/txpool/subpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ type PendingFilter struct {
BlobFee *uint256.Int // Minimum 4844 blobfee needed to include a blob transaction
GasLimitCap uint64 // Maximum gas can be used for a single transaction execution (0 means no limit)

OnlyPlainTxs bool // Return only plain EVM transactions (peer-join announces, block space filling)
OnlyBlobTxs bool // Return only blob transactions (block blob-space filling)
OnlyPlainTxs bool // Return only plain EVM transactions (peer-join announces, block space filling)
OnlyBlobV0Txs bool // Return only V0 encoded blob transactions (block blob-space filling)
Copy link
Contributor

@fjl fjl Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MinBlobVersion int?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Min sounds good at first, but actually the only thing we need in the current usage is an exact BlobVersion.

OnlyBlobV1Txs bool // Return only V1 encoded blob transactions (block blob-space filling)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this API seems overkill since it is only useful for a short period around the fork boundary. I would just skip over v0 blob sidecars in the miner worker after Osaka and we can remove it again later on after the fork.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worker does not interface directly to the blobpool, only to the txpool, so I think getting a sidecar version would require even more API changes. It would either need to relay a call to the blobpool (PendingV1Only), or we would need to add blob version info to the LazyTransaction. Both seems messy to me compared to this.

}

// TxMetadata denotes the metadata of a transaction.
Expand Down
8 changes: 6 additions & 2 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,14 @@ func (miner *Miner) fillTransactions(interrupt *atomic.Int32, env *environment)
if miner.chainConfig.IsOsaka(env.header.Number, env.header.Time) {
filter.GasLimitCap = params.MaxTxGas
}
filter.OnlyPlainTxs, filter.OnlyBlobTxs = true, false
filter.OnlyPlainTxs, filter.OnlyBlobV0Txs, filter.OnlyBlobV1Txs = true, false, false
pendingPlainTxs := miner.txpool.Pending(filter)

filter.OnlyPlainTxs, filter.OnlyBlobTxs = false, true
if miner.chainConfig.IsOsaka(env.header.Number, env.header.Time) {
filter.OnlyPlainTxs, filter.OnlyBlobV0Txs, filter.OnlyBlobV1Txs = false, false, true
} else {
filter.OnlyPlainTxs, filter.OnlyBlobV0Txs, filter.OnlyBlobV1Txs = false, true, false
}
pendingBlobTxs := miner.txpool.Pending(filter)

// Split the pending transactions into locals and remotes.
Expand Down
Loading