Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rebase 03/01/2024 #17

Merged
merged 3 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/blueprint
Submodule blueprint updated 92 files
+15 −2 include/nil/blueprint/blueprint/plonk/assignment_proxy.hpp
+1 −1 include/nil/blueprint/components/algebra/curves/edwards/plonk/non_native/bool_scalar_multiplication.hpp
+1 −1 include/nil/blueprint/components/algebra/curves/edwards/plonk/non_native/complete_addition.hpp
+1 −1 include/nil/blueprint/components/algebra/curves/edwards/plonk/non_native/doubling.hpp
+1 −1 include/nil/blueprint/components/algebra/curves/edwards/plonk/non_native/scalar_non_native_range.hpp
+3 −3 include/nil/blueprint/components/algebra/curves/edwards/plonk/non_native/variable_base_multiplication.hpp
+1 −1 ...e/nil/blueprint/components/algebra/curves/edwards/plonk/non_native/variable_base_multiplication_per_bit.hpp
+1 −1 include/nil/blueprint/components/algebra/curves/pasta/plonk/endo_scalar.hpp
+1 −1 include/nil/blueprint/components/algebra/curves/pasta/plonk/unified_addition.hpp
+1 −1 include/nil/blueprint/components/algebra/curves/pasta/plonk/variable_base_scalar_mul.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/addition.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/bit_shift_constant.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/division.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/division_or_zero.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/exponentiation.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/linear_interpolation.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/logic_and_flag.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/logic_or_flag.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/multiplication.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/multiplication_by_constant.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/non_native/addition.hpp
+8 −4 include/nil/blueprint/components/algebra/fields/plonk/non_native/bit_composition.hpp
+3 −3 include/nil/blueprint/components/algebra/fields/plonk/non_native/bit_decomposition.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/non_native/comparison_checked.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/non_native/comparison_flag.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/non_native/comparison_unchecked.hpp
+2 −2 include/nil/blueprint/components/algebra/fields/plonk/non_native/detail/boolean_lookup_op_component.hpp
+2 −2 include/nil/blueprint/components/algebra/fields/plonk/non_native/detail/boolean_op_component.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/non_native/division_remainder.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/non_native/equality_flag.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/non_native/multiplication.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/non_native/range.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/non_native/reduction.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/non_native/subtraction.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/quadratic_interpolation.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/range_check.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/sqrt.hpp
+1 −1 include/nil/blueprint/components/algebra/fields/plonk/subtraction.hpp
+11 −6 include/nil/blueprint/components/algebra/fixedpoint/plonk/argmax.hpp
+10 −6 include/nil/blueprint/components/algebra/fixedpoint/plonk/argmin.hpp
+8 −3 include/nil/blueprint/components/algebra/fixedpoint/plonk/boolean.hpp
+3 −5 include/nil/blueprint/components/algebra/fixedpoint/plonk/ceil.hpp
+8 −4 include/nil/blueprint/components/algebra/fixedpoint/plonk/cmp.hpp
+14 −11 include/nil/blueprint/components/algebra/fixedpoint/plonk/cmp_extended.hpp
+13 −9 include/nil/blueprint/components/algebra/fixedpoint/plonk/cmp_min_max.hpp
+18 −10 include/nil/blueprint/components/algebra/fixedpoint/plonk/cos.hpp
+11 −8 include/nil/blueprint/components/algebra/fixedpoint/plonk/div.hpp
+12 −9 include/nil/blueprint/components/algebra/fixedpoint/plonk/div_by_positive.hpp
+10 −11 include/nil/blueprint/components/algebra/fixedpoint/plonk/dot_rescale_1_gate.hpp
+26 −14 include/nil/blueprint/components/algebra/fixedpoint/plonk/dot_rescale_2_gates.hpp
+10 −7 include/nil/blueprint/components/algebra/fixedpoint/plonk/exp.hpp
+4 −4 include/nil/blueprint/components/algebra/fixedpoint/plonk/exp_ranged.hpp
+8 −4 include/nil/blueprint/components/algebra/fixedpoint/plonk/floor.hpp
+3 −3 include/nil/blueprint/components/algebra/fixedpoint/plonk/gather_acc.hpp
+20 −16 include/nil/blueprint/components/algebra/fixedpoint/plonk/log.hpp
+8 −4 include/nil/blueprint/components/algebra/fixedpoint/plonk/max.hpp
+8 −4 include/nil/blueprint/components/algebra/fixedpoint/plonk/min.hpp
+8 −4 include/nil/blueprint/components/algebra/fixedpoint/plonk/mul_rescale.hpp
+8 −6 include/nil/blueprint/components/algebra/fixedpoint/plonk/mul_rescale_const.hpp
+3 −3 include/nil/blueprint/components/algebra/fixedpoint/plonk/neg.hpp
+10 −6 include/nil/blueprint/components/algebra/fixedpoint/plonk/range.hpp
+14 −11 include/nil/blueprint/components/algebra/fixedpoint/plonk/rem.hpp
+8 −4 include/nil/blueprint/components/algebra/fixedpoint/plonk/rescale.hpp
+3 −3 include/nil/blueprint/components/algebra/fixedpoint/plonk/select.hpp
+8 −4 include/nil/blueprint/components/algebra/fixedpoint/plonk/sign_abs.hpp
+19 −11 include/nil/blueprint/components/algebra/fixedpoint/plonk/sin.hpp
+13 −10 include/nil/blueprint/components/algebra/fixedpoint/plonk/sqrt.hpp
+13 −10 include/nil/blueprint/components/algebra/fixedpoint/plonk/sqrt_floor.hpp
+12 −20 include/nil/blueprint/components/algebra/fixedpoint/plonk/tanh.hpp
+2 −2 include/nil/blueprint/components/algebra/fixedpoint/plonk/tester.hpp
+4 −3 include/nil/blueprint/components/algebra/fixedpoint/plonk/to_fixedpoint.hpp
+140 −53 include/nil/blueprint/components/algebra/fixedpoint/type.hpp
+2 −2 include/nil/blueprint/components/hashes/poseidon/plonk/poseidon.hpp
+1 −1 include/nil/blueprint/components/hashes/sha2/plonk/decomposition.hpp
+1 −1 include/nil/blueprint/components/hashes/sha2/plonk/sha256.hpp
+2 −2 include/nil/blueprint/components/hashes/sha2/plonk/sha256_process.hpp
+2 −2 include/nil/blueprint/components/hashes/sha2/plonk/sha512.hpp
+2 −2 include/nil/blueprint/components/hashes/sha2/plonk/sha512_process.hpp
+2 −2 include/nil/blueprint/components/systems/snark/plonk/kimchi/detail/limbs.hpp
+3 −3 include/nil/blueprint/components/systems/snark/plonk/placeholder/detail/f1_loop.hpp
+3 −3 include/nil/blueprint/components/systems/snark/plonk/placeholder/detail/f3_loop.hpp
+3 −3 include/nil/blueprint/components/systems/snark/plonk/placeholder/detail/gate_component.hpp
+3 −3 include/nil/blueprint/components/systems/snark/plonk/placeholder/fri_array_swap.hpp
+7 −8 include/nil/blueprint/components/systems/snark/plonk/placeholder/fri_cosets.hpp
+1 −1 include/nil/blueprint/components/systems/snark/plonk/placeholder/fri_lin_inter.hpp
+2 −2 include/nil/blueprint/components/systems/snark/plonk/placeholder/gate_argument_verifier.hpp
+2 −2 include/nil/blueprint/components/systems/snark/plonk/placeholder/lookup_argument_verifier.hpp
+2 −2 include/nil/blueprint/components/systems/snark/plonk/placeholder/permutation_argument_verifier.hpp
+4 −4 include/nil/blueprint/utils/connectedness_check.hpp
+2 −2 test/non_native/plonk/add_mul_zkllvm_compatible.cpp
+0 −1 test/test_plonk_component.hpp
+1 −1 test/verifiers/placeholder/fri_cosets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#ifndef CRYPTO3_ASSIGNER_HANDLE_COMPONENT_HPP
#define CRYPTO3_ASSIGNER_HANDLE_COMPONENT_HPP

