core/txpool/blobpool: bump per blob overhead

This commit is contained in:
lightclient 2025-09-04 11:01:11 -06:00
parent dd99cf07e4
commit 0a061be6a0
No known key found for this signature in database
GPG key ID: 657913021EF45A6A
3 changed files with 18 additions and 20 deletions

View file

@ -51,14 +51,18 @@ const (
// transaction. There can be multiple of these embedded into a single tx. // transaction. There can be multiple of these embedded into a single tx.
blobSize = params.BlobTxFieldElementsPerBlob * params.BlobTxBytesPerFieldElement blobSize = params.BlobTxFieldElementsPerBlob * params.BlobTxBytesPerFieldElement
// proofSize is the size in bytes that each cell proof requires.
proofSize = kzg4844.CellProofsPerBlob * 48
// txAvgSize is an approximate byte size of a transaction metadata to avoid // txAvgSize is an approximate byte size of a transaction metadata to avoid
// tiny overflows causing all txs to move a shelf higher, wasting disk space. // tiny overflows causing all txs to move a shelf higher, wasting disk space.
txAvgSize = 4 * 1024 txAvgSize = 4 * 1024
// txBlobOverhead is an approximation of the overhead that an additional blob // txBlobOverhead is an approximation of the overhead that an additional blob
// has on transaction size. This is added to the slotter to avoid // has on transaction size. This is added to the slotter to avoid tiny
// tiny overflows causing all txs to move a shelf higher, wasting disk space. // overflows causing all txs to move a shelf higher, wasting disk space. A
txBlobOverhead = 2048 // small buffer is added to the proof overhead.
txBlobOverhead = kzg4844.CellProofsPerBlob*proofSize + 64
// txMaxSize is the maximum size a single transaction can have, outside // txMaxSize is the maximum size a single transaction can have, outside
// the included blobs. Since blob transactions are pulled instead of pushed, // the included blobs. Since blob transactions are pulled instead of pushed,

View file

@ -74,21 +74,15 @@ func TestNewSlotterEIP7594(t *testing.T) {
} }
// Compare the database shelves to the expected ones // Compare the database shelves to the expected ones
want := []uint32{ want := []uint32{
0*blobSize + 0*txBlobOverhead + txAvgSize, // 0 blob + some expected tx infos 0*blobSize + 0*txBlobOverhead + txAvgSize, // 0 blob + some expected tx infos
1*blobSize + 1*txBlobOverhead + txAvgSize, // 1 blob + some expected tx infos 1*blobSize + 1*txBlobOverhead + txAvgSize, // 1 blob + some expected tx infos
2*blobSize + 2*txBlobOverhead + txAvgSize, // 2 blob + some expected tx infos (could be fewer blobs and more tx data) 2*blobSize + 2*txBlobOverhead + txAvgSize, // 2 blob + some expected tx infos (could be fewer blobs and more tx data)
3*blobSize + 3*txBlobOverhead + txAvgSize, // 3 blob + some expected tx infos (could be fewer blobs and more tx data) 3*blobSize + 3*txBlobOverhead + txAvgSize, // 3 blob + some expected tx infos (could be fewer blobs and more tx data)
4*blobSize + 4*txBlobOverhead + txAvgSize, // 4 blob + some expected tx infos (could be fewer blobs and more tx data) 4*blobSize + 4*txBlobOverhead + txAvgSize, // 4 blob + some expected tx infos (could be fewer blobs and more tx data)
5*blobSize + 5*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size 5*blobSize + 5*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
6*blobSize + 6*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size 6*blobSize + 6*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
7*blobSize + 7*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size 7*blobSize + 7*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
8*blobSize + 8*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size 8*blobSize + 8*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos >= 4 blobs + max tx metadata size
9*blobSize + 9*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
10*blobSize + 10*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
11*blobSize + 11*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
12*blobSize + 12*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
13*blobSize + 13*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
14*blobSize + 14*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos >= 4 blobs + max tx metadata size
} }
if len(shelves) != len(want) { if len(shelves) != len(want) {
t.Errorf("shelves count mismatch: have %d, want %d", len(shelves), len(want)) t.Errorf("shelves count mismatch: have %d, want %d", len(shelves), len(want))

View file

@ -34,10 +34,10 @@ var (
blobT = reflect.TypeFor[Blob]() blobT = reflect.TypeFor[Blob]()
commitmentT = reflect.TypeFor[Commitment]() commitmentT = reflect.TypeFor[Commitment]()
proofT = reflect.TypeFor[Proof]() proofT = reflect.TypeFor[Proof]()
CellProofsPerBlob = 128
) )
const CellProofsPerBlob = 128
// Blob represents a 4844 data blob. // Blob represents a 4844 data blob.
type Blob [131072]byte type Blob [131072]byte