Skip to content

Commit

Permalink
remove prover with verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu authored and bxue-l2 committed Aug 5, 2024
1 parent 341d6f4 commit 305f52e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions verify/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ func NewVerifier(cfg *Config, l log.Logger) (*Verifier, error) {
}
}

v, err := verifier.NewVerifier(cfg.KzgConfig, false)
kzgVerifier, err := verifier.NewVerifier(cfg.KzgConfig, false)
if err != nil {
return nil, err
}

return &Verifier{
verifyCert: cfg.Verify,
kzgVerifier: v,
kzgVerifier: kzgVerifier,
cv: cv,
}, nil
}
Expand Down Expand Up @@ -93,7 +93,7 @@ func (v *Verifier) Commit(blob []byte) (*bn254.G1Affine, error) {
}

if len(v.kzgVerifier.Srs.G1) < len(inputFr) {
return nil, fmt.Errorf("cannot verify commitment because the number of stored srs in the memory is insufficient")
return nil, fmt.Errorf("cannot verify commitment because the number of stored srs in the memory is insufficient, have %v need %v", len(v.kzgVerifier.Srs.G1), len(inputFr))
}

config := ecc.MultiExpConfig{}
Expand Down
10 changes: 8 additions & 2 deletions verify/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package verify
import (
"crypto/rand"
"encoding/hex"
"fmt"
"runtime"
"testing"

"github.com/Layr-Labs/eigenda/api/clients/codecs"
"github.com/Layr-Labs/eigenda/api/grpc/common"
"github.com/Layr-Labs/eigenda/encoding/kzg"
"github.com/Layr-Labs/eigenda/encoding/rs"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -61,7 +63,7 @@ func TestCommitmentVerification(t *testing.T) {

func TestCommitmentWithTooLargeBlob(t *testing.T) {

var dataRand [4000 * 32]byte
var dataRand [2000 * 32]byte
_, err := rand.Read(dataRand[:])
require.NoError(t, err)
data := dataRand[:]
Expand Down Expand Up @@ -98,9 +100,13 @@ func TestCommitmentWithTooLargeBlob(t *testing.T) {
// Happy path verification
codec := codecs.NewIFFTCodec(codecs.NewDefaultBlobCodec())
blob, err := codec.EncodeBlob(data)
require.NoError(t, err)

inputFr, err := rs.ToFrArray(blob)
require.NoError(t, err)

err = v.VerifyCommitment(c, blob)
require.EqualError(t, err, "cannot verify commitment because the number of stored srs in the memory is insufficient")
msg := fmt.Sprintf("cannot verify commitment because the number of stored srs in the memory is insufficient, have %v need %v", kzgConfig.SRSNumberToLoad, len(inputFr))
require.EqualError(t, err, msg)

}

0 comments on commit 305f52e

Please sign in to comment.