You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
825 B

  1. package gocircomprover
  2. import (
  3. "fmt"
  4. "io/ioutil"
  5. "math/big"
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. "github.com/stretchr/testify/require"
  9. )
  10. func TestProve(t *testing.T) {
  11. provingKeyJson, err := ioutil.ReadFile("testdata/provingkey.json")
  12. require.Nil(t, err)
  13. pk, err := ParseProvingKey(provingKeyJson)
  14. require.Nil(t, err)
  15. fmt.Println("polsA", pk.PolsA)
  16. fmt.Println("polsB", pk.PolsB)
  17. fmt.Println("polsC", pk.PolsC)
  18. witnessJson, err := ioutil.ReadFile("testdata/witness.json")
  19. require.Nil(t, err)
  20. w, err := ParseWitness(witnessJson)
  21. require.Nil(t, err)
  22. fmt.Println("w", w)
  23. assert.Equal(t, Witness{big.NewInt(1), big.NewInt(33), big.NewInt(3), big.NewInt(11)}, w)
  24. proof, pubSignals, err := Prove(pk, w)
  25. assert.Nil(t, err)
  26. fmt.Println("proof", proof)
  27. fmt.Println("pubSignals", pubSignals)
  28. }