26
26
// SOFTWARE.
27
27
// ---------------------------------------------------------------------------//
28
28
29
- #ifndef CRYPTO3_ZK_MARSHALLING_TEST_PLONK_CIRCUITS_HPP
30
- #define CRYPTO3_ZK_MARSHALLING_TEST_PLONK_CIRCUITS_HPP
31
-
32
- #define _RND_ algebra::random_element<FieldType>();
29
+ #ifndef MARSHALLING_ZK_TEST_PLONK_CIRCUITS_HPP
30
+ #define MARSHALLING_ZK_TEST_PLONK_CIRCUITS_HPP
33
31
34
32
#include < nil/crypto3/algebra/random_element.hpp>
35
33
@@ -105,7 +103,8 @@ namespace nil {
105
103
106
104
template <typename FieldType>
107
105
circuit_description<FieldType, placeholder_circuit_params<FieldType, arithmetization_params_1>, 4 , 4 > circuit_test_1 (
108
- typename nil::crypto3::random::algebraic_engine<FieldType> alg_rnd = nil::crypto3::random::algebraic_engine<FieldType>()
106
+ typename nil::crypto3::random::algebraic_engine<FieldType> alg_rnd = nil::crypto3::random::algebraic_engine<FieldType>(),
107
+ boost::random::mt11213b rnd = boost::random::mt11213b()
109
108
) {
110
109
using assignment_type = typename FieldType::value_type;
111
110
@@ -242,7 +241,11 @@ namespace nil {
242
241
243
242
template <typename FieldType>
244
243
circuit_description<FieldType, placeholder_circuit_params<FieldType, arithmetization_params_t >, 4 , 4 >
245
- circuit_test_t (typename FieldType::value_type pi0 = FieldType::value_type::zero()) {
244
+ circuit_test_t (
245
+ typename FieldType::value_type pi0 = 0 ,
246
+ typename nil::crypto3::random::algebraic_engine<FieldType> alg_rnd = nil::crypto3::random::algebraic_engine<FieldType>(),
247
+ boost::random::mt11213b rnd = boost::random::mt11213b()
248
+ ) {
246
249
using assignment_type = typename FieldType::value_type;
247
250
248
251
constexpr static const std::size_t rows_log = 4 ;
@@ -372,7 +375,10 @@ namespace nil {
372
375
public_columns_3, constant_columns_3, selector_columns_3>;
373
376
374
377
template <typename FieldType>
375
- circuit_description<FieldType, placeholder_circuit_params<FieldType, arithmetization_params_3>, 3 , 3 > circuit_test_3 () {
378
+ circuit_description<FieldType, placeholder_circuit_params<FieldType, arithmetization_params_3>, 3 , 3 > circuit_test_3 (
379
+ typename nil::crypto3::random::algebraic_engine<FieldType> alg_rnd = nil::crypto3::random::algebraic_engine<FieldType>(),
380
+ boost::random::mt11213b rnd = boost::random::mt11213b()
381
+ ) {
376
382
using assignment_type = typename FieldType::value_type;
377
383
using field_type = typename FieldType::value_type;
378
384
@@ -489,7 +495,10 @@ namespace nil {
489
495
490
496
template <typename FieldType>
491
497
circuit_description<FieldType, placeholder_circuit_params<FieldType,
492
- arithmetization_params_4>, 3 , 3 > circuit_test_4 () {
498
+ arithmetization_params_4>, 3 , 3 > circuit_test_4 (
499
+ typename nil::crypto3::random::algebraic_engine<FieldType> alg_rnd = nil::crypto3::random::algebraic_engine<FieldType>(),
500
+ boost::random::mt11213b rnd = boost::random::mt11213b()
501
+ ) {
493
502
using assignment_type = typename FieldType::value_type;
494
503
495
504
constexpr static const std::size_t rows_log = 3 ;
@@ -511,12 +520,11 @@ namespace nil {
511
520
table[j].resize (test_circuit.table_rows );
512
521
}
513
522
514
- srand (time (NULL ));
515
523
// lookup inputs
516
524
typename FieldType::value_type one = FieldType::value_type::one ();
517
525
typename FieldType::value_type zero = FieldType::value_type::zero ();
518
- table[0 ] = {rand () % 2 , rand () % 2 , rand (), rand () % 2 , rand () % 2 , 0 , 0 , 0 };
519
- table[1 ] = {rand () % 2 , rand () % 2 , rand (), rand () % 2 , rand () % 2 , 0 , 0 , 0 };;
526
+ table[0 ] = {rnd () % 2 , rnd () % 2 , rnd (), rnd () % 2 , rnd () % 2 , 0 , 0 , 0 };
527
+ table[1 ] = {rnd () % 2 , rnd () % 2 , rnd (), rnd () % 2 , rnd () % 2 , 0 , 0 , 0 };;
520
528
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 };
521
529
522
530
@@ -883,7 +891,10 @@ namespace nil {
883
891
884
892
template <typename FieldType>
885
893
circuit_description<FieldType, placeholder_circuit_params<FieldType,
886
- arithmetization_params_6>, 3 , 3 > circuit_test_6 () {
894
+ arithmetization_params_6>, 3 , 3 > circuit_test_6 (
895
+ typename nil::crypto3::random::algebraic_engine<FieldType> alg_rnd = nil::crypto3::random::algebraic_engine<FieldType>(),
896
+ boost::random::mt11213b rnd = boost::random::mt11213b()
897
+ ) {
887
898
using assignment_type = typename FieldType::value_type;
888
899
889
900
constexpr static const std::size_t rows_log = 3 ;
@@ -905,11 +916,10 @@ namespace nil {
905
916
table[j].resize (test_circuit.table_rows );
906
917
}
907
918
908
- srand (time (NULL ));
909
919
// lookup inputs
910
920
typename FieldType::value_type one = FieldType::value_type::one ();
911
921
typename FieldType::value_type zero = FieldType::value_type::zero ();
912
- table[0 ] = {rand () % 5 + 2 , rand () % 5 + 2 , rand () % 5 + 2 , rand () % 5 + 2 , rand () % 5 + 2 , rand () % 5 + 2 , 0 , 0 };
922
+ table[0 ] = {rnd () % 5 + 2 , rnd () % 5 + 2 , rnd () % 5 + 2 , rnd () % 5 + 2 , rnd () % 5 + 2 , rnd () % 5 + 2 , 0 , 0 };
913
923
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 ], 0 , 0 };;
914
924
915
925
@@ -1030,7 +1040,10 @@ namespace nil {
1030
1040
1031
1041
template <typename FieldType>
1032
1042
circuit_description<FieldType, placeholder_circuit_params<FieldType,
1033
- arithmetization_params_7>, 4 , 3 > circuit_test_7 () {
1043
+ arithmetization_params_7>, 4 , 3 > circuit_test_7 (
1044
+ typename nil::crypto3::random::algebraic_engine<FieldType> alg_rnd = nil::crypto3::random::algebraic_engine<FieldType>(),
1045
+ boost::random::mt11213b rnd = boost::random::mt11213b()
1046
+ ) {
1034
1047
using assignment_type = typename FieldType::value_type;
1035
1048
1036
1049
constexpr static const std::size_t rows_log = 4 ;
@@ -1052,12 +1065,11 @@ namespace nil {
1052
1065
table[j].resize (test_circuit.table_rows );
1053
1066
}
1054
1067
1055
- srand (time (NULL ));
1056
1068
// lookup inputs
1057
1069
typename FieldType::value_type one = FieldType::value_type::one ();
1058
1070
typename FieldType::value_type zero = FieldType::value_type::zero ();
1059
1071
1060
- auto r = rand () % 8 ;
1072
+ auto r = rnd () % 7 ;
1061
1073
table[0 ] = std::vector<typename FieldType::value_type>(16 );
1062
1074
std::size_t j = 0 ;
1063
1075
for ( std::size_t i = 0 ; i < 7 ; i++){
@@ -1088,8 +1100,8 @@ namespace nil {
1088
1100
constant_assignment[2 ] = {0 , 3 , 3 , 3 , 2 , 2 , 2 , 2 , 6 , 7 , 7 , 7 , 7 , 7 , 0 , 0 }; // Lookup tables
1089
1101
constant_assignment[3 ] = {0 , 4 , 4 , 4 , 4 , 3 , 3 , 3 , 64 , 128 , 128 , 128 , 128 , 128 , 0 , 0 }; // Lookup tables
1090
1102
constant_assignment[4 ] = {0 , 5 , 5 , 5 , 5 , 5 , 4 , 4 , 1 , 2 , 4 , 8 , 16 , 32 , 0 , 0 }; // Lookup tables
1091
- constant_assignment[5 ] = {0 , 6 , 6 , 6 , 6 , 6 , 5 , 5 , 64 , 128 , 256 , 512 , 1024 , 2048 , 0 , 0 }; // Lookup tables
1092
- constant_assignment[6 ] = {0 , 7 , 7 , 7 , 7 , 7 , 7 , 6 ,4096 ,8192 ,16384 ,16384 ,16384 ,16384 , 0 , 0 }; // Lookup tables
1103
+ constant_assignment[5 ] = {0 , 6 , 6 , 6 , 6 , 6 , 6 , 5 , 64 , 128 , 256 , 512 , 1024 , 2048 , 0 , 0 }; // Lookup tables
1104
+ constant_assignment[6 ] = {0 , 7 , 7 , 7 , 7 , 7 , 7 , 7 ,4096 ,8192 ,16384 ,16384 ,16384 ,16384 , 0 , 0 }; // Lookup tables
1093
1105
1094
1106
std::array<plonk_column<FieldType>, witness_columns> private_assignment;
1095
1107
for (std::size_t i = 0 ; i < witness_columns; i++) {
@@ -1137,7 +1149,7 @@ namespace nil {
1137
1149
1138
1150
std::vector<plonk_lookup_constraint<FieldType>> lookup_constraints = {lookup_constraint1};
1139
1151
plonk_lookup_gate<FieldType, plonk_lookup_constraint<FieldType>> lookup_gate (1 , lookup_constraints);
1140
- // test_circuit.lookup_gates.push_back(lookup_gate);
1152
+ test_circuit.lookup_gates .push_back (lookup_gate);
1141
1153
1142
1154
plonk_variable<assignment_type> w1 ( 1 , 0 , true , plonk_variable<assignment_type>::column_type::witness);
1143
1155
plonk_lookup_constraint<FieldType> lookup_constraint2;
@@ -1182,4 +1194,4 @@ namespace nil {
1182
1194
} // namespace nil
1183
1195
1184
1196
1185
- #endif // CRYPTO3_MARSHALLING_ZK_TEST_PLONK_CIRCUITS_HPP
1197
+ #endif // MARSHALLING_ZK_TEST_PLONK_CIRCUITS_HPP
0 commit comments