mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
core/txpool/blobpool: bump per blob overhead
This commit is contained in:
parent
dd99cf07e4
commit
0a061be6a0
3 changed files with 18 additions and 20 deletions
|
|
@ -51,14 +51,18 @@ const (
|
|||
// transaction. There can be multiple of these embedded into a single tx.
|
||||
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
|
||||
// tiny overflows causing all txs to move a shelf higher, wasting disk space.
|
||||
txAvgSize = 4 * 1024
|
||||
|
||||
// txBlobOverhead is an approximation of the overhead that an additional blob
|
||||
// has on transaction size. This is added to the slotter to avoid
|
||||
// tiny overflows causing all txs to move a shelf higher, wasting disk space.
|
||||
txBlobOverhead = 2048
|
||||
// has on transaction size. This is added to the slotter to avoid tiny
|
||||
// overflows causing all txs to move a shelf higher, wasting disk space. A
|
||||
// small buffer is added to the proof overhead.
|
||||
txBlobOverhead = kzg4844.CellProofsPerBlob*proofSize + 64
|
||||
|
||||
// txMaxSize is the maximum size a single transaction can have, outside
|
||||
// the included blobs. Since blob transactions are pulled instead of pushed,
|
||||
|
|
|
|||
|
|
@ -74,21 +74,15 @@ func TestNewSlotterEIP7594(t *testing.T) {
|
|||
}
|
||||
// Compare the database shelves to the expected ones
|
||||
want := []uint32{
|
||||
0*blobSize + 0*txBlobOverhead + txAvgSize, // 0 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)
|
||||
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)
|
||||
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
|
||||
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
|
||||
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
|
||||
0*blobSize + 0*txBlobOverhead + txAvgSize, // 0 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)
|
||||
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)
|
||||
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
|
||||
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
|
||||
}
|
||||
if len(shelves) != len(want) {
|
||||
t.Errorf("shelves count mismatch: have %d, want %d", len(shelves), len(want))
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ var (
|
|||
blobT = reflect.TypeFor[Blob]()
|
||||
commitmentT = reflect.TypeFor[Commitment]()
|
||||
proofT = reflect.TypeFor[Proof]()
|
||||
|
||||
CellProofsPerBlob = 128
|
||||
)
|
||||
|
||||
const CellProofsPerBlob = 128
|
||||
|
||||
// Blob represents a 4844 data blob.
|
||||
type Blob [131072]byte
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue