Skip to content

Commit 76146a5

Browse files
committed
core/txpool/blobpool: bump per blob overhead
1 parent 0543193 commit 76146a5

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

core/txpool/blobpool/blobpool.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,18 @@ const (
5151
// transaction. There can be multiple of these embedded into a single tx.
5252
blobSize = params.BlobTxFieldElementsPerBlob * params.BlobTxBytesPerFieldElement
5353

54+
// proofSize is the size in bytes that each cell proof requires.
55+
proofSize = kzg4844.CellProofsPerBlob * 48
56+
5457
// txAvgSize is an approximate byte size of a transaction metadata to avoid
5558
// tiny overflows causing all txs to move a shelf higher, wasting disk space.
5659
txAvgSize = 4 * 1024
5760

5861
// txBlobOverhead is an approximation of the overhead that an additional blob
59-
// has on transaction size. This is added to the slotter to avoid
60-
// tiny overflows causing all txs to move a shelf higher, wasting disk space.
61-
txBlobOverhead = 2048
62+
// has on transaction size. This is added to the slotter to avoid tiny
63+
// overflows causing all txs to move a shelf higher, wasting disk space. A
64+
// small buffer is added to the proof overhead.
65+
txBlobOverhead = params.BlobTxCellsPerBlob*proofSize + 64
6266

6367
// txMaxSize is the maximum size a single transaction can have, outside
6468
// the included blobs. Since blob transactions are pulled instead of pushed,

core/txpool/blobpool/slotter_test.go

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,15 @@ func TestNewSlotterEIP7594(t *testing.T) {
7474
}
7575
// Compare the database shelves to the expected ones
7676
want := []uint32{
77-
0*blobSize + 0*txBlobOverhead + txAvgSize, // 0 blob + some expected tx infos
78-
1*blobSize + 1*txBlobOverhead + txAvgSize, // 1 blob + some expected tx infos
79-
2*blobSize + 2*txBlobOverhead + txAvgSize, // 2 blob + some expected tx infos (could be fewer blobs and more tx data)
80-
3*blobSize + 3*txBlobOverhead + txAvgSize, // 3 blob + some expected tx infos (could be fewer blobs and more tx data)
81-
4*blobSize + 4*txBlobOverhead + txAvgSize, // 4 blob + some expected tx infos (could be fewer blobs and more tx data)
82-
5*blobSize + 5*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
83-
6*blobSize + 6*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
84-
7*blobSize + 7*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
85-
8*blobSize + 8*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
86-
9*blobSize + 9*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
87-
10*blobSize + 10*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
88-
11*blobSize + 11*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
89-
12*blobSize + 12*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
90-
13*blobSize + 13*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
91-
14*blobSize + 14*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos >= 4 blobs + max tx metadata size
77+
0*blobSize + 0*txBlobOverhead + txAvgSize, // 0 blob + some expected tx infos
78+
1*blobSize + 1*txBlobOverhead + txAvgSize, // 1 blob + some expected tx infos
79+
2*blobSize + 2*txBlobOverhead + txAvgSize, // 2 blob + some expected tx infos (could be fewer blobs and more tx data)
80+
3*blobSize + 3*txBlobOverhead + txAvgSize, // 3 blob + some expected tx infos (could be fewer blobs and more tx data)
81+
4*blobSize + 4*txBlobOverhead + txAvgSize, // 4 blob + some expected tx infos (could be fewer blobs and more tx data)
82+
5*blobSize + 5*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
83+
6*blobSize + 6*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
84+
7*blobSize + 7*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
85+
8*blobSize + 8*txBlobOverhead + txAvgSize, // 1-6 blobs + unexpectedly large tx infos >= 4 blobs + max tx metadata size
9286
}
9387
if len(shelves) != len(want) {
9488
t.Errorf("shelves count mismatch: have %d, want %d", len(shelves), len(want))

crypto/kzg4844/kzg4844.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ var (
3434
blobT = reflect.TypeFor[Blob]()
3535
commitmentT = reflect.TypeFor[Commitment]()
3636
proofT = reflect.TypeFor[Proof]()
37-
38-
CellProofsPerBlob = 128
3937
)
4038

39+
const CellProofsPerBlob = 128
40+
4141
// Blob represents a 4844 data blob.
4242
type Blob [131072]byte
4343

0 commit comments

Comments
 (0)