Skip to content

Commit

Permalink
Use conversion function in stdlib context.
Browse files Browse the repository at this point in the history
  • Loading branch information
codygunton committed Nov 29, 2023
1 parent e32fa65 commit 84820e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once
#include "barretenberg/common/zip_view.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/transcript/transcript.hpp"

namespace proof_system::honk::pcs::zeromorph {

/**
Expand Down Expand Up @@ -404,9 +406,7 @@ template <typename Curve> class ZeroMorphProver_ {
transcript.send_to_verifier("ZM:C_q", q_commitment);

// Get challenges x and z
auto challenges = transcript.get_challenges("ZM:x", "ZM:z");
FF x_challenge = challenges[0];
FF z_challenge = challenges[1];
auto [x_challenge, z_challenge] = challenges_to_field_elements<FF>(transcript.get_challenges("ZM:x", "ZM:z"));

// Compute degree check polynomial \zeta partially evaluated at x
auto zeta_x =
Expand Down Expand Up @@ -675,9 +675,7 @@ template <typename Curve> class ZeroMorphVerifier_ {
auto C_q = transcript.template receive_from_prover<Commitment>("ZM:C_q");

// Challenges x, z
auto challenges = transcript.get_challenges("ZM:x", "ZM:z");
FF x_challenge = challenges[0];
FF z_challenge = challenges[1];
auto [x_challenge, z_challenge] = challenges_to_field_elements<FF>(transcript.get_challenges("ZM:x", "ZM:z"));

// Compute commitment C_{\zeta_x}
auto C_zeta_x = compute_C_zeta_x(C_q, C_q_k, y_challenge, x_challenge);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class BaseTranscript {
* @details The syntax `std::array<FF, 2> [a, b] = transcript.get_challenges("a", "b")` is unfortunately not allowed
* (structured bindings must be defined with auto return type), so we need a workaround.
*/
template <typename FF, size_t N> std::array<FF, N> challenges_to_field_elements(std::array<uint256_t, N>&& arr)
template <typename FF, typename T, size_t N> std::array<FF, N> challenges_to_field_elements(std::array<T, N>&& arr)
{
std::array<FF, N> result;
std::move(arr.begin(), arr.end(), result.begin());
Expand Down

0 comments on commit 84820e3

Please sign in to comment.