Skip to content

Commit

Permalink
Initial patch #254
Browse files Browse the repository at this point in the history
  • Loading branch information
nemothenoone authored and x-mass committed Jun 11, 2024
1 parent 5ceacd0 commit abc2538
Show file tree
Hide file tree
Showing 43 changed files with 3,423 additions and 2,977 deletions.
65 changes: 60 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
nixpkgs.url = github:NixOS/nixpkgs/nixos-23.11;
crypto3 = {
url =
"git+https://github.com/NilFoundation/crypto3?submodules=1&rev=887b4dbcc1adfe57d7236620f01d079537245b75";
"git+https://github.com/NilFoundation/crypto3?submodules=1";
inputs.nixpkgs.follows = "nixpkgs";
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ namespace nil {
using commitment_type = typename ParamsType::commitment_type;
using field_type = typename ParamsType::field_type;
using transcript_type = TranscriptType;
using poly_type = PolynomialType;
using polynomial_type = PolynomialType;

eval_storage<field_type> _z;

polys_evaluator() = default;

protected:
std::map<std::size_t, std::vector<poly_type>> _polys;
std::map<std::size_t, std::vector<polynomial_type>> _polys;
std::map<std::size_t, bool> _locked; // _locked[batch] is true after it is commited
std::map<std::size_t, std::vector<std::vector<typename field_type::value_type>>> _points;

Expand Down Expand Up @@ -205,7 +205,7 @@ namespace nil {
return root;
}

void append_to_batch(std::size_t index, const poly_type& poly){
void append_to_batch(std::size_t index, const polynomial_type& poly){
if( _locked.find(index) == _locked.end() ) _locked[index] = false;
BOOST_ASSERT(!_locked[index]); // We cannot modify batch after commitment
_polys[index].push_back(poly);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,20 @@ namespace nil {
typedef poly_comm<typename scalar_field_type::value_type> blinding_type;
typedef std::tuple<commitment_type, blinding_type> blinded_commitment_type;

struct poly_type_single {
struct polynomial_type_single {
// polynomial itself
math::polynomial<typename scalar_field_type::value_type> coeffs;
// optional degree bound - poly degree must not exceed it
std::size_t bound = -1;
// chunked commitment
blinding_type commit;

poly_type_single(math::polynomial<typename scalar_field_type::value_type> &coeffs, int bound,
blinding_type &commit) : coeffs(coeffs), bound(bound), commit(commit) {}
polynomial_type_single(math::polynomial<typename scalar_field_type::value_type> &coeffs,
int bound,
blinding_type &commit) : coeffs(coeffs), bound(bound), commit(commit) {}
};

typedef std::vector<poly_type_single> poly_type;
typedef std::vector<polynomial_type_single> polynomial_type;

struct proof_type {
std::vector<std::tuple<typename group_type::value_type, typename group_type::value_type>> lr;
Expand Down Expand Up @@ -383,7 +384,7 @@ namespace nil {
}

static proof_type proof_eval(const params_type &params, group_map_type &group_map,
const poly_type &plms,
const polynomial_type &plms,
const std::vector<typename scalar_field_type::value_type> &elm,
const typename scalar_field_type::value_type &polyscale,
const typename scalar_field_type::value_type &evalscale,
Expand Down
Loading

0 comments on commit abc2538

Please sign in to comment.