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 hashing to stdlib transcript #4161

Merged
merged 81 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
29a0d28
added poseidon2 to native transcript
lucasxia01 Dec 14, 2023
61c9eca
wip
lucasxia01 Jan 4, 2024
a8204fb
removed grumpkin poseidon2 params
lucasxia01 Jan 10, 2024
05085c5
removed transcript template param,
lucasxia01 Jan 10, 2024
99bd01d
removing poseidon2 grumpkin
lucasxia01 Jan 10, 2024
029350c
removed template param from honk::proof
lucasxia01 Jan 10, 2024
a045b6d
linker error be gone among other merge errors
lucasxia01 Jan 14, 2024
86065bc
conversions
lucasxia01 Jan 16, 2024
d50ac92
updated calc_num_frs() with all transcript types
lucasxia01 Jan 17, 2024
5f46e2d
completed convert_to_bn254_frs for various transcript types
lucasxia01 Jan 17, 2024
d157087
convert_from_bn254_frs initial impl updated
lucasxia01 Jan 17, 2024
f769528
fixing bugs (wip)
lucasxia01 Jan 17, 2024
e8702c7
hacky solution to templating to get things to compile
lucasxia01 Jan 17, 2024
86eae85
checking if CI tests still fail
lucasxia01 Jan 18, 2024
4a04326
fixed bugs in conversions
lucasxia01 Jan 18, 2024
2d16e5d
added (partial) unit tests
lucasxia01 Jan 18, 2024
2c6406d
updated structuring and tests
lucasxia01 Jan 18, 2024
c0c715c
temporary "fix" to ci gcc compile error
lucasxia01 Jan 18, 2024
dd3366c
cleaning up field conversion calc_num_frs style
lucasxia01 Jan 18, 2024
b37bed8
undo challenge fix
lucasxia01 Jan 18, 2024
09f7ea2
pushing linker error
lucasxia01 Jan 19, 2024
7346629
Merge branch 'master' into lx/transcript-native-field-refactor
lucasxia01 Jan 19, 2024
1484030
changed to bb::
lucasxia01 Jan 19, 2024
97c2f88
inline + comments + cleanup
lucasxia01 Jan 19, 2024
e2f7526
completed tests, small updates
lucasxia01 Jan 19, 2024
f67148d
Merge branch 'master' into lx/transcript-native-field-refactor
lucasxia01 Jan 19, 2024
0a8b2fc
initial stdlib conversions
lucasxia01 Jan 19, 2024
6bc91fb
templated transcript
lucasxia01 Jan 22, 2024
c0b5fb6
reomving unnecessary cmake stuff
lucasxia01 Jan 22, 2024
d3e110b
Merge branch 'master' into lx/transcript-native-field-refactor
lucasxia01 Jan 22, 2024
330c0c8
Merge branch 'master' into lx/transcript-native-field-refactor
lucasxia01 Jan 23, 2024
7fd7553
fix?
lucasxia01 Jan 23, 2024
bbfb92b
cbind fix fix
lucasxia01 Jan 23, 2024
a53a144
undo
lucasxia01 Jan 23, 2024
e12cb61
maybe cbind fix
lucasxia01 Jan 23, 2024
fe43adf
cbind fix for real this time
lucasxia01 Jan 24, 2024
1b9416d
wip conversions
lucasxia01 Jan 24, 2024
b1d5678
fixed error caused by overfixing
lucasxia01 Jan 24, 2024
cab1312
Merge branch 'master' into lx/transcript-native-field-refactor
lucasxia01 Jan 24, 2024
54bb864
fixed merge conflicts with protogalaxy, decider recursive verifiers
lucasxia01 Jan 24, 2024
c75735d
new stdlib field conversion functions
lucasxia01 Jan 25, 2024
cc5fce9
gcc typename fix
lucasxia01 Jan 25, 2024
cd5049e
adding stdlib transcript into the ONE transcript
lucasxia01 Jan 26, 2024
c4375d3
type check fix demanded by wasm clang
lucasxia01 Jan 26, 2024
4c022f0
fixed constructor (sorta hacky)
lucasxia01 Jan 26, 2024
610d6b6
added testing, updated conversion
lucasxia01 Jan 29, 2024
9cc55d1
updated conversion for grumpkin fr
lucasxia01 Jan 29, 2024
87078b3
responded to PR comments, refactored, added comments
lucasxia01 Jan 29, 2024
1fbf9e2
Merge branch 'lx/transcript-native-field-refactor' into lx/transcript…
lucasxia01 Jan 29, 2024
2d6eca7
update everything to new transcript
lucasxia01 Jan 29, 2024
f75cca3
small fix, uint64_t -> uint256_t to dodge overflow
lucasxia01 Jan 29, 2024
0c9bb81
fix to ipa transcript usage
lucasxia01 Jan 29, 2024
e86d026
fixed two bugs:
lucasxia01 Jan 30, 2024
850ec4d
small style updates
lucasxia01 Jan 30, 2024
85c92df
Merge branch 'lx/transcript-native-field-refactor' into lx/transcript…
lucasxia01 Jan 30, 2024
adfa3d3
update to ipa poly degree type: uint64_t -> uint32_t
lucasxia01 Jan 30, 2024
9f6293c
Merge branch 'master' into lx/transcript-native-field-refactor
lucasxia01 Jan 30, 2024
777e8b1
updated merged in code
lucasxia01 Jan 30, 2024
de5b619
updated protogalaxy cmakelists
lucasxia01 Jan 30, 2024
efb5d18
Merge branch 'lx/transcript-native-field-refactor' into lx/transcript…
lucasxia01 Jan 30, 2024
407d802
Merge commit 'afcfa71da760680dfe02c39cf2de068a4297b3e7' into lx/trans…
lucasxia01 Jan 31, 2024
6a0ee73
Merge branch 'master' into lx/transcript-stdlib-hashing
lucasxia01 Jan 31, 2024
2ca5fee
simplication of functions using bigfield constructor
lucasxia01 Jan 31, 2024
ab52a67
updates to stdlib field conversion tests
lucasxia01 Jan 31, 2024
22b3f56
test fix
lucasxia01 Jan 31, 2024
7fb693c
Merge remote-tracking branch 'origin/master' into lx/transcript-stdli…
lucasxia01 Jan 31, 2024
f376c16
Merge remote-tracking branch 'origin/master' into lx/transcript-stdli…
codygunton Feb 2, 2024
1586230
Fix GCC
codygunton Feb 2, 2024
81279e9
Merge remote-tracking branch 'origin/master' into lx/transcript-stdli…
codygunton Feb 2, 2024
33940e4
Revert scratch
codygunton Feb 2, 2024
8d89cc1
updated stdlib grumpkin element conversion and refactored
lucasxia01 Feb 5, 2024
be52ead
delete the existing stdlib transcript
lucasxia01 Feb 5, 2024
38d6909
addressing minor comments
lucasxia01 Feb 7, 2024
123abba
fixed dependencies to remove cycle
lucasxia01 Feb 7, 2024
cdbb894
removed no op functions in arithmetization
lucasxia01 Feb 7, 2024
a8765e4
added tests for converting challenges,
lucasxia01 Feb 8, 2024
69d9bde
changed evaluate_linear_identity to assert_equal
lucasxia01 Feb 8, 2024
4b007e1
Merge branch 'master' into lx/transcript-stdlib-hashing
lucasxia01 Feb 8, 2024
c3f3d94
Merge remote-tracking branch 'origin/master' into lx/transcript-stdli…
lucasxia01 Feb 8, 2024
a7e6559
added TODO comments
lucasxia01 Feb 8, 2024
5963b98
Merge branch 'master' into lx/transcript-stdlib-hashing
lucasxia01 Feb 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ std::shared_ptr<bb::srs::factories::CrsFactory<curve::Grumpkin>> crs_factory(
auto ck = std::make_shared<CommitmentKey<Curve>>(1 << MAX_POLYNOMIAL_DEGREE_LOG2, crs_factory);
auto vk = std::make_shared<VerifierCommitmentKey<Curve>>(1 << MAX_POLYNOMIAL_DEGREE_LOG2, crs_factory);

std::vector<std::shared_ptr<BaseTranscript>> prover_transcripts(MAX_POLYNOMIAL_DEGREE_LOG2 -
MIN_POLYNOMIAL_DEGREE_LOG2 + 1);
std::vector<std::shared_ptr<NativeTranscript>> prover_transcripts(MAX_POLYNOMIAL_DEGREE_LOG2 -
MIN_POLYNOMIAL_DEGREE_LOG2 + 1);
std::vector<OpeningClaim<Curve>> opening_claims(MAX_POLYNOMIAL_DEGREE_LOG2 - MIN_POLYNOMIAL_DEGREE_LOG2 + 1);

void ipa_open(State& state) noexcept
Expand All @@ -36,7 +36,7 @@ void ipa_open(State& state) noexcept
const OpeningPair<Curve> opening_pair = { x, eval };
const OpeningClaim<Curve> opening_claim{ opening_pair, ck->commit(poly) };
// initialize empty prover transcript
auto prover_transcript = std::make_shared<BaseTranscript>();
auto prover_transcript = std::make_shared<NativeTranscript>();
state.ResumeTiming();
// Compute proof
IPA<Curve>::compute_opening_proof(ck, opening_pair, poly, prover_transcript);
Expand All @@ -53,7 +53,7 @@ void ipa_verify(State& state) noexcept
auto prover_transcript = prover_transcripts[static_cast<size_t>(state.range(0)) - MIN_POLYNOMIAL_DEGREE_LOG2];
auto opening_claim = opening_claims[static_cast<size_t>(state.range(0)) - MIN_POLYNOMIAL_DEGREE_LOG2];
// initialize verifier transcript from proof data
auto verifier_transcript = std::make_shared<BaseTranscript>(prover_transcript->proof_data);
auto verifier_transcript = std::make_shared<NativeTranscript>(prover_transcript->proof_data);

state.ResumeTiming();
auto result = IPA<Curve>::verify(vk, opening_claim, verifier_transcript);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ template <typename Curve> class GeminiVerifier_ {
}

// compute vector of powers of random evaluation point r
const Fr r = transcript->get_challenge("Gemini:r");
const Fr r = transcript->template get_challenge<Fr>("Gemini:r");
std::vector<Fr> r_squares = gemini::squares_of_r(r, num_variables);

// Get evaluations a_i, i = 0,...,m-1 from transcript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ template <class Curve> class GeminiTest : public CommitmentTest<Curve> {
std::vector<GroupElement> multilinear_commitments,
std::vector<GroupElement> multilinear_commitments_to_be_shifted)
{
auto prover_transcript = BaseTranscript::prover_init_empty();
auto prover_transcript = NativeTranscript::prover_init_empty();

const Fr rho = Fr::random_element();

Expand Down Expand Up @@ -65,7 +65,7 @@ template <class Curve> class GeminiTest : public CommitmentTest<Curve> {
prover_transcript->send_to_verifier(label, commitment);
}

const Fr r_challenge = prover_transcript->get_challenge("Gemini:r");
const Fr r_challenge = prover_transcript->get_challenge<Fr>("Gemini:r");

auto prover_output = GeminiProver::compute_fold_polynomial_evaluations(
multilinear_evaluation_point, std::move(gemini_polynomials), r_challenge);
Expand All @@ -79,7 +79,7 @@ template <class Curve> class GeminiTest : public CommitmentTest<Curve> {
// Check that the Fold polynomials have been evaluated correctly in the prover
this->verify_batch_opening_pair(prover_output.opening_pairs, prover_output.witnesses);

auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
auto verifier_transcript = NativeTranscript::verifier_init_empty(prover_transcript);

// Compute:
// - Single opening pair: {r, \hat{a}_0}
Expand Down
18 changes: 10 additions & 8 deletions barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ template <typename Curve> class IPA {
static void compute_opening_proof(const std::shared_ptr<CK>& ck,
const OpeningPair<Curve>& opening_pair,
const Polynomial& polynomial,
const std::shared_ptr<BaseTranscript>& transcript)
const std::shared_ptr<NativeTranscript>& transcript)
{
ASSERT(opening_pair.challenge != 0 && "The challenge point should not be zero");
auto poly_degree = static_cast<size_t>(polynomial.size());
transcript->send_to_verifier("IPA:poly_degree", static_cast<uint64_t>(poly_degree));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed poly degree to uint32_t

const Fr generator_challenge = transcript->get_challenge("IPA:generator_challenge");
transcript->send_to_verifier("IPA:poly_degree", static_cast<uint32_t>(poly_degree));
const Fr generator_challenge = transcript->template get_challenge<Fr>("IPA:generator_challenge");
auto aux_generator = Commitment::one() * generator_challenge;
// Checks poly_degree is greater than zero and a power of two
// In the future, we might want to consider if non-powers of two are needed
Expand Down Expand Up @@ -138,7 +138,7 @@ template <typename Curve> class IPA {
transcript->send_to_verifier("IPA:R_" + index, Commitment(R_elements[i]));

// Generate the round challenge.
const Fr round_challenge = transcript->get_challenge("IPA:round_challenge_" + index);
const Fr round_challenge = transcript->get_challenge<Fr>("IPA:round_challenge_" + index);
const Fr round_challenge_inv = round_challenge.invert();

auto G_lo = GroupElement::batch_mul_with_endomorphism(
Expand Down Expand Up @@ -183,10 +183,12 @@ template <typename Curve> class IPA {
*/
static bool verify(const std::shared_ptr<VK>& vk,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we ever need a recursive verify for IPA? If so, this would require changes since it just treats the output of receive_from_prover as a native type. It would throw a compile error if we ever tried to instantiate IPA with a stdlib curve.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compile errors are good, no need for a github issue here.

const OpeningClaim<Curve>& opening_claim,
const std::shared_ptr<BaseTranscript>& transcript)
const std::shared_ptr<NativeTranscript>& transcript)
{
auto poly_degree = static_cast<size_t>(transcript->template receive_from_prover<uint64_t>("IPA:poly_degree"));
const Fr generator_challenge = transcript->get_challenge("IPA:generator_challenge");
auto poly_degree = static_cast<uint32_t>(transcript->template receive_from_prover<typename Curve::BaseField>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it always has to be bb::fr then we should just hard code that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what to do about this, since I don't hardcoded and just use FF in most cases. I don't feel great about hardcoding bb::fr everywhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I wrote this I thought that something would break if we were to replace bb::fr with another field, but I don't recall now where that thought came from.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also can't hardcode bb::fr everywhere since we want field_ct in the circuit case, not bb::fr.

"IPA:poly_degree")); // note this is base field because this is a uint32_t, which should map to a bb::fr,
// not a grumpkin::fr, which is a BaseField element for Grumpkin
const Fr generator_challenge = transcript->template get_challenge<Fr>("IPA:generator_challenge");
auto aux_generator = Commitment::one() * generator_challenge;

auto log_poly_degree = static_cast<size_t>(numeric::get_msb(poly_degree));
Expand All @@ -204,7 +206,7 @@ template <typename Curve> class IPA {
std::string index = std::to_string(i);
auto element_L = transcript->template receive_from_prover<Commitment>("IPA:L_" + index);
auto element_R = transcript->template receive_from_prover<Commitment>("IPA:R_" + index);
round_challenges[i] = transcript->get_challenge("IPA:round_challenge_" + index);
round_challenges[i] = transcript->template get_challenge<Fr>("IPA:round_challenge_" + index);
round_challenges_inv[i] = round_challenges[i].invert();

msm_elements[2 * i] = element_L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ TEST_F(IPATest, Open)
const OpeningClaim<Curve> opening_claim{ opening_pair, commitment };

// initialize empty prover transcript
auto prover_transcript = std::make_shared<BaseTranscript>();
auto prover_transcript = std::make_shared<NativeTranscript>();
IPA::compute_opening_proof(this->ck(), opening_pair, poly, prover_transcript);

// initialize verifier transcript from proof data
auto verifier_transcript = std::make_shared<BaseTranscript>(prover_transcript->proof_data);
auto verifier_transcript = std::make_shared<NativeTranscript>(prover_transcript->proof_data);

auto result = IPA::verify(this->vk(), opening_claim, verifier_transcript);
EXPECT_TRUE(result);
Expand Down Expand Up @@ -131,7 +131,7 @@ TEST_F(IPATest, GeminiShplonkIPAWithShift)
batched_commitment_unshifted = commitment1 * rhos[0] + commitment2 * rhos[1];
batched_commitment_to_be_shifted = commitment2 * rhos[2];

auto prover_transcript = BaseTranscript::prover_init_empty();
auto prover_transcript = NativeTranscript::prover_init_empty();

auto gemini_polynomials = GeminiProver::compute_gemini_polynomials(
mle_opening_point, std::move(batched_unshifted), std::move(batched_to_be_shifted));
Expand All @@ -142,7 +142,7 @@ TEST_F(IPATest, GeminiShplonkIPAWithShift)
prover_transcript->send_to_verifier(label, commitment);
}

const Fr r_challenge = prover_transcript->get_challenge("Gemini:r");
const Fr r_challenge = prover_transcript->template get_challenge<Fr>("Gemini:r");

const auto [gemini_opening_pairs, gemini_witnesses] = GeminiProver::compute_fold_polynomial_evaluations(
mle_opening_point, std::move(gemini_polynomials), r_challenge);
Expand All @@ -153,18 +153,18 @@ TEST_F(IPATest, GeminiShplonkIPAWithShift)
prover_transcript->send_to_verifier(label, evaluation);
}

const Fr nu_challenge = prover_transcript->get_challenge("Shplonk:nu");
const Fr nu_challenge = prover_transcript->template get_challenge<Fr>("Shplonk:nu");
auto batched_quotient_Q =
ShplonkProver::compute_batched_quotient(gemini_opening_pairs, gemini_witnesses, nu_challenge);
prover_transcript->send_to_verifier("Shplonk:Q", this->ck()->commit(batched_quotient_Q));

const Fr z_challenge = prover_transcript->get_challenge("Shplonk:z");
const Fr z_challenge = prover_transcript->template get_challenge<Fr>("Shplonk:z");
const auto [shplonk_opening_pair, shplonk_witness] = ShplonkProver::compute_partially_evaluated_batched_quotient(
gemini_opening_pairs, gemini_witnesses, std::move(batched_quotient_Q), nu_challenge, z_challenge);

IPA::compute_opening_proof(this->ck(), shplonk_opening_pair, shplonk_witness, prover_transcript);

auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
auto verifier_transcript = NativeTranscript::verifier_init_empty(prover_transcript);

auto gemini_verifier_claim = GeminiVerifier::reduce_verification(mle_opening_point,
batched_evaluation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ template <typename Curve> class KZG {
static void compute_opening_proof(std::shared_ptr<CK> ck,
const OpeningPair<Curve>& opening_pair,
const Polynomial& polynomial,
const std::shared_ptr<BaseTranscript>& prover_trancript)
const std::shared_ptr<NativeTranscript>& prover_trancript)
{
Polynomial quotient = polynomial;
quotient[0] -= opening_pair.evaluation;
Expand All @@ -55,7 +55,7 @@ template <typename Curve> class KZG {
*/
static bool verify(const std::shared_ptr<VK>& vk,
const OpeningClaim<Curve>& claim,
const std::shared_ptr<BaseTranscript>& verifier_transcript)
const std::shared_ptr<NativeTranscript>& verifier_transcript)
{
auto quotient_commitment = verifier_transcript->template receive_from_prover<Commitment>("KZG:W");
auto lhs = claim.commitment - (GroupElement::one() * claim.opening_pair.evaluation) +
Expand All @@ -82,7 +82,7 @@ template <typename Curve> class KZG {

GroupElement P_0;
if constexpr (Curve::is_stdlib_type) {
auto builder = verifier_transcript->builder;
auto builder = quotient_commitment.get_context();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we no longer store the builder in the transcript, so I get the builder from another stdlib type.

auto one = Fr(builder, 1);
std::vector<GroupElement> commitments = { claim.commitment,
quotient_commitment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ TYPED_TEST(KZGTest, single)
auto opening_pair = OpeningPair<TypeParam>{ challenge, evaluation };
auto opening_claim = OpeningClaim<TypeParam>{ opening_pair, commitment };

auto prover_transcript = BaseTranscript::prover_init_empty();
auto prover_transcript = NativeTranscript::prover_init_empty();

KZG::compute_opening_proof(this->ck(), opening_pair, witness, prover_transcript);

auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
auto verifier_transcript = NativeTranscript::verifier_init_empty(prover_transcript);
bool verified = KZG::verify(this->vk(), opening_claim, verifier_transcript);

EXPECT_EQ(verified, true);
Expand Down Expand Up @@ -109,7 +109,7 @@ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift)
batched_commitment_unshifted = commitment1 * rhos[0] + commitment2 * rhos[1];
batched_commitment_to_be_shifted = commitment2 * rhos[2];

auto prover_transcript = BaseTranscript::prover_init_empty();
auto prover_transcript = NativeTranscript::prover_init_empty();

// Run the full prover PCS protocol:

Expand All @@ -125,7 +125,7 @@ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift)
prover_transcript->send_to_verifier(label, commitment);
}

const Fr r_challenge = prover_transcript->get_challenge("Gemini:r");
const Fr r_challenge = prover_transcript->template get_challenge<Fr>("Gemini:r");

const auto [gemini_opening_pairs, gemini_witnesses] = GeminiProver::compute_fold_polynomial_evaluations(
mle_opening_point, std::move(gemini_polynomials), r_challenge);
Expand All @@ -139,12 +139,12 @@ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift)
// Shplonk prover output:
// - opening pair: (z_challenge, 0)
// - witness: polynomial Q - Q_z
const Fr nu_challenge = prover_transcript->get_challenge("Shplonk:nu");
const Fr nu_challenge = prover_transcript->template get_challenge<Fr>("Shplonk:nu");
auto batched_quotient_Q =
ShplonkProver::compute_batched_quotient(gemini_opening_pairs, gemini_witnesses, nu_challenge);
prover_transcript->send_to_verifier("Shplonk:Q", this->ck()->commit(batched_quotient_Q));

const Fr z_challenge = prover_transcript->get_challenge("Shplonk:z");
const Fr z_challenge = prover_transcript->template get_challenge<Fr>("Shplonk:z");
const auto [shplonk_opening_pair, shplonk_witness] = ShplonkProver::compute_partially_evaluated_batched_quotient(
gemini_opening_pairs, gemini_witnesses, std::move(batched_quotient_Q), nu_challenge, z_challenge);

Expand All @@ -154,7 +154,7 @@ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift)

// Run the full verifier PCS protocol with genuine opening claims (genuine commitment, genuine evaluation)

auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
auto verifier_transcript = NativeTranscript::verifier_init_empty(prover_transcript);

// Gemini verifier output:
// - claim: d+1 commitments to Fold_{r}^(0), Fold_{-r}^(0), Fold^(l), d+1 evaluations a_0_pos, a_l, l = 0:d-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ template <typename Curve> class ShplonkVerifier_ {

const size_t num_claims = claims.size();

const Fr nu = transcript->get_challenge("Shplonk:nu");
const Fr nu = transcript->template get_challenge<Fr>("Shplonk:nu");

auto Q_commitment = transcript->template receive_from_prover<Commitment>("Shplonk:Q");

const Fr z_challenge = transcript->get_challenge("Shplonk:z");
const Fr z_challenge = transcript->template get_challenge<Fr>("Shplonk:z");

// [G] = [Q] - ∑ⱼ ρʲ / ( r − xⱼ )⋅[fⱼ] + G₀⋅[1]
// = [Q] - [∑ⱼ ρʲ ⋅ ( fⱼ(X) − vⱼ) / ( r − xⱼ )]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ TYPED_TEST(ShplonkTest, ShplonkSimple)

const size_t n = 16;

auto prover_transcript = BaseTranscript::prover_init_empty();
auto prover_transcript = NativeTranscript::prover_init_empty();

// Generate two random (unrelated) polynomials of two different sizes, as well as their evaluations at a (single but
// different) random point and their commitments.
Expand All @@ -47,11 +47,11 @@ TYPED_TEST(ShplonkTest, ShplonkSimple)
std::vector<Polynomial> polynomials = { poly1.share(), poly2.share() };

// Execute the shplonk prover functionality
const Fr nu_challenge = prover_transcript->get_challenge("Shplonk:nu");
const Fr nu_challenge = prover_transcript->template get_challenge<Fr>("Shplonk:nu");
auto batched_quotient_Q = ShplonkProver::compute_batched_quotient(opening_pairs, polynomials, nu_challenge);
prover_transcript->send_to_verifier("Shplonk:Q", this->ck()->commit(batched_quotient_Q));

const Fr z_challenge = prover_transcript->get_challenge("Shplonk:z");
const Fr z_challenge = prover_transcript->template get_challenge<Fr>("Shplonk:z");
const auto [prover_opening_pair, shplonk_prover_witness] =
ShplonkProver::compute_partially_evaluated_batched_quotient(
opening_pairs, polynomials, std::move(batched_quotient_Q), nu_challenge, z_challenge);
Expand All @@ -64,7 +64,7 @@ TYPED_TEST(ShplonkTest, ShplonkSimple)
opening_claims.emplace_back(OpeningClaim{ opening_pairs[0], commitment1 });
opening_claims.emplace_back(OpeningClaim{ opening_pairs[1], commitment2 });

auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
auto verifier_transcript = NativeTranscript::verifier_init_empty(prover_transcript);

// Execute the shplonk verifier functionality
const auto verifier_claim = ShplonkVerifier::reduce_verification(this->vk(), opening_claims, verifier_transcript);
Expand Down
Loading
Loading