Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vo-nil committed Dec 12, 2024
1 parent 6c17cba commit 1e1618c
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 34 deletions.
14 changes: 7 additions & 7 deletions crypto3/libs/blueprint/include/nil/blueprint/component_batch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ namespace nil {
const compiler_manifest assignment_manifest(parent_assignment.witnesses_amount(), false);
const auto component_manifest = std::apply(ComponentType::get_manifest, params_tuple);
const auto intersection = assignment_manifest.intersect(component_manifest);
BOOST_ASSERT_MSG(intersection.is_satisfiable(), "Component either has a constant or does not fit");
BOOST_VERIFY_MSG(intersection.is_satisfiable(), "Component either has a constant or does not fit");
const std::size_t component_witness_amount = intersection.witness_amount->max_value_if_sat();
return component_witness_amount;
}
Expand Down Expand Up @@ -239,7 +239,7 @@ namespace nil {
variable.get() = parent_assignment.add_batch_variable(0);
}
bool insertion_result = inputs_results.insert({input, {result, false}}).second;
BOOST_ASSERT(insertion_result);
BOOST_VERIFY(insertion_result);
return result;
}

Expand All @@ -265,21 +265,21 @@ namespace nil {
variable_transform(variable);
}
bool insertion_result = inputs_results.insert({input, {result, true}}).second;
BOOST_ASSERT(insertion_result);
BOOST_VERIFY(insertion_result);
return result;
} else {
// already have some vars
auto unassigned_result = inputs_results.find(input)->second.first;
auto unsassigned_vars = unassigned_result.all_vars();
auto result_vars = result.all_vars();
BOOST_ASSERT(unsassigned_vars.size() == result_vars.size());
BOOST_VERIFY(unsassigned_vars.size() == result_vars.size());
for (std::size_t i = 0; i < unsassigned_vars.size(); i++) {
parent_assignment.batch_private_storage(unsassigned_vars[i].get().rotation) =
var_value(internal_assignment, result_vars[i].get());
}
inputs_results.erase(input);
bool insertion_result = inputs_results.insert({input, {unassigned_result, true}}).second;
BOOST_ASSERT(insertion_result);
BOOST_VERIFY(insertion_result);
return unassigned_result;
}
}
Expand Down Expand Up @@ -307,7 +307,7 @@ namespace nil {
const input_type &input = input_result.first;
result_type &result = input_result.second.first;
bool result_status = input_result.second.second;
BOOST_ASSERT(result_status);
BOOST_VERIFY(result_status);
if (col_offset == 0) {
parent_assignment.enable_selector(gate_id, row);
}
Expand Down Expand Up @@ -366,7 +366,7 @@ namespace nil {
ComponentType component_instance = build_component_instance(component_witness_amount);
generate_gates(component_instance, tmp_bp, parent_assignment, example_input);
const auto &gates = tmp_bp.gates();
BOOST_ASSERT(gates.size() == 1);
BOOST_VERIFY(gates.size() == 1);

std::vector<constraint_type> new_gate_constraints, one_gate_constraints;
auto curr_gate = gates[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ namespace nil {
integral_type(t_last) * zkevm_modulus -
integral_type(b));

zkevm_word_type result = is_div ? r : q_out;

a_chunks = zkevm_word_to_field_element<FieldType>(a);
b_chunks = zkevm_word_to_field_element<FieldType>(b);
r_chunks = zkevm_word_to_field_element<FieldType>(r);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ namespace nil {
integral_type(t_last) * zkevm_modulus -
integral_type(N));

zkevm_word_type result = q;

v_chunks = zkevm_word_to_field_element<FieldType>(v);
N_chunks = zkevm_word_to_field_element<FieldType>(N);
q_chunks = zkevm_word_to_field_element<FieldType>(q);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ namespace nil {
q_chunks = zkevm_word_to_field_element<FieldType>(q);
v_chunks = zkevm_word_to_field_element<FieldType>(v);

integral_type two_15 = 32768;
integral_type biggest_input_a_chunk = integral_type(input_a) >> (256 - 16);

b0p = integral_type(input_b) % 16;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ namespace nil {
zkevm_word_type v = zkevm_word_type(integral_type(q_abs) +
integral_type(t_last) * zkevm_modulus -
integral_type(b_abs));
zkevm_word_type result = is_div ? r : q_out;

a_chunks = zkevm_word_to_field_element<FieldType>(a);
b_input_chunks = zkevm_word_to_field_element<FieldType>(b_input);
Expand Down Expand Up @@ -620,4 +619,4 @@ namespace nil {
};
} // namespace bbf
} // namespace blueprint
} // namespace nil
} // namespace nil
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace nil {

auto step_list = make_integer_vector<Endianness, std::size_t>(std::get<5>(filled_params.value()));
std::size_t expand_factor = std::get<6>(filled_params.value()).value();
std::size_t r = std::accumulate(step_list.begin(), step_list.end(), 0);
std::accumulate(step_list.begin(), step_list.end(), 0);

return CommitmentParamsType(
step_list,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,10 @@ namespace nil {
std::stringstream out;

out << "\t\tgate = 0;" << std::endl;
int c = 0;
for(const auto &constraint: gate.constraints){
out << constraint_computation_code_optimized(_var_indices, constraint);
out << "\t\tgate = addmod(gate, mulmod(theta_acc, sum, modulus), modulus);" << std::endl;
out << "\t\ttheta_acc = mulmod(theta_acc, theta, modulus);" << std::endl;
c++;
}
variable_type sel_var(gate.selector_index, 0, true, variable_type::column_type::selector);
out << "\t\tgate = mulmod(gate, basic_marshalling.get_uint256_be(blob, " << _var_indices.at(sel_var) * 0x20 << "), modulus);" << std::endl;
Expand Down Expand Up @@ -527,9 +525,7 @@ namespace nil {
++i;
}


std::size_t gate_modules_count = 0;
std::size_t current_selector = 0;
if (total_cost <= _gates_contract_size_threshold) {
auto it = constraints.begin();
gate_argument_str << "\t\tuint256 prod;" << std::endl;
Expand Down Expand Up @@ -604,9 +600,7 @@ namespace nil {
return "";

std::stringstream lookup_str;
std::size_t j = 0;
std::size_t i = 0;
std::size_t cur = 0;
std::unordered_map<std::size_t, std::string> lookup_codes;
std::vector<std::size_t> lookup_ids(lookup_count);
std::vector<std::pair<std::size_t, std::size_t>> lookup_costs(lookup_count);
Expand Down Expand Up @@ -686,7 +680,6 @@ namespace nil {
out.close();
}

j = 0;
std::size_t table_index = 1;
for(const auto &table: _constraint_system.lookup_tables()){
variable_type sel_var(table.tag_index, 0, true, variable_type::column_type::selector);
Expand All @@ -710,7 +703,6 @@ namespace nil {
lookup_str << "\t\t\tstate.theta_acc = mulmod(state.theta_acc, state.theta, modulus);" << std::endl;
}
lookup_str << "\t\t\tstate.g = mulmod(state.g, addmod( state.factor, addmod(l, mulmod(state.beta, state.l_shifted, modulus), modulus), modulus), modulus);" << std::endl;
j++;
}
table_index++;
}
Expand Down Expand Up @@ -740,7 +732,6 @@ namespace nil {
poly_points += _desc.selector_columns;
eta_buf.resize( 32*poly_points );

std::array<std::uint8_t, 0> empty;
auto writer = eta_buf.begin();

result << "\t\t///* eta points check */" << std::endl;
Expand Down Expand Up @@ -881,9 +872,6 @@ namespace nil {
reps["$LOOKUP_PARTS$"] = lookup_parts_hex_string(_constraint_system.lookup_parts(_common_data.max_quotient_chunks));
reps["$MAX_QUOTIENT_CHUNKS$"] = to_string(_common_data.max_quotient_chunks);

std::size_t _lookup_degree = _constraint_system.lookup_poly_degree_bound();
std::size_t _rows_amount = _desc.rows_amount;

commitment_scheme_replaces<PlaceholderParams>(
_placeholder_info,
_desc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,11 @@ namespace nil {
static inline std::vector<std::string> split_point_string(std::string point){
std::vector<std::string> result;
std::size_t found = point.find("& ");
std::size_t j = 0;
std::size_t prev = 0;
while (found!=std::string::npos){
result.push_back(point.substr(prev, found-prev));
prev = found + 2;
found = point.find("& ",prev);
j++;
}
return result;
}
Expand Down Expand Up @@ -536,8 +534,6 @@ namespace nil {
round_proof_layers_num += log2(fri_params.D[i]->m) -1;
}

std::size_t lookup_degree = constraint_system.lookup_poly_degree_bound();

std::size_t rows_amount = desc.rows_amount;
std::size_t quotient_polys = placeholder_info.quotient_size;

Expand Down Expand Up @@ -1094,4 +1090,4 @@ namespace nil {
}
}

#endif // CRYPTO3_RECURSIVE_VERIFIER_GENERATOR_HPP
#endif // CRYPTO3_RECURSIVE_VERIFIER_GENERATOR_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ namespace nil {
break;
}
}
BOOST_ASSERT(found);
BOOST_VERIFY(found);
}
}
return eval_map;
Expand Down
3 changes: 2 additions & 1 deletion proof-producer/bin/proof-producer/src/arg_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ namespace nil {
/*line_length=*/120,
/*min_description_length=*/60
);

// clang-format off
auto options_appender = config.add_options()
config.add_options()
("stage", make_defaulted_option(prover_options.stage),
"Stage of the prover to run, one of (all, preprocess, prove, verify, generate-aggregated-challenge, generate-combined-Q, aggregated-FRI, consistency-checks). Defaults to 'all'.")
("proof,p", make_defaulted_option(prover_options.proof_file_path), "Proof file")
Expand Down

0 comments on commit 1e1618c

Please sign in to comment.