mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
internal: avoid large blob value copy
This commit is contained in:
parent
2eb185c92b
commit
675effd03c
1 changed files with 6 additions and 5 deletions
|
|
@ -325,13 +325,14 @@ func (args *TransactionArgs) setBlobTxSidecar(ctx context.Context) error {
|
|||
// Generate commitment and proof.
|
||||
commitments := make([]kzg4844.Commitment, n)
|
||||
proofs := make([]kzg4844.Proof, n)
|
||||
for i, b := range args.Blobs {
|
||||
c, err := kzg4844.BlobToCommitment(&b)
|
||||
for i := range args.Blobs {
|
||||
b := &args.Blobs[i]
|
||||
c, err := kzg4844.BlobToCommitment(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("blobs[%d]: error computing commitment: %v", i, err)
|
||||
}
|
||||
commitments[i] = c
|
||||
p, err := kzg4844.ComputeBlobProof(&b, c)
|
||||
p, err := kzg4844.ComputeBlobProof(b, c)
|
||||
if err != nil {
|
||||
return fmt.Errorf("blobs[%d]: error computing proof: %v", i, err)
|
||||
}
|
||||
|
|
@ -340,8 +341,8 @@ func (args *TransactionArgs) setBlobTxSidecar(ctx context.Context) error {
|
|||
args.Commitments = commitments
|
||||
args.Proofs = proofs
|
||||
} else {
|
||||
for i, b := range args.Blobs {
|
||||
if err := kzg4844.VerifyBlobProof(&b, args.Commitments[i], args.Proofs[i]); err != nil {
|
||||
for i := range args.Blobs {
|
||||
if err := kzg4844.VerifyBlobProof(&args.Blobs[i], args.Commitments[i], args.Proofs[i]); err != nil {
|
||||
return fmt.Errorf("failed to verify blob proof: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue