@@ -220,7 +220,6 @@ namespace nil {
220
220
for (std::size_t j = 0 ; j < eval_proof.z .get_poly_points_number (k, i); j++){
221
221
if ( sum != 0 ) out << " ," << std::endl;
222
222
out << " \t\t\t {\" field\" :\" " << eval_proof.z .get (k, i, j) << " \" }" ;
223
- // std::cout << "batch " << k << " poly " << i << " value " << eval_proof.z.get(k, i, j) << std::endl;
224
223
sum++;
225
224
}
226
225
}
@@ -349,29 +348,30 @@ namespace nil {
349
348
std::stringstream out;
350
349
out << " [" << std::endl;
351
350
352
- out << " \t {\" array\" :[" << std::endl;
353
- std::size_t cur = 0 ;
354
- for (std::size_t i = 0 ; i < arithmetization_params::public_input_columns; i++){
355
- std::size_t max_non_zero = 0 ;
356
- for (std::size_t j = 0 ; j < public_inputs[i].size (); j++){
357
- if ( public_inputs[i][j] != 0 ) max_non_zero = j;
358
- }
359
- if ( max_non_zero + 1 > public_input_sizes[i] ) {
360
- std::cout << " Public input size is larger than reserved. Real size = " << max_non_zero + 1 << " reserved = " << public_input_sizes[i] << std::endl;
361
- exit (1 );
362
- }
363
- BOOST_ASSERT (max_non_zero <= public_input_sizes[i]);
364
- for (std::size_t j = 0 ; j < public_input_sizes[i]; j++){
365
- if (cur != 0 ) out << " ," << std::endl;
366
- if ( j >= public_inputs[i].size () )
367
- out << " \t\t {\" field\" : \" " << typename field_type::value_type (0 ) << " \" }" ;
368
- else
369
- out << " \t\t {\" field\" : \" " << public_inputs[i][j] << " \" }" ;
370
- cur++;
351
+ if (arithmetization_params::public_input_columns != 0 ){
352
+ out << " \t {\" array\" :[" << std::endl;
353
+ std::size_t cur = 0 ;
354
+ for (std::size_t i = 0 ; i < arithmetization_params::public_input_columns; i++){
355
+ std::size_t max_non_zero = 0 ;
356
+ for (std::size_t j = 0 ; j < public_inputs[i].size (); j++){
357
+ if ( public_inputs[i][j] != 0 ) max_non_zero = j;
358
+ }
359
+ if ( max_non_zero + 1 > public_input_sizes[i] ) {
360
+ std::cout << " Public input size is larger than reserved. Real size = " << max_non_zero + 1 << " reserved = " << public_input_sizes[i] << std::endl;
361
+ exit (1 );
362
+ }
363
+ BOOST_ASSERT (max_non_zero <= public_input_sizes[i]);
364
+ for (std::size_t j = 0 ; j < public_input_sizes[i]; j++){
365
+ if (cur != 0 ) out << " ," << std::endl;
366
+ if ( j >= public_inputs[i].size () )
367
+ out << " \t\t {\" field\" : \" " << typename field_type::value_type (0 ) << " \" }" ;
368
+ else
369
+ out << " \t\t {\" field\" : \" " << public_inputs[i][j] << " \" }" ;
370
+ cur++;
371
+ }
371
372
}
373
+ out << std::endl << " \t ]}," << std::endl;
372
374
}
373
- out << std::endl << " \t ]}," << std::endl;
374
- std::cout << " Public input: " << out.str () << std::endl;
375
375
376
376
out << " \t {\" array\" :[" << std::endl;
377
377
out << " \t\t " << generate_hash<typename PlaceholderParams::transcript_hash_type>(
@@ -743,7 +743,6 @@ namespace nil {
743
743
}
744
744
}
745
745
}
746
- std::cout << " Printing" << std::endl;
747
746
748
747
std::stringstream lookup_shifted_options_list;
749
748
cur = 0 ;
@@ -770,40 +769,6 @@ namespace nil {
770
769
use_lookups?constraint_system.sorted_lookup_columns_number ():0 ,
771
770
" recursive" // Generator mode
772
771
);
773
- std::cout << " Singles" << std::endl;
774
- for ( const auto &single: singles_strs){
775
- std::cout << single << std::endl;
776
- }
777
- std::cout << " Singles_map" << std::endl;
778
- for ( const auto &[single, ind]: singles_map){
779
- std::cout << single << " => " << ind << std::endl;
780
- }
781
- std::cout << " Poly ids" << std::endl;
782
- for ( std::size_t i = 0 ; i < poly_ids.size (); i++){
783
- std::cout << " Poly " << i << std::endl;
784
- for ( std::size_t j = 0 ; j < poly_ids[i].size (); j++){
785
- std::cout << poly_ids[i][j] << " " ;
786
- }
787
- std::cout << std::endl;
788
- }
789
- std::cout << " Z points indices" << std::endl;
790
- for ( std::size_t i = 0 ; i < z_points_indices.size (); i++){
791
- std::cout << " [" << i << " ]=>" << z_points_indices[i] << " " ;
792
- }
793
- std::cout << std::endl;
794
-
795
- std::vector<std::vector<std::string>> unique_points;
796
- std::vector<std::size_t > point_ids;
797
- std::map<std::string, std::size_t > singles;
798
- std::tie (unique_points, point_ids, singles) = calculate_unique_point_sets (
799
- common_data, permutation_size, use_lookups, quotient_polys, use_lookups?constraint_system.sorted_lookup_columns_number ():0
800
- );
801
-
802
- std::string point_inds_str = " " ;
803
- for (std::size_t i = 0 ; i < point_ids.size (); i++){
804
- if ( i != 0 ) point_inds_str += " , " ;
805
- point_inds_str += to_string (point_ids[i]);
806
- }
807
772
808
773
std::string singles_str = " " ;
809
774
for (const auto &[k, v]: singles_map){
@@ -822,29 +787,14 @@ namespace nil {
822
787
823
788
std::stringstream prepare_U_V_str;
824
789
prepare_U_V_str << " \t pallas::base_field_type::value_type theta_acc = pallas::base_field_type::value_type(1);\n\n " ;
825
- for (std::size_t i = 0 ; i < unique_points .size ();i++){
790
+ for (std::size_t i = 0 ; i < singles_strs .size ();i++){
826
791
for (std::size_t j = 0 ; j <z_points_indices.size (); j++){
827
792
if ( z_points_indices[j] == i)
828
793
prepare_U_V_str << " \t U[" + to_string (i) << " ] += theta_acc * proof.z[" << j << " ]; theta_acc *= challenges.lpc_theta;\n " ;
829
794
}
830
795
prepare_U_V_str << " \n " ;
831
796
}
832
797
833
- std::stringstream compute_combined_y;
834
- for (std::size_t i = 0 ; i < point_ids.size (); i++){
835
- /* y[0] = y[0] * challenges.lpc_theta;
836
- y[0] = y[0] + proof.initial_proof_values[initial_proof_ind] * V_evals[point_ids[k]][0];
837
- y[1] = y[1] * challenges.lpc_theta;
838
- y[1] = y[1] + proof.initial_proof_values[initial_proof_ind+1] * V_evals[point_ids[k]][1];*/
839
-
840
- // compute_combined_y << "\t\ty[0] = y[0]*challenges.lpc_theta;" << std::endl;
841
- // compute_combined_y << "\t\ty[0] = y[0] + proof.initial_proof_values[initial_proof_ind] * V_evals[" << point_ids[i]<< "][0];" << std::endl;
842
- // compute_combined_y << "\t\tinitial_proof_ind++;" << std::endl;
843
- // compute_combined_y << "\t\ty[1] = y[1]*challenges.lpc_theta;" << std::endl;
844
- // compute_combined_y << "\t\ty[1] = y[1] + proof.initial_proof_values[initial_proof_ind] * V_evals[" << point_ids[i]<< "][1];" << std::endl;
845
- // compute_combined_y << "\t\tinitial_proof_ind++;" << std::endl;
846
- }
847
-
848
798
std::string public_input_sizes_str = " " ;
849
799
std::size_t full_public_input_size = 0 ;
850
800
for (std::size_t i = 0 ; i < public_input_sizes.size (); i++){
@@ -864,9 +814,8 @@ namespace nil {
864
814
}
865
815
lpc_y_computation << " \t\t Q0 -= U[" << i << " ];" << std::endl;
866
816
lpc_y_computation << " \t\t Q1 -= U[" << i << " ];" << std::endl;
867
- lpc_y_computation << " \t\t Q0 /= (res[0][0] - challenges." << singles_strs[i] <<" );" << std::endl;
868
- lpc_y_computation << " \t\t Q1 /= (res[0][1] - challenges." << singles_strs[i] <<" );" << std::endl;
869
- std::cout << " single " << singles_strs[i] << std::endl;
817
+ lpc_y_computation << " \t\t Q0 /= (res[0][0] - singles[" << i << " ]);" << std::endl;
818
+ lpc_y_computation << " \t\t Q1 /= (res[0][1] - singles[" << i << " ]);" << std::endl;
870
819
lpc_y_computation << " \t\t y[0] += Q0;" << std::endl;
871
820
lpc_y_computation << " \t\t y[1] += Q1;" << std::endl;
872
821
}
@@ -920,12 +869,10 @@ namespace nil {
920
869
reps[" $D0_OMEGA$" ] = " pallas::base_field_type::value_type(0x" + to_hex_string (fri_params.D [0 ]->get_domain_element (1 )) + " _cppui255)" ;
921
870
reps[" $OMEGA$" ] = " pallas::base_field_type::value_type(0x" + to_hex_string (common_data.basic_domain ->get_domain_element (1 )) + " _cppui255)" ;
922
871
reps[" $FRI_ROUNDS$" ] = to_string (fri_params.r );
923
- reps[" $UNIQUE_POINTS$" ] = to_string (unique_points.size ());
924
- reps[" $POINTS_IDS$" ] = point_inds_str;
925
- reps[" $SINGLES_AMOUNT$" ] = to_string (singles.size ());
872
+ reps[" $UNIQUE_POINTS$" ] = to_string (singles_strs.size ());
873
+ reps[" $SINGLES_AMOUNT$" ] = to_string (singles_strs.size ());
926
874
reps[" $SINGLES_COMPUTATION$" ] = singles_str;
927
875
reps[" $PREPARE_U_AND_V$" ] = prepare_U_V_str.str ();
928
- reps[" $COMPUTE_COMBINED_Y$" ] = compute_combined_y.str ();
929
876
reps[" $SORTED_COLUMNS$" ] = to_string (constraint_system.sorted_lookup_columns_number ());
930
877
reps[" $SORTED_ALPHAS$" ] = to_string (use_lookups? constraint_system.sorted_lookup_columns_number () - 1 : 1 );
931
878
reps[" $LOOKUP_TABLE_AMOUNT$" ] = to_string (constraint_system.lookup_tables ().size ());
@@ -951,6 +898,8 @@ namespace nil {
951
898
reps[" $FULL_PUBLIC_INPUT_SIZE$" ] = to_string (full_public_input_size);
952
899
reps[" $LPC_POLY_IDS_CONSTANT_ARRAYS$" ] = lpc_poly_ids_const_arrays;
953
900
reps[" $LPC_Y_COMPUTATION$" ] = lpc_y_computation.str ();
901
+ reps[" $PUBLIC_INPUT_CHECK$" ] = arithmetization_params::public_input_columns == 0 ? " " :public_input_check_str;
902
+ reps[" $PUBLIC_INPUT_INPUT$" ] = arithmetization_params::public_input_columns == 0 ? " " : public_input_input_str;
954
903
955
904
result = replace_all (result, reps);
956
905
return result;
0 commit comments