Skip to content

Commit

Permalink
minor changes #98
Browse files Browse the repository at this point in the history
  • Loading branch information
CblPOK-git committed Jan 11, 2023
1 parent 65f139e commit 98c2a9f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

#include <nil/blueprint/blueprint/plonk/circuit.hpp>
#include <nil/blueprint/blueprint/plonk/assignment.hpp>
// #include <nil/crypto3/zk/algorithms/generate_circuit.hpp>

namespace nil {
namespace blueprint {
Expand All @@ -49,6 +48,10 @@ namespace nil {
std::size_t ScalarSize,
std::uint32_t WitnessesAmount>
class endo_scalar;
// Input: x
// Output: y
// Such as:
// mul(x, G) = endomul(y, G), for G \in E(F)

template<typename CurveType>
struct endo_scalar_params;
Expand Down Expand Up @@ -236,8 +239,7 @@ namespace nil {
}

template<typename BlueprintFieldType, typename ArithmetizationParams, typename CurveType, std::size_t ScalarSize>
typename plonk_endo_scalar<BlueprintFieldType, ArithmetizationParams, CurveType, ScalarSize>::result_type
generate_gates(
void generate_gates(
const plonk_endo_scalar<BlueprintFieldType, ArithmetizationParams, CurveType, ScalarSize> &component,
circuit<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams>> &bp,
assignment<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams>> &assignment,
Expand Down Expand Up @@ -299,8 +301,7 @@ namespace nil {
}

template<typename BlueprintFieldType, typename ArithmetizationParams, typename CurveType, std::size_t ScalarSize>
typename plonk_endo_scalar<BlueprintFieldType, ArithmetizationParams, CurveType, ScalarSize>::result_type
generate_copy_constraints(
void generate_copy_constraints(
const plonk_endo_scalar<BlueprintFieldType, ArithmetizationParams, CurveType, ScalarSize> &component,
circuit<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams>> &bp,
assignment<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams>> &assignment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ namespace nil {

using var = typename component_type::var;

public:

constexpr static const std::size_t witness_amount = 15;
constexpr static const std::size_t reserved_witnesses = 2; // base, accumulated_n
public:
constexpr static const std::size_t intermediate_start = 0 + reserved_witnesses;
constexpr static const std::size_t bits_per_intermediate_result =
2; // defines
Expand Down Expand Up @@ -201,7 +200,7 @@ namespace nil {
typename BlueprintFieldType::value_type accumulated_n = 0;
typename BlueprintFieldType::value_type acc1 = 1;

// we use first empty row to unify first row gate woth others
// we use first empty row to unify first row gate with others
assignment.witness(component.W(1), start_row_index) = 0;
assignment.witness(component.intermediate_start + component.intermediate_results_per_row - 1, start_row_index) = 1;
std::size_t start_row_padded = start_row_index + 1;
Expand Down Expand Up @@ -240,8 +239,7 @@ namespace nil {
}

template<typename BlueprintFieldType, typename ArithmetizationParams, std::size_t ExponentSize>
typename plonk_exponentiation<BlueprintFieldType, ArithmetizationParams, ExponentSize, 15>::result_type
generate_gates(
void generate_gates(
const plonk_exponentiation<BlueprintFieldType, ArithmetizationParams, ExponentSize, 15> &component,
circuit<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams>> &bp,
assignment<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams>> &assignment,
Expand Down Expand Up @@ -292,8 +290,7 @@ namespace nil {
}

template<typename BlueprintFieldType, typename ArithmetizationParams, std::size_t ExponentSize>
typename plonk_exponentiation<BlueprintFieldType, ArithmetizationParams, ExponentSize, 15>::result_type
generate_copy_constraints(
void generate_copy_constraints(
const plonk_exponentiation<BlueprintFieldType, ArithmetizationParams, ExponentSize, 15> &component,
circuit<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams>> &bp,
assignment<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams>> &assignment,
Expand All @@ -318,8 +315,7 @@ namespace nil {
}

template<typename BlueprintFieldType, typename ArithmetizationParams, std::size_t ExponentSize>
typename plonk_exponentiation<BlueprintFieldType, ArithmetizationParams, ExponentSize, 15>::result_type
generate_assignments_constants(
void generate_assignments_constants(
const plonk_exponentiation<BlueprintFieldType, ArithmetizationParams, ExponentSize, 15> &component,
circuit<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams>> &bp,
assignment<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType, ArithmetizationParams>> &assignment,
Expand Down

0 comments on commit 98c2a9f

Please sign in to comment.