Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix gcc build
Browse files Browse the repository at this point in the history
ledwards2225 committed Apr 10, 2023
1 parent e432712 commit c093a17
Showing 10 changed files with 11 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -51,22 +51,10 @@ void UltraHonkComposerHelper<CircuitConstructor>::compute_witness(CircuitConstru
circuit_constructor.w_4.emplace_back(circuit_constructor.zero_idx);
}

info("circuit_constructor.w_l.size() = ", circuit_constructor.w_l.size());
info("filled_gates = ", filled_gates);
info("total_num_gates = ", total_num_gates);
info("subgroup_size = ", subgroup_size);
info("circuit_constructor.w_l[2786] = ", circuit_constructor.w_l[2786]);
// info("circuit_constructor.w_l.end() = ", circuit_constructor.w_l.end());

// TODO(luke): subgroup size was already computed above but compute_witness_base computes it again. If we pass in
// NUM_RANDOMIZED_GATES (as in the other split composers) the resulting sizes can differ. Reconcile this.
wire_polynomials = compute_witness_base(circuit_constructor, total_num_gates, NUM_RANDOMIZED_GATES);

info("circuit_constructor.w_l.size() = ", circuit_constructor.w_l.size());
info("circuit_constructor.w_l[2786] = ", circuit_constructor.w_l[2786]);
info("circuit_constructor.w_l[4095] = ", circuit_constructor.w_l[4095]);
// info("circuit_constructor.w_l.end() = ", circuit_constructor.w_l.end());

