MCPcopy Create free account
hub / github.com/PolyhedraZK/ExpanderCompilerCollection / Verify

Method Verify

ecgo/integration/expander_exec.go:71–98  ·  view source on GitHub ↗
(witnessData []byte, proof_and_claim []byte)

Source from the content-addressed store, hash-verified

69}
70
71func (p *Prover) Verify(witnessData []byte, proof_and_claim []byte) (bool, error) {
72 if is_url(p.filename) {
73 witnessLen := make([]byte, 8)
74 binary.LittleEndian.PutUint64(witnessLen, uint64(len(witnessData)))
75 proofLen := make([]byte, 8)
76 binary.LittleEndian.PutUint64(proofLen, uint64(len(proof_and_claim)))
77 verifierInput := append(append(append(witnessLen, proofLen...), witnessData...), proof_and_claim...)
78 verifyReq, err := http.NewRequest("POST", p.filename+"/verify", bytes.NewBuffer(verifierInput))
79 if err != nil {
80 return false, err
81 }
82 verifyReq.Header.Set("Content-Type", "application/octet-stream")
83 verifyReq.Header.Set("Content-Length", fmt.Sprintf("%d", len(verifierInput)))
84 client := &http.Client{}
85 verifyResp, err := client.Do(verifyReq)
86 if err != nil {
87 return false, err
88 }
89 defer verifyResp.Body.Close()
90
91 verificationResult, err := io.ReadAll(verifyResp.Body)
92 if err != nil {
93 return false, err
94 }
95 return string(verificationResult) == "success", nil
96 }
97 return rust.VerifyFile(p.circuitDir, witnessData, proof_and_claim), nil
98}

Callers 1

mainFunction · 0.95

Calls 3

VerifyFileFunction · 0.92
is_urlFunction · 0.85
SetMethod · 0.80

Tested by

no test coverage detected