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

Cg/flavor #326

Merged
merged 127 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
27079ce
Add flavor & shuffle; everything builds with clang
codygunton Mar 31, 2023
6bc56b1
Template composer lib; split plonk tests pass.
codygunton Apr 6, 2023
7546bc3
WIP on building Honk
codygunton Apr 11, 2023
18a85ab
set log_circuit_size in pk
codygunton Apr 11, 2023
ebf82e8
"Everything builds" in clang!
codygunton Apr 11, 2023
c8d75c7
"It builds" again after rebase
codygunton Apr 15, 2023
cef40e5
Make flavor base class, proof_system_tests pass.
codygunton Apr 17, 2023
08b6c34
Less inheritance
codygunton Apr 17, 2023
06ce1dc
Good through creation of prover.
codygunton Apr 17, 2023
9073ecf
Fix compilation.
codygunton Apr 18, 2023
05db2a3
Bring back evaluation_domain constructor.
codygunton Apr 18, 2023
fdbf396
Work on prover (it builds again!)
codygunton Apr 19, 2023
1a7de69
BaseCase runs through but fails.
codygunton Apr 19, 2023
27ffbeb
Add table polys and reinstate in prover lib.
codygunton Apr 19, 2023
43bc9f1
Change assignment operators
codygunton Apr 19, 2023
f10c9ce
Reinstate some more polynomials.
codygunton Apr 19, 2023
549cad1
Fix grand product test.
codygunton Apr 20, 2023
5825d73
A bit of tidying up.
codygunton Apr 20, 2023
7320e4c
Debugging: sigma polys make it to loop in test.
codygunton Apr 20, 2023
6fd6206
Notes after lookover.
codygunton Apr 20, 2023
f97be70
See failures in AssertEquals test.
codygunton Apr 20, 2023
e2c18d5
Cleanup-ish
codygunton Apr 20, 2023
8155d48
Logs showing change in sigma polys.
codygunton Apr 20, 2023
924d562
move wire index incrementer inside loop in compute perm mapping
ledwards2225 Apr 20, 2023
c279b8b
Comments
codygunton Apr 20, 2023
ac03bf8
commitment label fix
ledwards2225 Apr 20, 2023
92e3bb0
Merge branch 'cg/flavor' of github.com:AztecProtocol/barretenberg int…
codygunton Apr 20, 2023
56a5b0a
New vk
codygunton Apr 20, 2023
43fdc20
WIP on verifier (build but failing assert)
codygunton Apr 20, 2023
a25deb3
WIP on Gemini verification
codygunton Apr 21, 2023
8b82d58
WIP sumcheck verifier passes but Gemini fails.
codygunton Apr 21, 2023
84bbeed
proof bbytes agree with master
ledwards2225 Apr 21, 2023
ed68972
WIP
codygunton Apr 21, 2023
2bed95e
fix typo, verifies
ledwards2225 Apr 21, 2023
7d9b768
Merge branch 'cg/flavor' of github.com:AztecProtocol/barretenberg int…
codygunton Apr 21, 2023
9192d6b
LookupGrandProduct passes.
codygunton Apr 22, 2023
a6f1875
WIP debugging correctness test
codygunton Apr 22, 2023
dcbabf1
Get rid of old flavor file.
codygunton Apr 24, 2023
a843aea
fix and simplify relation consistency tests
ledwards2225 Apr 24, 2023
b9ef0bf
fix expected manifest in transcript tests
ledwards2225 Apr 24, 2023
4410fdb
exploring some simplifications in the Flavor data classes
ledwards2225 Apr 24, 2023
a4a6157
simplifying flavor classes a bit
ledwards2225 Apr 25, 2023
881da26
make selector order match that in ultra composer; relation correctnes…
ledwards2225 Apr 25, 2023
ea20222
Cheaply fix Flavor.Standard.
codygunton Apr 25, 2023
94b4cc3
Enrich circuit constructor
codygunton Apr 26, 2023
44430c0
Reduce boilerplate.
codygunton Apr 26, 2023
bdb25d6
Revert "Cheaply fix Flavor.Standard."
codygunton Apr 26, 2023
67e5d5b
Merge branch 'cg/flavor' of github.com:AztecProtocol/barretenberg int…
codygunton Apr 26, 2023
e867a9c
Trip skipping segfaulting incomplete test.
codygunton Apr 26, 2023
cfc911e
Reorg CCI workflow
codygunton Apr 26, 2023
727a47e
Fix CCI workflow.
codygunton Apr 26, 2023
154da15
Initialize proving key in SetUp().
codygunton Apr 26, 2023
62a12d7
Write test idiomatically.
codygunton Apr 26, 2023
19bedf0
Change num_randomized_gates.
codygunton Apr 26, 2023
5a77e5b
Fix typo in pk setup.
codygunton Apr 26, 2023
4d255db
Splitting out biggroup tests saves no time.
codygunton Apr 26, 2023
b9b4ed8
initial merge
ledwards2225 Apr 26, 2023
3589b0e
getting things to build post master merge; all previously passing tes…
ledwards2225 Apr 26, 2023
6601e97
well ok now its building anyway
ledwards2225 Apr 26, 2023
d53aede
lookup relation consistency tests passing
ledwards2225 Apr 26, 2023
893d6ae
reinstated UH composer tests passing
ledwards2225 Apr 26, 2023
2f24618
all tests reinstated and passing!
ledwards2225 Apr 26, 2023
d0732c0
new ProvingKey and WiP on making everything use the wires in the pkey
ledwards2225 Apr 26, 2023
06116f5
store all witness polys in the provng key for standard and ultra honk
ledwards2225 Apr 27, 2023
d64b9f8
Small WORKTODOs
codygunton Apr 27, 2023
2c83444
fix wrong wire access in field tests
ledwards2225 Apr 27, 2023
5c54ee0
WORKTODO: read wires
codygunton Apr 27, 2023
0a6d1a9
Small WORKTODOs
codygunton Apr 27, 2023
b1e2617
Prover ~> StandardProver_, simly for Honk
codygunton Apr 27, 2023
b8884ca
Small WORKTODOs
codygunton Apr 27, 2023
5f9f19e
Delete test due to significant drift over time.
codygunton Apr 27, 2023
d1631d0
Fix commitment labels
codygunton Apr 27, 2023
a768d8f
Clean up test
codygunton Apr 27, 2023
ecb272f
Make MAX_RELATION_LENGTH issue.
codygunton Apr 27, 2023
0684049
Reference zip issue
codygunton Apr 27, 2023
916a225
Another opportunity to zip
codygunton Apr 27, 2023
1a0c774
Merge branch 'cg/flavor' of github.com:AztecProtocol/barretenberg int…
codygunton Apr 27, 2023
d197327
Remove unused template argument.
codygunton Apr 27, 2023
59ceaf7
Update comment.
codygunton Apr 27, 2023
dffbefd
Ranged `for` loop and note.
codygunton Apr 27, 2023
ac0414d
Clarify complicated loop.
codygunton Apr 27, 2023
ffdffef
Note on ComposerType
codygunton Apr 28, 2023
f881a12
Add note on ComposerType
codygunton Apr 28, 2023
fb3b0db
Fix the dirty hack.
codygunton Apr 28, 2023
3c17edd
Generalize verifier, nix unused template param
codygunton Apr 28, 2023
dc3e03a
Fix reverted comments (?)
codygunton Apr 28, 2023
bfe8ce5
Fix compilation.
codygunton Apr 28, 2023
e98ca5d
Clean up comments
codygunton Apr 28, 2023
c7fc7cb
More cleanup of TODOs
codygunton Apr 28, 2023
1611950
Rename template args in Flavor.
codygunton Apr 28, 2023
9a30d6e
Add handle types for uniformity
codygunton Apr 28, 2023
64836c8
Rename the base classes.
codygunton Apr 28, 2023
a69185c
Straggler
codygunton Apr 28, 2023
66ac270
Some hierarchy simplifications.
codygunton Apr 28, 2023
87499ff
Split flavor
codygunton Apr 28, 2023
372f14b
Less verbose name
codygunton Apr 28, 2023
df37f58
Comments and clarity.
codygunton Apr 28, 2023
859e5dd
Rename "data" to "entities"
codygunton Apr 28, 2023
2bdacb7
Use access specifiers in flavors.
codygunton Apr 28, 2023
4dfe945
Explicitness in flavor
codygunton Apr 28, 2023
0be17f0
Move constructor from array and clean up.
codygunton Apr 28, 2023
8421b49
Add huge introductory comment.
codygunton Apr 28, 2023
e89aeef
Document flavor class templates.
codygunton Apr 28, 2023
c6dc98a
num_wires ~> NUM_WIRES
codygunton Apr 28, 2023
2a9af17
Comment standard flavor; resolve last WORKTODO.
codygunton Apr 28, 2023
91913f9
Comments and WitnessEntities_
codygunton May 1, 2023
0c33146
Remove redundant template arg.
codygunton May 1, 2023
93d6d61
Symmetry of proving key.
codygunton May 1, 2023
604e68e
Remove some boilerplate
codygunton May 1, 2023
f25d727
Share proving key constructor.
codygunton May 1, 2023
1ddb451
Rename members; resue VK constructors.
codygunton May 1, 2023
050bb38
Paste standard flavor comments into ultra flavor.
codygunton May 1, 2023
e6d7ebe
Cleanup
codygunton May 1, 2023
623e11a
Merge branch 'master' into cg/flavor
codygunton May 1, 2023
12b0ea4
Merge branch 'master' into cg/flavor
codygunton May 4, 2023
2c70458
Merge branch 'master' into cg/flavor
codygunton May 4, 2023
c7b3e30
Add cci config line back in.
codygunton May 4, 2023
4a8d52d
Low-lying fixes like typos.
codygunton May 4, 2023
b9c2952
Cheaply reintroduce equality check.
codygunton May 4, 2023
503aca0
Leave note on unfinished tests
codygunton May 4, 2023
75589bf
Make todo an issue
codygunton May 4, 2023
aa6d063
Add failure case.
codygunton May 4, 2023
7053096
Clarify some flavor tests.
codygunton May 4, 2023
e7a997d
Remove some logging.
codygunton May 4, 2023
034c541
Add assert suggested by Kesha.
codygunton May 4, 2023
0561e5d
Fix typo.
codygunton May 4, 2023
5282d68
Remove proof printing function.
codygunton May 4, 2023
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
24 changes: 11 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
name: "Build"
command: cond_spot_run_build barretenberg-x86_64-linux-clang-assert 64

