mirror of
https://github.com/arnaucube/go-circom-prover-verifier.git
synced 2026-02-07 19:36:42 +01:00
Add proof parsers to string (decimal & hex)
Also adds ProofToSmartContractFormat, which returns a ProofString as the proof.B elements swap is not a valid point for the bn256.G2 format. Also unexports internal structs and methods of the prover package. Also apply golint.
This commit is contained in:
@@ -172,3 +172,27 @@ func TestParseWitnessBin(t *testing.T) {
|
||||
testCircuitParseWitnessBin(t, "circuit1k")
|
||||
testCircuitParseWitnessBin(t, "circuit5k")
|
||||
}
|
||||
|
||||
func TestProofSmartContractFormat(t *testing.T) {
|
||||
proofJson, err := ioutil.ReadFile("../testdata/circuit1k/proof.json")
|
||||
require.Nil(t, err)
|
||||
proof, err := ParseProof(proofJson)
|
||||
require.Nil(t, err)
|
||||
pS := ProofToString(proof)
|
||||
|
||||
pSC := ProofToSmartContractFormat(proof)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, pS.A[0], pSC.A[0])
|
||||
assert.Equal(t, pS.A[1], pSC.A[1])
|
||||
assert.Equal(t, pS.B[0][0], pSC.B[0][1])
|
||||
assert.Equal(t, pS.B[0][1], pSC.B[0][0])
|
||||
assert.Equal(t, pS.B[1][0], pSC.B[1][1])
|
||||
assert.Equal(t, pS.B[1][1], pSC.B[1][0])
|
||||
assert.Equal(t, pS.C[0], pSC.C[0])
|
||||
assert.Equal(t, pS.C[1], pSC.C[1])
|
||||
assert.Equal(t, pS.Protocol, pSC.Protocol)
|
||||
|
||||
pSC2 := ProofStringToSmartContractFormat(pS)
|
||||
assert.Equal(t, pSC, pSC2)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user