Skip to content

Commit fdfb7fb

Browse files
holimanqianhh
authored andcommitted
crypto/kz4844: pass blobs by ref (#29050)
This change makes use of the following underlying changes to the kzg-libraries in order to avoid passing large things on the stack: - c-kzg: ethereum/c-kzg-4844#393 and - go-kzg: https://github.com/crate-crypto/go-kzg-4844/pull/63
1 parent 52de97d commit fdfb7fb

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

internal/ethapi/api_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,7 @@ func TestFillBlobTransaction(t *testing.T) {
10981098
Alloc: types.GenesisAlloc{},
10991099
}
11001100
emptyBlob = new(kzg4844.Blob)
1101+
emptyBlobs = []kzg4844.Blob{*emptyBlob}
11011102
emptyBlobCommit, _ = kzg4844.BlobToCommitment(emptyBlob)
11021103
emptyBlobProof, _ = kzg4844.ComputeBlobProof(emptyBlob, emptyBlobCommit)
11031104
emptyBlobHash common.Hash = kzg4844.CalcBlobHashV1(sha256.New(), &emptyBlobCommit)
@@ -1180,14 +1181,14 @@ func TestFillBlobTransaction(t *testing.T) {
11801181
From: &b.acc.Address,
11811182
To: &to,
11821183
Value: (*hexutil.Big)(big.NewInt(1)),
1183-
Blobs: []kzg4844.Blob{*emptyBlob},
1184+
Blobs: emptyBlobs,
11841185
Commitments: []kzg4844.Commitment{emptyBlobCommit},
11851186
Proofs: []kzg4844.Proof{emptyBlobProof},
11861187
},
11871188
want: &result{
11881189
Hashes: []common.Hash{emptyBlobHash},
11891190
Sidecar: &types.BlobTxSidecar{
1190-
Blobs: []kzg4844.Blob{*emptyBlob},
1191+
Blobs: emptyBlobs,
11911192
Commitments: []kzg4844.Commitment{emptyBlobCommit},
11921193
Proofs: []kzg4844.Proof{emptyBlobProof},
11931194
},
@@ -1200,14 +1201,14 @@ func TestFillBlobTransaction(t *testing.T) {
12001201
To: &to,
12011202
Value: (*hexutil.Big)(big.NewInt(1)),
12021203
BlobHashes: []common.Hash{emptyBlobHash},
1203-
Blobs: []kzg4844.Blob{*emptyBlob},
1204+
Blobs: emptyBlobs,
12041205
Commitments: []kzg4844.Commitment{emptyBlobCommit},
12051206
Proofs: []kzg4844.Proof{emptyBlobProof},
12061207
},
12071208
want: &result{
12081209
Hashes: []common.Hash{emptyBlobHash},
12091210
Sidecar: &types.BlobTxSidecar{
1210-
Blobs: []kzg4844.Blob{*emptyBlob},
1211+
Blobs: emptyBlobs,
12111212
Commitments: []kzg4844.Commitment{emptyBlobCommit},
12121213
Proofs: []kzg4844.Proof{emptyBlobProof},
12131214
},
@@ -1220,7 +1221,7 @@ func TestFillBlobTransaction(t *testing.T) {
12201221
To: &to,
12211222
Value: (*hexutil.Big)(big.NewInt(1)),
12221223
BlobHashes: []common.Hash{{0x01, 0x22}},
1223-
Blobs: []kzg4844.Blob{*emptyBlob},
1224+
Blobs: emptyBlobs,
12241225
Commitments: []kzg4844.Commitment{emptyBlobCommit},
12251226
Proofs: []kzg4844.Proof{emptyBlobProof},
12261227
},
@@ -1232,12 +1233,12 @@ func TestFillBlobTransaction(t *testing.T) {
12321233
From: &b.acc.Address,
12331234
To: &to,
12341235
Value: (*hexutil.Big)(big.NewInt(1)),
1235-
Blobs: []kzg4844.Blob{*emptyBlob},
1236+
Blobs: emptyBlobs,
12361237
},
12371238
want: &result{
12381239
Hashes: []common.Hash{emptyBlobHash},
12391240
Sidecar: &types.BlobTxSidecar{
1240-
Blobs: []kzg4844.Blob{*emptyBlob},
1241+
Blobs: emptyBlobs,
12411242
Commitments: []kzg4844.Commitment{emptyBlobCommit},
12421243
Proofs: []kzg4844.Proof{emptyBlobProof},
12431244
},

0 commit comments

Comments
 (0)