Skip to content

Commit

Permalink
fix: add cbind declarations for new methods to fix autogen (#6622)
Browse files Browse the repository at this point in the history
Some declarations for new cbind methods were missing which was causing
the autogen bindings in index.ts not to be produced.

I guess these aren't being tested? Update: seems like most are tested
and it was working because the CI does not re-autogen the bindings so if
they've been manually implemented it works?
  • Loading branch information
ledwards2225 authored May 23, 2024
1 parent ca89670 commit 2429cd8
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 11 deletions.
10 changes: 9 additions & 1 deletion barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,12 @@ WASM_EXPORT void acir_serialize_verification_key_into_fields(in_ptr acir_compose
fr::vec_out_buf out_vkey,
fr::out_buf out_key_hash);

WASM_EXPORT void acir_prove_ultra_honk(uint8_t const* acir_vec, uint8_t const* witness_vec, uint8_t** out);
WASM_EXPORT void acir_prove_ultra_honk(uint8_t const* acir_vec, uint8_t const* witness_vec, uint8_t** out);

WASM_EXPORT void acir_verify_ultra_honk(uint8_t const* proof_buf, uint8_t const* vk_buf, bool* result);

WASM_EXPORT void acir_write_vk_ultra_honk(uint8_t const* acir_vec, uint8_t** out);

WASM_EXPORT void acir_proof_as_fields_ultra_honk(uint8_t const* proof_buf, fr::vec_out_buf out);

WASM_EXPORT void acir_vk_as_fields_ultra_honk(uint8_t const* vk_buf, fr::vec_out_buf out_vkey);
88 changes: 88 additions & 0 deletions barretenberg/exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -839,5 +839,93 @@
}
],
"isAsync": false
},
{
"functionName": "acir_prove_ultra_honk",
"inArgs": [
{
"name": "acir_vec",
"type": "const uint8_t *"
},
{
"name": "witness_vec",
"type": "const uint8_t *"
}
],
"outArgs": [
{
"name": "out",
"type": "uint8_t **"
}
],
"isAsync": false
},
{
"functionName": "acir_verify_ultra_honk",
"inArgs": [
{
"name": "proof_buf",
"type": "const uint8_t *"
},
{
"name": "vk_buf",
"type": "const uint8_t *"
}
],
"outArgs": [
{
"name": "result",
"type": "bool *"
}
],
"isAsync": false
},
{
"functionName": "acir_write_vk_ultra_honk",
"inArgs": [
{
"name": "acir_vec",
"type": "const uint8_t *"
}
],
"outArgs": [
{
"name": "out",
"type": "uint8_t **"
}
],
"isAsync": false
},
{
"functionName": "acir_proof_as_fields_ultra_honk",
"inArgs": [
{
"name": "proof_buf",
"type": "const uint8_t *"
}
],
"outArgs": [
{
"name": "out",
"type": "fr::vec_out_buf"
}
],
"isAsync": false
},
{
"functionName": "acir_vk_as_fields_ultra_honk",
"inArgs": [
{
"name": "vk_buf",
"type": "const uint8_t *"
}
],
"outArgs": [
{
"name": "out_vkey",
"type": "fr::vec_out_buf"
}
],
"isAsync": false
}
]
20 changes: 10 additions & 10 deletions barretenberg/ts/src/barretenberg_api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ export class BarretenbergApi {
return out as any;
}

async acirProveUltraHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): Promise<Uint8Array> {
const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
async acirProveUltraHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Promise<Uint8Array> {
const inArgs = [acirVec, witnessVec].map(serializeBufferable);
const outTypes: OutputType[] = [BufferDeserializer()];
const result = await this.wasm.callWasmExport(
'acir_prove_ultra_honk',
Expand All @@ -592,8 +592,8 @@ export class BarretenbergApi {
return out[0];
}

async acirWriteVkUltraHonk(constraintSystemBuf: Uint8Array): Promise<Uint8Array> {
const inArgs = [constraintSystemBuf].map(serializeBufferable);
async acirWriteVkUltraHonk(acirVec: Uint8Array): Promise<Uint8Array> {
const inArgs = [acirVec].map(serializeBufferable);
const outTypes: OutputType[] = [BufferDeserializer()];
const result = await this.wasm.callWasmExport(
'acir_write_vk_ultra_honk',
Expand Down Expand Up @@ -625,7 +625,7 @@ export class BarretenbergApi {
outTypes.map(t => t.SIZE_IN_BYTES),
);
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
return out as any;
return out[0];
}
}
export class BarretenbergApiSync {
Expand Down Expand Up @@ -1172,8 +1172,8 @@ export class BarretenbergApiSync {
return out as any;
}

acirUltraHonkProve(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): Uint8Array {
const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
acirProveUltraHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
const inArgs = [acirVec, witnessVec].map(serializeBufferable);
const outTypes: OutputType[] = [BufferDeserializer()];
const result = this.wasm.callWasmExport(
'acir_prove_ultra_honk',
Expand All @@ -1196,8 +1196,8 @@ export class BarretenbergApiSync {
return out[0];
}

acirWriteVkUltraHonk(constraintSystemBuf: Uint8Array): Uint8Array {
const inArgs = [constraintSystemBuf].map(serializeBufferable);
acirWriteVkUltraHonk(acirVec: Uint8Array): Uint8Array {
const inArgs = [acirVec].map(serializeBufferable);
const outTypes: OutputType[] = [BufferDeserializer()];
const result = this.wasm.callWasmExport(
'acir_write_vk_ultra_honk',
Expand Down Expand Up @@ -1229,6 +1229,6 @@ export class BarretenbergApiSync {
outTypes.map(t => t.SIZE_IN_BYTES),
);
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
return out as any;
return out[0];
}
}

0 comments on commit 2429cd8

Please sign in to comment.