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

Function CompileWithRustLib

ecgo/rust/wrapper/wrapper.go:200–221  ·  view source on GitHub ↗
(s []byte, configId uint64)

Source from the content-addressed store, hash-verified

198}
199
200func CompileWithRustLib(s []byte, configId uint64) ([]byte, []byte, error) {
201 initCompilePtr()
202
203 in := C.ByteArray{data: (*C.uint8_t)(C.CBytes(s)), length: C.uint64_t(len(s))}
204 defer C.free(unsafe.Pointer(in.data))
205
206 cr := C.compile(compilePtr, in, C.uint64_t(configId))
207
208 defer C.free(unsafe.Pointer(cr.ir_witness_gen.data))
209 defer C.free(unsafe.Pointer(cr.layered.data))
210 defer C.free(unsafe.Pointer(cr.error.data))
211
212 irWitnessGen := goBytes(cr.ir_witness_gen.data, cr.ir_witness_gen.length)
213 layered := goBytes(cr.layered.data, cr.layered.length)
214 errMsg := goBytes(cr.error.data, cr.error.length)
215
216 if len(errMsg) > 0 {
217 return nil, nil, errors.New(string(errMsg))
218 }
219
220 return irWitnessGen, layered, nil
221}
222
223func ProveCircuitFile(circuitFilename string, witness []byte, configId uint64) []byte {
224 initCompilePtr()

Callers 1

CompileFunction · 0.92

Calls 3

initCompilePtrFunction · 0.85
goBytesFunction · 0.85
compileMethod · 0.80

Tested by

no test coverage detected