|
|
@ -98,13 +98,13 @@ func TestGroth16MinimalFlow(t *testing.T) { |
|
|
|
b35Verif := big.NewInt(int64(35)) |
|
|
|
publicSignalsVerif := []*big.Int{b35Verif} |
|
|
|
before := time.Now() |
|
|
|
assert.True(t, groth16.VerifyProof(*circuit, setup, proof, publicSignalsVerif, true)) |
|
|
|
assert.True(t, groth16.VerifyProof(setup, proof, publicSignalsVerif, true)) |
|
|
|
fmt.Println("verify proof time elapsed:", time.Since(before)) |
|
|
|
|
|
|
|
// check that with another public input the verification returns false
|
|
|
|
bOtherWrongPublic := big.NewInt(int64(34)) |
|
|
|
wrongPublicSignalsVerif := []*big.Int{bOtherWrongPublic} |
|
|
|
assert.True(t, !groth16.VerifyProof(*circuit, setup, proof, wrongPublicSignalsVerif, false)) |
|
|
|
assert.True(t, !groth16.VerifyProof(setup, proof, wrongPublicSignalsVerif, false)) |
|
|
|
} |
|
|
|
|
|
|
|
func TestZkFromFlatCircuitCode(t *testing.T) { |
|
|
@ -233,13 +233,13 @@ func TestZkFromFlatCircuitCode(t *testing.T) { |
|
|
|
b35Verif := big.NewInt(int64(35)) |
|
|
|
publicSignalsVerif := []*big.Int{b35Verif} |
|
|
|
before := time.Now() |
|
|
|
assert.True(t, VerifyProof(*circuit, setup, proof, publicSignalsVerif, true)) |
|
|
|
assert.True(t, VerifyProof(setup, proof, publicSignalsVerif, true)) |
|
|
|
fmt.Println("verify proof time elapsed:", time.Since(before)) |
|
|
|
|
|
|
|
// check that with another public input the verification returns false
|
|
|
|
bOtherWrongPublic := big.NewInt(int64(34)) |
|
|
|
wrongPublicSignalsVerif := []*big.Int{bOtherWrongPublic} |
|
|
|
assert.True(t, !VerifyProof(*circuit, setup, proof, wrongPublicSignalsVerif, false)) |
|
|
|
assert.True(t, !VerifyProof(setup, proof, wrongPublicSignalsVerif, false)) |
|
|
|
} |
|
|
|
|
|
|
|
func TestZkMultiplication(t *testing.T) { |
|
|
@ -341,13 +341,13 @@ func TestZkMultiplication(t *testing.T) { |
|
|
|
b12Verif := big.NewInt(int64(12)) |
|
|
|
publicSignalsVerif := []*big.Int{b12Verif} |
|
|
|
before := time.Now() |
|
|
|
assert.True(t, VerifyProof(*circuit, setup, proof, publicSignalsVerif, true)) |
|
|
|
assert.True(t, VerifyProof(setup, proof, publicSignalsVerif, true)) |
|
|
|
fmt.Println("verify proof time elapsed:", time.Since(before)) |
|
|
|
|
|
|
|
// check that with another public input the verification returns false
|
|
|
|
bOtherWrongPublic := big.NewInt(int64(11)) |
|
|
|
wrongPublicSignalsVerif := []*big.Int{bOtherWrongPublic} |
|
|
|
assert.True(t, !VerifyProof(*circuit, setup, proof, wrongPublicSignalsVerif, false)) |
|
|
|
assert.True(t, !VerifyProof(setup, proof, wrongPublicSignalsVerif, false)) |
|
|
|
} |
|
|
|
|
|
|
|
func TestMinimalFlow(t *testing.T) { |
|
|
@ -430,11 +430,11 @@ func TestMinimalFlow(t *testing.T) { |
|
|
|
b35Verif := big.NewInt(int64(35)) |
|
|
|
publicSignalsVerif := []*big.Int{b35Verif} |
|
|
|
before := time.Now() |
|
|
|
assert.True(t, VerifyProof(*circuit, setup, proof, publicSignalsVerif, true)) |
|
|
|
assert.True(t, VerifyProof(setup, proof, publicSignalsVerif, true)) |
|
|
|
fmt.Println("verify proof time elapsed:", time.Since(before)) |
|
|
|
|
|
|
|
// check that with another public input the verification returns false
|
|
|
|
bOtherWrongPublic := big.NewInt(int64(34)) |
|
|
|
wrongPublicSignalsVerif := []*big.Int{bOtherWrongPublic} |
|
|
|
assert.True(t, !VerifyProof(*circuit, setup, proof, wrongPublicSignalsVerif, false)) |
|
|
|
assert.True(t, !VerifyProof(setup, proof, wrongPublicSignalsVerif, false)) |
|
|
|
} |