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

Merge master #2

Merged
merged 85 commits into from
May 29, 2023
Merged

Merge master #2

merged 85 commits into from
May 29, 2023

Conversation

ludamad
Copy link
Owner

@ludamad ludamad commented May 29, 2023

Description

Please provide a paragraph or two giving a summary of the change, including relevant motivation and context.

Checklist:

  • I have reviewed my diff in github, line by line.
  • Every change is related to the PR description.
  • I have linked this pull request to the issue(s) that it resolves.
  • There are no unexpected formatting changes, superfluous debug logs, or commented-out code.
  • There are no circuit changes, OR specifications in /markdown/specs have been updated.
  • There are no circuit changes, OR a cryptographer has been assigned for review.
  • I've updated any terraform that needs updating (e.g. environment variables) for deployment.
  • The branch has been rebased against the head of its merge target.
  • I'm happy for the PR to be merged at the reviewer's next convenience.
  • New functions, classes, etc. have been documented according to the doxygen comment format. Classes and structs must have @brief describing the intended functionality.
  • If existing code has been modified, such documentation has been added or updated.

zac-williamson and others added 30 commits March 18, 2023 17:38
Implements RAM/ROM stuff and dynamic arrays as well as separated all fixed_base operation in standard plonk into a separate file, so that it is no longer part of composer
* store lagrange forms of selector polynomials when serializing pk for Ultra

* added comment to ultra_selector_properties
* feat(ts): switch to node-modules linker

* feat(ts): add new env for SRS objects

* feat(ts): test srs bindings

* fix: proper uint8_t include

* feat(ts): revert unneeded changes

* feat(ts): revert unneeded changes

* feat(ts): unify writeMemory arg order

* Update barretenberg_wasm.ts

* feat(ts): fix srs comments

* Update data_store.hpp

---------

Co-authored-by: Adam Domurad <adam@aztecprotocol.com>
* adding adrians new transcript classes
* tests added for transcript and new manifest concept

---------

Co-authored-by: codygunton <codygunton@gmail.com>
* feat(ts): switch to node-modules linker

* feat(ts): add new env for SRS objects

* feat(ts): test srs bindings

* fix: proper uint8_t include

* feat(ts): revert unneeded changes

* feat(ts): revert unneeded changes

* feat(ts): unify writeMemory arg order

* Update barretenberg_wasm.ts

* feat(ts): fix srs comments

* Fix deps

* Fix comments

* fix(build): git add -f .yalc

* Merge

---------

Co-authored-by: Adam Domurad <adam@aztecprotocol.com>
* chore: modularize ts

* chore: reformat
* cleaning up bb.js deps

* update bb structure to use workspaces

* remove foundation .yarn/cache

* chore: don't bundle .yalc

* Update readme