barretenberg-tests:
stdlib-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
Expand All @@ -157,10 +157,10 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 bb-tests
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 stdlib-tests
- *save_logs

honk-tests:
barretenberg-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
Expand All @@ -169,11 +169,10 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 honk_tests
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 bb-tests
- *save_logs


stdlib-primitives-tests:
honk-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
Expand All @@ -182,10 +181,10 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 stdlib_primitives_tests --gtest_filter=-stdlib_biggroup*
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 honk_tests
- *save_logs

stdlib-biggroup-tests:
proof-system-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
Expand All @@ -194,7 +193,7 @@ jobs:
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 stdlib_primitives_tests --gtest_filter=stdlib_biggroup*
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 proof_system_tests
- *save_logs

stdlib-recursion-turbo-tests:
Expand Down Expand Up @@ -322,18 +321,17 @@ workflows:
- x86_64-linux-clang: *defaults
- x86_64-linux-clang-assert: *defaults
- wasm-linux-clang: *defaults
- proof-system-tests: *bb_test
- honk-tests: *bb_test
- barretenberg-tests: *bb_test
- stdlib-primitives-tests: *bb_test
- stdlib-biggroup-tests: *bb_test
- stdlib-tests: *bb_test
- stdlib-recursion-turbo-tests: *bb_test
- stdlib-recursion-ultra-tests: *bb_test
- join-split-tests: *bb_test
- benchmark-aggregator:
requires:
- barretenberg-tests
- stdlib-primitives-tests
- stdlib-biggroup-tests
- stdlib-tests
- stdlib-recursion-turbo-tests
- stdlib-recursion-ultra-tests
- join-split-tests
Expand Down
4 changes: 4 additions & 0 deletions barretenberg.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
// to the default value "clangd".
//
"clangd.path": "clangd-15",
// We should disable automatic inclusion of headers unless we decide to follow "WhyIWYU".
"clangd.arguments": [
"-header-insertion=never"
]
//
// CMake
//
Expand Down
11 changes: 8 additions & 3 deletions cpp/.clangd
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ CompileFlags: # Tweak the parse settings
If:
PathMatch: [src/.*\.hpp, src/.*\.cpp, src/.*\.tcc]
Diagnostics:
# Checks whether we are including unused header files
# Value Strict checks whether we are including unused header files
# Note that some headers may be _implicitly_ used and still
# need to be included, so be careful before removing them.
UnusedIncludes: Strict
# need to be included. This is very noisy, and is probably best used
# by occasionally toggling it on.
UnusedIncludes: None

