@@ -209,7 +209,7 @@ void print_assignment_table(const assignment_proxy<ArithmetizationType> &table_p
209209 usable_rows_amount = table_proxy.get_used_rows ().size ();
210210 usable_rows_amount = std::max ({usable_rows_amount, max_shared_size, max_public_inputs_size, max_constant_size, max_selector_size});
211211 } else { // FULL
212- total_columns = AssignmentTableType::arithmetization_params::total_columns ;
212+ total_columns = witness_size + shared_size + public_input_size + constant_size + selector_size ;
213213 std::uint32_t max_witness_size = 0 ;
214214 for (std::uint32_t i = 0 ; i < witness_size; i++) {
215215 max_witness_size = std::max (max_witness_size, table_proxy.witness_column_size (i));
@@ -236,122 +236,175 @@ void print_assignment_table(const assignment_proxy<ArithmetizationType> &table_p
236236 using plonk_assignment_table = nil::marshalling::types::bundle<
237237 TTypeBase,
238238 std::tuple<
239+ nil::marshalling::types::integral<TTypeBase, std::size_t >, // witness_amount
240+ nil::marshalling::types::integral<TTypeBase, std::size_t >, // public_input_amount
241+ nil::marshalling::types::integral<TTypeBase, std::size_t >, // constant_amount
242+ nil::marshalling::types::integral<TTypeBase, std::size_t >, // selector_amount
243+
239244 nil::marshalling::types::integral<TTypeBase, std::size_t >, // usable_rows
240- nil::marshalling::types::integral<TTypeBase, std::size_t >, // columns_number
241- // table_values
245+ nil::marshalling::types::integral<TTypeBase, std::size_t >, // padded_rows_amount
246+
247+ // table_witness_values
248+ nil::marshalling::types::array_list<
249+ TTypeBase,
250+ nil::crypto3::marshalling::types::field_element<TTypeBase, typename AssignmentTableType::field_type::value_type>,
251+ nil::marshalling::option::sequence_size_field_prefix<nil::marshalling::types::integral<TTypeBase, std::size_t >>
252+ >,
253+ // table_public_input_values
254+ nil::marshalling::types::array_list<
255+ TTypeBase,
256+ nil::crypto3::marshalling::types::field_element<TTypeBase, typename AssignmentTableType::field_type::value_type>,
257+ nil::marshalling::option::sequence_size_field_prefix<nil::marshalling::types::integral<TTypeBase, std::size_t >>
258+ >,
259+ // table_constant_values
260+ nil::marshalling::types::array_list<
261+ TTypeBase,
262+ nil::crypto3::marshalling::types::field_element<TTypeBase, typename AssignmentTableType::field_type::value_type>,
263+ nil::marshalling::option::sequence_size_field_prefix<nil::marshalling::types::integral<TTypeBase, std::size_t >>
264+ >,
265+ // table_selector_values
242266 nil::marshalling::types::array_list<
243267 TTypeBase,
244268 nil::crypto3::marshalling::types::field_element<TTypeBase, typename AssignmentTableType::field_type::value_type>,
245269 nil::marshalling::option::sequence_size_field_prefix<nil::marshalling::types::integral<TTypeBase, std::size_t >>
246- >
247270 >
248- >;
271+ >
272+ >;
249273 using column_type = typename crypto3::zk::snark::plonk_column<BlueprintFieldType>;
250274
251- std::vector<typename AssignmentTableType::field_type::value_type> table_values (total_size, 0 );
275+ std::vector<typename AssignmentTableType::field_type::value_type> table_witness_values ( padded_rows_amount * witness_size , 0 );
276+ std::vector<typename AssignmentTableType::field_type::value_type> table_public_input_values (padded_rows_amount * (public_input_size + shared_size), 0 );
277+ std::vector<typename AssignmentTableType::field_type::value_type> table_constant_values ( padded_rows_amount * constant_size, 0 );
278+ std::vector<typename AssignmentTableType::field_type::value_type> table_selector_values ( padded_rows_amount * selector_size, 0 );
252279 if (print_kind == print_table_kind::FULL) {
253- auto it = table_values .begin ();
280+ auto it = table_witness_values .begin ();
254281 for (std::uint32_t i = 0 ; i < witness_size; i++) {
255282 fill_vector_value<typename AssignmentTableType::field_type::value_type, column_type>
256- (table_values , table_proxy.witness (i), it);
283+ (table_witness_values , table_proxy.witness (i), it);
257284 it += padded_rows_amount;
258285 }
286+ it = table_public_input_values.begin ();
259287 for (std::uint32_t i = 0 ; i < public_input_size; i++) {
260288 fill_vector_value<typename AssignmentTableType::field_type::value_type, column_type>
261- (table_values , table_proxy.public_input (i), it);
289+ (table_public_input_values , table_proxy.public_input (i), it);
262290 it += padded_rows_amount;
263291 }
292+ it = table_constant_values.begin ();
264293 for (std::uint32_t i = 0 ; i < constant_size; i++) {
265294 fill_vector_value<typename AssignmentTableType::field_type::value_type, column_type>
266- (table_values , table_proxy.constant (i), it);
295+ (table_constant_values , table_proxy.constant (i), it);
267296 it += padded_rows_amount;
268297 }
298+ it = table_selector_values.begin ();
269299 for (std::uint32_t i = 0 ; i < selector_size; i++) {
270300 fill_vector_value<typename AssignmentTableType::field_type::value_type, column_type>
271- (table_values , table_proxy.selector (i), it);
301+ (table_selector_values , table_proxy.selector (i), it);
272302 it += padded_rows_amount;
273303 }
274304 } else {
275305 const auto & rows = table_proxy.get_used_rows ();
276306 const auto & selector_rows = table_proxy.get_used_selector_rows ();
277- const std::uint32_t padding = padded_rows_amount - rows.size ();
278- std::uint32_t idx = 0 ;
279- auto it = table_values.begin ();
307+ std::uint32_t witness_idx = 0 ;
280308 // witness
281- for ( std::size_t i = 0 ; i < AssignmentTableType::arithmetization_params::witness_columns ; i++ ){
309+ for ( std::size_t i = 0 ; i < witness_size ; i++ ){
282310 const auto column_size = table_proxy.witness_column_size (i);
283311 std::uint32_t offset = 0 ;
284312 for (const auto & j : rows){
285313 if (j < column_size) {
286- table_values[idx + offset] = table_proxy.witness (i, j);
314+ table_witness_values[witness_idx + offset] = table_proxy.witness (i, j);
287315 offset++;
288316 }
289317 }
290- idx += padded_rows_amount;
318+ witness_idx += padded_rows_amount;
291319 }
292320 // public input
293- it += idx;
321+ std::uint32_t pub_inp_idx = 0 ;
322+ auto it_pub_inp = table_public_input_values.begin ();
294323 for (std::uint32_t i = 0 ; i < public_input_size; i++) {
295324 fill_vector_value<typename AssignmentTableType::field_type::value_type, column_type>
296- (table_values , table_proxy.public_input (i), it );
297- it += padded_rows_amount;
298- idx += padded_rows_amount;
325+ (table_public_input_values , table_proxy.public_input (i), it_pub_inp );
326+ it_pub_inp += padded_rows_amount;
327+ pub_inp_idx += padded_rows_amount;
299328 }
300329 for (std::uint32_t i = 0 ; i < shared_size; i++) {
301330 fill_vector_value<typename AssignmentTableType::field_type::value_type, column_type>
302- (table_values , table_proxy.shared (i), it );
303- it += padded_rows_amount;
304- idx += padded_rows_amount;
331+ (table_public_input_values , table_proxy.shared (i), it_pub_inp );
332+ it_pub_inp += padded_rows_amount;
333+ pub_inp_idx += padded_rows_amount;
305334 }
306335 // constant
336+ std::uint32_t constant_idx = 0 ;
307337 for (std::uint32_t i = 0 ; i < ComponentConstantColumns; i++) {
308338 const auto column_size = table_proxy.constant_column_size (i);
309339 std::uint32_t offset = 0 ;
310340 for (const auto & j : rows){
311341 if (j < column_size) {
312- table_values[idx + offset] = table_proxy.constant (i, j);
342+ table_constant_values[constant_idx + offset] = table_proxy.constant (i, j);
313343 offset++;
314344 }
315345 }
316- idx += padded_rows_amount;
346+
347+ constant_idx += padded_rows_amount;
317348 }
318- it += idx;
349+
350+ auto it_const = table_constant_values.begin () + constant_idx;
319351 for (std::uint32_t i = ComponentConstantColumns; i < constant_size; i++) {
320352 fill_vector_value<typename AssignmentTableType::field_type::value_type, column_type>
321- (table_values , table_proxy.constant (i), it );
322- it += padded_rows_amount;
323- idx += padded_rows_amount;
353+ (table_constant_values , table_proxy.constant (i), it_const );
354+ it_const += padded_rows_amount;
355+ constant_idx += padded_rows_amount;
324356 }
325357 // selector
358+ std::uint32_t selector_idx = 0 ;
326359 for (std::uint32_t i = 0 ; i < ComponentSelectorColumns; i++) {
327360 const auto column_size = table_proxy.selector_column_size (i);
328361 std::uint32_t offset = 0 ;
329362 for (const auto & j : rows){
330363 if (j < column_size) {
331364 if (selector_rows.find (j) != selector_rows.end ()) {
332- table_values[idx + offset] = table_proxy.selector (i, j);
365+
366+ table_selector_values[selector_idx + offset] = table_proxy.selector (i, j);
333367 }
334368 offset++;
335369 }
336370 }
337- idx += padded_rows_amount;
371+ selector_idx += padded_rows_amount;
338372 }
373+
374+ auto it_selector = table_selector_values.begin ();
339375 for (std::uint32_t i = ComponentSelectorColumns; i < selector_size; i++) {
340376 fill_vector_value<typename AssignmentTableType::field_type::value_type, column_type>
341- (table_values , table_proxy.selector (i), it );
342- it += padded_rows_amount;
343- idx += padded_rows_amount;
377+ (table_selector_values , table_proxy.selector (i), it_selector );
378+ it_selector += padded_rows_amount;
379+ selector_idx += padded_rows_amount;
344380 }
345- ASSERT_MSG (idx == total_size, " Printed index not equal required assignment size" );
381+ ASSERT_MSG (witness_idx + pub_inp_idx + constant_idx + selector_idx == total_size, " Printed index not equal required assignment size" );
346382 }
347383
348384 auto filled_val = plonk_assignment_table (std::make_tuple (
385+ nil::marshalling::types::integral<TTypeBase, std::size_t >(witness_size),
386+ nil::marshalling::types::integral<TTypeBase, std::size_t >(public_input_size),
387+ nil::marshalling::types::integral<TTypeBase, std::size_t >(constant_size),
388+ nil::marshalling::types::integral<TTypeBase, std::size_t >(selector_size),
349389 nil::marshalling::types::integral<TTypeBase, std::size_t >(usable_rows_amount),
350- nil::marshalling::types::integral<TTypeBase, std::size_t >(total_columns),
351- nil::crypto3::marshalling::types::fill_field_element_vector<typename AssignmentTableType::field_type::value_type, Endianness>(table_values)
352- ));
353- table_values.clear ();
354- table_values.shrink_to_fit ();
390+ nil::marshalling::types::integral<TTypeBase, std::size_t >(padded_rows_amount),
391+ nil::crypto3::marshalling::types::fill_field_element_vector<typename AssignmentTableType::field_type::value_type, Endianness>(table_witness_values),
392+ nil::crypto3::marshalling::types::fill_field_element_vector<typename AssignmentTableType::field_type::value_type, Endianness>(table_public_input_values),
393+ nil::crypto3::marshalling::types::fill_field_element_vector<typename AssignmentTableType::field_type::value_type, Endianness>(table_constant_values),
394+ nil::crypto3::marshalling::types::fill_field_element_vector<typename AssignmentTableType::field_type::value_type, Endianness>(table_selector_values)
395+ ));
396+
397+ table_witness_values.clear ();
398+ table_witness_values.shrink_to_fit ();
399+
400+ table_public_input_values.clear ();
401+ table_public_input_values.shrink_to_fit ();
402+
403+ table_constant_values.clear ();
404+ table_constant_values.shrink_to_fit ();
405+
406+ table_selector_values.clear ();
407+ table_selector_values.shrink_to_fit ();
355408
356409 std::vector<std::uint8_t > cv;
357410 cv.resize (filled_val.length (), 0x00 );
@@ -431,13 +484,13 @@ int curve_dependent_main(std::string bytecode_file_name,
431484 constexpr std::size_t ConstantColumns = ComponentConstantColumns + LookupConstantColumns;
432485 constexpr std::size_t SelectorColumns = ComponentSelectorColumns + LookupSelectorColumns;
433486
434- using ArithmetizationParams =
435- zk::snark::plonk_arithmetization_params< WitnessColumns, PublicInputColumns, ConstantColumns, SelectorColumns> ;
436- using ConstraintSystemType = zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams >;
437- using ConstraintSystemProxyType = zk::snark::plonk_table<BlueprintFieldType, ArithmetizationParams, zk::snark::plonk_column<BlueprintFieldType>>;
487+ zk::snark::plonk_table_description<BlueprintFieldType> desc (
488+ WitnessColumns, PublicInputColumns, ConstantColumns, SelectorColumns) ;
489+ using ConstraintSystemType = zk::snark::plonk_constraint_system<BlueprintFieldType>;
490+ using ConstraintSystemProxyType = zk::snark::plonk_table<BlueprintFieldType, zk::snark::plonk_column<BlueprintFieldType>>;
438491 using ArithmetizationType =
439- crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams >;
440- using AssignmentTableType = zk::snark::plonk_table<BlueprintFieldType, ArithmetizationParams, zk::snark::plonk_column<BlueprintFieldType>>;
492+ crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType>;
493+ using AssignmentTableType = zk::snark::plonk_table<BlueprintFieldType, zk::snark::plonk_column<BlueprintFieldType>>;
441494
442495 boost::json::value public_input_json_value;
443496 if (public_input_file_name.empty ()) {
@@ -453,7 +506,8 @@ int curve_dependent_main(std::string bytecode_file_name,
453506 return 1 ;
454507 }
455508
456- nil::blueprint::assigner<BlueprintFieldType, ArithmetizationParams> assigner_instance (
509+ nil::blueprint::assigner<BlueprintFieldType> assigner_instance (
510+ desc,
457511 stack_size,
458512 log_level,
459513 max_num_provers,
0 commit comments