(s []byte, configId uint64)
| 198 | } |
| 199 | |
| 200 | func 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 | |
| 223 | func ProveCircuitFile(circuitFilename string, witness []byte, configId uint64) []byte { |
| 224 | initCompilePtr() |
no test coverage detected