Skip to content

Commit 8529da3

Browse files
committed
Fix some issues with rebase
1 parent 0cc8837 commit 8529da3

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

encoding/kzg/prover/commitments.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package prover
22

33
import (
4+
"fmt"
5+
46
"github.com/Layr-Labs/eigenda/encoding/kzg"
57
"github.com/consensys/gnark-crypto/ecc"
68
"github.com/consensys/gnark-crypto/ecc/bn254"
@@ -15,14 +17,25 @@ type KzgCommitmentsGnarkBackend struct {
1517

1618
func (p *KzgCommitmentsGnarkBackend) ComputeLengthProof(coeffs []fr.Element) (*bn254.G2Affine, error) {
1719
inputLength := uint64(len(coeffs))
18-
shiftedSecret := p.G2Trailing[p.KzgConfig.SRSNumberToLoad-inputLength:]
20+
return p.ComputeLengthProofForLength(coeffs, inputLength)
21+
}
22+
23+
func (p *KzgCommitmentsGnarkBackend) ComputeLengthProofForLength(coeffs []fr.Element, length uint64) (*bn254.G2Affine, error) {
24+
if length < uint64(len(coeffs)) {
25+
return nil, fmt.Errorf("length is less than the number of coefficients")
26+
}
27+
28+
start := p.KzgConfig.SRSNumberToLoad - length
29+
shiftedSecret := p.G2Trailing[start : start+uint64(len(coeffs))]
1930
config := ecc.MultiExpConfig{}
31+
2032
//The proof of low degree is commitment of the polynomial shifted to the largest srs degree
2133
var lengthProof bn254.G2Affine
2234
_, err := lengthProof.MultiExp(shiftedSecret, coeffs, config)
2335
if err != nil {
2436
return nil, err
2537
}
38+
2639
return &lengthProof, nil
2740
}
2841

encoding/kzg/prover/parametrized_prover_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ func TestProveAllCosetThreads(t *testing.T) {
2424
inputFr, err := rs.ToFrArray(gettysburgAddressBytes)
2525
assert.Nil(t, err)
2626

27-
frames, fIndices, err := enc.GetFrames(inputFr)
28-
require.Nil(t, err)
29-
30-
commit, _, _, err := enc.GetCommitments(inputFr)
27+
commit, _, _, frames, fIndices, err := enc.Encode(inputFr)
3128
require.Nil(t, err)
3229

3330
for i := 0; i < len(frames); i++ {

encoding/kzg/prover/prover.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ func (p *Prover) createGnarkBackendProver(params encoding.EncodingParams, fs *ff
403403
}
404404

405405
// Set KZG Commitments default backend
406-
commitmentsBckend := &KzgCommitmentsGnarkBackend{
406+
commitmentsBackend := &KzgCommitmentsGnarkBackend{
407407
Srs: p.Srs,
408408
G2Trailing: p.G2Trailing,
409409
KzgConfig: p.KzgConfig,
@@ -415,7 +415,7 @@ func (p *Prover) createGnarkBackendProver(params encoding.EncodingParams, fs *ff
415415
KzgConfig: p.KzgConfig,
416416
Ks: ks,
417417
KzgMultiProofBackend: multiproofBackend,
418-
KzgCommitmentsBackend: commitmentsBckend,
418+
KzgCommitmentsBackend: commitmentsBackend,
419419
}, nil
420420
}
421421

0 commit comments

Comments
 (0)