Skip to content

Commit

Permalink
Fix compliation, verifier test. Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
codygunton committed Jan 17, 2023
1 parent 286c188 commit 4aac909
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 16 deletions.
6 changes: 2 additions & 4 deletions cpp/src/aztec/honk/composer/standard_honk_composer.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,8 @@ TEST(StandarHonkComposer, BaseCase)

auto prover = composer.create_unrolled_prover();
// waffle::Verifier verifier = composer.create_verifier();
// TODO(Cody): multivariate_d can't be a template parameter.
// auto multivariates = honk::sumcheck::Multivariates<fr, 17, 1>(prover.proving_key);
// (void)multivariates;
// Next up: construct sumcheck module from multivariates.
auto multivariates = honk::sumcheck::Multivariates<fr, 17>(prover.proving_key);
(void)multivariates;
waffle::plonk_proof proof = prover.construct_proof();

// bool result = verifier.verify_proof(proof); // instance, prover.reference_string.SRS_T2);
Expand Down
1 change: 1 addition & 0 deletions cpp/src/aztec/honk/proof_system/prover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ template <typename settings> void Prover<settings>::execute_relation_check_round

sumcheck.execute_prover();

// TODO(Cody): Execute as a loop over polynomial manifest? Things thare are called *_lagrange
transcript.add_element("w_1", multivariates.folded_polynomials[1][0].to_buffer());
transcript.add_element("w_2", multivariates.folded_polynomials[1][0].to_buffer());
transcript.add_element("w_3", multivariates.folded_polynomials[2][0].to_buffer());
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/aztec/honk/proof_system/verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <polynomials/polynomial_arithmetic.hpp>
#include <math.h>

#pragma GCC diagnostic ignored "-Wunused-variable"

using namespace barretenberg;
using namespace honk::sumcheck;

Expand Down
3 changes: 2 additions & 1 deletion cpp/src/aztec/honk/sumcheck/polynomials/multivariates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ template <class FF_, size_t num_polys> class Multivariates {
}

explicit Multivariates(transcript::StandardTranscript transcript)
: multivariate_n(transcript.get_field_element("circuit_size"))
: multivariate_n(
static_cast<size_t>(transcript.get_field_element("circuit_size").from_montgomery_form().data[0]))
, multivariate_d(numeric::get_msb(multivariate_n))
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ TYPED_TEST(MultivariatesTests, Constructor)
MULTIVARIATES_TESTS_TYPE_ALIASES

const size_t num_polys(4);
const size_t multivariate_d(2);
// const size_t multivariate_d(2);
// const size_t multivariate_n(1 << multivariate_d);

std::array<FF, 3> f0 = { 0, 0, 1 };
Expand Down
7 changes: 4 additions & 3 deletions cpp/src/aztec/honk/sumcheck/sumcheck.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ TEST(Sumcheck, Prover)
{
const size_t num_polys(proving_system::StandardArithmetization::NUM_POLYNOMIALS);
const size_t multivariate_d(1);
const size_t multivariate_n(1 << multivariate_d);
const size_t max_relation_length = 4;
// const size_t multivariate_n(1 << multivariate_d);

// const size_t max_relation_length = 4;
constexpr size_t fr_size = 32;

using Multivariates = ::Multivariates<FF, num_polys>;
Expand Down Expand Up @@ -102,7 +103,7 @@ TEST(Sumcheck, Verifier)
{
const size_t num_polys(proving_system::StandardArithmetization::NUM_POLYNOMIALS);
const size_t multivariate_d(1);
const size_t multivariate_n(1 << multivariate_d);
// const size_t multivariate_n(1 << multivariate_d);
const size_t max_relation_length = 5;

using Multivariates = ::Multivariates<FF, num_polys>;
Expand Down
1 change: 0 additions & 1 deletion cpp/src/aztec/honk/sumcheck/sumcheck_round.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ template <class FF, size_t num_multivariates, template <class> class... Relation
accumulate_relation_univariates<>();
}

FF running_challenge(1);
auto result = batch_over_relations<Univariate<FF, MAX_RELATION_LENGTH>>(univariate_accumulators,
relation_separator_challenge);

Expand Down
10 changes: 5 additions & 5 deletions cpp/src/aztec/honk/sumcheck/sumcheck_round.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace test_sumcheck_round {
TEST(SumcheckRound, ComputeUnivariateProver)
{
const size_t num_polys(proving_system::StandardArithmetization::NUM_POLYNOMIALS);
const size_t multivariate_d(1);
// const size_t multivariate_d(1);
const size_t max_relation_length = 5;

using FF = barretenberg::fr;
Expand Down Expand Up @@ -73,9 +73,9 @@ TEST(SumcheckRound, ComputeUnivariateProver)
TEST(SumcheckRound, ComputeUnivariateVerifier)
{
const size_t num_polys(proving_system::StandardArithmetization::NUM_POLYNOMIALS);
const size_t multivariate_d(1);
const size_t multivariate_n(1 << multivariate_d);
const size_t max_relation_length = 5;
// const size_t multivariate_d(1);
// const size_t multivariate_n(1 << multivariate_d);
// const size_t max_rezlation_length = 5;

using FF = barretenberg::fr;
using Multivariates = ::Multivariates<FF, num_polys>;
Expand Down Expand Up @@ -104,7 +104,7 @@ TEST(SumcheckRound, ComputeUnivariateVerifier)
std::vector<FF> purported_evaluations = { w_l, w_r, w_o, z_perm, z_perm_shift, q_m, q_l, q_r, q_o,
q_c, sigma_1, sigma_2, sigma_3, id_1, id_2, id_3, lagrange_1 };

size_t round_size = 1;
// size_t round_size = 1;
auto relations = std::tuple(
ArithmeticRelation<FF>(), GrandProductComputationRelation<FF>(), GrandProductInitializationRelation<FF>());
auto round = SumcheckRound<FF,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ size_t get_cache_capacity(size_t num_gates, waffle::ComposerType composer_type)
break;
};
default: {
// Will hit this with Standard Honk.
throw_or_abort("Received invalid composer type");
}
};
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/aztec/proof_system/proving_key/proving_key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace waffle {
proving_key::proving_key(const size_t num_gates,
const size_t num_inputs,
std::shared_ptr<ProverReferenceString> const& crs,
waffle::ComposerType type = waffle::STANDARD)
waffle::ComposerType type = waffle::STANDARD) // TODO(Cody): Don't use default for Honk
: composer_type(type)
, n(num_gates)
, log_n(numeric::get_msb(num_gates))
Expand Down

0 comments on commit 4aac909

Please sign in to comment.