Skip to content

Commit

Permalink
Transfer Honk PoC work (#6)
Browse files Browse the repository at this point in the history
* Patch of src/aztec applied.

Patch was generated on aztec2-internal by running the command
`git diff --relative=barretenberg a036fb7c1..72704faec -- src/aztec/`
from within barretenberg/.

* Update .circleci/config.yml

* Patch of src/aztec/plonk applied.

Wasn't applied before?

* Temporarily ignore code-workspace file and .clangd

* Fix gcc compilation.
  • Loading branch information
codygunton authored and dbanks12 committed Jan 28, 2023
1 parent 991985c commit 804647e
Show file tree
Hide file tree
Showing 74 changed files with 3,296 additions and 41 deletions.
14 changes: 14 additions & 0 deletions barretenberg/.circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ jobs:
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 bb-tests
- *save_logs

honk-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests barretenberg-x86_64-linux-clang-assert 1 honk_tests
- *save_logs


stdlib-primitives-tests:
docker:
- image: aztecprotocol/alpine-build-image
Expand Down Expand Up @@ -270,6 +283,7 @@ workflows:
- x86_64-linux-clang
- x86_64-linux-clang-assert
- wasm-linux-clang
- honk-tests: *bb_test
- barretenberg-tests: *bb_test
- stdlib-primitives-tests: *bb_test
- stdlib-recursion-turbo-tests: *bb_test
Expand Down
2 changes: 2 additions & 0 deletions barretenberg/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# to be unignored when we finalize one of these
.vscode/*.code-workspace
6 changes: 4 additions & 2 deletions barretenberg/cpp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.cache/
build*/
src/wasi-sdk-*
src/aztec/plonk/proof_system/proving_key/fixtures
src/aztec/proof_system/proving_key/fixtures
src/aztec/rollup/proofs/*/fixtures
srs_db/ignition/transcript*
srs_db/lagrange
srs_db/coset_lagrange
srs_db/modified_lagrange
.vscode
# to be unignored when we agree on clang-tidy rules
.clangd
4 changes: 3 additions & 1 deletion barretenberg/cpp/cmake/toolchains/x86_64-linux-gcc.cmake
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_CXX_COMPILER "g++")
# TODO(Cody): git rid of this when Adrian's work goes in
add_compile_options(-Wno-uninitialized)
4 changes: 3 additions & 1 deletion barretenberg/cpp/cmake/toolchains/x86_64-linux-gcc10.cmake
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
set(CMAKE_C_COMPILER "gcc-10")
set(CMAKE_CXX_COMPILER "g++-10")
set(CMAKE_CXX_COMPILER "g++-10")
# TODO(Cody): git rid of this when Adrian's work goes in
add_compile_options(-Wno-uninitialized)
2 changes: 2 additions & 0 deletions barretenberg/cpp/src/aztec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ add_subdirectory(srs)
add_subdirectory(ecc)
add_subdirectory(crypto)
add_subdirectory(polynomials)
add_subdirectory(proof_system)
add_subdirectory(honk)
add_subdirectory(plonk)
add_subdirectory(stdlib)
add_subdirectory(rollup)
Expand Down
1 change: 1 addition & 0 deletions barretenberg/cpp/src/aztec/honk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
barretenberg_module(honk numeric ecc srs plonk proof_system)
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#pragma once
#include <vector>

// TODO: this needs to be a C++20 concept!
// i.e. we don't want to inherit from CommitmentScheme, but rather this thing defines an interface
// that we want multiple classes to conform

/**
* @brief describes information (minus challenges) required to create a Kate opening proof.
* Conforms to the OpeningSchema concept
*
* @param polynomials Polynomials being opened
* @param shifted_polynomials Shifted polynomials being opened. Should be size ZERO for Kate as shifts are
* represented by modifying the evaluation points
* @param commitments Commitments to the polynomials being opened
* @param variables The set of points that the polynomials are being opened at
* @param evaluations The claimed evaluations of the committed polynomials when evaluated at points described by
* `variables`
* @param evaluations The claimed evaluations of the shifted polynomials. Should be size ZERO for Kate as shfits are
* represented by modifying the evaluation points
* @param n the number of coefficients in our polynomials (assumed all polynomials are of size n)
*/
template <typename Fr, typename Commitment> struct OpeningSchema {
std::vector<Fr*> polynomials;
std::vector<Fr*> shifted_polynomials;
std::vector<Commitment> commitments;
// 2d vector. First vector = number of variables, second vector = number of point openings for each variable. I
// think we can assume we open all polynomials at all points to keep things simplish...
std::vector<std::vector<Fr>> variables;

// 2d vector. First vector = evaluations for a specific polynomial. Second vector = evaluations for a specific
// polynomial given a specific opening point
std::vector<std::vector<Fr>> evaluations;
std::vector<std::vector<Fr>> shifted_evaluations;

const size_t n;
};

/**
* @brief describes information (minus challenges) required to verify a Kate opening proof.
* Conforms to the OpeningProof concept
*
* @param commitments Commitments to the polynomials being opened
* @param variables The set of points that the polynomials are being opened at
* @param evaluations The claimed evaluations of the committed polynomials when evaluated at points described by
* `variables`
* @param PI the opening proof group elements. One for every variable
*/
template <typename Fr, typename Commitment> struct OpeningProof {
std::vector<Commitment> commitments;
// variables we're opening our polynomials at, and their opening proofs
std::vector<Fr> variables;
// 2d vector. First vector = evaluations for a specific polynomial. Second vector = evaluations for a specific
// polynomial given a specific opening point
std::vector<std::vector<Fr>> evaluations;
std::vector<Commitment> PI;
};

// namespace commitment_scheme_types
// template <typename CommitmentSchemeData> class CommitmentScheme {
// public:
// typedef typename CommitmentSchemeData::Fr Fr;
// typedef typename CommitmentSchemeData::Commitment Commitment;
// typedef typename CommitmentSchemeData::SRS SRS;
// typedef typename CommitmentSchemeData::OpeningProof OpeningProof;

// using ChallengeGenerator = Fr (*)(const std::vector<Fr>&);

// static std::vector<Commitment> commit(const std::vector<Fr*>& , std::shared_ptr<SRS> const&) = 0;

// struct OpeningSchema {
// std::vector<Fr*> polynomials;
// std::vector<Fr*> shifted_polynomials;
// std::vector<Commitment> commitments;
// // 2d vector. First vector = number of variables, second vector = number of point openings for each variable.

// // think we can assume we open all polynomials at all points to keep things simplish...
// std::vector<std::vector<Fr>> variables;

// // 2d vector. First vector = evaluations for a specific polynomial. Second vector = evaluations for a
// specific
// // polynomial given a specific opening point
// std::vector<std::vector<Fr>> evaluations;
// std::vector<std::vector<Fr>> shifted_evaluations;

// const size_t n;
// };

// static virtual OpeningProof batch_open(const OpeningSchema& committed_polynomials,
// std::shared_ptr<SRS> const& srs,
// ChallengeGenerator& challenge_generator);

// static virtual bool batch_verify(const OpeningProof& opening_proof,
// std::shared_ptr<SRS> const& srs,
// ChallengeGenerator& challenge_generator);

// // virtual AggregatedProof aggregate(const OpeningProof& opening_proof,
// // const AggregatedProof& input_aggregation,
// // std::shared_ptr<SRS> const& srs,
// // ChallengeGenerator& challenge_generator);
// };
Empty file.
Loading

0 comments on commit 804647e

Please sign in to comment.