Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ledwards2225 committed Apr 4, 2023
1 parent edc2bfe commit 103cfd4
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 245 deletions.
11 changes: 0 additions & 11 deletions cpp/src/barretenberg/plonk/composer/composer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ template <size_t program_width> void ComposerBase::compute_wire_copy_cycles()
const auto w_4_index = real_variable_index[w_4[i]];
wire_copy_cycles[static_cast<size_t>(w_4_index)].emplace_back(static_cast<uint32_t>(i + num_public_inputs),
WireType::FOURTH);
// info("w_1_index = ", w_1_index);
// info("w_2_index = ", w_2_index);
// info("w_3_index = ", w_3_index);
// info("w_4_index = ", w_4_index);
// info();
}
}
}
Expand All @@ -111,12 +106,6 @@ template <size_t program_width, bool with_tags> void ComposerBase::compute_sigma
std::array<std::vector<permutation_subgroup_element>, program_width> sigma_mappings;
std::array<std::vector<permutation_subgroup_element>, program_width> id_mappings;

// for (auto& val : wire_copy_cycles[0])
// {
// info( "gate_index = ", val.gate_index);
// info( "wire_type = ", static_cast<uint32_t>(val.wire_type) >> 30U);
// }

// Instantiate the sigma and id mappings by reserving enough space and pushing 'default' permutation subgroup
// elements that point to themselves.
for (size_t i = 0; i < program_width; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ void UltraPlonkComposerHelper<CircuitConstructor>::compute_witness(CircuitConstr
circuit_constructor.w_4.emplace_back(circuit_constructor.zero_idx);
}

// 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.
auto wire_polynomial_evaluations =
compute_witness_base(circuit_constructor, minimum_circuit_size, NUM_RANDOMIZED_GATES);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@
#include "barretenberg/plonk/proof_system/prover/prover.hpp"
#include "barretenberg/plonk/proof_system/verifier/verifier.hpp"

// #include "barretenberg/plonk/composer/plookup_tables/types.hpp"
// #include "barretenberg/srs/reference_string/file_reference_string.hpp"
// #include "barretenberg/proof_system/proving_key/proving_key.hpp"
// #include "barretenberg/plonk/proof_system/prover/prover.hpp"
// #include "barretenberg/plonk/proof_system/verifier/verifier.hpp"
// #include "barretenberg/proof_system/circuit_constructors/standard_circuit_constructor.hpp"
// #include "barretenberg/honk/pcs/commitment_key.hpp"
// #include "barretenberg/proof_system/verification_key/verification_key.hpp"
// #include "barretenberg/plonk/proof_system/verifier/verifier.hpp"
// #include "barretenberg/proof_system/composer/composer_base.hpp"
// #include "barretenberg/proof_system/composer/composer_helper_lib.hpp"
// #include "barretenberg/proof_system/composer/permutation_helper.hpp"

#include <cstddef>
#include <utility>

Expand All @@ -27,8 +14,11 @@ namespace plonk {
// Cody: What does this mean?
template <typename CircuitConstructor> class UltraPlonkComposerHelper {
public:
// TODO(luke): NUM_RANDOMIZED_GATES corresponds (at least in part) to NUM_RESERVED_GATES (in ultra composer) when
// determining circuit size next power of 2. I'm setting in to 4 for now to match that value. Clarify this.
// TODO(luke): In the split composers, NUM_RANDOMIZED_GATES has replaced NUM_RESERVED_GATES (in some places) to
// determine the next-power-of-2 circuit size. (There are some places in this composer that still use
// NUM_RESERVED_GATES). Therefore for consistency within this composer itself, and consistency with the original
// Ultra Composer, this value must match that of NUM_RESERVED_GATES. This issue needs to be reconciled
// simultaneously here and in the other split composers.
static constexpr size_t NUM_RANDOMIZED_GATES = 4; // equal to the number of multilinear evaluations leaked
static constexpr size_t program_width = CircuitConstructor::program_width;
std::shared_ptr<bonk::proving_key> circuit_proving_key;
Expand All @@ -40,25 +30,15 @@ template <typename CircuitConstructor> class UltraPlonkComposerHelper {
std::vector<uint32_t> recursive_proof_public_input_indices;
bool contains_recursive_proof = false;
bool computed_witness = false;
bool circuit_finalised = false; // TODO(luke): Does this belong here or does this break our separation..

// std::vector<plookup::BasicTable> lookup_tables; // TODO(luke): Does this belong here?
// std::vector<plookup::MultiTable> lookup_multi_tables; // TODO(luke): Does this belong here?

// This variable controls the amount with which the lookup table and witness values need to be shifted
// above to make room for adding randomness into the permutation and witness polynomials in the plookup widget.
// This must be (num_roots_cut_out_of_the_vanishing_polynomial - 1), since the variable num_roots_cut_out_of_
// vanishing_polynomial cannot be trivially fetched here, I am directly setting this to 4 - 1 = 3.
static constexpr size_t s_randomness = 0; // TODO(luke): In Plonk this vaue is 3. Ok to just set to zero for now?

UltraPlonkComposerHelper()
: UltraPlonkComposerHelper("../srs_db/ignition")
{}

UltraPlonkComposerHelper(std::string const& crs_path)
: UltraPlonkComposerHelper(std::unique_ptr<ReferenceStringFactory>(new FileReferenceStringFactory(crs_path))){};
// Note: Set to 0 until ZK is added
static constexpr size_t s_randomness = 0;

UltraPlonkComposerHelper(std::shared_ptr<ReferenceStringFactory> const crs_factory)
explicit UltraPlonkComposerHelper(std::shared_ptr<ReferenceStringFactory> crs_factory)
: crs_factory_(std::move(crs_factory))
{}

Expand All @@ -67,9 +47,11 @@ template <typename CircuitConstructor> class UltraPlonkComposerHelper {
, circuit_verification_key(std::move(v_key))
{}

UltraPlonkComposerHelper(UltraPlonkComposerHelper&& other) = default;
UltraPlonkComposerHelper& operator=(UltraPlonkComposerHelper&& other) = default;
~UltraPlonkComposerHelper() {}
UltraPlonkComposerHelper(UltraPlonkComposerHelper&& other) noexcept = default;
UltraPlonkComposerHelper(UltraPlonkComposerHelper const& other) noexcept = default;
UltraPlonkComposerHelper& operator=(UltraPlonkComposerHelper&& other) noexcept = default;
UltraPlonkComposerHelper& operator=(UltraPlonkComposerHelper const& other) noexcept = default;
~UltraPlonkComposerHelper() = default;

std::vector<bonk::SelectorProperties> ultra_selector_properties()
{
Expand Down Expand Up @@ -117,7 +99,7 @@ template <typename CircuitConstructor> class UltraPlonkComposerHelper {
constexpr size_t g1_size = 64;
constexpr size_t fr_size = 32;
const size_t public_input_size = fr_size * num_public_inputs;
const transcript::Manifest output = transcript::Manifest(
transcript::Manifest output = transcript::Manifest(

{ transcript::Manifest::RoundManifest(
{ // { name, num_bytes, derived_by_verifier }
Expand Down
Loading

0 comments on commit 103cfd4

Please sign in to comment.