From f599be1ce6d473356a314d9638d0b4f6bf044add Mon Sep 17 00:00:00 2001 From: MariusVanDerWijden Date: Wed, 4 Jun 2025 18:41:54 +0200 Subject: [PATCH] core/txpool/blobpool: factor out peerdas slotter --- core/txpool/blobpool/slotter.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/txpool/blobpool/slotter.go b/core/txpool/blobpool/slotter.go index 822584cfbd..a59fdffd36 100644 --- a/core/txpool/blobpool/slotter.go +++ b/core/txpool/blobpool/slotter.go @@ -26,6 +26,24 @@ package blobpool // allowed in the current protocol, having an empty shelf is not a relevant use // of resources, but it makes stress testing with junk transactions simpler. func newSlotter(maxBlobsPerTransaction int) func() (uint32, bool) { + slotsize := uint32(txAvgSize) + slotsize -= uint32(blobSize) // underflows, it's ok, will overflow back in the first return + + return func() (size uint32, done bool) { + slotsize += blobSize + finished := slotsize > uint32(maxBlobsPerTransaction)*blobSize+txMaxSize + + return slotsize, finished + } +} + +// newSlotterEIP7594 creates a different slotter for EIP-7594 transactions. +// EIP-7594 (PeerDAS) changes the median transaction size which means the current +// static 4KB average size is not enough anymore. +// This slotter adds a dynamic overhead component to the slotter, which also +// captures the notion that blob transactions with more blobs are also more likely to +// to have more calldata. +func newSlotterEIP7594(maxBlobsPerTransaction int) func() (uint32, bool) { slotsize := uint32(txAvgSize) slotsize -= uint32(blobSize) + txBlobOverhead // underflows, it's ok, will overflow back in the first return