Skip to content

Commit

Permalink
Do not panic if the wrong number of chunks are returned. (#1325)
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <cody@eigenlabs.org>
  • Loading branch information
cody-littley authored Feb 27, 2025
1 parent 25665d8 commit 217365e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/clients/v2/retrieval_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"

"github.com/docker/go-units"

"github.com/Layr-Labs/eigenda/api/clients"
Expand Down
11 changes: 9 additions & 2 deletions encoding/kzg/verifier/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,15 @@ func VerifyLengthProof(lengthCommit *bn254.G2Affine, proof *bn254.G2Affine, g1Ch
return PairingsVerify(g1Challenge, lengthCommit, &kzg.GenG1, proof)
}

func (v *Verifier) VerifyFrames(frames []*encoding.Frame, indices []encoding.ChunkNumber, commitments encoding.BlobCommitments, params encoding.EncodingParams) error {
func (v *Verifier) VerifyFrames(
frames []*encoding.Frame,
indices []encoding.ChunkNumber,
commitments encoding.BlobCommitments,
params encoding.EncodingParams) error {

if len(frames) != len(indices) {
return fmt.Errorf("invalid number of frames and indices: %d != %d", len(frames), len(indices))
}

verifier, err := v.GetKzgVerifier(params)
if err != nil {
Expand All @@ -222,7 +230,6 @@ func (v *Verifier) VerifyFrames(frames []*encoding.Frame, indices []encoding.Chu
}

return nil

}

func (v *ParametrizedVerifier) VerifyFrame(commit *bn254.G1Affine, f *encoding.Frame, index uint64, numChunks uint64) error {
Expand Down

0 comments on commit 217365e

Please sign in to comment.