#include <functional>
#include <mlir-assigner/memory/stack_frame.hpp>
#include <nil/blueprint/components/algebra/fixedpoint/plonk/to_fixedpoint.hpp>
#include <nil/blueprint/components/algebra/fixedpoint/plonk/sin.hpp>
Expand Down Expand Up @@ -88,8 +89,7 @@ namespace nil {

using var = crypto3::zk::snark::plonk_variable<typename BlueprintFieldType::value_type>;

std::vector<var> all_vars = instance_input.all_vars();
std::vector<std::reference_wrapper<var>> input(all_vars.begin(), all_vars.end());
std::vector<std::reference_wrapper<var>> input = instance_input.all_vars();
const auto &used_rows = assignment.get_used_rows();

for (auto &v : input) {
Expand Down
22 changes: 5 additions & 17 deletions mlir-assigner/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,6 @@ using namespace nil;
using namespace nil::crypto3;
using namespace nil::blueprint;

template<typename TIter>
void print_hex_byteblob(std::ostream &os, TIter iter_begin, TIter iter_end, bool endl) {
os << "0x" << std::hex;
for (TIter it = iter_begin; it != iter_end; it++) {
os << std::setfill('0') << std::setw(2) << std::right << int(*it);
}
os << std::dec;
if (endl) {
os << std::endl;
}
}

template<typename Endianness, typename ArithmetizationType, typename ConstraintSystemType>
void print_circuit(const circuit_proxy<ArithmetizationType> &circuit_proxy,
const assignment_proxy<ArithmetizationType> &table_proxy, bool rename_required,
Expand Down Expand Up @@ -162,7 +150,7 @@ void print_circuit(const circuit_proxy<ArithmetizationType> &circuit_proxy,
cv.resize(filled_val.length(), 0x00);
auto write_iter = cv.begin();
nil::marshalling::status_type status = filled_val.write(write_iter, cv.size());
print_hex_byteblob(out, cv.cbegin(), cv.cend(), false);
out.write(reinterpret_cast<char*>(cv.data()), cv.size());
}

enum class print_table_kind { PRIVATE, SHARED, FULL };
Expand Down Expand Up @@ -346,7 +334,7 @@ void print_assignment_table(const assignment_proxy<ArithmetizationType> &table_p
cv.resize(filled_val.length(), 0x00);
auto write_iter = cv.begin();
nil::marshalling::status_type status = filled_val.write(write_iter, cv.size());
print_hex_byteblob(out, cv.cbegin(), cv.cend(), false);
out.write(reinterpret_cast<char*>(cv.data()), cv.size());
}

template<typename CurveType, bool PrintCircuitOutput>
Expand Down Expand Up @@ -443,7 +431,7 @@ int curve_dependent_main(std::string bytecode_file_name, std::string public_inpu
// print full table
if (parser_instance.assignments.size() == 1) {
std::ofstream otable;
otable.open(assignment_table_file_name);
otable.open(assignment_table_file_name, std::ios_base::binary | std::ios_base::out);
if (!otable) {
std::cout << "Something wrong with output " << assignment_table_file_name << std::endl;
return 1;
Expand All @@ -457,7 +445,7 @@ int curve_dependent_main(std::string bytecode_file_name, std::string public_inpu
} else if (parser_instance.assignments.size() > 1) {
for (const auto &it : parser_instance.assignments) {
std::ofstream otable;
otable.open(assignment_table_file_name + std::to_string(it.get_id()));
otable.open(assignment_table_file_name + std::to_string(it.get_id()), std::ios_base::binary | std::ios_base::out);
if (!otable) {
std::cout << "Something wrong with output " << assignment_table_file_name + std::to_string(it.get_id())
<< std::endl;
Expand All @@ -476,7 +464,7 @@ int curve_dependent_main(std::string bytecode_file_name, std::string public_inpu
std::ofstream ocircuit;
std::string file_name =
parser_instance.circuits.size() > 1 ? circuit_file_name + std::to_string(it.get_id()) : circuit_file_name;
ocircuit.open(file_name);
ocircuit.open(file_name, std::ios_base::binary | std::ios_base::out);
if (!ocircuit) {
std::cout << "Something wrong with output " << file_name << std::endl;
return 1;
Expand Down