* chore: modularize bb (#271)

* chore: modularize ts

* chore: reformat

* merge

* remove yalc

* Unbundle tsbuildinfo

---------

Co-authored-by: ludamad <domuradical@gmail.com>
Co-authored-by: ludamad <adam.domurad@gmail.com>
* Turbo Circuit Constructor working

* Turbo!! And also fixed some of the fuzzer compilation issues

* Luke: Addressing my own comments and adding minor TODOs where necessary

---------

Co-authored-by: ledwards2225 <l.edwards.d@gmail.com>
* Move circuit constructors to shared.

* Move helper lib and perm helper.

* Move tmp composers and helpers for plonk.

* Fix namespace and red herring comment.

* Remove pointless namespace declaration.

* Fix more namespaces.

* Split flavor

* Rename tests to avoid ambiguity.

* Remove redundant macro defs.

* Fix comment formatting.

* StandardArithmetization is not shared with plonk.
* adding adrians new transcript classes

* building with some failing tests

* tests passing

* tests added for transcript and new manifest concept

* improvements to the manifest concept

* prover now operating on split gemini fuctionality

* make shplonk test independent of Gemini

* gemini and kzg tests updated; reduce prove removed from gemini

* general cleanup

* woops, fix gcc build

* minor rebase fix

* make gemini method return fold polys per Adrians suggestion

* fix bad move
* moving perm grand product to prover lib and fleshing out lookup grand product

* cleaning up perm grand product test

* lookup grand product test in place

* cleaning up lookup grand prod test and adding sorted list accum method and test

* rename prover tests to prover library tests

* general cleanup

* improve naming for gamma and beta constants

* rabse fix
* Move gate data to better location.
* Add basic arithmetization class.
* CircuitConstructor takes Arithmetization.
* Remove FooSelector enums from split composers.
* Make dsl composer agnostic.

* change SYSTEM_COMPOSER under stdlib::types to ultra composer type

* use ultra logic constraints

* in process of debugging, move to using ultra logic constraints

* add get_total_circuit_size method

* acir format tests showing failures with range constraints of different bit sizes

* remove unnecessary comment

* (fix) Temporarily add a redundant add-gate for variables that need range constraint < 8 bits.

* rename functions

* Implement get_solidity_verifier function

* Fix no longer available properties

* remove constraint system

* logic gate changes using plookup

* logic gate debugging

* test for logic gates passing

* last debug things XOR and AND returnign correct results, XOR still failing

* cleanup

* pedersen_plookup

* plookup funcs

* add to header

* fixed error in pedersen hash when RHS is a circuit constant

* added ACIR test for XOR gate

pedersen hash test now checks y coordinate

* temp disable wasm-opt

* Making everything compile with any composer & add a cmake flag to switch on turbo

* enable wasm-opt for asyncify but disable optimizations

* remove using in header

* fixed work queue bug with wasm

wasm code path was not correctly storing fft outputs in proving key

* added bitwise logic operations into stdlib

stdlib method is utility method to provide Composer-agnostic interface due to the use of plookup tables if enabled

* updated acir_format to use new stdlib logic class

Updated ReadMe to include wasm example that supports gtest filtering

* reenable tests

* linting fixes

* disable binaryen with comment

* write instead of read

* remove random

* WIP

* cleanup the debug logging

* restore the randomness

* only add a zero/one test instead of replacing

* remove unused change

* changes to make solgen work correctly in bindings

* fix join_split_tests.test_deposit_construct_proof

* working serialized proving key size and circuit change test for ultra (#307)

* USE_TURBO for join_split

* Empty-Commit

* Don't default one function; tweak comments.

* Empty-Commit

---------

Co-authored-by: Suyash Bagad <suyashnbagad1997@gmail.com>
Co-authored-by: vezenovm <mvezenov@gmail.com>
Co-authored-by: Maxim Vezenov <maximvezenov@Maxims-MacBook-Pro.local>
Co-authored-by: zac-williamson <blorktronics@gmail.com>
Co-authored-by: kevaundray <kevtheappdev@gmail.com>
Co-authored-by: codygunton <codygunton@gmail.com>
* Add debugging CMake preset & update code-workspace

---------

Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com>
* duplicate ultra composer with tests passing

* instantiating a circuit constructor in composer but not using it yet

* directory updates after rebase plus finalize circuit function added

* WiP almost have composer helper proving key computation building

* WiP still debugging linker error

* linker issue seemingly resolved

* create prover building and running with new composer

* proving key polys match old composer for simple circuit

* circuit with no lookups is verifying

* all composer tests passing with split ultra composer

* kill poly store debug code

* cleanup

* fix arithmetization rebase issues

* WiP new test

* fix bad circuit size bug

* cleanup
* fix(nix): Use wasi-sdk 12 to provide barretenberg-wasm in overlay

* chore: Remove the wasm stuff from main package

* chore(nix): Switch the default llvm to 11

* chore(nix): Add transcript00 to the overlay

chore(nix): Cleanup for nix flake check

* Use hash for each platform

* avoid symlinks

* try wasi-sdk that someone wrote on github

* fix hash for linux

* try to ignore libstdc++

* need the whole name

* try to include std lib instead of ignore

* cleanup and nix flake check

* chore(ci): Check the nix flake in CI

* run default build instead of llvm12
* Move composer type from plonk to bonk.
* Move pk & vk into plonk.
* bonk ~>  proof_system; nest plonk and honk in it.
* proof_system independent of plonk.
* fix(dsl): Use info instead of std::cout to log

* Empty-Commit

---------

Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
* fix(nix): Disable ASM & ADX when building in Nix

* Empty-Commit

---------

Co-authored-by: kevaundray <kevtheappdev@gmail.com>
* Split Pedersen Hash & Commitment Gadgets (#95)

* [SQUASHED] Pedersen refactor into hash and commitment.

Use lookup pedersen for merkle tree, fixed-base pedersen for commitments.
---------
Co-authored-by: Suyash Bagad <suyashnbagad1997@gmail.com>

Port `copy_as_new_witness`.

Port `must_imply`.

`operator++`.

Port changes from `common`.

Port `ecc/groups`.

* [CPM] add missing dependencies to libbarretenberg.a (#154)
---------

* Increase Pedersen Generator indices and subindices. (#169)

* Remove a3 specific types. (#252)

* Address Luke's Comments on `aztec3 -> master` (#263)

* Add must_imply tests.

* Added a test for `field_t::copy_as_new_witness`

* add test for `conditional_assign`

* Added `infinity` test.

* Add `add_affine_test`.

* Tests for Array Object in `stdlib` (#262)

* basic array tests.

* Add `composer_type` while hashing/compressing a vkey.

* Add `contains_recursive_proof` to Recursive VK (#268)

* feat: debug utility for serialization (#290)

* feat: enable asan config

* `array_push` for Generic Type (#291)

* Add Indexed Merkle Tree  (#281)

* remove ts (consulted with Adam and we're good to go). (#292)

* Add cout for verification_key struct (#295)

* compute tree (#298)

* [SQUASHED] fixing `push_array_to_array` method. (#304)

* feat(memory_tree|a3): add sibling path calculations (#301)

* feat(memory_tree): frontier paths

* fix array and resolve merge conflicts (#305)

* Mc/hash vk (#306)

* Increase number of sub-generators to 128.

* Build a3crypto.wasm (#311)

* More Tests on A3 `stdlib` methods (#316)

* test: more vk tests to compare circuit/native/vk_data (#310)

* Mc/hash vk (#306)

* inc num_generators_per_hash_index to 128. (#309)

* fix. (#318)

* Added test for `compute_tree_native`. (#319)

* Install instructions for apt on ubuntu (#312)

* Fix address compilation. (#329)

---------

Co-authored-by: David Banks <47112877+dbanks12@users.noreply.github.com>
Co-authored-by: Michael Connor <mike@aztecprotocol.com>
Co-authored-by: dbanks12 <david@aztecprotocol.com>
Co-authored-by: Santiago Palladino <spalladino@gmail.com>
Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: Maddiaa <47148561+cheethas@users.noreply.github.com>
Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com>
Co-authored-by: ludamad <domuradical@gmail.com>
Co-authored-by: cheethas <urmasurda@gmail.com>
* make MSM size in work queue more flexible

* new work queue hooked up everywhere excluding shplonk

* improve interface and remove commitment key from prover

* move old work queue to plonk namespace
…335)

* fix(cmake): Remove leveldb dep d that was accidentally re-added

* Empty-Commit

---------

Co-authored-by: kevaundray <kevtheappdev@gmail.com>
* add split UltraHonk composer and checks for consistency with UltraPlonk

* adding issue number to some TODOs
* fix: Revert generator changes that cause memory OOB access

* Empty-Commit

* Fix cci (temporarily).

* comment out one more test.

---------

Co-authored-by: kevaundray <kevtheappdev@gmail.com>
Co-authored-by: Suyash Bagad <suyashnbagad1997@gmail.com>
* Update field.hpp

* Update field.hpp

* Update field.hpp
codygunton and others added 28 commits May 4, 2023 17:18
- Introducing the flavor classes (mainly honk, splash of plonk)
---------

Co-authored-by: ledwards2225 <l.edwards.d@gmail.com>
Adds an external_bench file with benchmarks we use for external benchmarking projects
Co-authored-by: maramihali <mara@aztecprotocol.com>
Co-authored-by: maramihali <mara@aztecprotocol.com>
---------

Co-authored-by: zac-williamson <blorktronics@gmail.com>
* verification takes a pre-hashed message : Note: if len(hash) > 32 bytes, then bigfield will fail

* use hashed_message when generating signature

* modify acir structure and function to now use prehashed variant

* message -> hashed_message
…ting circuit (#438)

* Add way to make verifiers data valid by replacing zeroes with valid public keys and signatures

Co-authored-by: Zachary James Williamson <zac-williamson@users.noreply.github.com>

* Update cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp

* replace templates with concrete methods

* add comment

* PR review

* add comments

* change to use boolean flag, so dummy_ecdsa method lives in ecdsa

* ad true as default

---------

Co-authored-by: Zachary James Williamson <zac-williamson@users.noreply.github.com>
* *WIP* do not push

* Generate constraints for dynamic memory

* fix unit test: add missing block_constraint

* add unit test for dynamic memory

* missed one block constraint in ecdsa unit test

* trying a rebase

* remove comments
* Regenerate pedersen lookup tables if they're empty

* re-init generator tables if they're empty.

* feat(nullifier_tree): make empty nullifier tree leaves hash be 0 (#360)

* feat(nullifier_tree): make empty nullifier tree leaves be 0

* fix: add append zero behaviour and test

* fix: explicit type name

* clean: update class semantics

---------

Co-authored-by: cheethas <urmasurda@gmail.com>
Co-authored-by: cheethas <addaboy@gmail.com>

* More generators for aztec3.

* update js vk (because we now use UP for merkle hashing)

* Helpers for ECDSA in A3 (#364)

* Add `stdlib_keccak` in cmake.

Correct an assertion in `to_byte_array` in bigfield.

* Add `random_element` to affine element.

* negate y conditionally.

* feat(nullifier_tree): make empty nullifier tree leaves hash be 0 (#360)

* feat(nullifier_tree): make empty nullifier tree leaves be 0

* fix: add append zero behaviour and test

* fix: explicit type name

* clean: update class semantics

---------

Co-authored-by: cheethas <urmasurda@gmail.com>
Co-authored-by: cheethas <addaboy@gmail.com>

* Change pedersen hash c_bind to use `pedersen_hash::lookup`.

* feat: add msgpack-c submodule

* Give up on msgpack c_master

* Working hacky msgpack test

* Interim work

* Interim work

* Getting rid of memory hacks

* fix: memory leaks

* Start of demoing cbinds

* Align with other methods

* chore: Remove need to return from msgpack method

* Iterate example

* fix: Hack around generator issues

* feat: iterate on msgpack in bb

* fix: fork msgpack for greater checks

* Refactor

* cleanup

* Update turbo_circuit_constructor.cpp

* chore: continued cleanup

* chore: continued cleanup

* chore: continued cleanup

* Refactor

* Refactor

* fix: ci

* feat(wasm): hacks to make work in a fno-exceptions wasm environment

* feat(wasm): bump msgpack-c

* feat(msgpack): first 'complex' object bound

* More wasm fixes. Was breaking throw() declaration

* Fix field serialization

* refactoring

* Update CMakeLists.txt

* Remove // TODO redundant with msgpack

* Refactor to use macro

* Refactor to use macro

* fix printing bug

* fix: fieldd msgpack endianness fix

* fix: remove shared ptr reference

* doc

* Add static checking for MSGPACK usage

* Revert log.hpp change

* Update struct_map_impl.hpp

* Revert

* remote_build fix

* Keep trying to init submodules

* Keep trying to init submodules

* Bump

* Add missing init_submodules

* Msgpack test fix

* Msgpack test fix

* Msgpack test fix

* Msgpack test fix

* Update polynomial_store.test.cpp

* Merge master

* Update msgpack error

* Better abort distinguishing

* fix: join split VK hash

* Serialization updates

* Fix circuits build

* Try to make circuits test work again

* Try to make circuits test work again

* Try to make circuits test work again

* fix: initialization warning

* fix: prefer default constructor for field, related cleanup

* Grand rename

* chore: remove unused funcs

* Revert fields constructor change for now

* chore: Revert .circleci changes

* chore: Revert foundation removal

* Revert .gitmodules

* Update affine_element.hpp

* Update element.hpp

* Revert header optimizations

* Revert init line

* Update polynomial_store.test.cpp

* Revert header optimization

* Update raw_pointer.hpp

* Update raw_pointer.hpp

* Update func_traits.hpp documentation

* Document msgpack methods in field_impl.hpp

* Update msgpack.hpp

* Update cbind.hpp

* Update msgpack.hpp

* Update msgpack.hpp

* Update schema_impl.hpp

* Update g1.hpp

---------

Co-authored-by: Suyash Bagad <suyashnbagad1997@gmail.com>
Co-authored-by: Maddiaa <47148561+cheethas@users.noreply.github.com>
Co-authored-by: cheethas <urmasurda@gmail.com>
Co-authored-by: cheethas <addaboy@gmail.com>
Co-authored-by: Suyash Bagad <suyash@aztecprotocol.com>
* removed redundant `reduce` operations after negating biggroup elements

simplified hash input structure when hashing transcripts

cached partial non native field multiplications

reverted how native transcript computes hash buffers

pedersen_plookup can be configured to skip the hash_single range check under limited conditions

fixed the range check in pedersen_plookup::hash_single

pedersen_plookup::hash_single now validates the low and high scalar slice values match the  original scalar

bigfield::operator- now correctly uses the UltraPlonk code path if able to

added biggroup::multiple_montgomery_ladder to reduce required field multiplications

added biggroup::quadruple_and_add to reduce required field multiplications

biggroup_nafs now directly calls the Composer range constraint methods to avoid creating redundant arithmetic gates when using the PlookupComposer

biggroup plookup ROM tables now track the maximum size of any field element recovered from the table (i.e. the maximum of the input maximum sizes)

biggroup batch tables prefer to create size-6 lookup tables if doing so reduces the number of individual tables required for a given MSM

recursion::transcript no longer performs redundant range constraints when adding buffer elements
recursion::transcript correctly checks that, when slicing field elements , the slice values are correct over the integers (i.e. slice_sum != original + p)

recursion::verification_key now optimally packs key data into minimum required number of field elements before hashing

recursion::verifier proof and key data is now correctly extracted from the transcript/key instead of being generated directly as witnesses.

cleaned up code + comments

code tidy, added more comments

cleaned up how aggregation object handles public inputs

native verification_key::compress matches circuit output

fixed compile errors + failing tests

compiler error

join_split.test.cpp passing

Note: not changing any upstream .js verification keys. I don't think we need to as bberg is now decoupled from aztec connect

* compiler fix

* more compiler fix

* attempt to fix .js and .sol tests

* revert keccak transcript to original functionality

* added hash_index back into verification_key::compress

fixed composer bug where `decompose_into_default_range` was sometimes not range-constraining last limb

removed commented-out code

added more descriptive comments to PedersenPreimageBuilder

* changed join-split vkey

* temporarily point to branch of aztec that updates aggregation state usage until fix is in aztec master

* revert .aztec-packages-commit

* header brittleness fix

* compiler fix

* compiler fix w. aggregation object

* reverting changes to `assign_object_to_proof_outputs` to preserve backwards-compatibility with a3-packages

* more backwards compatibility fixes

* wip

---------

Co-authored-by: dbanks12 <david@aztecprotocol.com>
Co-authored-by: David Banks <47112877+dbanks12@users.noreply.github.com>
* Revert msgpack submodule

* Bundle msgpack to avoid issues with submodules
* updated stdlib::keccak to be able to hash variable-length inputs (where input size not known at circuit-compile time, only a  maximum possible input size)

* compile error

* compile fils

* compiler fix

* more fix

* compiler fix

* compile fix

* Update cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp

Co-authored-by: kevaundray <kevtheappdev@gmail.com>

* Update cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp

Co-authored-by: kevaundray <kevtheappdev@gmail.com>

* Update cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp

Co-authored-by: kevaundray <kevtheappdev@gmail.com>

* Update cpp/src/barretenberg/stdlib/hash/keccak/keccak.test.cpp

Co-authored-by: kevaundray <kevtheappdev@gmail.com>

* Update cpp/src/barretenberg/stdlib/primitives/field/field.test.cpp

Co-authored-by: kevaundray <kevtheappdev@gmail.com>

* improved readability of stdlib test

* replaced magic numbers in keccak with constants + comments

---------

Co-authored-by: kevaundray <kevtheappdev@gmail.com>
* Add missing `hash_index` while compressing vk.

* comment back vk tests with hash index > 0.
* fix: msgpack error

* fix: allow explicit field init
Previous version accidentally created a packer<packer<Stream>>
* convert partially evaluated polynomials from vectors to Polynomials and rename

* rename fold method to partially_evaluate

* static constexpr barycentric arrays

* change purported evaluations to claimed evaluations

* specify relations in Flavor
* add initial KeccakVar code

* add result field

* add keccak_var_constraints to fields
Allow for correct and efficient batching over identities in the Sumcheck relation
@ludamad ludamad merged commit 9d7ea0b into ludamad:master May 29, 2023
ludamad added a commit that referenced this pull request May 29, 2023
This reverts commit 9d7ea0b.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.