# Static analysis configuration
ClangTidy:
Expand Down Expand Up @@ -56,6 +57,10 @@ Diagnostics:
- cert-err58-cpp
# Triggers on some tests that are not complex
- readability-function-cognitive-complexity
# It is often nicer to not be explicit
- google-explicit-constructor
CheckOptions:
- cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor: True

--- # this divider is necessary
# Disable some checks for Google Test/Bench
Expand Down
11 changes: 1 addition & 10 deletions cpp/scripts/bb-tests
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@ ecc_tests
numeric_tests
plonk_tests
polynomials_tests
proof_system_tests
join_split_example_proofs_inner_proof_data_tests
join_split_example_proofs_notes_tests
srs_tests
stdlib_aes128_tests
stdlib_blake2s_tests
stdlib_blake3s_tests
stdlib_ecdsa_tests
stdlib_merkle_tree_tests
stdlib_pedersen_commitment_tests
stdlib_schnorr_tests
stdlib_sha256_tests
transcript_tests
transcript_tests
9 changes: 9 additions & 0 deletions cpp/scripts/stdlib-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
stdlib_primitives_tests
stdlib_aes128_tests
stdlib_blake2s_tests
stdlib_blake3s_tests
stdlib_ecdsa_tests
stdlib_merkle_tree_tests
stdlib_pedersen_commitment_tests
stdlib_schnorr_tests
stdlib_sha256_tests
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "standard_honk_composer_helper.hpp"
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/honk/flavor/flavor.hpp"
#include "barretenberg/honk/pcs/commitment_key.hpp"
#include "barretenberg/numeric/bitop/get_msb.hpp"
#include "barretenberg/srs/reference_string/reference_string.hpp"

