From 5566ba1a5be419258b33a4e254430121fe7911f6 Mon Sep 17 00:00:00 2001 From: Martun Karapetyan Date: Tue, 30 Apr 2024 18:45:23 +0400 Subject: [PATCH] Changes related to multiprecision updates. --- .../zk/types/plonk/assignment_table.hpp | 8 +- test/CMakeLists.txt | 7 + test/accumulation_vector.cpp | 4 +- test/detail/circuits.hpp | 218 +++++++++--------- test/eddsa.cpp | 4 +- test/fri_commitment.cpp | 8 +- test/kzg_commitment.cpp | 25 +- test/lpc_commitment.cpp | 14 +- test/merkle_proof.cpp | 4 +- test/placeholder_common_data.cpp | 4 +- test/placeholder_proof.cpp | 8 +- test/r1cs_gg_ppzksnark_primary_input.cpp | 4 +- test/r1cs_gg_ppzksnark_proof.cpp | 4 +- test/r1cs_gg_ppzksnark_verification_key.cpp | 4 +- test/sparse_vector.cpp | 4 +- 15 files changed, 166 insertions(+), 154 deletions(-) diff --git a/include/nil/crypto3/marshalling/zk/types/plonk/assignment_table.hpp b/include/nil/crypto3/marshalling/zk/types/plonk/assignment_table.hpp index ffa9385d6e..f0f0460916 100644 --- a/include/nil/crypto3/marshalling/zk/types/plonk/assignment_table.hpp +++ b/include/nil/crypto3/marshalling/zk/types/plonk/assignment_table.hpp @@ -157,22 +157,22 @@ namespace nil { fill_field_element_vector_from_columns_with_padding( assignments.witnesses(), assignments.rows_amount(), - 0 + 0u ), fill_field_element_vector_from_columns_with_padding( assignments.public_inputs(), assignments.rows_amount(), - 0 + 0u ), fill_field_element_vector_from_columns_with_padding( assignments.constants(), assignments.rows_amount(), - 0 + 0u ), fill_field_element_vector_from_columns_with_padding( assignments.selectors(), assignments.rows_amount(), - 0 + 0u ) ))); } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 120bbc8fa0..c3c6b55ab2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -64,6 +64,13 @@ macro(define_marshalling_test test) endif() endif() + + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_compile_options(${full_test_name} PRIVATE "-fconstexpr-steps=2147483647") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(${full_test_name} PRIVATE "-fconstexpr-ops-limit=4294967295") + endif() + endmacro() set(TESTS_NAMES diff --git a/test/accumulation_vector.cpp b/test/accumulation_vector.cpp index 1f69f7410a..2479f94677 100644 --- a/test/accumulation_vector.cpp +++ b/test/accumulation_vector.cpp @@ -36,8 +36,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/test/detail/circuits.hpp b/test/detail/circuits.hpp index 8a24b3ced2..e9d8a76213 100644 --- a/test/detail/circuits.hpp +++ b/test/detail/circuits.hpp @@ -139,9 +139,9 @@ namespace nil { q_add[i] = one; q_mul[i] = FieldType::value_type::zero(); - plonk_variable x(1, i, false, + plonk_variable x(1u, i, false, plonk_variable::column_type::witness); - plonk_variable y(2, i - 1, false, + plonk_variable y(2, i - 1u, false, plonk_variable::column_type::witness); //test_circuit.copy_constraints.push_back(plonk_copy_constraint(x, y)); } @@ -155,9 +155,9 @@ namespace nil { q_add[i] = FieldType::value_type::zero(); q_mul[i] = one; - plonk_variable x(1, i, false, + plonk_variable x(1u, i, false, plonk_variable::column_type::witness); - plonk_variable y(0, 0, false, + plonk_variable y(0u, 0u, false, plonk_variable::column_type::public_input); test_circuit.copy_constraints.push_back(plonk_copy_constraint(x, y)); } @@ -184,9 +184,9 @@ namespace nil { test_circuit.table_rows = zk_padding>(test_circuit.table, alg_rnd); - plonk_variable w0(0, 0, true, plonk_variable::column_type::witness); - plonk_variable w1(1, 0, true, plonk_variable::column_type::witness); - plonk_variable w2(2, 0, true, plonk_variable::column_type::witness); + plonk_variable w0(0u, 0u, true, plonk_variable::column_type::witness); + plonk_variable w1(1u, 0u, true, plonk_variable::column_type::witness); + plonk_variable w2(2, 0u, true, plonk_variable::column_type::witness); plonk_constraint add_constraint; add_constraint += w0; @@ -194,7 +194,7 @@ namespace nil { add_constraint -= w2; std::vector> add_gate_costraints {add_constraint}; - plonk_gate> add_gate(0, add_gate_costraints); + plonk_gate> add_gate(0u, add_gate_costraints); test_circuit.gates.push_back(add_gate); plonk_constraint mul_constraint; @@ -204,7 +204,7 @@ namespace nil { mul_constraint -= w2; std::vector> mul_gate_costraints {mul_constraint}; - plonk_gate> mul_gate(1, mul_gate_costraints); + plonk_gate> mul_gate(1u, mul_gate_costraints); test_circuit.gates.push_back(mul_gate); return test_circuit; @@ -220,7 +220,7 @@ namespace nil { // k-1 | MUL | x | y | z | 0 | 0 | 1 | // // ADD: x + y = z, copy(prev(z), y) - // MUL: x * y + prev(x) = z, copy(p1, y) + // MUL: x * y + prev(x) = z, copy(p1u, y) //---------------------------------------------------------------------------// constexpr static const std::size_t witness_columns_t = 3; constexpr static const std::size_t public_columns_t = 1; @@ -231,7 +231,7 @@ namespace nil { template circuit_description, usable_rows_t> circuit_test_t( - typename FieldType::value_type pi0 = 0, + typename FieldType::value_type pi0 = 0u, typename nil::crypto3::random::algebraic_engine alg_rnd = nil::crypto3::random::algebraic_engine(), boost::random::mt11213b rnd = boost::random::mt11213b() ) { @@ -276,9 +276,9 @@ namespace nil { q_add[i] = one; q_mul[i] = FieldType::value_type::zero(); - plonk_variable x(1, i, false, + plonk_variable x(1u, i, false, plonk_variable::column_type::witness); - plonk_variable y(2, i - 1, false, + plonk_variable y(2, i - 1u, false, plonk_variable::column_type::witness); test_circuit.copy_constraints.push_back(plonk_copy_constraint(x, y)); } @@ -292,9 +292,9 @@ namespace nil { q_add[i] = FieldType::value_type::zero(); q_mul[i] = one; - plonk_variable x(1, i, false, + plonk_variable x(1u, i, false, plonk_variable::column_type::witness); - plonk_variable y(0, 0, false, + plonk_variable y(0u, 0u, false, plonk_variable::column_type::public_input); test_circuit.copy_constraints.push_back(plonk_copy_constraint(x, y)); } @@ -322,13 +322,13 @@ namespace nil { public_input_assignment, constant_assignment, selectors_assignment)); test_circuit.table_rows = zk_padding>(test_circuit.table, alg_rnd); - plonk_variable w0(0, 0, true, + plonk_variable w0(0u, 0u, true, plonk_variable::column_type::witness); - plonk_variable w1(1, 0, true, + plonk_variable w1(1u, 0u, true, plonk_variable::column_type::witness); - plonk_variable w2(2, 0, true, + plonk_variable w2(2, 0u, true, plonk_variable::column_type::witness); - plonk_variable w0_prev(0, -1, true, + plonk_variable w0_prev(0u, -1u, true, plonk_variable::column_type::witness); plonk_constraint add_constraint; @@ -337,7 +337,7 @@ namespace nil { add_constraint -= w2; std::vector> add_gate_costraints {add_constraint}; - plonk_gate> add_gate(0, add_gate_costraints); + plonk_gate> add_gate(0u, add_gate_costraints); test_circuit.gates.push_back(add_gate); plonk_constraint mul_constraint; @@ -348,7 +348,7 @@ namespace nil { mul_constraint += w0_prev; std::vector> mul_gate_costraints {mul_constraint}; - plonk_gate> mul_gate(1, mul_gate_costraints); + plonk_gate> mul_gate(1u, mul_gate_costraints); //test_circuit.gates.push_back(mul_gate); return test_circuit; @@ -386,13 +386,13 @@ namespace nil { } // lookup inputs - table[0] = {1, 0, 0, 0}; // Witness 1 - table[1] = {0, 0, 0, 0}; - table[2] = {0, 0, 0, 0}; + table[0] = {1u, 0u, 0u, 0u}; // Witness 1 + table[1] = {0u, 0u, 0u, 0u}; + table[2] = {0u, 0u, 0u, 0u}; - table[3] = {0, 1, 0, 1}; //Lookup values - table[4] = {0, 0, 1, 0}; //Lookup values - table[5] = {0, 1, 0, 0}; //Lookup values + table[3] = {0u, 1u, 0u, 1u}; //Lookup values + table[4] = {0u, 0u, 1u, 0u}; //Lookup values + table[5] = {0u, 1u, 0u, 0u}; //Lookup values std::vector> private_assignment(witness_columns); for (std::size_t i = 0; i < witness_columns; i++) { @@ -404,11 +404,11 @@ namespace nil { std::vector> constant_assignment(constant_columns); std::vector sel_lookup(test_circuit.table_rows); - sel_lookup = {1, 0, 0, 0}; + sel_lookup = {1u, 0u, 0u, 0u}; selectors_assignment[0] = sel_lookup; std::vector sel_lookup_table(test_circuit.table_rows); - sel_lookup_table = {0, 1, 1, 1}; + sel_lookup_table = {0u, 1u, 1u, 1u}; selectors_assignment[1] = sel_lookup_table; for (std::size_t i = 0; i < constant_columns; i++) { @@ -420,13 +420,13 @@ namespace nil { public_input_assignment, constant_assignment, selectors_assignment)); test_circuit.table_rows = zk_padding(test_circuit.table, alg_rnd); - plonk_variable w0(0, 0, true, plonk_variable::column_type::witness); - plonk_variable w1(1, 0, true, plonk_variable::column_type::witness); - plonk_variable w2(2, 0, true, plonk_variable::column_type::witness); + plonk_variable w0(0u, 0u, true, plonk_variable::column_type::witness); + plonk_variable w1(1u, 0u, true, plonk_variable::column_type::witness); + plonk_variable w2(2, 0u, true, plonk_variable::column_type::witness); - plonk_variable c0(0, 0, true, plonk_variable::column_type::constant); - plonk_variable c1(1, 0, true, plonk_variable::column_type::constant); - plonk_variable c2(2, 0, true, plonk_variable::column_type::constant); + plonk_variable c0(0u, 0u, true, plonk_variable::column_type::constant); + plonk_variable c1(1u, 0u, true, plonk_variable::column_type::constant); + plonk_variable c2(2, 0u, true, plonk_variable::column_type::constant); plonk_lookup_constraint lookup_constraint; @@ -436,7 +436,7 @@ namespace nil { lookup_constraint.table_id = 1; std::vector> lookup_constraints = {lookup_constraint}; - plonk_lookup_gate> lookup_gate(0, lookup_constraints); + plonk_lookup_gate> lookup_gate(0u, lookup_constraints); test_circuit.lookup_gates.push_back(lookup_gate); // Add constructor for lookup table @@ -493,16 +493,19 @@ namespace nil { } // lookup inputs - table[0] = {rnd() % 2, rnd() % 2, rnd(), rnd() % 2, rnd() % 2, 0, 0, 0}; - table[1] = {rnd() % 2, rnd() % 2, rnd(), rnd() % 2, rnd() % 2, 0, 0, 0};; - table[2] = {table[0][0] * table[1][0], table[0][1] * table[1][1], table[0][2] * table[1][2], table[0][3] * table[1][3], table[0][4] * table[1][4], 0, 0, 0}; + table[0] = {unsigned(rnd() % 2), unsigned(rnd() % 2), unsigned(rnd() % 2), + unsigned(rnd() % 2), unsigned(rnd() % 2), 0u, 0u, 0u}; + table[1] = {unsigned(rnd() % 2), unsigned(rnd() % 2), unsigned(rnd() % 2), + unsigned(rnd() % 2), unsigned(rnd() % 2), 0u, 0u, 0u};; + table[2] = {table[0][0] * table[1][0], table[0][1] * table[1][1], + table[0][2] * table[1][2], table[0][3] * table[1][3], table[0][4] * table[1][4], 0u, 0u, 0u}; //lookup values // Reserved zero row for unselected lookup input rows - table[3] = {0, 0, 0, 1, 1, 0, 0, 0}; - table[4] = {0, 0, 1, 0, 1, 0, 0, 0}; - table[5] = {0, 0, 0, 0, 1, 0, 0, 0}; + table[3] = {0u, 0u, 0u, 1u, 1u, 0u, 0u, 0u}; + table[4] = {0u, 0u, 1u, 0u, 1u, 0u, 0u, 0u}; + table[5] = {0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u}; std::vector> private_assignment(witness_columns); for (std::size_t i = 0; i < witness_columns; i++) { @@ -513,9 +516,9 @@ namespace nil { std::vector> public_input_assignment(public_columns); std::vector> constant_assignment(constant_columns); - selectors_assignment[0] = {1, 1, 0, 1, 1, 0, 0, 0}; - selectors_assignment[1] = {1, 1, 1, 1, 1, 0, 0, 0}; - selectors_assignment[2] = {0, 1, 1, 1, 1, 0, 0, 0}; + selectors_assignment[0] = {1u, 1u, 0u, 1u, 1u, 0u, 0u, 0u}; + selectors_assignment[1] = {1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u}; + selectors_assignment[2] = {0u, 1u, 1u, 1u, 1u, 0u, 0u, 0u}; for (std::size_t i = 0; i < constant_columns; i++) { constant_assignment[i] = table[witness_columns + i]; @@ -526,13 +529,13 @@ namespace nil { public_input_assignment, constant_assignment, selectors_assignment)); - plonk_variable w0(0, 0, true, plonk_variable::column_type::witness); - plonk_variable w1(1, 0, true, plonk_variable::column_type::witness); - plonk_variable w2(2, 0, true, plonk_variable::column_type::witness); + plonk_variable w0(0u, 0u, true, plonk_variable::column_type::witness); + plonk_variable w1(1u, 0u, true, plonk_variable::column_type::witness); + plonk_variable w2(2, 0u, true, plonk_variable::column_type::witness); - plonk_variable c0(0, 0, true, plonk_variable::column_type::constant); - plonk_variable c1(1, 0, true, plonk_variable::column_type::constant); - plonk_variable c2(2, 0, true, plonk_variable::column_type::constant); + plonk_variable c0(0u, 0u, true, plonk_variable::column_type::constant); + plonk_variable c1(1u, 0u, true, plonk_variable::column_type::constant); + plonk_variable c2(2, 0u, true, plonk_variable::column_type::constant); plonk_constraint mul_constraint; typename plonk_constraint::term_type w0_term(w0); @@ -541,7 +544,7 @@ namespace nil { mul_constraint -= w2; std::vector> mul_gate_costraints {mul_constraint}; - plonk_gate> mul_gate(1, mul_gate_costraints); + plonk_gate> mul_gate(1u, mul_gate_costraints); test_circuit.gates.push_back(mul_gate); plonk_lookup_constraint lookup_constraint; @@ -607,12 +610,12 @@ namespace nil { for(std::size_t i = 0; i < witness_columns; i++) { private_assignment[i].resize(test_circuit.usable_rows); private_assignment[i][0] = private_assignment[i][2] = public_input_assignment[0][i] = typename FieldType::value_type(rnd() % witness_columns); - private_assignment[i][1] = 1; - plonk_variable pi(0, i, false, plonk_variable::column_type::public_input); - plonk_variable wi(i, 0, false, plonk_variable::column_type::witness); + private_assignment[i][1] = 1u; + plonk_variable pi(0u, i, false, plonk_variable::column_type::public_input); + plonk_variable wi(i, 0u, false, plonk_variable::column_type::witness); test_circuit.copy_constraints.push_back(plonk_copy_constraint({pi, wi})); } - selectors_assignment[0][1] = 1; + selectors_assignment[0][1] = 1u; test_circuit.table = plonk_assignment_table( plonk_private_assignment_table(private_assignment), @@ -622,13 +625,13 @@ namespace nil { std::vector> mul_gate_constraints; for( std::size_t i = 0; i < witness_columns; i++){ - plonk_variable w0(i, -1, true, plonk_variable::column_type::witness); - plonk_variable w1(i, 0, true, plonk_variable::column_type::witness); - plonk_variable w2(i, 1, true, plonk_variable::column_type::witness); + plonk_variable w0(i, -1u, true, plonk_variable::column_type::witness); + plonk_variable w1(i, 0u, true, plonk_variable::column_type::witness); + plonk_variable w2(i, 1u, true, plonk_variable::column_type::witness); mul_gate_constraints.push_back(w0 - w1 * w2); } - plonk_gate> mul_gate(0, mul_gate_constraints); + plonk_gate> mul_gate(0u, mul_gate_constraints); test_circuit.gates.push_back(mul_gate); return test_circuit; @@ -690,13 +693,13 @@ namespace nil { table[2][0] = zero; table[2][1] = one; - plonk_variable x0(0, 0, false, plonk_variable::column_type::witness); - plonk_variable x1(0, 1, false, plonk_variable::column_type::witness); - plonk_variable p0(1, 0, false, plonk_variable::column_type::public_input); - plonk_variable p1(1, 1, false, plonk_variable::column_type::public_input); + plonk_variable x0(0u, 0u, false, plonk_variable::column_type::witness); + plonk_variable x1(0u, 1u, false, plonk_variable::column_type::witness); + plonk_variable p0(1u, 0u, false, plonk_variable::column_type::public_input); + plonk_variable p1(1u, 1u, false, plonk_variable::column_type::public_input); -// test_circuit.copy_constraints.push_back(plonk_copy_constraint(x0, p0)); -// test_circuit.copy_constraints.push_back(plonk_copy_constraint(x1, p1)); +// test_circuit.copy_constraints.push_back(plonk_copy_constraint(x0u, p0)); +// test_circuit.copy_constraints.push_back(plonk_copy_constraint(x1u, p1)); for (std::size_t i = 2; i < test_circuit.usable_rows - 1; i++) { table[0][i] = table[0][i-2] + table[0][i-1]; @@ -723,9 +726,9 @@ namespace nil { public_input_assignment, constant_assignment, selectors_assignment)); test_circuit.table_rows = zk_padding>(test_circuit.table, alg_rnd); - plonk_variable w0(0, -1, true, plonk_variable::column_type::witness); - plonk_variable w1(0, 0, true, plonk_variable::column_type::witness); - plonk_variable w2(0, 1, true, plonk_variable::column_type::witness); + plonk_variable w0(0u, -1u, true, plonk_variable::column_type::witness); + plonk_variable w1(0u, 0u, true, plonk_variable::column_type::witness); + plonk_variable w2(0u, 1u, true, plonk_variable::column_type::witness); typename plonk_constraint::term_type w0_term(w0); typename plonk_constraint::term_type w1_term(w1); @@ -737,7 +740,7 @@ namespace nil { fib_constraint -= w2_term; std::vector> fib_costraints {fib_constraint}; - plonk_gate> fib_gate(0, fib_costraints); + plonk_gate> fib_gate(0u, fib_costraints); test_circuit.gates.push_back(fib_gate); return test_circuit; @@ -792,20 +795,21 @@ namespace nil { } // lookup inputs - table[0] = {rnd() % 5 + 2, rnd() % 5 + 2, rnd() % 5 + 2, rnd() % 5 + 2, rnd() % 5 + 2, rnd() % 5 + 2}; - table[1] = {7, table[0][0] + table[0][1], table[0][1] + table[0][2], table[0][2] + table[0][3], table[0][3] + table[0][4], table[0][4] + table[0][5]}; - + table[0] = {unsigned(rnd() % 5 + 2), unsigned(rnd() % 5 + 2), unsigned(rnd() % 5 + 2), + unsigned(rnd() % 5 + 2), unsigned(rnd() % 5 + 2), unsigned(rnd() % 5 + 2)}; + table[1] = {7u, table[0][0] + table[0][1], table[0][1] + table[0][2], table[0][2] + table[0][3], + table[0][3] + table[0][4], table[0][4] + table[0][5]}; // selectors // Reserved zero row for unselected lookup input rows - table[2] = {0, 1, 1, 1, 1, 1}; // LT1 - table[3] = {1, 1, 1, 1, 1, 1}; // For the first lookup gate - table[4] = {0, 1, 1, 1, 1, 1}; // For the second lookup gate + table[2] = {0u, 1u, 1u, 1u, 1u, 1u}; // LT1 + table[3] = {1u, 1u, 1u, 1u, 1u, 1u}; // For the first lookup gate + table[4] = {0u, 1u, 1u, 1u, 1u, 1u}; // For the second lookup gate // Lookup values - table[5] = {0, 2, 3, 4, 5, 6}; // L1 - table[6] = {0, 7, 8, 9, 10, 11}; // L2 - table[7] = {0, 12, 12, 12, 12, 12}; // L3 + table[5] = {0u, 2u, 3u, 4u, 5u, 6u}; // L1 + table[6] = {0u, 7u, 8u, 9u, 10u, 11u}; // L2 + table[7] = {0u, 12u, 12u, 12u, 12u, 12u}; // L3 std::vector> private_assignment(witness_columns); for (std::size_t i = 0; i < witness_columns; i++) { @@ -829,9 +833,9 @@ namespace nil { public_input_assignment, constant_assignment, selectors_assignment)); test_circuit.table_rows = zk_padding(test_circuit.table, alg_rnd); - plonk_variable w0( 0, 0, true, plonk_variable::column_type::witness); + plonk_variable w0 (0, 0, true, plonk_variable::column_type::witness); plonk_variable w0_1(0,-1, true, plonk_variable::column_type::witness); - plonk_variable w1( 1, 0, true, plonk_variable::column_type::witness); + plonk_variable w1 (1, 0, true, plonk_variable::column_type::witness); plonk_variable c0(0, 0, true, plonk_variable::column_type::constant); plonk_variable c1(1, 0, true, plonk_variable::column_type::constant); @@ -846,7 +850,7 @@ namespace nil { lookup_constraint2.table_id = 2; std::vector> lookup_constraints = {lookup_constraint1, lookup_constraint2}; - plonk_lookup_gate> lookup_gate(1, lookup_constraints); + plonk_lookup_gate> lookup_gate(1u, lookup_constraints); test_circuit.lookup_gates.push_back(lookup_gate); @@ -862,11 +866,11 @@ namespace nil { test_circuit.lookup_gates.push_back(lookup_gate2); // Add constructor for lookup table - plonk_lookup_table table1(1, 0); // 2 -- selector_id, 3 -- number of columns; + plonk_lookup_table table1(1u, 0u); // 2 -- selector_id, 3 -- number of columns; table1.append_option({c0}); test_circuit.lookup_tables.push_back(table1); - plonk_lookup_table table2(1, 0); // 2 -- selector_id, 3 -- number of columns; + plonk_lookup_table table2(1u, 0u); // 2 -- selector_id, 3 -- number of columns; table2.append_option({c0}); table2.append_option({c1}); table2.append_option({c2}); @@ -876,8 +880,8 @@ namespace nil { } // Big columns rotations check: - // Table 1: LT1 options: {L1, L2, L3, L4, L5, L6, L7} - // Table 2: LT2 options: {L1, L2} || { L3, L4 } + // Table 1: LT1 options: {L1u, L2, L3, L4, L5, L6, L7} + // Table 2: LT2 options: {L1u, L2} || { L3, L4 } // Table 3: LT2 options: {L5} || {L6} || {L7} // Lookup gate1: // w1{-3}, w1{-2}, w1{-1}, w1, w1{+1}, w1{+2},w1{+3}, \in Table 1 selector s2 @@ -939,7 +943,7 @@ namespace nil { for( std::size_t i = 0; i < 7; i++){ if( j == r ) j++; table[0][i] = j; - table[1][i] = (typename FieldType::value_type(2)).pow(j); + table[1][i] = (typename FieldType::value_type(2u)).pow(j); j++; } for( std::size_t i = 7; i < 14; i++){ @@ -950,22 +954,22 @@ namespace nil { // selectors // Reserved zero row for unselected lookup input rows std::vector> selectors_assignment(selector_columns); - selectors_assignment[0] = {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }; // Selector for single gate - selectors_assignment[1] = {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }; // Selector lookup gate with multiple rotations - selectors_assignment[2] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; // Selector for gate w1 = 2^w0 - selectors_assignment[3] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; // Selector for gate w1_{-1} * w1 \in Table 3 - selectors_assignment[4] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 }; // Selector for lookup tables 2, 3 - selectors_assignment[5] = {0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }; // Selector for lookup table with 7 columns + selectors_assignment[0] = {0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u }; // Selector for single gate + selectors_assignment[1] = {0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u }; // Selector lookup gate with multiple rotations + selectors_assignment[2] = {1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u }; // Selector for gate w1 = 2^w0 + selectors_assignment[3] = {0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u }; // Selector for gate w1_{-1} * w1 \in Table 3 + selectors_assignment[4] = {0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u }; // Selector for lookup tables 2, 3 + selectors_assignment[5] = {0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, 0u }; // Selector for lookup table with 7 columns // Lookup values std::vector> constant_assignment(constant_columns); - constant_assignment[0] = {0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5 }; // Lookup tables - constant_assignment[1] = {0, 2, 2, 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 32 }; // Lookup tables - constant_assignment[2] = {0, 3, 3, 3, 2, 2, 2, 2, 6, 7, 7, 7, 7, 7 }; // Lookup tables - constant_assignment[3] = {0, 4, 4, 4, 4, 3, 3, 3, 64, 128, 128, 128, 128, 128 }; // Lookup tables - constant_assignment[4] = {0, 5, 5, 5, 5, 5, 4, 4, 1, 2, 4, 8, 16, 32 }; // Lookup tables - constant_assignment[5] = {0, 6, 6, 6, 6, 6, 6, 5, 64, 128, 256, 512, 1024, 2048 }; // Lookup tables - constant_assignment[6] = {0, 7, 7, 7, 7, 7, 7, 7,4096,8192,16384,16384,16384,16384 }; // Lookup tables + constant_assignment[0] = {0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 2u, 3u, 4u, 5u }; // Lookup tables + constant_assignment[1] = {0u, 2u, 2u, 1u, 1u, 1u, 1u, 1u, 1u, 2u, 4u, 8u, 16u, 32u }; // Lookup tables + constant_assignment[2] = {0u, 3u, 3u, 3u, 2u, 2u, 2u, 2u, 6u, 7u, 7u, 7u, 7u, 7u }; // Lookup tables + constant_assignment[3] = {0u, 4u, 4u, 4u, 4u, 3u, 3u, 3u, 64u, 128u, 128u, 128u, 128u, 128u }; // Lookup tables + constant_assignment[4] = {0u, 5u, 5u, 5u, 5u, 5u, 4u, 4u, 1u, 2u, 4u, 8u, 16u, 32u }; // Lookup tables + constant_assignment[5] = {0u, 6u, 6u, 6u, 6u, 6u, 6u, 5u, 64u, 128u, 256u, 512u, 1024u, 2048u }; // Lookup tables + constant_assignment[6] = {0u, 7u, 7u, 7u, 7u, 7u, 7u, 7u,4096u,8192u,16384u,16384u,16384u,16384u }; // Lookup tables std::vector> private_assignment(witness_columns); for (std::size_t i = 0; i < witness_columns; i++) { @@ -980,15 +984,17 @@ namespace nil { public_input_assignment, constant_assignment, selectors_assignment)); test_circuit.table_rows = zk_padding(test_circuit.table, alg_rnd); - plonk_variable w0( 0, 0, true, plonk_variable::column_type::witness); - plonk_variable w0__7(0,-7, true, plonk_variable::column_type::witness); + plonk_variable w0(0, 0, true, + plonk_variable::column_type::witness); + plonk_variable w0__7(0, -7, true, + plonk_variable::column_type::witness); plonk_constraint add_constraint; add_constraint += w0; add_constraint -= w0__7; std::vector> add_gate_costraints {add_constraint}; - plonk_gate> add_gate(0, add_gate_costraints); + plonk_gate> add_gate(0u, add_gate_costraints); test_circuit.gates.push_back(add_gate); plonk_variable w0__3( 0,-3, true, plonk_variable::column_type::witness); @@ -1012,10 +1018,10 @@ namespace nil { lookup_constraint1.table_id = 1; std::vector> lookup_constraints = {lookup_constraint1}; - plonk_lookup_gate> lookup_gate(1, lookup_constraints); + plonk_lookup_gate> lookup_gate(1u, lookup_constraints); test_circuit.lookup_gates.push_back(lookup_gate); - plonk_variable w1( 1, 0, true, plonk_variable::column_type::witness); + plonk_variable w1(1, 0, true, plonk_variable::column_type::witness); plonk_lookup_constraint lookup_constraint2; lookup_constraint2.lookup_input = {w0, w1}; lookup_constraint2.table_id = 2; @@ -1024,7 +1030,7 @@ namespace nil { plonk_lookup_gate> lookup_gate2(2, lookup_constraints2); test_circuit.lookup_gates.push_back(lookup_gate2); - plonk_variable w1__1( 1, -1, true, plonk_variable::column_type::witness); + plonk_variable w1__1( 1u, -1u, true, plonk_variable::column_type::witness); plonk_lookup_constraint lookup_constraint3; typename plonk_constraint::term_type w1__1_term(w1__1); typename plonk_constraint::term_type w1_term(w1); diff --git a/test/eddsa.cpp b/test/eddsa.cpp index 67e7a2cd96..d48a232589 100644 --- a/test/eddsa.cpp +++ b/test/eddsa.cpp @@ -38,8 +38,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/test/fri_commitment.cpp b/test/fri_commitment.cpp index 01d6fe3c12..a9070c6d77 100644 --- a/test/fri_commitment.cpp +++ b/test/fri_commitment.cpp @@ -40,8 +40,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -331,7 +331,7 @@ BOOST_FIXTURE_TEST_SUITE(marshalling_fri_proof_elements, zk::test_tools::random_ BOOST_AUTO_TEST_CASE(polynomial_test) { using polynomial_type = math::polynomial; - polynomial_type f = {1, 3, 4, 1, 5, 6, 7, 2, 8, 7, 5, 6, 1, 2, 1, 1}; + polynomial_type f = {{1u, 3u, 4u, 1u, 5u, 6u, 7u, 2u, 8u, 7u, 5u, 6u, 1u, 2u, 1u, 1u}}; auto filled_polynomial = nil::crypto3::marshalling::types::fill_fri_math_polynomial(f); auto _f = nil::crypto3::marshalling::types::make_fri_math_polynomial(filled_polynomial); @@ -460,7 +460,7 @@ BOOST_AUTO_TEST_CASE(marshalling_fri_basic_test) { BOOST_CHECK(D[1]->get_domain_element(1) == D[0]->get_domain_element(1).squared()); // commit - math::polynomial f = {1, 3, 4, 1, 5, 6, 7, 2, 8, 7, 5, 6, 1, 2, 1, 1}; + math::polynomial f = {{1u, 3u, 4u, 1u, 5u, 6u, 7u, 2u, 8u, 7u, 5u, 6u, 1u, 2u, 1u, 1u}}; std::array>, 1> fs; fs[0].resize(1); fs[0][0] = f; diff --git a/test/kzg_commitment.cpp b/test/kzg_commitment.cpp index 5e7fcc9a9f..e8b37bf809 100644 --- a/test/kzg_commitment.cpp +++ b/test/kzg_commitment.cpp @@ -38,8 +38,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -53,7 +53,7 @@ #include #include -#include +#include /* #include @@ -98,16 +98,16 @@ struct placeholder_class_test_initializer { using kzg_scheme_type = typename zk::commitments::kzg_commitment_scheme_v2; using endianness = nil::marshalling::option::big_endian; - scalar_value_type alpha = 7; + scalar_value_type alpha = 7u; auto params = kzg_scheme_type::create_params(8, alpha); kzg_scheme_type kzg(params); typename kzg_type::batch_of_polynomials_type polys(4); - polys[0].template from_coefficients>({{ 1, 2, 3, 4, 5, 6, 7, 8}}); - polys[1].template from_coefficients>({{11, 12, 13, 14, 15, 16, 17, 18}}); - polys[2].template from_coefficients>({{21, 22, 23, 24, 25, 26, 27, 28}}); - polys[3].template from_coefficients>({{31, 32, 33, 34, 35, 36, 37, 38}}); + polys[0].template from_coefficients>({{ 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u}}); + polys[1].template from_coefficients>({{11u, 12u, 13u, 14u, 15u, 16u, 17u, 18u}}); + polys[2].template from_coefficients>({{21u, 22u, 23u, 24u, 25u, 26u, 27u, 28u}}); + polys[3].template from_coefficients>({{31u, 32u, 33u, 34u, 35u, 36u, 37u, 38u}}); std::size_t batch_id = 0; @@ -116,10 +116,10 @@ struct placeholder_class_test_initializer { std::map commitments; commitments[batch_id] = kzg.commit(batch_id); - std::set points_0 = {101, 2, 3}; - std::set points_1 = {102, 2, 3}; - std::set points_2 = { 1, 2, 3}; - std::set points_3 = {104, 2, 3}; + std::set points_0 = {101u, 2u, 3u}; + std::set points_1 = {102u, 2u, 3u}; + std::set points_2 = { 1u, 2u, 3u}; + std::set points_3 = {104u, 2u, 3u}; kzg.append_eval_points(batch_id, 0, points_0); kzg.append_eval_points(batch_id, 1, points_1); kzg.append_eval_points(batch_id, 2, points_2); @@ -154,7 +154,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(placeholder_class_test, F, TestFixtures) { BOOST_CHECK(fixture.run_test()); } - BOOST_AUTO_TEST_SUITE_END() /* diff --git a/test/lpc_commitment.cpp b/test/lpc_commitment.cpp index debe58a099..75ca64ceaf 100644 --- a/test/lpc_commitment.cpp +++ b/test/lpc_commitment.cpp @@ -42,8 +42,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -483,11 +483,11 @@ BOOST_FIXTURE_TEST_CASE(batches_num_3_test, zk::test_tools::random_test_initiali lpc_scheme_type lpc_scheme_verifier(fri_params); // Generate polynomials - lpc_scheme_prover.append_to_batch(0, {1, 13, 4, 1, 5, 6, 7, 2, 8, 7, 5, 6, 1, 2, 1, 1}); - lpc_scheme_prover.append_to_batch(2, {0, 1}); - lpc_scheme_prover.append_to_batch(2, {0, 1, 2}); - lpc_scheme_prover.append_to_batch(2, {0, 1, 3}); - lpc_scheme_prover.append_to_batch(3, {0}); + lpc_scheme_prover.append_to_batch(0, {1u, 13u, 4u, 1u, 5u, 6u, 7u, 2u, 8u, 7u, 5u, 6u, 1u, 2u, 1u, 1u}); + lpc_scheme_prover.append_to_batch(2, {0u, 1u}); + lpc_scheme_prover.append_to_batch(2, {0u, 1u, 2u}); + lpc_scheme_prover.append_to_batch(2, {0u, 1u, 3u}); + lpc_scheme_prover.append_to_batch(3, {0u}); // Commit std::map commitments; diff --git a/test/merkle_proof.cpp b/test/merkle_proof.cpp index 6e2d549193..613c8965d4 100644 --- a/test/merkle_proof.cpp +++ b/test/merkle_proof.cpp @@ -40,8 +40,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/test/placeholder_common_data.cpp b/test/placeholder_common_data.cpp index 7989a2d9e0..7cf32bf6d7 100644 --- a/test/placeholder_common_data.cpp +++ b/test/placeholder_common_data.cpp @@ -15,8 +15,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/test/placeholder_proof.cpp b/test/placeholder_proof.cpp index a32e620bf6..2eb1440536 100644 --- a/test/placeholder_proof.cpp +++ b/test/placeholder_proof.cpp @@ -42,8 +42,8 @@ #include #include -#include -#include +#include +#include #include @@ -250,7 +250,7 @@ template void print_public_input(ColumnType &public_input, std::string filename){ std::size_t max_non_zero = 0; for(std::size_t i = 0; i < public_input.size(); i++){ - if( public_input[i] != 0 ){ + if( public_input[i] != 0u ){ max_non_zero = i + 1; } } @@ -1162,7 +1162,7 @@ struct placeholder_kzg_test_fixture_v2 : public test_tools::random_test_initiali typename policy_type::variable_assignment_type assignments = circuit.table; // KZG commitment scheme - typename kzg_type::field_type::value_type alpha (7); + typename kzg_type::field_type::value_type alpha(7u); auto kzg_params = kzg_scheme_type::create_params(1 << table_rows_log, alpha); kzg_scheme_type kzg_scheme(kzg_params); diff --git a/test/r1cs_gg_ppzksnark_primary_input.cpp b/test/r1cs_gg_ppzksnark_primary_input.cpp index 4f460b0c3d..349af1b9c2 100644 --- a/test/r1cs_gg_ppzksnark_primary_input.cpp +++ b/test/r1cs_gg_ppzksnark_primary_input.cpp @@ -37,8 +37,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/test/r1cs_gg_ppzksnark_proof.cpp b/test/r1cs_gg_ppzksnark_proof.cpp index f397e80dac..a0a046cae0 100644 --- a/test/r1cs_gg_ppzksnark_proof.cpp +++ b/test/r1cs_gg_ppzksnark_proof.cpp @@ -37,8 +37,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/test/r1cs_gg_ppzksnark_verification_key.cpp b/test/r1cs_gg_ppzksnark_verification_key.cpp index aa83b2f0fd..9d3259ec68 100644 --- a/test/r1cs_gg_ppzksnark_verification_key.cpp +++ b/test/r1cs_gg_ppzksnark_verification_key.cpp @@ -37,8 +37,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/test/sparse_vector.cpp b/test/sparse_vector.cpp index cc920affbb..67ec498ab6 100644 --- a/test/sparse_vector.cpp +++ b/test/sparse_vector.cpp @@ -36,8 +36,8 @@ #include #include -#include -#include +#include +#include #include #include