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: Goblin translator prototype #1249

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -44,8 +44,7 @@
__extension__ using uint128_t = unsigned __int128;
#endif

template <typename T>
concept IntegralOrEnum = std::integral<T> || std::is_enum_v<T>;
template <typename T> concept IntegralOrEnum = std::integral<T> || std::is_enum_v<T>;

namespace serialize {
// Forward declare derived msgpack methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ template <std::integral T, typename A> inline std::ostream& operator<<(std::ostr
}

template <typename T, typename A>
requires(!std::integral<T>)
inline std::ostream& operator<<(std::ostream& os, std::vector<T, A> const& arr)
requires(!std::integral<T>) inline std::ostream& operator<<(std::ostream& os, std::vector<T, A> const& arr)
{
os << "[\n";
for (auto element : arr) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "block_constraint.hpp"
#include "acir_format.hpp"
#include "barretenberg/plonk/proof_system/types/proof.hpp"
#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp"
#include "block_constraint.hpp"

#include <gtest/gtest.h>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "ecdsa_secp256k1.hpp"
#include "acir_format.hpp"
#include "barretenberg/crypto/ecdsa/ecdsa.hpp"
#include "barretenberg/plonk/proof_system/types/proof.hpp"
#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp"
#include "ecdsa_secp256k1.hpp"

#include <gtest/gtest.h>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "ecdsa_secp256r1.hpp"
#include "acir_format.hpp"
#include "barretenberg/crypto/ecdsa/ecdsa.hpp"
#include "barretenberg/plonk/proof_system/types/proof.hpp"
#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp"
#include "ecdsa_secp256r1.hpp"

#include <gtest/gtest.h>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "recursion_constraint.hpp"
#include "acir_format.hpp"
#include "barretenberg/plonk/proof_system/types/proof.hpp"
#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp"
#include "recursion_constraint.hpp"

#include <gtest/gtest.h>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#include "relation_parameters.hpp"

namespace proof_system::honk::sumcheck {
template <typename T>
concept HasSubrelationLinearlyIndependentMember = requires(T) { T::Relation::SUBRELATION_LINEARLY_INDEPENDENT; };
template <typename T> concept HasSubrelationLinearlyIndependentMember = requires(T)
{
T::Relation::SUBRELATION_LINEARLY_INDEPENDENT;
};
/**
* @brief The templates defined herein facilitate sharing the relation arithmetic between the prover and the verifier.
*
Expand All @@ -34,9 +36,9 @@ concept HasSubrelationLinearlyIndependentMember = requires(T) { T::Relation::SUB
* @return requires
*/
template <typename FF, typename AccumulatorTypes, typename T>
requires std::is_same<std::span<FF>, T>::value
inline typename std::tuple_element<0, typename AccumulatorTypes::AccumulatorViews>::type get_view(const T& input,
const size_t index)
requires std::is_same<std::span<FF>, T>::value inline
typename std::tuple_element<0, typename AccumulatorTypes::AccumulatorViews>::type
get_view(const T& input, const size_t index)
{
return input[index];
}
Expand Down Expand Up @@ -110,8 +112,8 @@ template <typename FF, template <typename> typename RelationBase> class Relation
* @tparam size_t
*/
template <size_t>
static constexpr bool is_subrelation_linearly_independent()
requires(!HasSubrelationLinearlyIndependentMember<Relation>)
static constexpr bool is_subrelation_linearly_independent() requires(
!HasSubrelationLinearlyIndependentMember<Relation>)
{
return true;
}
Expand All @@ -122,8 +124,8 @@ template <typename FF, template <typename> typename RelationBase> class Relation
* @tparam size_t
*/
template <size_t subrelation_index>
static constexpr bool is_subrelation_linearly_independent()
requires(HasSubrelationLinearlyIndependentMember<Relation>)
static constexpr bool is_subrelation_linearly_independent() requires(
HasSubrelationLinearlyIndependentMember<Relation>)
{
return std::get<subrelation_index>(Relation::SUBRELATION_LINEARLY_INDEPENDENT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,8 @@ template <typename Flavor> class SumcheckRound {
template <typename... T>
static constexpr void add_tuples(std::tuple<T...>& tuple_1, const std::tuple<T...>& tuple_2)
{
[&]<std::size_t... I>(std::index_sequence<I...>) {
((std::get<I>(tuple_1) += std::get<I>(tuple_2)), ...);
}(std::make_index_sequence<sizeof...(T)>{});
[&]<std::size_t... I>(std::index_sequence<I...>) { ((std::get<I>(tuple_1) += std::get<I>(tuple_2)), ...); }
(std::make_index_sequence<sizeof...(T)>{});
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include "barretenberg/ecc/curves/bn254/bn254.hpp"
#include <array>
#include <barretenberg/common/slab_allocator.hpp>
#include <cstddef>
Expand Down Expand Up @@ -173,4 +174,10 @@ template <typename _FF> class Ultra : public Arithmetization</*NUM_WIRES =*/4, /
// ~Selectors() = default;
};
};
class GoblinTranslator : public Arithmetization</*NUM_WIRES =*/78, /*num_selectors =*/0> {
public:
// Dirty hack
using Selectors = bool;
using FF = curve::BN254::ScalarField;
};
} // namespace arithmetization
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ void CircuitBuilderBase<Arithmetization>::assert_equal(const uint32_t a_variable
template class CircuitBuilderBase<arithmetization::Standard<barretenberg::fr>>;
template class CircuitBuilderBase<arithmetization::Standard<grumpkin::fr>>;
template class CircuitBuilderBase<arithmetization::Ultra<barretenberg::fr>>;
template class CircuitBuilderBase<arithmetization::GoblinTranslator>;
template class CircuitBuilderBase<arithmetization::Turbo<barretenberg::fr>>;
} // namespace proof_system
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ template <typename Arithmetization> class CircuitBuilderBase {
prev_var_index.reserve(size_hint * 3);
real_variable_index.reserve(size_hint * 3);
real_variable_tags.reserve(size_hint * 3);
for (auto& p : selectors) {
p.reserve(size_hint);
// We set selectors type to bool, when we don't actually use them
if constexpr (!std::is_same<typename Arithmetization::Selectors, bool>::value) {
for (auto& p : selectors) {
p.reserve(size_hint);
}
}
}

Expand Down
Loading