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

feat: Add ability to make proofs with an already computed proving key #1682

Closed
wants to merge 9 commits into from
Prev Previous commit
Next Next commit
add acir_get_proving_key to cbinds. Analogous to `acir_get_verifica…
…tion_key`
kevaundray committed Aug 20, 2023
commit 6d66180d6aba963fca39fb8c53468f315f0fdbd3
Original file line number Diff line number Diff line change
@@ -38,6 +38,15 @@ WASM_EXPORT void acir_init_proving_key(in_ptr acir_composer_ptr, uint8_t const*
acir_composer->init_proving_key(barretenberg::srs::get_crs_factory(), constraint_system);
}

WASM_EXPORT void acir_get_proving_key(in_ptr acir_composer_ptr, uint8_t const* acir_vec, uint8_t** out)
{
auto acir_composer = reinterpret_cast<acir_proofs::AcirComposer*>(*acir_composer_ptr);
auto constraint_system = acir_format::circuit_buf_to_acir_format(from_buffer<std::vector<uint8_t>>(acir_vec));

auto pk = acir_composer->init_proving_key(barretenberg::srs::get_crs_factory(), constraint_system);
*out = to_heap_buffer(to_buffer(*pk));
}

WASM_EXPORT void acir_create_proof(in_ptr acir_composer_ptr,
uint8_t const* acir_vec,
uint8_t const* witness_vec,
Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@ WASM_EXPORT void acir_create_circuit(in_ptr acir_composer_ptr,

WASM_EXPORT void acir_init_proving_key(in_ptr acir_composer_ptr, uint8_t const* constraint_system_buf);

WASM_EXPORT void acir_get_proving_key(in_ptr acir_composer_ptr, uint8_t const* acir_vec, uint8_t** out);

/**
* It would have been nice to just hold onto the constraint_system in the acir_composer, but we can't waste the
* memory. Being able to reuse the underlying Composer would help as well. But, given the situation, we just have