Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add cbind declarations for new methods to fix autogen #6622

Merged
merged 3 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe I forgot to test this function through wasm? This function isn't tested through CI, so its possible that out as any was wrong.

}
}
Loading