diff --git a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp index 45d2c1acbe2..49a77736219 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp @@ -32,7 +32,7 @@ template void execute_relation(::benchmark: } } BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); BENCHMARK(execute_relation>); BENCHMARK(execute_relation>); BENCHMARK(execute_relation>); @@ -43,7 +43,7 @@ BENCHMARK(execute_relation>); BENCHMARK(execute_relation>); BENCHMARK(execute_relation>); BENCHMARK(execute_relation>); -BENCHMARK(execute_relation>); +BENCHMARK(execute_relation>); BENCHMARK(execute_relation>); BENCHMARK(execute_relation>); diff --git a/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.cpp b/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.cpp index 1a31f3355ba..3747c8063a6 100644 --- a/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.cpp +++ b/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.cpp @@ -90,9 +90,9 @@ bool UltraCircuitChecker::check_block(Builder& builder, info("Failed Auxiliary relation at row idx = ", idx); return false; } - result = result && check_relation(values, params); + result = result && check_relation(values, params); if (result == false) { - info("Failed GenPermSort relation at row idx = ", idx); + info("Failed DeltaRangeConstraint relation at row idx = ", idx); return false; } result = result && check_lookup(values, lookup_hash_table); @@ -234,7 +234,7 @@ void UltraCircuitChecker::populate_values( values.q_o = block.q_3()[idx]; values.q_4 = block.q_4()[idx]; values.q_arith = block.q_arith()[idx]; - values.q_sort = block.q_sort()[idx]; + values.q_delta_range = block.q_delta_range()[idx]; values.q_elliptic = block.q_elliptic()[idx]; values.q_aux = block.q_aux()[idx]; values.q_lookup = block.q_lookup_type()[idx]; diff --git a/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.hpp b/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.hpp index 2a5680b001b..5aea34513b6 100644 --- a/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.hpp +++ b/barretenberg/cpp/src/barretenberg/circuit_checker/ultra_circuit_checker.hpp @@ -3,9 +3,9 @@ #include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp" #include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" +#include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/ecc_op_queue_relation.hpp" #include "barretenberg/relations/elliptic_relation.hpp" -#include "barretenberg/relations/gen_perm_sort_relation.hpp" #include "barretenberg/relations/poseidon2_external_relation.hpp" #include "barretenberg/relations/poseidon2_internal_relation.hpp" #include "barretenberg/relations/relation_parameters.hpp" @@ -21,7 +21,7 @@ class UltraCircuitChecker { using Arithmetic = UltraArithmeticRelation; using Elliptic = EllipticRelation; using Auxiliary = AuxiliaryRelation; - using GenPermSort = GenPermSortRelation; + using DeltaRangeConstraint = DeltaRangeConstraintRelation; using PoseidonExternal = Poseidon2ExternalRelation; using PoseidonInternal = Poseidon2InternalRelation; using Params = RelationParameters; diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp b/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp index f69a5814155..211171f0087 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/goblin_translator.hpp @@ -11,8 +11,8 @@ #include "barretenberg/proof_system/circuit_builder/goblin_translator_circuit_builder.hpp" #include "barretenberg/relations/relation_parameters.hpp" #include "barretenberg/relations/translator_vm/translator_decomposition_relation.hpp" +#include "barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.hpp" #include "barretenberg/relations/translator_vm/translator_extra_relations.hpp" -#include "barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.hpp" #include "barretenberg/relations/translator_vm/translator_non_native_field_relation.hpp" #include "barretenberg/relations/translator_vm/translator_permutation_relation.hpp" #include "relation_definitions.hpp" @@ -38,7 +38,7 @@ class GoblinTranslatorFlavor { static constexpr size_t MINIMUM_MINI_CIRCUIT_SIZE = 2048; // The size of the circuit which is filled with non-zero values for most polynomials. Most relations (everything - // except for Permutation and GenPermSort) can be evaluated just on the first chunk + // except for Permutation and DeltaRangeConstraint) can be evaluated just on the first chunk // It is also the only parameter that can be changed without updating relations or structures in the flavor static constexpr size_t MINI_CIRCUIT_SIZE = mini_circuit_size; @@ -56,7 +56,7 @@ class GoblinTranslatorFlavor { // Number of wires static constexpr size_t NUM_WIRES = CircuitBuilder::NUM_WIRES; - // The step in the GenPermSort relation + // The step in the DeltaRangeConstraint relation static constexpr size_t SORT_STEP = 3; // The bitness of the range constraint @@ -82,7 +82,7 @@ class GoblinTranslatorFlavor { using GrandProductRelations = std::tuple>; // define the tuple of Relations that comprise the Sumcheck relation using Relations = std::tuple, - GoblinTranslatorGenPermSortRelation, + GoblinTranslatorDeltaRangeConstraintRelation, GoblinTranslatorOpcodeConstraintRelation, GoblinTranslatorAccumulatorTransferRelation, GoblinTranslatorDecompositionRelation, @@ -99,13 +99,13 @@ class GoblinTranslatorFlavor { static constexpr size_t NUM_RELATIONS = std::tuple_size_v; // define the containers for storing the contributions from each relation in Sumcheck - using SumcheckTupleOfTuplesOfUnivariates = - std::tuple::SumcheckTupleOfUnivariatesOverSubrelations, - typename GoblinTranslatorGenPermSortRelation::SumcheckTupleOfUnivariatesOverSubrelations, - typename GoblinTranslatorOpcodeConstraintRelation::SumcheckTupleOfUnivariatesOverSubrelations, - typename GoblinTranslatorAccumulatorTransferRelation::SumcheckTupleOfUnivariatesOverSubrelations, - typename GoblinTranslatorDecompositionRelation::SumcheckTupleOfUnivariatesOverSubrelations, - typename GoblinTranslatorNonNativeFieldRelation::SumcheckTupleOfUnivariatesOverSubrelations>; + using SumcheckTupleOfTuplesOfUnivariates = std::tuple< + typename GoblinTranslatorPermutationRelation::SumcheckTupleOfUnivariatesOverSubrelations, + typename GoblinTranslatorDeltaRangeConstraintRelation::SumcheckTupleOfUnivariatesOverSubrelations, + typename GoblinTranslatorOpcodeConstraintRelation::SumcheckTupleOfUnivariatesOverSubrelations, + typename GoblinTranslatorAccumulatorTransferRelation::SumcheckTupleOfUnivariatesOverSubrelations, + typename GoblinTranslatorDecompositionRelation::SumcheckTupleOfUnivariatesOverSubrelations, + typename GoblinTranslatorNonNativeFieldRelation::SumcheckTupleOfUnivariatesOverSubrelations>; using TupleOfArraysOfValues = decltype(create_tuple_of_arrays_of_values()); private: @@ -157,7 +157,7 @@ class GoblinTranslatorFlavor { * @details Goblin proves that several polynomials contain only values in a certain range through 2 relations: * 1) A grand product which ignores positions of elements (GoblinTranslatorPermutationRelation) * 2) A relation enforcing a certain ordering on the elements of the given polynomial - * (GoblinTranslatorGenPermSortRelation) + * (GoblinTranslatorDeltaRangeConstraintRelation) * * We take the values from 4 polynomials, and spread them into 5 polynomials + add all the steps from MAX_VALUE * to 0. We order these polynomials and use them in the denominator of the grand product, at the same time diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp index 7f48253dffc..a8ed0ceb79f 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra.hpp @@ -8,9 +8,9 @@ #include "barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" #include "barretenberg/relations/databus_lookup_relation.hpp" +#include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/ecc_op_queue_relation.hpp" #include "barretenberg/relations/elliptic_relation.hpp" -#include "barretenberg/relations/gen_perm_sort_relation.hpp" #include "barretenberg/relations/lookup_relation.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/poseidon2_external_relation.hpp" @@ -53,7 +53,7 @@ class GoblinUltraFlavor { using Relations_ = std::tuple, bb::UltraPermutationRelation, bb::LookupRelation, - bb::GenPermSortRelation, + bb::DeltaRangeConstraintRelation, bb::EllipticRelation, bb::AuxiliaryRelation, bb::EccOpQueueRelation, @@ -103,7 +103,7 @@ class GoblinUltraFlavor { q_o, // column 4 q_4, // column 5 q_arith, // column 6 - q_sort, // column 7 + q_delta_range, // column 7 q_elliptic, // column 8 q_aux, // column 9 q_lookup, // column 10 @@ -139,7 +139,7 @@ class GoblinUltraFlavor { q_o, q_4, q_arith, - q_sort, + q_delta_range, q_elliptic, q_aux, q_lookup, @@ -386,7 +386,7 @@ class GoblinUltraFlavor { q_4 = "Q_4"; q_m = "Q_M"; q_arith = "Q_ARITH"; - q_sort = "Q_SORT"; + q_delta_range = "Q_SORT"; q_elliptic = "Q_ELLIPTIC"; q_aux = "Q_AUX"; q_lookup = "Q_LOOKUP"; @@ -427,7 +427,7 @@ class GoblinUltraFlavor { this->q_4 = verification_key->q_4; this->q_c = verification_key->q_c; this->q_arith = verification_key->q_arith; - this->q_sort = verification_key->q_sort; + this->q_delta_range = verification_key->q_delta_range; this->q_elliptic = verification_key->q_elliptic; this->q_aux = verification_key->q_aux; this->q_lookup = verification_key->q_lookup; diff --git a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp index 21b3f80dd0e..040439dc3c3 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/goblin_ultra_recursive.hpp @@ -127,7 +127,7 @@ template class GoblinUltraRecursiveFlavor_ { this->q_4 = Commitment::from_witness(builder, native_key->q_4); this->q_c = Commitment::from_witness(builder, native_key->q_c); this->q_arith = Commitment::from_witness(builder, native_key->q_arith); - this->q_sort = Commitment::from_witness(builder, native_key->q_sort); + this->q_delta_range = Commitment::from_witness(builder, native_key->q_delta_range); this->q_elliptic = Commitment::from_witness(builder, native_key->q_elliptic); this->q_aux = Commitment::from_witness(builder, native_key->q_aux); this->q_lookup = Commitment::from_witness(builder, native_key->q_lookup); diff --git a/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp b/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp index f807449ba57..d6db5c90909 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/ultra.hpp @@ -9,8 +9,8 @@ #include "barretenberg/polynomials/univariate.hpp" #include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" +#include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/elliptic_relation.hpp" -#include "barretenberg/relations/gen_perm_sort_relation.hpp" #include "barretenberg/relations/lookup_relation.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/ultra_arithmetic_relation.hpp" @@ -46,7 +46,7 @@ class UltraFlavor { using Relations = std::tuple, bb::UltraPermutationRelation, bb::LookupRelation, - bb::GenPermSortRelation, + bb::DeltaRangeConstraintRelation, bb::EllipticRelation, bb::AuxiliaryRelation>; @@ -94,7 +94,7 @@ class UltraFlavor { q_o, // column 4 q_4, // column 5 q_arith, // column 6 - q_sort, // column 7 + q_delta_range, // column 7 q_elliptic, // column 8 q_aux, // column 9 q_lookup, // column 10 @@ -117,7 +117,7 @@ class UltraFlavor { auto get_selectors() { - return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, q_elliptic, q_aux, q_lookup }; + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_delta_range, q_elliptic, q_aux, q_lookup }; }; auto get_sigma_polynomials() { return RefArray{ sigma_1, sigma_2, sigma_3, sigma_4 }; }; auto get_id_polynomials() { return RefArray{ id_1, id_2, id_3, id_4 }; }; @@ -187,7 +187,7 @@ class UltraFlavor { q_4, // column 4 q_m, // column 5 q_arith, // column 6 - q_sort, // column 7 + q_delta_range, // column 7 q_elliptic, // column 8 q_aux, // column 9 q_lookup, // column 10 @@ -228,7 +228,7 @@ class UltraFlavor { // Gemini-specific getters. auto get_unshifted() { - return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_delta_range, q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, lagrange_last, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup @@ -238,7 +238,7 @@ class UltraFlavor { auto get_precomputed() { - return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_delta_range, q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, lagrange_last @@ -382,7 +382,7 @@ class UltraFlavor { q_4 = "Q_4"; q_m = "Q_M"; q_arith = "Q_ARITH"; - q_sort = "Q_SORT"; + q_delta_range = "Q_SORT"; q_elliptic = "Q_ELLIPTIC"; q_aux = "Q_AUX"; q_lookup = "Q_LOOKUP"; @@ -420,7 +420,7 @@ class UltraFlavor { q_o = verification_key->q_o; q_4 = verification_key->q_4; q_arith = verification_key->q_arith; - q_sort = verification_key->q_sort; + q_delta_range = verification_key->q_delta_range; q_elliptic = verification_key->q_elliptic; q_aux = verification_key->q_aux; q_lookup = verification_key->q_lookup; diff --git a/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp b/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp index d1b4174252f..5f905863c4c 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/ultra_recursive.hpp @@ -11,8 +11,8 @@ #include "barretenberg/polynomials/univariate.hpp" #include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" +#include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/elliptic_relation.hpp" -#include "barretenberg/relations/gen_perm_sort_relation.hpp" #include "barretenberg/relations/lookup_relation.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/ultra_arithmetic_relation.hpp" @@ -74,7 +74,7 @@ template class UltraRecursiveFlavor_ { using Relations = std::tuple, bb::UltraPermutationRelation, bb::LookupRelation, - bb::GenPermSortRelation, + bb::DeltaRangeConstraintRelation, bb::EllipticRelation, bb::AuxiliaryRelation>; @@ -116,7 +116,7 @@ template class UltraRecursiveFlavor_ { q_o, // column 4 q_4, // column 5 q_arith, // column 6 - q_sort, // column 7 + q_delta_range, // column 7 q_elliptic, // column 8 q_aux, // column 9 q_lookup, // column 10 @@ -137,7 +137,7 @@ template class UltraRecursiveFlavor_ { auto get_selectors() { - return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, q_elliptic, q_aux, q_lookup }; + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_delta_range, q_elliptic, q_aux, q_lookup }; }; auto get_sigma_polynomials() { return RefArray{ sigma_1, sigma_2, sigma_3, sigma_4 }; }; auto get_id_polynomials() { return RefArray{ id_1, id_2, id_3, id_4 }; }; @@ -190,7 +190,7 @@ template class UltraRecursiveFlavor_ { q_4, // column 4 q_m, // column 5 q_arith, // column 6 - q_sort, // column 7 + q_delta_range, // column 7 q_elliptic, // column 8 q_aux, // column 9 q_lookup, // column 10 @@ -232,7 +232,7 @@ template class UltraRecursiveFlavor_ { // Gemini-specific getters. auto get_unshifted() { - return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_delta_range, q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, lagrange_last, w_l, w_r, w_o, w_4, sorted_accum, z_perm, z_lookup @@ -241,7 +241,7 @@ template class UltraRecursiveFlavor_ { }; auto get_precomputed() { - return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_sort, + return RefArray{ q_m, q_c, q_l, q_r, q_o, q_4, q_arith, q_delta_range, q_elliptic, q_aux, q_lookup, sigma_1, sigma_2, sigma_3, sigma_4, id_1, id_2, id_3, id_4, table_1, table_2, table_3, table_4, lagrange_first, lagrange_last @@ -298,7 +298,7 @@ template class UltraRecursiveFlavor_ { this->q_4 = Commitment::from_witness(builder, native_key->q_4); this->q_c = Commitment::from_witness(builder, native_key->q_c); this->q_arith = Commitment::from_witness(builder, native_key->q_arith); - this->q_sort = Commitment::from_witness(builder, native_key->q_sort); + this->q_delta_range = Commitment::from_witness(builder, native_key->q_delta_range); this->q_elliptic = Commitment::from_witness(builder, native_key->q_elliptic); this->q_aux = Commitment::from_witness(builder, native_key->q_aux); this->q_lookup = Commitment::from_witness(builder, native_key->q_lookup); @@ -355,7 +355,7 @@ template class UltraRecursiveFlavor_ { this->q_4 = "Q_4"; this->q_m = "Q_M"; this->q_arith = "Q_ARITH"; - this->q_sort = "Q_SORT"; + this->q_delta_range = "Q_SORT"; this->q_elliptic = "Q_ELLIPTIC"; this->q_aux = "Q_AUX"; this->q_lookup = "Q_LOOKUP"; @@ -388,7 +388,7 @@ template class UltraRecursiveFlavor_ { this->q_4 = verification_key->q_4; this->q_c = verification_key->q_c; this->q_arith = verification_key->q_arith; - this->q_sort = verification_key->q_sort; + this->q_delta_range = verification_key->q_delta_range; this->q_elliptic = verification_key->q_elliptic; this->q_aux = verification_key->q_aux; this->q_lookup = verification_key->q_lookup; diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/permutation_library.hpp b/barretenberg/cpp/src/barretenberg/honk/proof_system/permutation_library.hpp index 43ec3081adf..e5b22bffe32 100644 --- a/barretenberg/cpp/src/barretenberg/honk/proof_system/permutation_library.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/proof_system/permutation_library.hpp @@ -222,8 +222,9 @@ template void compute_concatenated_pol * changed ∈ [0 , 2¹⁴ - 1]. To do this, we use several virtual concatenated wires, each of which represents a subset * or original wires (concatenated_range_constraints_). We also generate several new polynomials of the same length * as concatenated ones. These polynomials have values within range, but they are also constrained by the - * GoblinTranslatorFlavor's GenPermSort relation, which ensures that sequential values differ by not more than 3, the - * last value is the maximum and the first value is zero (zero at the start allows us not to dance around shifts). + * GoblinTranslatorFlavor's DeltaRangeConstraint relation, which ensures that sequential values differ by not more than + * 3, the last value is the maximum and the first value is zero (zero at the start allows us not to dance around + * shifts). * * Ideally, we could simply rearrange the values in concatenated_.._0 ,..., concatenated_.._3 and get denominator * polynomials (ordered_constraints), but we could get the worst case scenario: each value in the polynomials is diff --git a/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/arithmetization.hpp b/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/arithmetization.hpp index a89f0430bd7..35587e3c208 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/arithmetization.hpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/arithmetization/arithmetization.hpp @@ -24,7 +24,7 @@ namespace bb { * * struct Component { * using Arithmetic = component::Arithmetic3Wires; - * using RangeConstraints = component::Base4Accumulators or component::GenPerm or... + * using RangeConstraints = component::Base4Accumulators or component::DeltaRangeConstraint or... * using LookupTables = component::Plookup4Wire or component::CQ8Wire or... * ... * }; @@ -142,7 +142,7 @@ template class UltraArith { auto& q_3() { return this->selectors[4]; }; auto& q_4() { return this->selectors[5]; }; auto& q_arith() { return this->selectors[6]; }; - auto& q_sort() { return this->selectors[7]; }; + auto& q_delta_range() { return this->selectors[7]; }; auto& q_elliptic() { return this->selectors[8]; }; auto& q_aux() { return this->selectors[9]; }; auto& q_lookup_type() { return this->selectors[10]; }; @@ -215,7 +215,7 @@ template class UltraHonkArith { auto& q_3() { return this->selectors[4]; }; auto& q_4() { return this->selectors[5]; }; auto& q_arith() { return this->selectors[6]; }; - auto& q_sort() { return this->selectors[7]; }; + auto& q_delta_range() { return this->selectors[7]; }; auto& q_elliptic() { return this->selectors[8]; }; auto& q_aux() { return this->selectors[9]; }; auto& q_lookup_type() { return this->selectors[10]; }; @@ -254,7 +254,8 @@ template class UltraHonkArith { UltraHonkTraceBlock ecc_op; UltraHonkTraceBlock pub_inputs; UltraHonkTraceBlock arithmetic; - // TODO(https://github.com/AztecProtocol/barretenberg/issues/919): Change: GenPermSort --> DeltaRangeConstraint + // TODO(https://github.com/AztecProtocol/barretenberg/issues/919): Change: DeltaRangeConstraint --> + // DeltaRangeConstraint UltraHonkTraceBlock delta_range; UltraHonkTraceBlock elliptic; UltraHonkTraceBlock aux; diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp index 6d7d474da8a..b845a817bb0 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/goblin_ultra_circuit_builder.cpp @@ -50,7 +50,7 @@ template void GoblinUltraCircuitBuilder_::add_gates_to_ensure_ this->blocks.poseidon_external.q_c().emplace_back(0); this->blocks.poseidon_external.q_arith().emplace_back(0); this->blocks.poseidon_external.q_4().emplace_back(0); - this->blocks.poseidon_external.q_sort().emplace_back(0); + this->blocks.poseidon_external.q_delta_range().emplace_back(0); this->blocks.poseidon_external.q_lookup_type().emplace_back(0); this->blocks.poseidon_external.q_elliptic().emplace_back(0); this->blocks.poseidon_external.q_aux().emplace_back(0); @@ -73,7 +73,7 @@ template void GoblinUltraCircuitBuilder_::add_gates_to_ensure_ this->blocks.poseidon_internal.q_c().emplace_back(0); this->blocks.poseidon_internal.q_arith().emplace_back(0); this->blocks.poseidon_internal.q_4().emplace_back(0); - this->blocks.poseidon_internal.q_sort().emplace_back(0); + this->blocks.poseidon_internal.q_delta_range().emplace_back(0); this->blocks.poseidon_internal.q_lookup_type().emplace_back(0); this->blocks.poseidon_internal.q_elliptic().emplace_back(0); this->blocks.poseidon_internal.q_aux().emplace_back(0); @@ -239,7 +239,7 @@ void GoblinUltraCircuitBuilder_::create_calldata_lookup_gate(const databus_l block.q_2().emplace_back(0); block.q_3().emplace_back(0); block.q_c().emplace_back(0); - block.q_sort().emplace_back(0); + block.q_delta_range().emplace_back(0); block.q_arith().emplace_back(0); block.q_4().emplace_back(0); block.q_lookup_type().emplace_back(0); @@ -267,7 +267,7 @@ void GoblinUltraCircuitBuilder_::create_poseidon2_external_gate(const poseid block.q_c().emplace_back(0); block.q_arith().emplace_back(0); block.q_4().emplace_back(Poseidon2Bn254ScalarFieldParams::round_constants[in.round_idx][3]); - block.q_sort().emplace_back(0); + block.q_delta_range().emplace_back(0); block.q_lookup_type().emplace_back(0); block.q_elliptic().emplace_back(0); block.q_aux().emplace_back(0); @@ -293,7 +293,7 @@ void GoblinUltraCircuitBuilder_::create_poseidon2_internal_gate(const poseid block.q_c().emplace_back(0); block.q_arith().emplace_back(0); block.q_4().emplace_back(0); - block.q_sort().emplace_back(0); + block.q_delta_range().emplace_back(0); block.q_lookup_type().emplace_back(0); block.q_elliptic().emplace_back(0); block.q_aux().emplace_back(0); diff --git a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.cpp b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.cpp index baa8d032a0b..258a0dfed15 100644 --- a/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.cpp +++ b/barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/ultra_circuit_builder.cpp @@ -67,7 +67,7 @@ void UltraCircuitBuilder_::add_gates_to_ensure_all_polys_are_no blocks.arithmetic.q_3().emplace_back(1); blocks.arithmetic.q_4().emplace_back(1); blocks.arithmetic.q_c().emplace_back(0); - blocks.arithmetic.q_sort().emplace_back(0); + blocks.arithmetic.q_delta_range().emplace_back(0); blocks.arithmetic.q_arith().emplace_back(0); blocks.arithmetic.q_lookup_type().emplace_back(0); blocks.arithmetic.q_elliptic().emplace_back(0); @@ -78,7 +78,7 @@ void UltraCircuitBuilder_::add_gates_to_ensure_all_polys_are_no check_selector_length_consistency(); ++this->num_gates; - // q_sort + // q_delta_range blocks.delta_range.populate_wires(this->zero_idx, this->zero_idx, this->zero_idx, this->zero_idx); blocks.delta_range.q_m().emplace_back(0); blocks.delta_range.q_1().emplace_back(0); @@ -86,7 +86,7 @@ void UltraCircuitBuilder_::add_gates_to_ensure_all_polys_are_no blocks.delta_range.q_3().emplace_back(0); blocks.delta_range.q_4().emplace_back(0); blocks.delta_range.q_c().emplace_back(0); - blocks.delta_range.q_sort().emplace_back(1); + blocks.delta_range.q_delta_range().emplace_back(1); blocks.delta_range.q_arith().emplace_back(0); blocks.delta_range.q_lookup_type().emplace_back(0); blocks.delta_range.q_elliptic().emplace_back(0); @@ -106,7 +106,7 @@ void UltraCircuitBuilder_::add_gates_to_ensure_all_polys_are_no blocks.elliptic.q_3().emplace_back(0); blocks.elliptic.q_4().emplace_back(0); blocks.elliptic.q_c().emplace_back(0); - blocks.elliptic.q_sort().emplace_back(0); + blocks.elliptic.q_delta_range().emplace_back(0); blocks.elliptic.q_arith().emplace_back(0); blocks.elliptic.q_lookup_type().emplace_back(0); blocks.elliptic.q_elliptic().emplace_back(1); @@ -126,7 +126,7 @@ void UltraCircuitBuilder_::add_gates_to_ensure_all_polys_are_no blocks.aux.q_3().emplace_back(0); blocks.aux.q_4().emplace_back(0); blocks.aux.q_c().emplace_back(0); - blocks.aux.q_sort().emplace_back(0); + blocks.aux.q_delta_range().emplace_back(0); blocks.aux.q_arith().emplace_back(0); blocks.aux.q_lookup_type().emplace_back(0); blocks.aux.q_elliptic().emplace_back(0); @@ -184,7 +184,7 @@ void UltraCircuitBuilder_::create_add_gate(const add_triple_::create_big_add_gate(const add_quad_< blocks.arithmetic.q_c().emplace_back(in.const_scaling); blocks.arithmetic.q_arith().emplace_back(include_next_gate_w_4 ? 2 : 1); blocks.arithmetic.q_4().emplace_back(in.d_scaling); - blocks.arithmetic.q_sort().emplace_back(0); + blocks.arithmetic.q_delta_range().emplace_back(0); blocks.arithmetic.q_lookup_type().emplace_back(0); blocks.arithmetic.q_elliptic().emplace_back(0); blocks.arithmetic.q_aux().emplace_back(0); @@ -310,7 +310,7 @@ void UltraCircuitBuilder_::create_big_mul_gate(const mul_quad_< blocks.arithmetic.q_c().emplace_back(in.const_scaling); blocks.arithmetic.q_arith().emplace_back(1); blocks.arithmetic.q_4().emplace_back(in.d_scaling); - blocks.arithmetic.q_sort().emplace_back(0); + blocks.arithmetic.q_delta_range().emplace_back(0); blocks.arithmetic.q_lookup_type().emplace_back(0); blocks.arithmetic.q_elliptic().emplace_back(0); blocks.arithmetic.q_aux().emplace_back(0); @@ -336,7 +336,7 @@ void UltraCircuitBuilder_::create_balanced_add_gate(const add_q blocks.arithmetic.q_c().emplace_back(in.const_scaling); blocks.arithmetic.q_arith().emplace_back(1); blocks.arithmetic.q_4().emplace_back(in.d_scaling); - blocks.arithmetic.q_sort().emplace_back(0); + blocks.arithmetic.q_delta_range().emplace_back(0); blocks.arithmetic.q_lookup_type().emplace_back(0); blocks.arithmetic.q_elliptic().emplace_back(0); blocks.arithmetic.q_aux().emplace_back(0); @@ -378,7 +378,7 @@ void UltraCircuitBuilder_::create_mul_gate(const mul_triple_::create_bool_gate(const uint32_t vari blocks.arithmetic.q_2().emplace_back(0); blocks.arithmetic.q_3().emplace_back(0); blocks.arithmetic.q_c().emplace_back(0); - blocks.arithmetic.q_sort().emplace_back(0); + blocks.arithmetic.q_delta_range().emplace_back(0); blocks.arithmetic.q_arith().emplace_back(1); blocks.arithmetic.q_4().emplace_back(0); @@ -435,7 +435,7 @@ void UltraCircuitBuilder_::create_poly_gate(const poly_triple_< blocks.arithmetic.q_2().emplace_back(in.q_r); blocks.arithmetic.q_3().emplace_back(in.q_o); blocks.arithmetic.q_c().emplace_back(in.q_c); - blocks.arithmetic.q_sort().emplace_back(0); + blocks.arithmetic.q_delta_range().emplace_back(0); blocks.arithmetic.q_arith().emplace_back(1); blocks.arithmetic.q_4().emplace_back(0); @@ -497,7 +497,7 @@ void UltraCircuitBuilder_::create_ecc_add_gate(const ecc_add_ga block.q_2().emplace_back(0); block.q_m().emplace_back(0); block.q_c().emplace_back(0); - block.q_sort().emplace_back(0); + block.q_delta_range().emplace_back(0); block.q_lookup_type().emplace_back(0); block.q_elliptic().emplace_back(1); block.q_aux().emplace_back(0); @@ -551,7 +551,7 @@ void UltraCircuitBuilder_::create_ecc_dbl_gate(const ecc_dbl_ga block.q_c().emplace_back(0); block.q_arith().emplace_back(0); block.q_4().emplace_back(0); - block.q_sort().emplace_back(0); + block.q_delta_range().emplace_back(0); block.q_lookup_type().emplace_back(0); block.q_aux().emplace_back(0); if constexpr (HasAdditionalSelectors) { @@ -582,7 +582,7 @@ void UltraCircuitBuilder_::fix_witness(const uint32_t witness_i blocks.arithmetic.q_c().emplace_back(-witness_value); blocks.arithmetic.q_arith().emplace_back(1); blocks.arithmetic.q_4().emplace_back(0); - blocks.arithmetic.q_sort().emplace_back(0); + blocks.arithmetic.q_delta_range().emplace_back(0); blocks.arithmetic.q_lookup_type().emplace_back(0); blocks.arithmetic.q_elliptic().emplace_back(0); blocks.arithmetic.q_aux().emplace_back(0); @@ -658,7 +658,7 @@ plookup::ReadData UltraCircuitBuilder_::create_gates_ blocks.lookup.q_c().emplace_back((i == (num_lookups - 1) ? 0 : -multi_table.column_3_step_sizes[i + 1])); blocks.lookup.q_arith().emplace_back(0); blocks.lookup.q_4().emplace_back(0); - blocks.lookup.q_sort().emplace_back(0); + blocks.lookup.q_delta_range().emplace_back(0); blocks.lookup.q_elliptic().emplace_back(0); blocks.lookup.q_aux().emplace_back(0); if constexpr (HasAdditionalSelectors) { @@ -967,7 +967,7 @@ void UltraCircuitBuilder_::create_sort_constraint(const std::ve blocks.delta_range.q_c().emplace_back(0); blocks.delta_range.q_arith().emplace_back(0); blocks.delta_range.q_4().emplace_back(0); - blocks.delta_range.q_sort().emplace_back(1); + blocks.delta_range.q_delta_range().emplace_back(1); blocks.delta_range.q_elliptic().emplace_back(0); blocks.delta_range.q_lookup_type().emplace_back(0); blocks.delta_range.q_aux().emplace_back(0); @@ -1001,7 +1001,7 @@ void UltraCircuitBuilder_::create_dummy_gate( block.q_c().emplace_back(0); block.q_arith().emplace_back(0); block.q_4().emplace_back(0); - block.q_sort().emplace_back(0); + block.q_delta_range().emplace_back(0); block.q_elliptic().emplace_back(0); block.q_lookup_type().emplace_back(0); block.q_aux().emplace_back(0); @@ -1059,7 +1059,7 @@ void UltraCircuitBuilder_::create_sort_constraint_with_edges( block.q_c().emplace_back(0); block.q_arith().emplace_back(0); block.q_4().emplace_back(0); - block.q_sort().emplace_back(1); + block.q_delta_range().emplace_back(1); block.q_elliptic().emplace_back(0); block.q_lookup_type().emplace_back(0); block.q_aux().emplace_back(0); @@ -1082,7 +1082,7 @@ void UltraCircuitBuilder_::create_sort_constraint_with_edges( block.q_c().emplace_back(0); block.q_arith().emplace_back(0); block.q_4().emplace_back(0); - block.q_sort().emplace_back(1); + block.q_delta_range().emplace_back(1); block.q_elliptic().emplace_back(0); block.q_lookup_type().emplace_back(0); block.q_aux().emplace_back(0); @@ -1203,7 +1203,7 @@ void UltraCircuitBuilder_::apply_aux_selectors(const AUX_SELECT { auto& block = blocks.aux; block.q_aux().emplace_back(type == AUX_SELECTORS::NONE ? 0 : 1); - block.q_sort().emplace_back(0); + block.q_delta_range().emplace_back(0); block.q_lookup_type().emplace_back(0); block.q_elliptic().emplace_back(0); switch (type) { @@ -1620,7 +1620,7 @@ std::array UltraCircuitBuilder_::evaluate_non_nati blocks.aux.q_c().emplace_back(0); blocks.aux.q_arith().emplace_back(2); blocks.aux.q_4().emplace_back(-LIMB_SHIFT.sqr()); - blocks.aux.q_sort().emplace_back(0); + blocks.aux.q_delta_range().emplace_back(0); blocks.aux.q_lookup_type().emplace_back(0); blocks.aux.q_elliptic().emplace_back(0); blocks.aux.q_aux().emplace_back(0); @@ -1904,7 +1904,7 @@ std::array UltraCircuitBuilder_::evaluate_non_nati block.q_arith().emplace_back(1); for (size_t i = 0; i < 4; ++i) { - block.q_sort().emplace_back(0); + block.q_delta_range().emplace_back(0); block.q_lookup_type().emplace_back(0); block.q_elliptic().emplace_back(0); block.q_aux().emplace_back(0); @@ -2024,7 +2024,7 @@ std::array UltraCircuitBuilder_::evaluate_non_nati block.q_arith().emplace_back(1); for (size_t i = 0; i < 4; ++i) { - block.q_sort().emplace_back(0); + block.q_delta_range().emplace_back(0); block.q_lookup_type().emplace_back(0); block.q_elliptic().emplace_back(0); block.q_aux().emplace_back(0); diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp b/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp index 390ccd71779..b9fd0f9d8c0 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/combiner.test.cpp @@ -23,7 +23,7 @@ TEST(Protogalaxy, CombinerOn2Instances) const auto restrict_to_standard_arithmetic_relation = [](auto& polys) { std::fill(polys.q_arith.begin(), polys.q_arith.end(), 1); - std::fill(polys.q_sort.begin(), polys.q_sort.end(), 0); + std::fill(polys.q_delta_range.begin(), polys.q_delta_range.end(), 0); std::fill(polys.q_elliptic.begin(), polys.q_elliptic.end(), 0); std::fill(polys.q_aux.begin(), polys.q_aux.end(), 0); std::fill(polys.q_lookup.begin(), polys.q_lookup.end(), 0); @@ -151,7 +151,7 @@ TEST(Protogalaxy, CombinerOn4Instances) const auto zero_all_selectors = [](auto& polys) { std::fill(polys.q_arith.begin(), polys.q_arith.end(), 0); - std::fill(polys.q_sort.begin(), polys.q_sort.end(), 0); + std::fill(polys.q_delta_range.begin(), polys.q_delta_range.end(), 0); std::fill(polys.q_elliptic.begin(), polys.q_elliptic.end(), 0); std::fill(polys.q_aux.begin(), polys.q_aux.end(), 0); std::fill(polys.q_lookup.begin(), polys.q_lookup.end(), 0); diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/combiner_example_gen.py b/barretenberg/cpp/src/barretenberg/protogalaxy/combiner_example_gen.py index ac701d41e95..0ace782160a 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/combiner_example_gen.py +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/combiner_example_gen.py @@ -15,7 +15,7 @@ def __init__(self, start): self.q_4 = start + 2 * 4 self.q_m = start + 2 * 5 self.q_arith = start + 2 * 6 - self.q_sort = start + 2 * 7 + self.q_delta_range = start + 2 * 7 self.q_elliptic = start + 2 * 8 self.q_aux = start + 2 * 9 self.q_lookup = start + 2 * 10 diff --git a/barretenberg/cpp/src/barretenberg/relations/gen_perm_sort_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/delta_range_constraint_relation.hpp similarity index 87% rename from barretenberg/cpp/src/barretenberg/relations/gen_perm_sort_relation.hpp rename to barretenberg/cpp/src/barretenberg/relations/delta_range_constraint_relation.hpp index 2da286ee3e2..dee7759db07 100644 --- a/barretenberg/cpp/src/barretenberg/relations/gen_perm_sort_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/delta_range_constraint_relation.hpp @@ -3,7 +3,7 @@ namespace bb { -template class GenPermSortRelationImpl { +template class DeltaRangeConstraintRelationImpl { public: using FF = FF_; @@ -17,7 +17,7 @@ template class GenPermSortRelationImpl { /** * @brief Expression for the generalized permutation sort gate. * @details The relation is defined as C(in(X)...) = - * q_sort * \sum{ i = [0, 3]} \alpha^i D_i(D_i - 1)(D_i - 2)(D_i - 3) + * q_delta_range * \sum{ i = [0, 3]} \alpha^i D_i(D_i - 1)(D_i - 2)(D_i - 3) * where * D_0 = w_2 - w_1 * D_1 = w_3 - w_2 @@ -42,7 +42,7 @@ template class GenPermSortRelationImpl { auto w_3 = View(in.w_o); auto w_4 = View(in.w_4); auto w_1_shift = View(in.w_l_shift); - auto q_sort = View(in.q_sort); + auto q_delta_range = View(in.q_delta_range); static const FF minus_one = FF(-1); static const FF minus_two = FF(-2); @@ -59,7 +59,7 @@ template class GenPermSortRelationImpl { tmp_1 *= (delta_1 + minus_one); tmp_1 *= (delta_1 + minus_two); tmp_1 *= (delta_1 + minus_three); - tmp_1 *= q_sort; + tmp_1 *= q_delta_range; tmp_1 *= scaling_factor; std::get<0>(accumulators) += tmp_1; @@ -68,7 +68,7 @@ template class GenPermSortRelationImpl { tmp_2 *= (delta_2 + minus_one); tmp_2 *= (delta_2 + minus_two); tmp_2 *= (delta_2 + minus_three); - tmp_2 *= q_sort; + tmp_2 *= q_delta_range; tmp_2 *= scaling_factor; std::get<1>(accumulators) += tmp_2; @@ -77,7 +77,7 @@ template class GenPermSortRelationImpl { tmp_3 *= (delta_3 + minus_one); tmp_3 *= (delta_3 + minus_two); tmp_3 *= (delta_3 + minus_three); - tmp_3 *= q_sort; + tmp_3 *= q_delta_range; tmp_3 *= scaling_factor; std::get<2>(accumulators) += tmp_3; @@ -86,12 +86,12 @@ template class GenPermSortRelationImpl { tmp_4 *= (delta_4 + minus_one); tmp_4 *= (delta_4 + minus_two); tmp_4 *= (delta_4 + minus_three); - tmp_4 *= q_sort; + tmp_4 *= q_delta_range; tmp_4 *= scaling_factor; std::get<3>(accumulators) += tmp_4; }; }; -template using GenPermSortRelation = Relation>; +template using DeltaRangeConstraintRelation = Relation>; } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp index 890810aee0a..2f55d2d8885 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/goblin_translator_relation_consistency.test.cpp @@ -102,10 +102,10 @@ TEST_F(GoblinTranslatorRelationConsistency, PermutationRelation) run_test(/*random_inputs=*/true); }; -TEST_F(GoblinTranslatorRelationConsistency, GenPermSortRelation) +TEST_F(GoblinTranslatorRelationConsistency, DeltaRangeConstraintRelation) { const auto run_test = [](bool random_inputs) { - using Relation = GoblinTranslatorGenPermSortRelation; + using Relation = GoblinTranslatorDeltaRangeConstraintRelation; using RelationValues = typename Relation::SumcheckArrayOfValuesOverSubrelations; const InputElements input_elements = random_inputs ? get_random_input() : get_special_input(); diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.cpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.cpp similarity index 89% rename from barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.cpp rename to barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.cpp index fe5c222a8cc..70c0456e884 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.cpp @@ -1,4 +1,4 @@ -#include "barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.hpp" +#include "barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.hpp" #include "barretenberg/flavor/goblin_translator.hpp" namespace bb { @@ -17,10 +17,10 @@ namespace bb { */ template template -void GoblinTranslatorGenPermSortRelationImpl::accumulate(ContainerOverSubrelations& accumulators, - const AllEntities& in, - const Parameters&, - const FF& scaling_factor) +void GoblinTranslatorDeltaRangeConstraintRelationImpl::accumulate(ContainerOverSubrelations& accumulators, + const AllEntities& in, + const Parameters&, + const FF& scaling_factor) { static const FF minus_one = FF(-1); static const FF minus_two = FF(-2); @@ -126,7 +126,7 @@ void GoblinTranslatorGenPermSortRelationImpl::accumulate(ContainerOverSubrel }(); }; -template class GoblinTranslatorGenPermSortRelationImpl; -DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorGenPermSortRelationImpl, GoblinTranslatorFlavor); +template class GoblinTranslatorDeltaRangeConstraintRelationImpl; +DEFINE_SUMCHECK_RELATION_CLASS(GoblinTranslatorDeltaRangeConstraintRelationImpl, GoblinTranslatorFlavor); } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.hpp similarity index 91% rename from barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.hpp rename to barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.hpp index 3212cc3925d..01547603e0c 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_gen_perm_sort_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.hpp @@ -3,7 +3,7 @@ namespace bb { -template class GoblinTranslatorGenPermSortRelationImpl { +template class GoblinTranslatorDeltaRangeConstraintRelationImpl { public: using FF = FF_; @@ -44,6 +44,6 @@ template class GoblinTranslatorGenPermSortRelationImpl { }; template -using GoblinTranslatorGenPermSortRelation = Relation>; +using GoblinTranslatorDeltaRangeConstraintRelation = Relation>; } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/relations/ultra_relation_consistency.test.cpp b/barretenberg/cpp/src/barretenberg/relations/ultra_relation_consistency.test.cpp index 731725d6ee2..79e7349d6b8 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ultra_relation_consistency.test.cpp +++ b/barretenberg/cpp/src/barretenberg/relations/ultra_relation_consistency.test.cpp @@ -14,8 +14,8 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" +#include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/elliptic_relation.hpp" -#include "barretenberg/relations/gen_perm_sort_relation.hpp" #include "barretenberg/relations/lookup_relation.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/poseidon2_external_relation.hpp" @@ -56,7 +56,7 @@ struct InputElements { FF& q_4 = std::get<4>(_data); FF& q_m = std::get<5>(_data); FF& q_arith = std::get<6>(_data); - FF& q_sort = std::get<7>(_data); + FF& q_delta_range = std::get<7>(_data); FF& q_elliptic = std::get<8>(_data); FF& q_aux = std::get<9>(_data); FF& q_lookup = std::get<10>(_data); @@ -282,10 +282,10 @@ TEST_F(UltraRelationConsistency, LookupRelation) run_test(/*random_inputs=*/true); }; -TEST_F(UltraRelationConsistency, GenPermSortRelation) +TEST_F(UltraRelationConsistency, DeltaRangeConstraintRelation) { const auto run_test = [](bool random_inputs) { - using Relation = GenPermSortRelation; + using Relation = DeltaRangeConstraintRelation; using SumcheckArrayOfValuesOverSubrelations = typename Relation::SumcheckArrayOfValuesOverSubrelations; const InputElements input_elements = random_inputs ? InputElements::get_random() : InputElements::get_special(); @@ -294,7 +294,7 @@ TEST_F(UltraRelationConsistency, GenPermSortRelation) const auto& w_3 = input_elements.w_o; const auto& w_4 = input_elements.w_4; const auto& w_1_shift = input_elements.w_l_shift; - const auto& q_sort = input_elements.q_sort; + const auto& q_delta_range = input_elements.q_delta_range; auto delta_1 = w_2 - w_1; auto delta_2 = w_3 - w_2; @@ -308,10 +308,10 @@ TEST_F(UltraRelationConsistency, GenPermSortRelation) SumcheckArrayOfValuesOverSubrelations expected_values; - expected_values[0] = contribution_1 * q_sort; - expected_values[1] = contribution_2 * q_sort; - expected_values[2] = contribution_3 * q_sort; - expected_values[3] = contribution_4 * q_sort; + expected_values[0] = contribution_1 * q_delta_range; + expected_values[1] = contribution_2 * q_delta_range; + expected_values[2] = contribution_3 * q_delta_range; + expected_values[3] = contribution_4 * q_delta_range; const auto parameters = RelationParameters::get_random(); diff --git a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp index 008cbd01570..a3d94d3ac79 100644 --- a/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp +++ b/barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.test.cpp @@ -2,8 +2,8 @@ #include "barretenberg/ecc/curves/bn254/fr.hpp" #include "barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" +#include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/elliptic_relation.hpp" -#include "barretenberg/relations/gen_perm_sort_relation.hpp" #include "barretenberg/relations/lookup_relation.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/ultra_arithmetic_relation.hpp" diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp index 2ff86d31da2..85a6eba0bc6 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/relation_correctness.test.cpp @@ -4,9 +4,9 @@ #include "barretenberg/honk/proof_system/permutation_library.hpp" #include "barretenberg/proof_system/library/grand_product_library.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" +#include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/ecc_op_queue_relation.hpp" #include "barretenberg/relations/elliptic_relation.hpp" -#include "barretenberg/relations/gen_perm_sort_relation.hpp" #include "barretenberg/relations/lookup_relation.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/relation_parameters.hpp" @@ -138,7 +138,7 @@ template void create_some_lookup_gates(auto& circuit_builder) plookup::MultiTableId::FIXED_BASE_LEFT_LO, sequence_data_lo, input_lo_index); } -template void create_some_genperm_sort_gates(auto& circuit_builder) +template void create_some_delta_range_constraint_gates(auto& circuit_builder) { // Add a sort gate (simply checks that consecutive inputs have a difference of < 4) using FF = typename Flavor::FF; @@ -257,7 +257,7 @@ TEST_F(RelationCorrectnessTests, UltraRelationCorrectness) // Create an assortment of representative gates create_some_add_gates(builder); create_some_lookup_gates(builder); - create_some_genperm_sort_gates(builder); + create_some_delta_range_constraint_gates(builder); create_some_elliptic_curve_addition_gates(builder); create_some_RAM_gates(builder); @@ -277,7 +277,7 @@ TEST_F(RelationCorrectnessTests, UltraRelationCorrectness) // Check that selectors are nonzero to ensure corresponding relation has nontrivial contribution ensure_non_zero(proving_key->q_arith); - ensure_non_zero(proving_key->q_sort); + ensure_non_zero(proving_key->q_delta_range); ensure_non_zero(proving_key->q_lookup); ensure_non_zero(proving_key->q_elliptic); ensure_non_zero(proving_key->q_aux); @@ -308,7 +308,7 @@ TEST_F(RelationCorrectnessTests, GoblinUltraRelationCorrectness) // Create an assortment of representative gates create_some_add_gates(builder); create_some_lookup_gates(builder); - create_some_genperm_sort_gates(builder); + create_some_delta_range_constraint_gates(builder); create_some_elliptic_curve_addition_gates(builder); create_some_RAM_gates(builder); create_some_ecc_op_queue_gates(builder); // Goblin! @@ -330,7 +330,7 @@ TEST_F(RelationCorrectnessTests, GoblinUltraRelationCorrectness) // Check that selectors are nonzero to ensure corresponding relation has nontrivial contribution ensure_non_zero(proving_key->q_arith); - ensure_non_zero(proving_key->q_sort); + ensure_non_zero(proving_key->q_delta_range); ensure_non_zero(proving_key->q_lookup); ensure_non_zero(proving_key->q_elliptic); ensure_non_zero(proving_key->q_aux); @@ -481,7 +481,7 @@ TEST_F(RelationCorrectnessTests, GoblinTranslatorPermutationRelationCorrectness) check_relation>(full_circuit_size, prover_polynomials, params); } -TEST_F(RelationCorrectnessTests, GoblinTranslatorGenPermSortRelationCorrectness) +TEST_F(RelationCorrectnessTests, GoblinTranslatorDeltaRangeConstraintRelationCorrectness) { using Flavor = GoblinTranslatorFlavor; using FF = typename Flavor::FF; @@ -502,11 +502,11 @@ TEST_F(RelationCorrectnessTests, GoblinTranslatorGenPermSortRelationCorrectness) polynomial = Polynomial{ circuit_size }; } - // Construct lagrange polynomials that are needed for Goblin Translator's GenPermSort Relation + // Construct lagrange polynomials that are needed for Goblin Translator's DeltaRangeConstraint Relation prover_polynomials.lagrange_first[0] = 1; prover_polynomials.lagrange_last[circuit_size - 1] = 1; - // Create a vector and fill with necessary steps for the GenPermSort relation + // Create a vector and fill with necessary steps for the DeltaRangeConstraint relation auto sorted_elements_count = (max_value / sort_step) + 1; std::vector vector_for_sorting(circuit_size); for (size_t i = 0; i < sorted_elements_count - 1; i++) { @@ -552,7 +552,7 @@ TEST_F(RelationCorrectnessTests, GoblinTranslatorGenPermSortRelationCorrectness) using Relations = typename Flavor::Relations; - // Check that GenPermSort relation is satisfied across each row of the prover polynomials + // Check that DeltaRangeConstraint relation is satisfied across each row of the prover polynomials check_relation>(circuit_size, prover_polynomials, params); } diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp index 69b3285d9d6..4f71fd5ea62 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/sumcheck.test.cpp @@ -4,8 +4,8 @@ #include "barretenberg/proof_system/library/grand_product_library.hpp" #include "barretenberg/proof_system/plookup_tables/fixed_base/fixed_base.hpp" #include "barretenberg/relations/auxiliary_relation.hpp" +#include "barretenberg/relations/delta_range_constraint_relation.hpp" #include "barretenberg/relations/elliptic_relation.hpp" -#include "barretenberg/relations/gen_perm_sort_relation.hpp" #include "barretenberg/relations/lookup_relation.hpp" #include "barretenberg/relations/permutation_relation.hpp" #include "barretenberg/relations/ultra_arithmetic_relation.hpp"