@@ -78,7 +78,7 @@ void print_hex_byteblob(std::ostream &os, TIter iter_begin, TIter iter_end, bool
78
78
template <typename Endianness, typename ArithmetizationType, typename ConstraintSystemType>
79
79
void print_circuit (const circuit_proxy<ArithmetizationType> &circuit_proxy,
80
80
const assignment_proxy<ArithmetizationType> &table_proxy,
81
- bool rename_required, std::ostream &out = std::cout) {
81
+ std::ostream &out = std::cout) {
82
82
using TTypeBase = nil::marshalling::field_type<Endianness>;
83
83
using plonk_constraint_system = nil::marshalling::types::bundle<
84
84
TTypeBase, std::tuple<
@@ -102,31 +102,28 @@ void print_circuit(const circuit_proxy<ArithmetizationType> &circuit_proxy,
102
102
const auto & copy_constraints = circuit_proxy.copy_constraints ();
103
103
typename ConstraintSystemType::copy_constraints_container_type used_copy_constraints;
104
104
const auto & used_copy_constraints_idx = circuit_proxy.get_used_copy_constraints ();
105
- for (const auto &it : used_copy_constraints_idx) {
106
- used_copy_constraints.push_back (copy_constraints[it]);
107
- }
108
-
109
- if (rename_required) {
110
- const auto & used_rows = table_proxy.get_used_rows ();
111
- std::uint32_t local_row = 0 ;
112
- for (const auto &row : used_rows) {
113
- for (auto &constraint : used_copy_constraints) {
114
- const auto first_var = constraint.first ;
115
- const auto second_var = constraint.second ;
116
- if ((first_var.type == variable_type::column_type::witness ||
117
- first_var.type == variable_type::column_type::constant) &&
118
- first_var.rotation == row) {
119
- constraint.first = variable_type (first_var.index , local_row, first_var.relative ,
120
- first_var.type );
121
- }
122
- if ((second_var.type == variable_type::column_type::witness ||
123
- second_var.type == variable_type::column_type::constant) &&
124
- second_var.rotation == row) {
125
- constraint.second = variable_type (second_var.index , local_row,
126
- second_var.relative , second_var.type );
127
- }
105
+ if (circuit_proxy.get_id () > 0 ) {
106
+ const auto start_row = table_proxy.get_start_row ();
107
+ for (const auto &it : used_copy_constraints_idx) {
108
+ auto first_var = copy_constraints[it].first ;
109
+ auto second_var = copy_constraints[it].second ;
110
+ if (first_var.type == variable_type::column_type::witness ||
111
+ first_var.type == variable_type::column_type::constant) {
112
+ ASSERT (first_var.rotation >= start_row);
113
+ first_var =
114
+ variable_type (first_var.index , first_var.rotation - start_row, first_var.relative , first_var.type );
115
+ }
116
+ if (second_var.type == variable_type::column_type::witness ||
117
+ second_var.type == variable_type::column_type::constant) {
118
+ ASSERT (second_var.rotation >= start_row);
119
+ second_var = variable_type (second_var.index , second_var.rotation - start_row, second_var.relative ,
120
+ second_var.type );
128
121
}
129
- local_row++;
122
+ used_copy_constraints.push_back ({first_var, second_var});
123
+ }
124
+ } else {
125
+ for (const auto &it : used_copy_constraints_idx) {
126
+ used_copy_constraints.push_back (copy_constraints[it]);
130
127
}
131
128
}
132
129
@@ -514,7 +511,7 @@ int curve_dependent_main(std::string bytecode_file_name,
514
511
}
515
512
516
513
print_circuit<nil::marshalling::option::big_endian, ArithmetizationType, ConstraintSystemType>(
517
- parser_instance.circuits [0 ], parser_instance.assignments [0 ], false , ocircuit);
514
+ parser_instance.circuits [0 ], parser_instance.assignments [0 ], ocircuit);
518
515
ocircuit.close ();
519
516
} else if (parser_instance.assignments .size () > 1 ) {
520
517
for (std::uint32_t idx = 0 ; idx < parser_instance.assignments .size (); idx++) {
@@ -543,7 +540,7 @@ int curve_dependent_main(std::string bytecode_file_name,
543
540
544
541
ASSERT_MSG (idx < parser_instance.circuits .size (), " Not found circuit" );
545
542
print_circuit<nil::marshalling::option::big_endian, ArithmetizationType, ConstraintSystemType>(
546
- parser_instance.circuits [idx], parser_instance.assignments [idx], (idx > 0 ), ocircuit);
543
+ parser_instance.circuits [idx], parser_instance.assignments [idx], ocircuit);
547
544
548
545
ocircuit.close ();
549
546
}
0 commit comments