#include <cstddef>
#include <cstdint>
Expand All @@ -14,26 +15,25 @@ namespace proof_system::honk {
* Compute proving key base.
*
* 1. Load crs.
* 2. Initialize this.circuit_proving_key.
* 2. Initialize this->proving_key.
* 3. Create constraint selector polynomials from each of this composer's `selectors` vectors and add them to the
* proving key.
*
* @param minimum_circuit_size Used as the total number of gates when larger than n + count of public inputs.
* @param num_reserved_gates The number of reserved gates.
* @return Pointer to the initialized proving key updated with selector polynomials.
* */
template <typename CircuitConstructor>
std::shared_ptr<plonk::proving_key> StandardHonkComposerHelper<CircuitConstructor>::compute_proving_key_base(
std::shared_ptr<StandardHonkComposerHelper::ProvingKey> StandardHonkComposerHelper::compute_proving_key_base(
const CircuitConstructor& constructor, const size_t minimum_circuit_size, const size_t num_randomized_gates)
{
// Initialize circuit_proving_key
// TODO(#229)(Kesha): replace composer types.
circuit_proving_key = initialize_proving_key(
// Initialize proving_key
// TODO(#392)(Kesha): replace composer types.
proving_key = initialize_proving_key<Flavor>(
constructor, crs_factory_.get(), minimum_circuit_size, num_randomized_gates, ComposerType::STANDARD_HONK);
// Compute lagrange selectors
construct_lagrange_selector_forms(constructor, circuit_proving_key.get());
construct_selector_polynomials<Flavor>(constructor, proving_key.get());

return circuit_proving_key;
return proving_key;
}

/**
Expand All @@ -42,29 +42,29 @@ std::shared_ptr<plonk::proving_key> StandardHonkComposerHelper<CircuitConstructo
* (2) sets the polynomial manifest using the data from proving key.
*/

template <typename CircuitConstructor>
std::shared_ptr<plonk::verification_key> StandardHonkComposerHelper<CircuitConstructor>::compute_verification_key_base(
std::shared_ptr<plonk::proving_key> const& proving_key, std::shared_ptr<VerifierReferenceString> const& vrs)
std::shared_ptr<StandardHonkComposerHelper::VerificationKey> StandardHonkComposerHelper::compute_verification_key_base(
std::shared_ptr<StandardHonkComposerHelper::ProvingKey> const& proving_key,
std::shared_ptr<VerifierReferenceString> const& vrs)
{
auto key = std::make_shared<plonk::verification_key>(
auto key = std::make_shared<VerificationKey>(
proving_key->circuit_size, proving_key->num_public_inputs, vrs, proving_key->composer_type);
// TODO(kesha): Dirty hack for now. Need to actually make commitment-agnositc
auto commitment_key = pcs::kzg::CommitmentKey(proving_key->circuit_size, "../srs_db/ignition");

// Compute and store commitments to all precomputed polynomials
key->commitments["Q_M"] = commitment_key.commit(proving_key->polynomial_store.get("q_m_lagrange"));
key->commitments["Q_1"] = commitment_key.commit(proving_key->polynomial_store.get("q_1_lagrange"));
key->commitments["Q_2"] = commitment_key.commit(proving_key->polynomial_store.get("q_2_lagrange"));
key->commitments["Q_3"] = commitment_key.commit(proving_key->polynomial_store.get("q_3_lagrange"));
key->commitments["Q_C"] = commitment_key.commit(proving_key->polynomial_store.get("q_c_lagrange"));
key->commitments["SIGMA_1"] = commitment_key.commit(proving_key->polynomial_store.get("sigma_1_lagrange"));
key->commitments["SIGMA_2"] = commitment_key.commit(proving_key->polynomial_store.get("sigma_2_lagrange"));
key->commitments["SIGMA_3"] = commitment_key.commit(proving_key->polynomial_store.get("sigma_3_lagrange"));
key->commitments["ID_1"] = commitment_key.commit(proving_key->polynomial_store.get("id_1_lagrange"));
key->commitments["ID_2"] = commitment_key.commit(proving_key->polynomial_store.get("id_2_lagrange"));
key->commitments["ID_3"] = commitment_key.commit(proving_key->polynomial_store.get("id_3_lagrange"));
key->commitments["LAGRANGE_FIRST"] = commitment_key.commit(proving_key->polynomial_store.get("L_first_lagrange"));
key->commitments["LAGRANGE_LAST"] = commitment_key.commit(proving_key->polynomial_store.get("L_last_lagrange"));
key->q_m = commitment_key.commit(proving_key->q_m);
key->q_l = commitment_key.commit(proving_key->q_l);
key->q_r = commitment_key.commit(proving_key->q_r);
key->q_o = commitment_key.commit(proving_key->q_o);
key->q_c = commitment_key.commit(proving_key->q_c);
key->sigma_1 = commitment_key.commit(proving_key->sigma_1);
key->sigma_2 = commitment_key.commit(proving_key->sigma_2);
key->sigma_3 = commitment_key.commit(proving_key->sigma_3);
key->id_1 = commitment_key.commit(proving_key->id_1);
key->id_2 = commitment_key.commit(proving_key->id_2);
key->id_3 = commitment_key.commit(proving_key->id_3);
key->lagrange_first = commitment_key.commit(proving_key->lagrange_first);
key->lagrange_last = commitment_key.commit(proving_key->lagrange_last);

return key;
}
Expand All @@ -78,14 +78,18 @@ std::shared_ptr<plonk::verification_key> StandardHonkComposerHelper<CircuitConst
*
* @tparam Program settings needed to establish if w_4 is being used.
* */
template <typename CircuitConstructor>
void StandardHonkComposerHelper<CircuitConstructor>::compute_witness(const CircuitConstructor& circuit_constructor,
const size_t minimum_circuit_size)
void StandardHonkComposerHelper::compute_witness(const CircuitConstructor& circuit_constructor,
const size_t minimum_circuit_size)
{
if (computed_witness) {
return;
}
wire_polynomials = compute_witness_base(circuit_constructor, minimum_circuit_size, NUM_RANDOMIZED_GATES);
auto wire_polynomials =
construct_wire_polynomials_base<Flavor>(circuit_constructor, minimum_circuit_size, NUM_RANDOMIZED_GATES);

proving_key->w_l = wire_polynomials[0];
proving_key->w_r = wire_polynomials[1];
proving_key->w_o = wire_polynomials[2];

computed_witness = true;
}
Expand All @@ -97,55 +101,51 @@ void StandardHonkComposerHelper<CircuitConstructor>::compute_witness(const Circu
* @return Proving key with saved computed polynomials.
* */

template <typename CircuitConstructor>
std::shared_ptr<plonk::proving_key> StandardHonkComposerHelper<CircuitConstructor>::compute_proving_key(
std::shared_ptr<StandardHonkComposerHelper::ProvingKey> StandardHonkComposerHelper::compute_proving_key(
const CircuitConstructor& circuit_constructor)
{
if (circuit_proving_key) {
return circuit_proving_key;
if (proving_key) {
return proving_key;
}
// Compute q_l, q_r, q_o, etc polynomials
StandardHonkComposerHelper::compute_proving_key_base(circuit_constructor, ComposerType::STANDARD_HONK);
StandardHonkComposerHelper::compute_proving_key_base(
circuit_constructor, /*minimum_circuit_size=*/0, NUM_RANDOMIZED_GATES);

// Compute sigma polynomials (we should update that late)
compute_standard_honk_sigma_permutations<CircuitConstructor::num_wires>(circuit_constructor,
circuit_proving_key.get());
compute_standard_honk_id_polynomials<CircuitConstructor::num_wires>(circuit_proving_key.get());
compute_standard_honk_sigma_permutations<Flavor>(circuit_constructor, proving_key.get());
compute_standard_honk_id_polynomials<Flavor>(proving_key.get());

compute_first_and_last_lagrange_polynomials(circuit_proving_key.get());
compute_first_and_last_lagrange_polynomials<Flavor>(proving_key.get());

return circuit_proving_key;
return proving_key;
}

/**
* Compute verification key consisting of selector precommitments.
*
* @return Pointer to created circuit verification key.
* */
template <typename CircuitConstructor>
std::shared_ptr<plonk::verification_key> StandardHonkComposerHelper<CircuitConstructor>::compute_verification_key(
std::shared_ptr<StandardHonkComposerHelper::VerificationKey> StandardHonkComposerHelper::compute_verification_key(
const CircuitConstructor& circuit_constructor)
{
if (circuit_verification_key) {
return circuit_verification_key;
if (verification_key) {
return verification_key;
}
if (!circuit_proving_key) {
if (!proving_key) {
compute_proving_key(circuit_constructor);
}

circuit_verification_key = StandardHonkComposerHelper::compute_verification_key_base(
circuit_proving_key, crs_factory_->get_verifier_crs());
circuit_verification_key->composer_type = circuit_proving_key->composer_type;
verification_key =
StandardHonkComposerHelper::compute_verification_key_base(proving_key, crs_factory_->get_verifier_crs());
verification_key->composer_type = proving_key->composer_type;

return circuit_verification_key;
return verification_key;
}

template <typename CircuitConstructor>
StandardVerifier StandardHonkComposerHelper<CircuitConstructor>::create_verifier(
const CircuitConstructor& circuit_constructor)
StandardVerifier StandardHonkComposerHelper::create_verifier(const CircuitConstructor& circuit_constructor)
{
compute_verification_key(circuit_constructor);
StandardVerifier output_state(circuit_verification_key);
StandardVerifier output_state(verification_key);

// TODO(Cody): This should be more generic
auto kate_verification_key = std::make_unique<pcs::kzg::VerificationKey>("../srs_db/ignition");
Expand All @@ -155,23 +155,13 @@ StandardVerifier StandardHonkComposerHelper<CircuitConstructor>::create_verifier
return output_state;
}

template <typename CircuitConstructor>
template <typename Flavor>
// TODO(Cody): this file should be generic with regard to flavor/arithmetization/whatever.
StandardProver StandardHonkComposerHelper<CircuitConstructor>::create_prover(
const CircuitConstructor& circuit_constructor)
StandardProver StandardHonkComposerHelper::create_prover(const CircuitConstructor& circuit_constructor)
{
compute_proving_key(circuit_constructor);
compute_witness(circuit_constructor);

size_t num_sumcheck_rounds(circuit_proving_key->log_circuit_size);
// TODO(luke): what is this manifest? Remove?
auto manifest = Flavor::create_manifest(circuit_constructor.public_inputs.size(), num_sumcheck_rounds);
StandardProver output_state(std::move(wire_polynomials), circuit_proving_key);
StandardProver output_state(proving_key);

return output_state;
}
template class StandardHonkComposerHelper<StandardCircuitConstructor>;
template StandardProver StandardHonkComposerHelper<StandardCircuitConstructor>::create_prover<StandardHonk>(
const StandardCircuitConstructor& circuit_constructor);
} // namespace proof_system::honk
Loading