polynomial s_1(subgroup_size);
polynomial s_2(subgroup_size);
polynomial s_3(subgroup_size);
Original file line number Diff line number Diff line change
@@ -71,7 +71,6 @@ void check_consistency(honk::UltraProver& honk_prover, plonk::UltraProver& plonk
for (auto& entry : honk_store) {
std::string key = entry.first;
if (plonk_store.contains(key)) {
// info(key);

bool polys_equal = (honk_store.get(key) == plonk_store.get(key));
if (polys_equal) {
@@ -80,9 +79,6 @@ void check_consistency(honk::UltraProver& honk_prover, plonk::UltraProver& plonk
if (!polys_equal) {
info("UNEQUAL: ", key);
}
// bool size_equal = (honk_store.get(key).size() == plonk_store.get(key).size());
// if(size_equal) { info("Size Equal: ", key); }
// if(!size_equal) { info("Size UNEQUAL: ", key); }
}
}

@@ -880,6 +876,7 @@ TEST(UltraHonkComposer, rom)
auto honk_prover = honk_composer.create_prover();
auto plonk_prover = plonk_composer.create_prover();

check_consistency(honk_prover, plonk_prover);
verify_consistency(honk_prover, plonk_prover);
}

7 changes: 4 additions & 3 deletions cpp/src/barretenberg/honk/proof_system/prover.hpp
Original file line number Diff line number Diff line change
@@ -27,10 +27,11 @@
#include "barretenberg/honk/proof_system/work_queue.hpp"

namespace proof_system::honk {
template <typename settings> class Prover {

using Fr = barretenberg::fr;
using Polynomial = Polynomial<Fr>;
using Fr = barretenberg::fr;
using Polynomial = Polynomial<Fr>;

template <typename settings> class Prover {

public:
Prover(std::vector<barretenberg::polynomial>&& wire_polys, std::shared_ptr<plonk::proving_key> input_key = nullptr);
5 changes: 0 additions & 5 deletions cpp/src/barretenberg/honk/proof_system/ultra_prover.cpp
Original file line number Diff line number Diff line change
@@ -24,11 +24,6 @@

namespace proof_system::honk {

using Fr = barretenberg::fr;
using Commitment = barretenberg::g1::affine_element;
using Polynomial = barretenberg::Polynomial<Fr>;
using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL;

/**
* Create UltraHonkProver from proving key, witness and manifest.
*
10 changes: 5 additions & 5 deletions cpp/src/barretenberg/honk/proof_system/ultra_prover.hpp
Original file line number Diff line number Diff line change
@@ -27,14 +27,14 @@

namespace proof_system::honk {

// using Fr = barretenberg::fr;
// using Polynomial = Polynomial<Fr>;

// TODO(luke): UltraHonkProver is probably bad name but this allows use of UltraProver elsewhere. Resolve.
// TODO(luke): UltraHonkProver is bad name but this allows use of UltraProver elsewhere (consistent with
// StandardProver). Resolve.
template <typename settings> class UltraHonkProver {

using Fr = barretenberg::fr;
using Polynomial = Polynomial<Fr>;
using Polynomial = barretenberg::Polynomial<Fr>;
using Commitment = barretenberg::g1::affine_element;
using POLYNOMIAL = proof_system::honk::StandardArithmetization::POLYNOMIAL;

public:
UltraHonkProver(std::vector<barretenberg::polynomial>&& wire_polys,
3 changes: 0 additions & 3 deletions cpp/src/barretenberg/honk/proof_system/verifier.hpp
Original file line number Diff line number Diff line change
@@ -15,9 +15,6 @@
namespace proof_system::honk {
template <typename program_settings> class Verifier {

using Fr = barretenberg::fr;
using Polynomial = Polynomial<Fr>;

public:
Verifier(std::shared_ptr<plonk::verification_key> verifier_key = nullptr);
Verifier(Verifier&& other);
7 changes: 0 additions & 7 deletions cpp/src/barretenberg/plonk/composer/composer_base.cpp
Original file line number Diff line number Diff line change
@@ -404,20 +404,13 @@ template <size_t program_width> void ComposerBase::compute_witness_base(const si
fr::__copy(get_variable(w_4[i - public_inputs.size()]), w_4_lagrange.at(i));
}

info("Normal: public_inputs.size() = ", public_inputs.size());
info("Normal: w_l[1] = ", w_l[1]);
info("Normal: w_1_lagrange[1] = ", w_1_lagrange[1]);

circuit_proving_key->polynomial_store.put("w_1_lagrange", std::move(w_1_lagrange));
circuit_proving_key->polynomial_store.put("w_2_lagrange", std::move(w_2_lagrange));
circuit_proving_key->polynomial_store.put("w_3_lagrange", std::move(w_3_lagrange));
if (program_width > 3) {
circuit_proving_key->polynomial_store.put("w_4_lagrange", std::move(w_4_lagrange));
}

info("Normal: polynomial_store.get(w_1_lagrange)[1] = ",
circuit_proving_key->polynomial_store.get("w_1_lagrange")[1]);

computed_witness = true;
}

11 changes: 0 additions & 11 deletions cpp/src/barretenberg/plonk/composer/ultra_composer.cpp
Original file line number Diff line number Diff line change
@@ -719,20 +719,9 @@ void UltraComposer::compute_witness()
w_4.emplace_back(zero_idx);
}

// info("w_l.size() = ", w_l.size());
// info("filled_gates = ", filled_gates);
// info("total_num_gates = ", total_num_gates);
// info("subgroup_size = ", subgroup_size);
// info("w_l[2786] = ", w_l[2786]);
// info("w_l[4095] = ", w_l[4095]);

// Create and store polynomials which interpolate the wire values (variable values pointed-to by the `w_`s).
ComposerBase::compute_witness_base<ultra_settings::program_width>(total_num_gates);

// info("w_l.size() = ", w_l.size());
// info("w_l[2786] = ", w_l[2786]);
// info("w_l[4095] = ", w_l[4095]);

polynomial s_1(subgroup_size);
polynomial s_2(subgroup_size);
polynomial s_3(subgroup_size);
20 changes: 0 additions & 20 deletions cpp/src/barretenberg/proof_system/composer/composer_helper_lib.hpp
Original file line number Diff line number Diff line change
@@ -114,18 +114,6 @@ std::vector<barretenberg::polynomial> compute_witness_base(const CircuitConstruc
const size_t subgroup_size =
circuit_constructor.get_circuit_subgroup_size(num_constraints + number_of_randomized_gates);

// // TODO(luke):
// for (size_t i = num_gates; i < subgroup_size; ++i) {
// circuit_constructor.w_l.emplace_back(circuit_constructor.zero_idx);
// circuit_constructor.w_r.emplace_back(circuit_constructor.zero_idx);
// circuit_constructor.w_o.emplace_back(circuit_constructor.zero_idx);
// }
// if (program_width > 3) {
// for (size_t i = num_gates; i < subgroup_size; ++i) {
// circuit_constructor.w_4.emplace_back(circuit_constructor.zero_idx);
// }
// }

// construct a view over all the wire's variable indices
// w[j][i] is the index of the variable in the j-th wire, at gate i
// Each array should be of size `num_gates`
@@ -136,10 +124,6 @@ std::vector<barretenberg::polynomial> compute_witness_base(const CircuitConstruc
if constexpr (program_width > 3) {
w[3] = circuit_constructor.w_4;
}

info("New: num_public_inputs = ", num_public_inputs);
info("New: w_l[1] = ", circuit_constructor.w_l[1]);

std::vector<barretenberg::polynomial> wires;
// Note: randomness is added to 3 of the last 4 positions in plonk/proof_system/prover/prover.cpp
// StandardProverBase::execute_preamble_round().
@@ -161,12 +145,8 @@ std::vector<barretenberg::polynomial> compute_witness_base(const CircuitConstruc
for (size_t i = 0; i < num_gates; ++i) {
w_lagrange[num_public_inputs + i] = circuit_constructor.get_variable(w[j][i]);
}
if (j == 0) {
info("New: w_lagrange[1] = ", w_lagrange[1]);
}
wires.push_back(std::move(w_lagrange));
}
info("New: wires[0][1] = ", wires[0][1]);
return wires;
}
} // namespace proof_system
Original file line number Diff line number Diff line change
@@ -524,7 +524,7 @@ void compute_honk_generalized_sigma_permutations(const CircuitConstructor& circu
auto mapping = compute_permutation_mapping<program_width, true>(circuit_constructor, key);

// Compute Plonk-style sigma and ID polynomials from the corresponding mappings
// TODO(luke): Change these to Honk style!
// TODO(luke): Change these to Honk style! (The only difference is we don't need any fancy coset logic)
compute_plonk_permutation_lagrange_polynomials_from_mapping("sigma", mapping.sigmas, key);
compute_plonk_permutation_lagrange_polynomials_from_mapping("id", mapping.ids, key);
}

0 comments on commit c093a17

Please sign in to comment.