diff --git a/.circleci/config.yml b/.circleci/config.yml
index edecd9b086df..bb420c5da890 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -373,17 +373,6 @@ jobs:
name: "Build and test"
command: build l1-contracts
- noir-contracts-build:
- machine:
- image: ubuntu-2204:2023.07.2
- resource_class: large
- steps:
- - *checkout
- - *setup_env
- - run:
- name: Build
- command: build noir-contracts-build | add_timestamps
-
yarn-project-base:
machine:
image: ubuntu-2204:2023.07.2
@@ -454,6 +443,32 @@ jobs:
echo "export DOCKER_BUILDKIT=" > $BASH_ENV
build aztec-sandbox false arm64
+ cli-x86_64:
+ machine:
+ image: ubuntu-2204:2023.07.2
+ resource_class: large
+ steps:
+ - *checkout
+ - *setup_env
+ - run:
+ name: "Build and test"
+ command: build cli false x86_64
+
+ cli-arm64:
+ machine:
+ image: ubuntu-2204:2023.07.2
+ resource_class: arm.large
+ steps:
+ - *checkout
+ - *setup_env
+ - run:
+ name: "Build and test"
+ # We need to force not to use docker buildkit because for some reason on arm only, it ends up making a call
+ # out to eu-west2 despite the image being locally tagged, resulting in unauthorized 401. Weird docker bug?
+ command: |
+ echo "export DOCKER_BUILDKIT=" > $BASH_ENV
+ build cli false arm64
+
aztec-p2p-bootstrap:
machine:
image: ubuntu-2204:2023.07.2
@@ -547,6 +562,7 @@ jobs:
command: |
create_ecr_manifest aztec-sandbox x86_64,arm64
create_ecr_manifest pxe x86_64,arm64
+ create_ecr_manifest cli x86_64,arm64
boxes-blank-react:
machine:
@@ -1210,7 +1226,6 @@ workflows:
<<: *defaults
- l1-contracts: *defaults
- - noir-contracts-build: *defaults
- mainnet-fork: *defaults
- deploy-mainnet-fork:
@@ -1227,7 +1242,6 @@ workflows:
- yarn-project:
requires:
- yarn-project-base
- - noir-contracts-build
<<: *defaults
- yarn-project-formatting:
requires:
@@ -1260,6 +1274,15 @@ workflows:
- yarn-project
<<: *defaults
+ - cli-x86_64:
+ requires:
+ - yarn-project
+ <<: *defaults
+ - cli-arm64:
+ requires:
+ - yarn-project
+ <<: *defaults
+
- aztec-p2p-bootstrap:
requires:
- yarn-project
@@ -1290,6 +1313,8 @@ workflows:
- aztec-sandbox-arm64
- pxe-x86_64
- pxe-arm64
+ - cli-x86_64
+ - cli-arm64
<<: *defaults
- boxes-blank-react:
diff --git a/.github/workflows/mirror_repos.yml b/.github/workflows/mirror_repos.yml
index ea5e694ca2a5..7f48d3d00c02 100644
--- a/.github/workflows/mirror_repos.yml
+++ b/.github/workflows/mirror_repos.yml
@@ -12,31 +12,8 @@ on:
- cron: '0 2 * * *'
jobs:
- mirror-to-docs-repo:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
- token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
- - name: Push to docs repo
- run: |
- SUBREPO_PATH=docs
- git config --global user.name AztecBot
- git config --global user.email tech@aztecprotocol.com
-
- if ./scripts/git_subrepo.sh push $SUBREPO_PATH --branch=main; then
- git fetch # in case a commit came after this
- git rebase origin/master
- git commit --amend -m "$(git log -1 --pretty=%B) [skip ci]"
- git push
- fi
-
mirror-to-build-system-repo:
runs-on: ubuntu-latest
- # Force sequential.
- needs: mirror-to-docs-repo
steps:
- name: Checkout
uses: actions/checkout@v3
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index a27be2f74939..fea09658ffc7 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,5 +1,5 @@
{
- ".": "0.12.0",
- "barretenberg": "0.12.0",
- "barretenberg/ts": "0.12.0"
+ ".": "0.13.1",
+ "barretenberg": "0.13.1",
+ "barretenberg/ts": "0.13.1"
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 90af93446175..2df30aceeb6c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,70 @@
# Changelog
+## [0.13.1](https://github.com/AztecProtocol/aztec-packages/compare/aztec-packages-v0.13.0...aztec-packages-v0.13.1) (2023-10-31)
+
+
+### Bug Fixes
+
+* Exposing `PXE.getBlock`, exporting `createAztecNodeClient` from `aztec.js` ([#3139](https://github.com/AztecProtocol/aztec-packages/issues/3139)) ([7af345e](https://github.com/AztecProtocol/aztec-packages/commit/7af345e9e96c81a05447a514dc7d27d113ba0948))
+* Revert push cli docker image to docker hub ([#3142](https://github.com/AztecProtocol/aztec-packages/issues/3142)) ([7119382](https://github.com/AztecProtocol/aztec-packages/commit/7119382b4646b4bfe6fc43ba217dc62e2f089cd4))
+
+## [0.13.0](https://github.com/AztecProtocol/aztec-packages/compare/aztec-packages-v0.12.0...aztec-packages-v0.13.0) (2023-10-31)
+
+
+### ⚠ BREAKING CHANGES
+
+* PXE.getNotes(...) + refactor of note types ([#3051](https://github.com/AztecProtocol/aztec-packages/issues/3051))
+
+### Features
+
+* `FieldNote` ([#3037](https://github.com/AztecProtocol/aztec-packages/issues/3037)) ([3d1ffd0](https://github.com/AztecProtocol/aztec-packages/commit/3d1ffd08938240405af7f02c12236486e0e9e0ba))
+* Add Aztec Boxes page to docs ([#2569](https://github.com/AztecProtocol/aztec-packages/issues/2569)) ([997c15c](https://github.com/AztecProtocol/aztec-packages/commit/997c15c9438d629b9f1e9435b8ceaeb54264b092))
+* Adding structure to Transcript ([#2937](https://github.com/AztecProtocol/aztec-packages/issues/2937)) ([db67aa1](https://github.com/AztecProtocol/aztec-packages/commit/db67aa1eb6ae9669d98301efbbb146d6265d58f4))
+* Compile noir contracts with noir_wasm ([#2737](https://github.com/AztecProtocol/aztec-packages/issues/2737)) ([524cecf](https://github.com/AztecProtocol/aztec-packages/commit/524cecf40a6148515d92b193024d2ce587e3e5a8))
+* Dockerize aztec-cli ([#3031](https://github.com/AztecProtocol/aztec-packages/issues/3031)) ([ec2e3c2](https://github.com/AztecProtocol/aztec-packages/commit/ec2e3c22d307d9c3c265cc97b0e5359e94669acc))
+* Efficient ZM quotient computation ([#3016](https://github.com/AztecProtocol/aztec-packages/issues/3016)) ([ebda5fc](https://github.com/AztecProtocol/aztec-packages/commit/ebda5fcbc7321cb3f91b0c7a742b7cbd88a15179))
+* **feature_branch:** Private Kernel Circuit ([#2740](https://github.com/AztecProtocol/aztec-packages/issues/2740)) ([f800a36](https://github.com/AztecProtocol/aztec-packages/commit/f800a36d351a18c1c06ee1acff90c6002a699a92))
+* Measure plonk rounds ([#3065](https://github.com/AztecProtocol/aztec-packages/issues/3065)) ([c8e1d8b](https://github.com/AztecProtocol/aztec-packages/commit/c8e1d8b9244c3955f0fea6a34a3cc28a81a29d2c))
+* Migrate the init kernel CPP tests to noir ([#3091](https://github.com/AztecProtocol/aztec-packages/issues/3091)) ([906429f](https://github.com/AztecProtocol/aztec-packages/commit/906429fa42628b1ccfc79f9d269301b3af133174))
+* New script to output table of benchmarks for README pasting. ([#2780](https://github.com/AztecProtocol/aztec-packages/issues/2780)) ([6c20b45](https://github.com/AztecProtocol/aztec-packages/commit/6c20b45993ee9cbd319ab8351e2722e0c912f427))
+* Pedersen in typescript. ([#3111](https://github.com/AztecProtocol/aztec-packages/issues/3111)) ([933f1b2](https://github.com/AztecProtocol/aztec-packages/commit/933f1b2c24a3a4bdaafd31e1158ba702ee9874c9))
+* Protogalaxy folding of challenges ([#2935](https://github.com/AztecProtocol/aztec-packages/issues/2935)) ([7ed30e8](https://github.com/AztecProtocol/aztec-packages/commit/7ed30e83d2bea8399b7acd477c4dfc739417f96d))
+* PXE.getNotes(...) + refactor of note types ([#3051](https://github.com/AztecProtocol/aztec-packages/issues/3051)) ([16abb5a](https://github.com/AztecProtocol/aztec-packages/commit/16abb5ae2e48ed7fcfe3dd2fbf9a111620f30b53))
+* Zeromorph with concatenation (Goblin Translator part 10) ([#3006](https://github.com/AztecProtocol/aztec-packages/issues/3006)) ([70b0f17](https://github.com/AztecProtocol/aztec-packages/commit/70b0f17101f3b378df3e9a0247230b9ebf67239a))
+
+
+### Bug Fixes
+
+* Bad contract txs publishing contract data ([#2673](https://github.com/AztecProtocol/aztec-packages/issues/2673)) ([ccd4611](https://github.com/AztecProtocol/aztec-packages/commit/ccd4611be86c0d73e50c755739afa06dd123c809))
+* Better error message for compute_note_hash_and_nullifier. ([#3097](https://github.com/AztecProtocol/aztec-packages/issues/3097)) ([57bec53](https://github.com/AztecProtocol/aztec-packages/commit/57bec53bd5960f5c2b8e78d944c2efd6d0722254))
+* Broken `FieldNote` test ([#3135](https://github.com/AztecProtocol/aztec-packages/issues/3135)) ([fe78ecf](https://github.com/AztecProtocol/aztec-packages/commit/fe78ecf7eef1f4b6f92b792dab5aa3bc3dffa322))
+* Docker-compose up, rather than run. ([#3081](https://github.com/AztecProtocol/aztec-packages/issues/3081)) ([242f780](https://github.com/AztecProtocol/aztec-packages/commit/242f7806a21a8706779545df15b40f33a7745695))
+* Formatting ([#3070](https://github.com/AztecProtocol/aztec-packages/issues/3070)) ([e1633d3](https://github.com/AztecProtocol/aztec-packages/commit/e1633d349a00bd9bdc2bcd2bbcc820c4d26e9928))
+* Minor stale naming fix ([#3117](https://github.com/AztecProtocol/aztec-packages/issues/3117)) ([a6786ae](https://github.com/AztecProtocol/aztec-packages/commit/a6786ae615071cfe5a74ca4fcec55ce1e735a902))
+* Push cli docker image to docker hub ([#3120](https://github.com/AztecProtocol/aztec-packages/issues/3120)) ([ccad50f](https://github.com/AztecProtocol/aztec-packages/commit/ccad50f0c8761be7298a72770972b75895f5618b))
+* Remove duplicate terraform resource definition ([#3066](https://github.com/AztecProtocol/aztec-packages/issues/3066)) ([d5abadb](https://github.com/AztecProtocol/aztec-packages/commit/d5abadb34f843d6f0e5831e905d1241d14df6237))
+* Retry request spot ([#3116](https://github.com/AztecProtocol/aztec-packages/issues/3116)) ([82de5f1](https://github.com/AztecProtocol/aztec-packages/commit/82de5f1075e05cf92072e083d92f28feaba80c0a))
+
+
+### Miscellaneous
+
+* Add stdlib tests for pedersen commitment ([#3075](https://github.com/AztecProtocol/aztec-packages/issues/3075)) ([87fa621](https://github.com/AztecProtocol/aztec-packages/commit/87fa621347e55f82e36c70515c1824161eee5282))
+* Automatic c_binds for commit should return a point instead of an Fr element ([#3072](https://github.com/AztecProtocol/aztec-packages/issues/3072)) ([2e289a5](https://github.com/AztecProtocol/aztec-packages/commit/2e289a5d11d28496ac47220bede03268065e0cb7))
+* Cleanup remaining mentions of `compress` with pedersen in cpp and ts ([#3074](https://github.com/AztecProtocol/aztec-packages/issues/3074)) ([52cf383](https://github.com/AztecProtocol/aztec-packages/commit/52cf3831794a6ab497c9a40f85859f4cc8ac4700))
+* E2e on spots [ci rebuild] ([#3068](https://github.com/AztecProtocol/aztec-packages/issues/3068)) ([15db6bf](https://github.com/AztecProtocol/aztec-packages/commit/15db6bf32a7c2c1f109392761cd2a16b51115ac9))
+* Fix dapp_testing e2e race condition ([#3094](https://github.com/AztecProtocol/aztec-packages/issues/3094)) ([89e7c21](https://github.com/AztecProtocol/aztec-packages/commit/89e7c2172ee0db4929a9d2d64a570dae250f85da))
+* Remove docs mirror ([#3122](https://github.com/AztecProtocol/aztec-packages/issues/3122)) ([3fa51e2](https://github.com/AztecProtocol/aztec-packages/commit/3fa51e28b480513887b18d0bf6538c178f4d9681))
+* Remove endomorphism coefficient from ecc_add_gate ([#3115](https://github.com/AztecProtocol/aztec-packages/issues/3115)) ([d294987](https://github.com/AztecProtocol/aztec-packages/commit/d294987ad25fb69d2934dfade2bf7063ff64bef2))
+* Remove unecessary calls to `pedersen__init` ([#3079](https://github.com/AztecProtocol/aztec-packages/issues/3079)) ([84f8db2](https://github.com/AztecProtocol/aztec-packages/commit/84f8db20f482242ac29a23eb4c8876f14f060b4c))
+* Remove unused pedersen c_binds ([#3058](https://github.com/AztecProtocol/aztec-packages/issues/3058)) ([e71e5f9](https://github.com/AztecProtocol/aztec-packages/commit/e71e5f94ba920208e7cc9b2b1b9d62678b699812))
+* Removes pedersen commit native pairs method ([#3073](https://github.com/AztecProtocol/aztec-packages/issues/3073)) ([69a34c7](https://github.com/AztecProtocol/aztec-packages/commit/69a34c72c9dccbd54072553ed1ecf0460b16db69))
+* Rename private-kernel subpackage to protocol-circuits ([#3134](https://github.com/AztecProtocol/aztec-packages/issues/3134)) ([3e07104](https://github.com/AztecProtocol/aztec-packages/commit/3e071046d7b0f280cc3b5c426399902425aa1039))
+
+
+### Documentation
+
+* Initial keys spec ([#3035](https://github.com/AztecProtocol/aztec-packages/issues/3035)) ([4b24c58](https://github.com/AztecProtocol/aztec-packages/commit/4b24c580b8770a5926209ca4e29a4cf0644bb383))
+
## [0.12.0](https://github.com/AztecProtocol/aztec-packages/compare/aztec-packages-v0.11.1...aztec-packages-v0.12.0) (2023-10-26)
diff --git a/VERSION b/VERSION
index 20d20514da3c..20183c81d36a 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-v0.12.0 x-release-please-version
+v0.13.1 x-release-please-version
diff --git a/barretenberg/.gitrepo b/barretenberg/.gitrepo
index eb47a3bf5988..abb4bafe5e9b 100644
--- a/barretenberg/.gitrepo
+++ b/barretenberg/.gitrepo
@@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/AztecProtocol/barretenberg
branch = master
- commit = fdbb662c243a9e3940e65fb7b31461a175f8c69e
- parent = 87fa621347e55f82e36c70515c1824161eee5282
+ commit = 340a25673099eee4ae38d4b4a24e2df1cce0c5d0
+ parent = 3e071046d7b0f280cc3b5c426399902425aa1039
method = merge
cmdver = 0.4.6
diff --git a/barretenberg/CHANGELOG.md b/barretenberg/CHANGELOG.md
index 596b744ca1a1..dd2a101c0896 100644
--- a/barretenberg/CHANGELOG.md
+++ b/barretenberg/CHANGELOG.md
@@ -1,5 +1,36 @@
# Changelog
+## [0.13.1](https://github.com/AztecProtocol/aztec-packages/compare/barretenberg-v0.13.0...barretenberg-v0.13.1) (2023-10-31)
+
+
+### Miscellaneous
+
+* **barretenberg:** Synchronize aztec-packages versions
+
+## [0.13.0](https://github.com/AztecProtocol/aztec-packages/compare/barretenberg-v0.12.0...barretenberg-v0.13.0) (2023-10-31)
+
+
+### Features
+
+* Adding structure to Transcript ([#2937](https://github.com/AztecProtocol/aztec-packages/issues/2937)) ([db67aa1](https://github.com/AztecProtocol/aztec-packages/commit/db67aa1eb6ae9669d98301efbbb146d6265d58f4))
+* Efficient ZM quotient computation ([#3016](https://github.com/AztecProtocol/aztec-packages/issues/3016)) ([ebda5fc](https://github.com/AztecProtocol/aztec-packages/commit/ebda5fcbc7321cb3f91b0c7a742b7cbd88a15179))
+* Measure plonk rounds ([#3065](https://github.com/AztecProtocol/aztec-packages/issues/3065)) ([c8e1d8b](https://github.com/AztecProtocol/aztec-packages/commit/c8e1d8b9244c3955f0fea6a34a3cc28a81a29d2c))
+* New script to output table of benchmarks for README pasting. ([#2780](https://github.com/AztecProtocol/aztec-packages/issues/2780)) ([6c20b45](https://github.com/AztecProtocol/aztec-packages/commit/6c20b45993ee9cbd319ab8351e2722e0c912f427))
+* Pedersen in typescript. ([#3111](https://github.com/AztecProtocol/aztec-packages/issues/3111)) ([933f1b2](https://github.com/AztecProtocol/aztec-packages/commit/933f1b2c24a3a4bdaafd31e1158ba702ee9874c9))
+* Protogalaxy folding of challenges ([#2935](https://github.com/AztecProtocol/aztec-packages/issues/2935)) ([7ed30e8](https://github.com/AztecProtocol/aztec-packages/commit/7ed30e83d2bea8399b7acd477c4dfc739417f96d))
+* Zeromorph with concatenation (Goblin Translator part 10) ([#3006](https://github.com/AztecProtocol/aztec-packages/issues/3006)) ([70b0f17](https://github.com/AztecProtocol/aztec-packages/commit/70b0f17101f3b378df3e9a0247230b9ebf67239a))
+
+
+### Miscellaneous
+
+* Add stdlib tests for pedersen commitment ([#3075](https://github.com/AztecProtocol/aztec-packages/issues/3075)) ([87fa621](https://github.com/AztecProtocol/aztec-packages/commit/87fa621347e55f82e36c70515c1824161eee5282))
+* Automatic c_binds for commit should return a point instead of an Fr element ([#3072](https://github.com/AztecProtocol/aztec-packages/issues/3072)) ([2e289a5](https://github.com/AztecProtocol/aztec-packages/commit/2e289a5d11d28496ac47220bede03268065e0cb7))
+* Cleanup remaining mentions of `compress` with pedersen in cpp and ts ([#3074](https://github.com/AztecProtocol/aztec-packages/issues/3074)) ([52cf383](https://github.com/AztecProtocol/aztec-packages/commit/52cf3831794a6ab497c9a40f85859f4cc8ac4700))
+* Remove endomorphism coefficient from ecc_add_gate ([#3115](https://github.com/AztecProtocol/aztec-packages/issues/3115)) ([d294987](https://github.com/AztecProtocol/aztec-packages/commit/d294987ad25fb69d2934dfade2bf7063ff64bef2))
+* Remove unecessary calls to `pedersen__init` ([#3079](https://github.com/AztecProtocol/aztec-packages/issues/3079)) ([84f8db2](https://github.com/AztecProtocol/aztec-packages/commit/84f8db20f482242ac29a23eb4c8876f14f060b4c))
+* Remove unused pedersen c_binds ([#3058](https://github.com/AztecProtocol/aztec-packages/issues/3058)) ([e71e5f9](https://github.com/AztecProtocol/aztec-packages/commit/e71e5f94ba920208e7cc9b2b1b9d62678b699812))
+* Removes pedersen commit native pairs method ([#3073](https://github.com/AztecProtocol/aztec-packages/issues/3073)) ([69a34c7](https://github.com/AztecProtocol/aztec-packages/commit/69a34c72c9dccbd54072553ed1ecf0460b16db69))
+
## [0.12.0](https://github.com/AztecProtocol/aztec-packages/compare/barretenberg-v0.11.1...barretenberg-v0.12.0) (2023-10-26)
diff --git a/barretenberg/README.md b/barretenberg/README.md
index a6487a68e6d2..c8a3d1fab03d 100644
--- a/barretenberg/README.md
+++ b/barretenberg/README.md
@@ -7,6 +7,39 @@ As the spec solidifies, this should be less of an issue. Aztec and Barretenberg
**This code is highly experimental, use at your own risk!**
+### Benchmarks!
+
+Table represents time in ms to build circuit and proof for each test on n threads.
+Ignores proving key construction.
+
+#### x86_64
+
+```
++--------------------------+------------+---------------+-----------+-----------+-----------+-----------+-----------+
+| Test | Gate Count | Subgroup Size | 1 | 4 | 16 | 32 | 64 |
++--------------------------+------------+---------------+-----------+-----------+-----------+-----------+-----------+
+| sha256 | 38799 | 65536 | 5947 | 1653 | 729 | 476 | 388 |
+| ecdsa_secp256k1 | 41049 | 65536 | 6005 | 2060 | 963 | 693 | 583 |
+| ecdsa_secp256r1 | 67331 | 131072 | 12186 | 3807 | 1612 | 1351 | 1137 |
+| schnorr | 33740 | 65536 | 5817 | 1696 | 688 | 532 | 432 |
+| double_verify_proof | 505513 | 524288 | 47841 | 15824 | 7970 | 6784 | 6082 |
++--------------------------+------------+---------------+-----------+-----------+-----------+-----------+-----------+
+```
+
+#### WASM
+
+```
++--------------------------+------------+---------------+-----------+-----------+-----------+-----------+-----------+
+| Test | Gate Count | Subgroup Size | 1 | 4 | 16 | 32 | 64 |
++--------------------------+------------+---------------+-----------+-----------+-----------+-----------+-----------+
+| sha256 | 38799 | 65536 | 18764 | 5116 | 1854 | 1524 | 1635 |
+| ecdsa_secp256k1 | 41049 | 65536 | 19129 | 5595 | 2255 | 2097 | 2166 |
+| ecdsa_secp256r1 | 67331 | 131072 | 38815 | 11257 | 4744 | 3633 | 3702 |
+| schnorr | 33740 | 65536 | 18649 | 5244 | 2019 | 1498 | 1702 |
+| double_verify_proof | 505513 | 524288 | 149652 | 45702 | 20811 | 16979 | 15679 |
++--------------------------+------------+---------------+-----------+-----------+-----------+-----------+-----------+
+```
+
### Dependencies
- cmake >= 3.24
diff --git a/barretenberg/VERSION b/barretenberg/VERSION
index 20d20514da3c..20183c81d36a 100644
--- a/barretenberg/VERSION
+++ b/barretenberg/VERSION
@@ -1 +1 @@
-v0.12.0 x-release-please-version
+v0.13.1 x-release-please-version
diff --git a/barretenberg/acir_tests/bench_acir_tests.sh b/barretenberg/acir_tests/bench_acir_tests.sh
new file mode 100755
index 000000000000..b338e82e30b2
--- /dev/null
+++ b/barretenberg/acir_tests/bench_acir_tests.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+TEST_NAMES=("$@")
+THREADS=(1 4 16 32 64)
+BENCHMARKS=$(mktemp)
+
+if [ "${#TEST_NAMES[@]}" -eq 0 ]; then
+ TEST_NAMES=(sha256 ecdsa_secp256k1 ecdsa_secp256r1 schnorr double_verify_proof)
+fi
+
+for TEST in ${TEST_NAMES[@]}; do
+ for HC in ${THREADS[@]}; do
+ HARDWARE_CONCURRENCY=$HC BENCHMARK_FD=3 ./run_acir_tests.sh $TEST 3>>$BENCHMARKS
+ done
+done
+
+# Build results into string with \n delimited rows and space delimited values.
+TABLE_DATA=""
+for TEST in ${TEST_NAMES[@]}; do
+ GATE_COUNT=$(jq -r --arg test "$TEST" 'select(.name == "gate_count" and .acir_test == $test) | .value' $BENCHMARKS | uniq)
+ SUBGROUP_SIZE=$(jq -r --arg test "$TEST" 'select(.name == "subgroup_size" and .acir_test == $test) | .value' $BENCHMARKS | uniq)
+ # Name in col 1, gate count in col 2, subgroup size in col 3.
+ TABLE_DATA+="$TEST $GATE_COUNT $SUBGROUP_SIZE"
+ # Each thread timing in subsequent cols.
+ for HC in "${THREADS[@]}"; do
+ RESULT=$(cat $BENCHMARKS | jq -r --arg test "$TEST" --argjson hc $HC 'select(.name == "proof_construction_time" and .acir_test == $test and .threads == $hc) | .value')
+ TABLE_DATA+=" $RESULT"
+ done
+ TABLE_DATA+=$'\n'
+done
+
+# Trim the trailing newline.
+TABLE_DATA="${TABLE_DATA%$'\n'}"
+
+echo
+echo Table represents time in ms to build circuit and proof for each test on n threads.
+echo Ignores proving key construction.
+echo
+# Use awk to print the table
+echo -e "$TABLE_DATA" | awk -v threads="${THREADS[*]}" 'BEGIN {
+ split(threads, t, " ");
+ len_threads = length(t);
+ print "+--------------------------+------------+---------------+" genseparator(len_threads);
+ print "| Test | Gate Count | Subgroup Size |" genthreadheaders(t, len_threads);
+ print "+--------------------------+------------+---------------+" genseparator(len_threads);
+}
+{
+ printf("| %-24s | %-10s | %-13s |", $1, $2, $3);
+ for (i = 4; i <= len_threads+3; i++) {
+ printf " %9s |", $(i);
+ }
+ print "";
+}
+END {
+ print "+--------------------------+------------+---------------+" genseparator(len_threads);
+}
+function genseparator(len, res) {
+ for (i = 1; i <= len; i++) res = res "-----------+";
+ return res;
+}
+function genthreadheaders(t, len, res) {
+ for (i = 1; i <= len; i++) res = res sprintf(" %9s |", t[i]);
+ return res;
+}
+'
+
+rm $BENCHMARKS
\ No newline at end of file
diff --git a/barretenberg/acir_tests/flows/prove_and_verify.sh b/barretenberg/acir_tests/flows/prove_and_verify.sh
index 216c3742a65a..ac78ecc53d7d 100755
--- a/barretenberg/acir_tests/flows/prove_and_verify.sh
+++ b/barretenberg/acir_tests/flows/prove_and_verify.sh
@@ -4,5 +4,5 @@ set -eu
if [ -n "$VERBOSE" ]; then
$BIN prove_and_verify -v -c $CRS_PATH -b ./target/acir.gz
else
- $BIN prove_and_verify -c $CRS_PATH -b ./target/acir.gz > /dev/null 2>&1
+ $BIN prove_and_verify -c $CRS_PATH -b ./target/acir.gz
fi
\ No newline at end of file
diff --git a/barretenberg/acir_tests/run_acir_tests.sh b/barretenberg/acir_tests/run_acir_tests.sh
index e495580dd971..6121588d3919 100755
--- a/barretenberg/acir_tests/run_acir_tests.sh
+++ b/barretenberg/acir_tests/run_acir_tests.sh
@@ -9,7 +9,7 @@ FLOW=${FLOW:-prove_and_verify}
CRS_PATH=~/.bb-crs
BRANCH=master
VERBOSE=${VERBOSE:-}
-NAMED_TEST=${1:-}
+TEST_NAMES=("$@")
FLOW_SCRIPT=$(realpath ./flows/${FLOW}.sh)
@@ -47,12 +47,15 @@ function test() {
cd $1
set +e
+ start=$(date +%s%3N)
$FLOW_SCRIPT
result=$?
+ end=$(date +%s%3N)
+ duration=$((end - start))
set -eu
if [ $result -eq 0 ]; then
- echo -e "\033[32mPASSED\033[0m"
+ echo -e "\033[32mPASSED\033[0m ($duration ms)"
else
echo -e "\033[31mFAILED\033[0m"
exit 1
@@ -61,9 +64,11 @@ function test() {
cd ..
}
-if [ -n "$NAMED_TEST" ]; then
- echo -n "Testing $NAMED_TEST... "
- test $NAMED_TEST
+if [ "${#TEST_NAMES[@]}" -ne 0 ]; then
+ for NAMED_TEST in "${TEST_NAMES[@]}"; do
+ echo -n "Testing $NAMED_TEST... "
+ test $NAMED_TEST
+ done
else
for TEST_NAME in $(find -maxdepth 1 -type d -not -path '.' | sed 's|^\./||'); do
echo -n "Testing $TEST_NAME... "
diff --git a/barretenberg/cpp/CMakeLists.txt b/barretenberg/cpp/CMakeLists.txt
index 514c7c069ece..292b89b6f6e7 100644
--- a/barretenberg/cpp/CMakeLists.txt
+++ b/barretenberg/cpp/CMakeLists.txt
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.24)
project(
Barretenberg
DESCRIPTION "BN254 elliptic curve library, and PLONK SNARK prover"
- VERSION 0.12.0 # x-release-please-version
+ VERSION 0.13.1 # x-release-please-version
LANGUAGES CXX C
)
# Insert version into `bb` config file
diff --git a/barretenberg/cpp/dockerfiles/Dockerfile.wasm-linux-clang b/barretenberg/cpp/dockerfiles/Dockerfile.wasm-linux-clang
index 8be67fce55d4..bdcd6d3edc77 100644
--- a/barretenberg/cpp/dockerfiles/Dockerfile.wasm-linux-clang
+++ b/barretenberg/cpp/dockerfiles/Dockerfile.wasm-linux-clang
@@ -4,11 +4,8 @@ WORKDIR /usr/src/barretenberg/cpp
COPY ./scripts/install-wasi-sdk.sh ./scripts/install-wasi-sdk.sh
RUN ./scripts/install-wasi-sdk.sh
COPY . .
-# Building both wasm's in parallel reduces build from 120s to 80s.
-RUN (cmake --preset wasm && cmake --build --preset wasm) & \
- (cmake --preset wasm-threads && cmake --build --preset wasm-threads) & \
- wait
-
+RUN cmake --preset wasm && cmake --build --preset wasm
+RUN cmake --preset wasm-threads && cmake --build --preset wasm-threads
FROM scratch
WORKDIR /usr/src/barretenberg/cpp
diff --git a/barretenberg/cpp/scripts/bb-tests.sh b/barretenberg/cpp/scripts/bb-tests.sh
index 4ffbf4ea0360..d0ca404757e1 100755
--- a/barretenberg/cpp/scripts/bb-tests.sh
+++ b/barretenberg/cpp/scripts/bb-tests.sh
@@ -11,21 +11,31 @@ IMAGE_URI=$(calculate_image_uri $REPOSITORY)
retry docker pull $IMAGE_URI
TESTS=(
+ commitment_schemes_tests
crypto_aes128_tests
crypto_blake2s_tests
crypto_blake3s_tests
crypto_ecdsa_tests
+ crypto_pedersen_commitment_tests
+ crypto_pedersen_hash_tests
crypto_schnorr_tests
crypto_sha256_tests
+ dsl_tests
ecc_tests
+ eccvm_tests
+ flavor_tests
+ goblin_tests
+ join_split_example_proofs_inner_proof_data_tests
+ join_split_example_proofs_notes_tests
numeric_tests
plonk_tests
polynomials_tests
- join_split_example_proofs_inner_proof_data_tests
- join_split_example_proofs_notes_tests
+ protogalaxy_tests
+ relations_tests
srs_tests
+ sumcheck_tests
transcript_tests
- dsl_tests
+ ultra_honk_tests
)
TESTS_STR="${TESTS[@]}"
diff --git a/barretenberg/cpp/scripts/benchmarks.sh b/barretenberg/cpp/scripts/benchmarks.sh
new file mode 100755
index 000000000000..a7ec1dcb1d0e
--- /dev/null
+++ b/barretenberg/cpp/scripts/benchmarks.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+set -eu
+
+# Move above script dir.
+cd $(dirname $0)/..
+
+# Configure and build.
+cmake --preset clang16
+cmake --build --preset clang16
+
+cd build
+
+# github markdown style, works in comments and descriptions
+echo -e "Standard Plonk
"
+echo -e '\n```'
+./bin/standard_plonk_bench | tee standard_plonk_bench.out
+echo -e '```\n'
+echo -e " "
+echo -e "Ultra Honk Round Breakdown
"
+echo -e '\n```'
+./bin/ultra_honk_rounds_bench | tee ultra_honk_rounds_bench.out
+echo -e '```\n'
+echo -e " "
+echo -e "Ultra Plonk Round Breakdown
"
+echo -e '\n```'
+./bin/ultra_plonk_rounds_bench | tee ultra_plonk_rounds_bench.out
+echo -e '```\n'
+echo -e " "
+echo -e "Ultra Honk
"
+echo -e '\n```'
+./bin/ultra_honk_bench | tee ultra_honk_bench.out
+echo -e '```\n'
+echo -e " "
+echo -e "Ultra Plonk
"
+echo -e '\n```'
+./bin/ultra_plonk_bench | tee ultra_plonk_bench.out
+echo -e '```\n'
+echo -e " "
diff --git a/barretenberg/cpp/scripts/collect_profile_information.sh b/barretenberg/cpp/scripts/collect_profile_information.sh
index 28ca73fe4d2a..df932c086bcd 100755
--- a/barretenberg/cpp/scripts/collect_profile_information.sh
+++ b/barretenberg/cpp/scripts/collect_profile_information.sh
@@ -1,9 +1,14 @@
#!/bin/bash
set -eu
-PRESET=${1:-xray} # can also be 'xray-1thread'
+# can also be 'xray-1thread'
+PRESET=${1:-xray}
+# pass "" to run and 1 to reuse old results
ONLY_PROCESS=${2:-}
+# pass the executable name from build/bin
EXECUTABLE=${3:-ultra_honk_rounds_bench}
+# by default run the executable, but we can provide an alt command e.g. use taskset and benchmark flags
+COMMAND=${4:-./bin/$EXECUTABLE}
# Move above script dir.
cd $(dirname $0)/..
@@ -19,7 +24,7 @@ if [ -z "$ONLY_PROCESS" ]; then
rm -f xray-log.$EXECUTABLE.*
# Run benchmark with profiling.
- XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic verbosity=1" ./bin/$EXECUTABLE
+ XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic verbosity=1" $COMMAND
fi
function shorten_cpp_names() {
diff --git a/barretenberg/cpp/src/CMakeLists.txt b/barretenberg/cpp/src/CMakeLists.txt
index 62f2100fa748..6b02009b6565 100644
--- a/barretenberg/cpp/src/CMakeLists.txt
+++ b/barretenberg/cpp/src/CMakeLists.txt
@@ -48,26 +48,35 @@ else()
message(STATUS "Using optimized assembly for field arithmetic.")
endif()
-add_subdirectory(barretenberg/env)
+add_subdirectory(barretenberg/bb)
+add_subdirectory(barretenberg/commitment_schemes)
add_subdirectory(barretenberg/common)
-add_subdirectory(barretenberg/numeric)
-add_subdirectory(barretenberg/srs)
-add_subdirectory(barretenberg/ecc)
add_subdirectory(barretenberg/crypto)
-add_subdirectory(barretenberg/polynomials)
-add_subdirectory(barretenberg/proof_system)
-add_subdirectory(barretenberg/transcript)
-add_subdirectory(barretenberg/honk)
-add_subdirectory(barretenberg/plonk)
-add_subdirectory(barretenberg/stdlib)
-add_subdirectory(barretenberg/join_split_example)
add_subdirectory(barretenberg/dsl)
+add_subdirectory(barretenberg/ecc)
+add_subdirectory(barretenberg/eccvm)
+add_subdirectory(barretenberg/env)
add_subdirectory(barretenberg/examples)
+add_subdirectory(barretenberg/flavor)
+add_subdirectory(barretenberg/grumpkin_srs_gen)
+add_subdirectory(barretenberg/goblin)
+add_subdirectory(barretenberg/honk)
+add_subdirectory(barretenberg/join_split_example)
+add_subdirectory(barretenberg/numeric)
+add_subdirectory(barretenberg/plonk)
+add_subdirectory(barretenberg/polynomials)
+add_subdirectory(barretenberg/proof_system)
+add_subdirectory(barretenberg/protogalaxy)
+add_subdirectory(barretenberg/relations)
add_subdirectory(barretenberg/serialize)
add_subdirectory(barretenberg/solidity_helpers)
+add_subdirectory(barretenberg/srs)
+add_subdirectory(barretenberg/stdlib)
+add_subdirectory(barretenberg/sumcheck)
+add_subdirectory(barretenberg/transcript)
+add_subdirectory(barretenberg/translator_vm)
+add_subdirectory(barretenberg/ultra_honk)
add_subdirectory(barretenberg/wasi)
-add_subdirectory(barretenberg/grumpkin_srs_gen)
-add_subdirectory(barretenberg/bb)
if(SMT)
@@ -89,7 +98,6 @@ message(STATUS "Compiling all-in-one barretenberg archive")
add_library(
barretenberg
STATIC
- $
$
$
$
@@ -100,6 +108,7 @@ add_library(
$
$
$
+ $
$
$
$
@@ -134,8 +143,6 @@ if(WASM)
# to implement the functions in env.
add_executable(
barretenberg.wasm
- $
- $
$
$
$
@@ -146,6 +153,7 @@ if(WASM)
$
$
$
+ $
$
$
$
@@ -165,6 +173,7 @@ if(WASM)
$
$
$
+ $
)
add_executable(
diff --git a/barretenberg/cpp/src/barretenberg/barretenberg.hpp b/barretenberg/cpp/src/barretenberg/barretenberg.hpp
index 24c79da90c01..30c143a6af6c 100644
--- a/barretenberg/cpp/src/barretenberg/barretenberg.hpp
+++ b/barretenberg/cpp/src/barretenberg/barretenberg.hpp
@@ -47,6 +47,7 @@
#include "stdlib/merkle_tree/merkle_tree.hpp"
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/728):
// Consider moving nullifier tree logic out of barretenberg into aztec repo
+#include "barretenberg/plonk/transcript/manifest.hpp"
#include "stdlib/merkle_tree/nullifier_tree/nullifier_leaf.hpp"
#include "stdlib/merkle_tree/nullifier_tree/nullifier_memory_tree.hpp"
#include "stdlib/merkle_tree/nullifier_tree/nullifier_tree.hpp"
@@ -68,4 +69,3 @@
#include "stdlib/recursion/verification_key/verification_key.hpp"
#include "stdlib/recursion/verifier/program_settings.hpp"
#include "stdlib/recursion/verifier/verifier.hpp"
-#include "transcript/manifest.hpp"
diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp
index 19d4fac408a8..61c15c7f3721 100644
--- a/barretenberg/cpp/src/barretenberg/bb/main.cpp
+++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp
@@ -1,9 +1,13 @@
+#include "barretenberg/dsl/acir_format/acir_format.hpp"
+#include "barretenberg/dsl/types.hpp"
#include "config.hpp"
#include "get_bytecode.hpp"
#include "get_crs.hpp"
#include "get_witness.hpp"
#include "log.hpp"
+#include
#include
+#include
#include
#include
#include
@@ -16,6 +20,9 @@ using namespace barretenberg;
std::string CRS_PATH = "./crs";
bool verbose = false;
+const std::filesystem::path current_path = std::filesystem::current_path();
+const auto current_dir = current_path.filename().string();
+
acir_proofs::AcirComposer init(acir_format::acir_format& constraint_system)
{
acir_proofs::AcirComposer acir_composer(0, verbose);
@@ -69,7 +76,20 @@ bool proveAndVerify(const std::string& bytecodePath, const std::string& witnessP
auto witness = get_witness(witnessPath);
auto acir_composer = init(constraint_system);
+ Timer pk_timer;
+ acir_composer.init_proving_key(constraint_system);
+ write_benchmark("pk_construction_time", pk_timer.milliseconds(), "acir_test", current_dir);
+ write_benchmark("gate_count", acir_composer.get_total_circuit_size(), "acir_test", current_dir);
+ write_benchmark("subgroup_size", acir_composer.get_circuit_subgroup_size(), "acir_test", current_dir);
+
+ Timer proof_timer;
auto proof = acir_composer.create_proof(constraint_system, witness, recursive);
+ write_benchmark("proof_construction_time", proof_timer.milliseconds(), "acir_test", current_dir);
+
+ Timer vk_timer;
+ acir_composer.init_verification_key();
+ write_benchmark("vk_construction_time", vk_timer.milliseconds(), "acir_test", current_dir);
+
auto verified = acir_composer.verify_proof(proof, recursive);
vinfo("verified: ", verified);
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt
index 16f375379bbb..bfba40b03b41 100644
--- a/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt
+++ b/barretenberg/cpp/src/barretenberg/benchmark/CMakeLists.txt
@@ -2,4 +2,5 @@ add_subdirectory(decrypt_bench)
add_subdirectory(pippenger_bench)
add_subdirectory(plonk_bench)
add_subdirectory(honk_bench)
-add_subdirectory(relations_bench)
\ No newline at end of file
+add_subdirectory(relations_bench)
+add_subdirectory(widgets_bench)
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/CMakeLists.txt
index ed6122bb41e5..1de8756be423 100644
--- a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/CMakeLists.txt
+++ b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/CMakeLists.txt
@@ -4,10 +4,12 @@ set(BENCHMARK_SOURCES
ultra_honk.bench.cpp
ultra_honk_rounds.bench.cpp
ultra_plonk.bench.cpp
+ ultra_plonk_rounds.bench.cpp
)
# Required libraries for benchmark suites
set(LINKED_LIBRARIES
+ ultra_honk
stdlib_sha256
stdlib_keccak
stdlib_merkle_tree
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/benchmark_utilities.hpp b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/benchmark_utilities.hpp
index 5053d89bd541..6f223939a4b1 100644
--- a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/benchmark_utilities.hpp
+++ b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/benchmark_utilities.hpp
@@ -2,8 +2,7 @@
#include
#include
-#include "barretenberg/honk/composer/ultra_composer.hpp"
-#include "barretenberg/honk/proof_system/ultra_prover.hpp"
+#include "barretenberg/plonk/composer/standard_composer.hpp"
#include "barretenberg/plonk/composer/ultra_composer.hpp"
#include "barretenberg/proof_system/types/circuit_type.hpp"
#include "barretenberg/stdlib/encryption/ecdsa/ecdsa.hpp"
@@ -18,40 +17,32 @@
#include "barretenberg/stdlib/primitives/field/field.hpp"
#include "barretenberg/stdlib/primitives/packed_byte_array/packed_byte_array.hpp"
#include "barretenberg/stdlib/primitives/witness/witness.hpp"
+#include "barretenberg/ultra_honk/ultra_composer.hpp"
+#include "barretenberg/ultra_honk/ultra_prover.hpp"
using namespace benchmark;
namespace bench_utils {
-struct BenchParams {
- // Num iterations of the operation of interest in a test circuit, e.g. num sha256 hashes
- static constexpr size_t MIN_NUM_ITERATIONS = 10;
- static constexpr size_t MAX_NUM_ITERATIONS = 10;
-
- // Log num gates; for simple circuits only, e.g. standard arithmetic circuit
- static constexpr size_t MIN_LOG_NUM_GATES = 16;
- static constexpr size_t MAX_LOG_NUM_GATES = 16;
-
- static constexpr size_t NUM_REPETITIONS = 1;
-};
-
/**
* @brief Generate test circuit with basic arithmetic operations
*
* @param composer
* @param num_iterations
*/
-template void generate_basic_arithmetic_circuit(Builder& builder, size_t num_gates)
+template void generate_basic_arithmetic_circuit(Builder& builder, size_t log2_num_gates)
{
proof_system::plonk::stdlib::field_t a(
proof_system::plonk::stdlib::witness_t(&builder, barretenberg::fr::random_element()));
proof_system::plonk::stdlib::field_t b(
proof_system::plonk::stdlib::witness_t(&builder, barretenberg::fr::random_element()));
proof_system::plonk::stdlib::field_t c(&builder);
- if (num_gates < 4) {
+ size_t passes = (1UL << log2_num_gates) / 4 - 4;
+ if (static_cast(passes) <= 0) {
throw std::runtime_error("too few gates");
}
- for (size_t i = 0; i < (num_gates / 4) - 4; ++i) {
+
+ for (size_t i = 0; i < passes; ++i) {
c = a + b;
c = a * c;
a = b * b;
@@ -175,37 +166,7 @@ template void generate_merkle_membership_test_circuit(Builder
}
}
-/**
- * @brief Performs proof constuction for benchmarks based on a provided circuit function
- *
- * @details This function assumes state.range refers to num_gates which is the size of the underlying circuit
- *
- * @tparam Builder
- * @param state
- * @param test_circuit_function
- */
-template
-void construct_proof_with_specified_num_gates(State& state,
- void (*test_circuit_function)(typename Composer::CircuitBuilder&,
- size_t)) noexcept
-{
- barretenberg::srs::init_crs_factory("../srs_db/ignition");
- auto num_gates = static_cast(1 << (size_t)state.range(0));
- for (auto _ : state) {
- // Constuct circuit and prover; don't include this part in measurement
- state.PauseTiming();
- auto builder = typename Composer::CircuitBuilder();
- test_circuit_function(builder, num_gates);
-
- auto composer = Composer();
- auto ext_prover = composer.create_prover(builder);
- state.ResumeTiming();
-
- // Construct proof
- auto proof = ext_prover.construct_proof();
- }
-}
-
+// ultrahonk
inline proof_system::honk::UltraProver get_prover(
proof_system::honk::UltraComposer& composer,
void (*test_circuit_function)(proof_system::honk::UltraComposer::CircuitBuilder&, size_t),
@@ -217,6 +178,18 @@ inline proof_system::honk::UltraProver get_prover(
return composer.create_prover(instance);
}
+// standard plonk
+inline proof_system::plonk::Prover get_prover(proof_system::plonk::StandardComposer& composer,
+ void (*test_circuit_function)(proof_system::StandardCircuitBuilder&,
+ size_t),
+ size_t num_iterations)
+{
+ proof_system::StandardCircuitBuilder builder;
+ test_circuit_function(builder, num_iterations);
+ return composer.create_prover(builder);
+}
+
+// ultraplonk
inline proof_system::plonk::UltraProver get_prover(
proof_system::plonk::UltraComposer& composer,
void (*test_circuit_function)(proof_system::honk::UltraComposer::CircuitBuilder&, size_t),
@@ -237,15 +210,13 @@ inline proof_system::plonk::UltraProver get_prover(
* @param test_circuit_function
*/
template
-void construct_proof_with_specified_num_iterations(State& state,
- void (*test_circuit_function)(typename Composer::CircuitBuilder&,
- size_t)) noexcept
+void construct_proof_with_specified_num_iterations(
+ State& state, void (*test_circuit_function)(typename Composer::CircuitBuilder&, size_t), size_t num_iterations)
{
barretenberg::srs::init_crs_factory("../srs_db/ignition");
Composer composer;
- auto num_iterations = static_cast(state.range(0));
for (auto _ : state) {
// Constuct circuit and prover; don't include this part in measurement
state.PauseTiming();
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/standard_plonk.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/standard_plonk.bench.cpp
index 9ed605a34801..b44f4123f610 100644
--- a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/standard_plonk.bench.cpp
+++ b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/standard_plonk.bench.cpp
@@ -4,30 +4,20 @@
using namespace benchmark;
-namespace standard_plonk_bench {
-
using StandardBuilder = proof_system::StandardCircuitBuilder;
using StandardPlonk = proof_system::plonk::StandardComposer;
-// Log number of gates for test circuit
-constexpr size_t MIN_LOG_NUM_GATES = bench_utils::BenchParams::MIN_LOG_NUM_GATES;
-constexpr size_t MAX_LOG_NUM_GATES = bench_utils::BenchParams::MAX_LOG_NUM_GATES;
-// Number of times to repeat each benchmark
-constexpr size_t NUM_REPETITIONS = bench_utils::BenchParams::NUM_REPETITIONS;
-
/**
* @brief Benchmark: Construction of a Standard proof for a circuit determined by the provided circuit function
*/
-void construct_proof_standard(State& state, void (*test_circuit_function)(StandardBuilder&, size_t)) noexcept
+static void construct_proof_standard_power_of_2(State& state) noexcept
{
- bench_utils::construct_proof_with_specified_num_gates(state, test_circuit_function);
+ auto log2_of_gates = static_cast(state.range(0));
+ bench_utils::construct_proof_with_specified_num_iterations(
+ state, &bench_utils::generate_basic_arithmetic_circuit, log2_of_gates);
}
-BENCHMARK_CAPTURE(construct_proof_standard,
- arithmetic,
- &bench_utils::generate_basic_arithmetic_circuit)
- ->DenseRange(MIN_LOG_NUM_GATES, MAX_LOG_NUM_GATES)
- ->Repetitions(NUM_REPETITIONS)
- ->Unit(::benchmark::kSecond);
-
-} // namespace standard_plonk_bench
\ No newline at end of file
+BENCHMARK(construct_proof_standard_power_of_2)
+ // 2**13 gates to 2**18 gates
+ ->DenseRange(13, 18)
+ ->Unit(::benchmark::kMillisecond);
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_honk.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_honk.bench.cpp
index 92933bb46489..471e7db76e09 100644
--- a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_honk.bench.cpp
+++ b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_honk.bench.cpp
@@ -1,51 +1,48 @@
#include
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
-#include "barretenberg/honk/composer/ultra_composer.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
+#include "barretenberg/ultra_honk/ultra_composer.hpp"
using namespace benchmark;
-using namespace proof_system::plonk;
-
-namespace ultra_honk_bench {
-
-using UltraBuilder = proof_system::UltraCircuitBuilder;
-using UltraHonk = proof_system::honk::UltraComposer;
-
-// Number of times to perform operation of interest in the benchmark circuits, e.g. # of hashes to perform
-constexpr size_t MIN_NUM_ITERATIONS = bench_utils::BenchParams::MIN_NUM_ITERATIONS;
-constexpr size_t MAX_NUM_ITERATIONS = bench_utils::BenchParams::MAX_NUM_ITERATIONS;
-// Number of times to repeat each benchmark
-constexpr size_t NUM_REPETITIONS = bench_utils::BenchParams::NUM_REPETITIONS;
+using namespace proof_system;
/**
* @brief Benchmark: Construction of a Ultra Honk proof for a circuit determined by the provided circuit function
*/
-void construct_proof_ultra(State& state, void (*test_circuit_function)(UltraBuilder&, size_t)) noexcept
+static void construct_proof_ultrahonk(State& state,
+ void (*test_circuit_function)(UltraCircuitBuilder&, size_t)) noexcept
+{
+ size_t num_iterations = 10; // 10x the circuit
+ bench_utils::construct_proof_with_specified_num_iterations(
+ state, test_circuit_function, num_iterations);
+}
+
+/**
+ * @brief Benchmark: Construction of a Ultra Plonk proof with 2**n gates
+ */
+static void construct_proof_ultrahonk_power_of_2(State& state) noexcept
{
- bench_utils::construct_proof_with_specified_num_iterations(state, test_circuit_function);
+ auto log2_of_gates = static_cast(state.range(0));
+ bench_utils::construct_proof_with_specified_num_iterations(
+ state, &bench_utils::generate_basic_arithmetic_circuit, log2_of_gates);
}
// Define benchmarks
-BENCHMARK_CAPTURE(construct_proof_ultra, sha256, &bench_utils::generate_sha256_test_circuit)
- ->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
- ->Repetitions(NUM_REPETITIONS)
- ->Unit(::benchmark::kMillisecond);
-BENCHMARK_CAPTURE(construct_proof_ultra, keccak, &bench_utils::generate_keccak_test_circuit)
- ->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
- ->Repetitions(NUM_REPETITIONS)
- ->Unit(::benchmark::kMillisecond);
-BENCHMARK_CAPTURE(construct_proof_ultra,
+BENCHMARK_CAPTURE(construct_proof_ultrahonk, sha256, &bench_utils::generate_sha256_test_circuit)
+ ->Unit(kMillisecond);
+BENCHMARK_CAPTURE(construct_proof_ultrahonk, keccak, &bench_utils::generate_keccak_test_circuit)
+ ->Unit(kMillisecond);
+BENCHMARK_CAPTURE(construct_proof_ultrahonk,
ecdsa_verification,
- &bench_utils::generate_ecdsa_verification_test_circuit)
- ->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
- ->Repetitions(NUM_REPETITIONS)
- ->Unit(::benchmark::kMillisecond);
-BENCHMARK_CAPTURE(construct_proof_ultra,
+ &bench_utils::generate_ecdsa_verification_test_circuit)
+ ->Unit(kMillisecond);
+BENCHMARK_CAPTURE(construct_proof_ultrahonk,
merkle_membership,
- &bench_utils::generate_merkle_membership_test_circuit)
- ->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
- ->Repetitions(NUM_REPETITIONS)
- ->Unit(::benchmark::kMillisecond);
+ &bench_utils::generate_merkle_membership_test_circuit)
+ ->Unit(kMillisecond);
-} // namespace ultra_honk_bench
\ No newline at end of file
+BENCHMARK(construct_proof_ultrahonk_power_of_2)
+ // 2**13 gates to 2**18 gates
+ ->DenseRange(13, 18)
+ ->Unit(kMillisecond);
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_honk_rounds.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_honk_rounds.bench.cpp
index 8b4e7145596b..46642345ef4f 100644
--- a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_honk_rounds.bench.cpp
+++ b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_honk_rounds.bench.cpp
@@ -1,9 +1,9 @@
#include
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
-#include "barretenberg/honk/composer/ultra_composer.hpp"
-#include "barretenberg/honk/proof_system/ultra_prover.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
+#include "barretenberg/ultra_honk/ultra_composer.hpp"
+#include "barretenberg/ultra_honk/ultra_prover.hpp"
using namespace benchmark;
using namespace proof_system;
@@ -24,39 +24,41 @@ BBERG_PROFILE static void test_round_inner(State& state, honk::UltraProver& prov
auto time_if_index = [&](size_t target_index, auto&& func) -> void {
if (index == target_index) {
state.ResumeTiming();
- func();
+ }
+ func();
+ if (index == target_index) {
state.PauseTiming();
- } else {
- func();
}
};
- for (auto _ : state) {
- state.PauseTiming();
- time_if_index(PREAMBLE, [&] { prover.execute_preamble_round(); });
- time_if_index(WIRE_COMMITMENTS, [&] { prover.execute_wire_commitments_round(); });
- time_if_index(SORTED_LIST_ACCUMULATOR, [&] { prover.execute_sorted_list_accumulator_round(); });
- time_if_index(GRAND_PRODUCT_COMPUTATION, [&] { prover.execute_grand_product_computation_round(); });
- time_if_index(RELATION_CHECK, [&] { prover.execute_relation_check_rounds(); });
- time_if_index(ZEROMORPH, [&] { prover.execute_zeromorph_rounds(); });
- state.ResumeTiming();
- }
+
+ time_if_index(PREAMBLE, [&] { prover.execute_preamble_round(); });
+ time_if_index(WIRE_COMMITMENTS, [&] { prover.execute_wire_commitments_round(); });
+ time_if_index(SORTED_LIST_ACCUMULATOR, [&] { prover.execute_sorted_list_accumulator_round(); });
+ time_if_index(GRAND_PRODUCT_COMPUTATION, [&] { prover.execute_grand_product_computation_round(); });
+ time_if_index(RELATION_CHECK, [&] { prover.execute_relation_check_rounds(); });
+ time_if_index(ZEROMORPH, [&] { prover.execute_zeromorph_rounds(); });
}
BBERG_PROFILE static void test_round(State& state, size_t index) noexcept
{
barretenberg::srs::init_crs_factory("../srs_db/ignition");
- honk::UltraComposer composer;
- // TODO(AD) benchmark both sparse and dense circuits?
- honk::UltraProver prover =
- bench_utils::get_prover(composer, &bench_utils::generate_keccak_test_circuit, 1);
- test_round_inner(state, prover, index);
+ for (auto _ : state) {
+ state.PauseTiming();
+ honk::UltraComposer composer;
+ // TODO: https://github.com/AztecProtocol/barretenberg/issues/761 benchmark both sparse and dense circuits
+ honk::UltraProver prover = bench_utils::get_prover(
+ composer, &bench_utils::generate_ecdsa_verification_test_circuit, 10);
+ test_round_inner(state, prover, index);
+ state.ResumeTiming();
+ // NOTE: google bench is very finnicky, must end in ResumeTiming() for correctness
+ }
}
#define ROUND_BENCHMARK(round) \
static void ROUND_##round(State& state) noexcept \
{ \
test_round(state, round); \
} \
- BENCHMARK(ROUND_##round)->Unit(::benchmark::kMillisecond)
+ BENCHMARK(ROUND_##round)->Unit(kMillisecond)
// Fast rounds take a long time to benchmark because of how we compute statistical significance.
// Limit to one iteration so we don't spend a lot of time redoing full proofs just to measure this part.
@@ -65,4 +67,4 @@ ROUND_BENCHMARK(WIRE_COMMITMENTS)->Iterations(1);
ROUND_BENCHMARK(SORTED_LIST_ACCUMULATOR)->Iterations(1);
ROUND_BENCHMARK(GRAND_PRODUCT_COMPUTATION)->Iterations(1);
ROUND_BENCHMARK(RELATION_CHECK);
-ROUND_BENCHMARK(ZEROMORPH);
\ No newline at end of file
+ROUND_BENCHMARK(ZEROMORPH);
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_plonk.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_plonk.bench.cpp
index 74a9fd1acc7e..9ea895fe7035 100644
--- a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_plonk.bench.cpp
+++ b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_plonk.bench.cpp
@@ -3,45 +3,44 @@
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
using namespace benchmark;
+using namespace proof_system;
-namespace ultra_plonk_bench {
-
-using UltraBuilder = proof_system::UltraCircuitBuilder;
-using UltraPlonk = proof_system::plonk::UltraComposer;
-
-// Number of times to perform operation of interest in the benchmark circuits, e.g. # of hashes to perform
-constexpr size_t MIN_NUM_ITERATIONS = bench_utils::BenchParams::MIN_NUM_ITERATIONS;
-constexpr size_t MAX_NUM_ITERATIONS = bench_utils::BenchParams::MAX_NUM_ITERATIONS;
-// Number of times to repeat each benchmark
-constexpr size_t NUM_REPETITIONS = bench_utils::BenchParams::NUM_REPETITIONS;
+/**
+ * @brief Benchmark: Construction of a Ultra Plonk proof for a circuit determined by the provided circuit function
+ */
+static void construct_proof_ultraplonk(State& state,
+ void (*test_circuit_function)(UltraCircuitBuilder&, size_t)) noexcept
+{
+ size_t num_iterations = 10; // 10x the circuit
+ bench_utils::construct_proof_with_specified_num_iterations(
+ state, test_circuit_function, num_iterations);
+}
/**
- * @brief Benchmark: Construction of a Ultra Honk proof for a circuit determined by the provided circuit function
+ * @brief Benchmark: Construction of a Ultra Plonk proof with 2**n gates
*/
-void construct_proof_ultra(State& state, void (*test_circuit_function)(UltraBuilder&, size_t)) noexcept
+static void construct_proof_ultraplonk_power_of_2(State& state) noexcept
{
- bench_utils::construct_proof_with_specified_num_iterations(state, test_circuit_function);
+ auto log2_of_gates = static_cast(state.range(0));
+ bench_utils::construct_proof_with_specified_num_iterations(
+ state, &bench_utils::generate_basic_arithmetic_circuit, log2_of_gates);
}
-BENCHMARK_CAPTURE(construct_proof_ultra, sha256, &bench_utils::generate_sha256_test_circuit)
- ->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
- ->Repetitions(NUM_REPETITIONS)
- ->Unit(::benchmark::kMillisecond);
-BENCHMARK_CAPTURE(construct_proof_ultra, keccak, &bench_utils::generate_keccak_test_circuit)
- ->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
- ->Repetitions(NUM_REPETITIONS)
- ->Unit(::benchmark::kMillisecond);
-BENCHMARK_CAPTURE(construct_proof_ultra,
+// Define benchmarks
+BENCHMARK_CAPTURE(construct_proof_ultraplonk, sha256, &bench_utils::generate_sha256_test_circuit)
+ ->Unit(kMillisecond);
+BENCHMARK_CAPTURE(construct_proof_ultraplonk, keccak, &bench_utils::generate_keccak_test_circuit)
+ ->Unit(kMillisecond);
+BENCHMARK_CAPTURE(construct_proof_ultraplonk,
ecdsa_verification,
- &bench_utils::generate_ecdsa_verification_test_circuit)
- ->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
- ->Repetitions(NUM_REPETITIONS)
- ->Unit(::benchmark::kMillisecond);
-BENCHMARK_CAPTURE(construct_proof_ultra,
+ &bench_utils::generate_ecdsa_verification_test_circuit)
+ ->Unit(kMillisecond);
+BENCHMARK_CAPTURE(construct_proof_ultraplonk,
merkle_membership,
- &bench_utils::generate_merkle_membership_test_circuit)
- ->DenseRange(MIN_NUM_ITERATIONS, MAX_NUM_ITERATIONS)
- ->Repetitions(NUM_REPETITIONS)
- ->Unit(::benchmark::kMillisecond);
+ &bench_utils::generate_merkle_membership_test_circuit)
+ ->Unit(kMillisecond);
-} // namespace ultra_plonk_bench
\ No newline at end of file
+BENCHMARK(construct_proof_ultraplonk_power_of_2)
+ // 2**13 gates to 2**18 gates
+ ->DenseRange(13, 18)
+ ->Unit(kMillisecond);
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_plonk_rounds.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_plonk_rounds.bench.cpp
new file mode 100644
index 000000000000..0db10eea9705
--- /dev/null
+++ b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/ultra_plonk_rounds.bench.cpp
@@ -0,0 +1,79 @@
+#include
+
+#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
+#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
+
+using namespace benchmark;
+using namespace proof_system;
+
+// The rounds to measure
+enum {
+ PREAMBLE,
+ FIRST_WIRE_COMMITMENTS,
+ SECOND_FIAT_SHAMIR_ETA,
+ THIRD_FIAT_SHAMIR_BETA_GAMMA,
+ FOURTH_FIAT_SHAMIR_ALPHA_AND_COMMIT,
+ FIFTH_COMPUTE_QUOTIENT_EVALUTION,
+ SIXTH_BATCH_OPEN
+};
+
+BBERG_PROFILE static void plonk_round(
+ State& state, plonk::UltraProver& prover, size_t target_index, size_t index, auto&& func) noexcept
+{
+ if (index == target_index) {
+ state.ResumeTiming();
+ }
+ func();
+ prover.queue.process_queue();
+ if (index == target_index) {
+ state.PauseTiming();
+ }
+}
+/**
+ * @details Benchmark ultraplonk by performing all the rounds, but only measuring one.
+ * Note: As a result the very short rounds take a long time for statistical significance, so recommended to set
+ *their iterations to 1.
+ * @param state - The google benchmark state.
+ * @param prover - The ultraplonk prover.
+ * @param index - The pass to measure.
+ **/
+BBERG_PROFILE static void test_round_inner(State& state, plonk::UltraProver& prover, size_t index) noexcept
+{
+ plonk_round(state, prover, PREAMBLE, index, [&] { prover.execute_preamble_round(); });
+ plonk_round(state, prover, FIRST_WIRE_COMMITMENTS, index, [&] { prover.execute_first_round(); });
+ plonk_round(state, prover, SECOND_FIAT_SHAMIR_ETA, index, [&] { prover.execute_second_round(); });
+ plonk_round(state, prover, THIRD_FIAT_SHAMIR_BETA_GAMMA, index, [&] { prover.execute_third_round(); });
+ plonk_round(state, prover, FOURTH_FIAT_SHAMIR_ALPHA_AND_COMMIT, index, [&] { prover.execute_fourth_round(); });
+ plonk_round(state, prover, FIFTH_COMPUTE_QUOTIENT_EVALUTION, index, [&] { prover.execute_fifth_round(); });
+ plonk_round(state, prover, SIXTH_BATCH_OPEN, index, [&] { prover.execute_sixth_round(); });
+}
+BBERG_PROFILE static void test_round(State& state, size_t index) noexcept
+{
+ barretenberg::srs::init_crs_factory("../srs_db/ignition");
+ for (auto _ : state) {
+ state.PauseTiming();
+ plonk::UltraComposer composer;
+ // TODO: https://github.com/AztecProtocol/barretenberg/issues/761 benchmark both sparse and dense circuits
+ plonk::UltraProver prover = bench_utils::get_prover(
+ composer, &bench_utils::generate_ecdsa_verification_test_circuit, 10);
+ test_round_inner(state, prover, index);
+ // NOTE: google bench is very finnicky, must end in ResumeTiming() for correctness
+ state.ResumeTiming();
+ }
+}
+#define ROUND_BENCHMARK(round) \
+ static void ROUND_##round(State& state) noexcept \
+ { \
+ test_round(state, round); \
+ } \
+ BENCHMARK(ROUND_##round)->Unit(kMillisecond)
+
+// Fast rounds take a long time to benchmark because of how we compute statistical significance.
+// Limit to one iteration so we don't spend a lot of time redoing full proofs just to measure this part.
+ROUND_BENCHMARK(PREAMBLE)->Iterations(1);
+ROUND_BENCHMARK(FIRST_WIRE_COMMITMENTS);
+ROUND_BENCHMARK(SECOND_FIAT_SHAMIR_ETA);
+ROUND_BENCHMARK(THIRD_FIAT_SHAMIR_BETA_GAMMA);
+ROUND_BENCHMARK(FOURTH_FIAT_SHAMIR_ALPHA_AND_COMMIT);
+ROUND_BENCHMARK(FIFTH_COMPUTE_QUOTIENT_EVALUTION);
+ROUND_BENCHMARK(SIXTH_BATCH_OPEN);
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/CMakeLists.txt
index 0db876053fb5..31f4834f4bc7 100644
--- a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/CMakeLists.txt
+++ b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/CMakeLists.txt
@@ -2,16 +2,13 @@
set(BENCHMARK_SOURCES
barycentric.bench.cpp
relations.bench.cpp
- widget.bench.cpp
)
# Required libraries for benchmark suites
set(LINKED_LIBRARIES
- polynomials
proof_system
benchmark::benchmark
transcript
- stdlib_primitives
)
# Add executable and custom target for each suite, e.g. ultra_honk_bench
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp
index 20a99af6a4af..3300fb4bf8ef 100644
--- a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp
+++ b/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/relations.bench.cpp
@@ -1,13 +1,6 @@
-#include "barretenberg/honk/flavor/goblin_ultra.hpp"
-#include "barretenberg/honk/flavor/ultra.hpp"
-#include "barretenberg/proof_system/relations/auxiliary_relation.hpp"
-#include "barretenberg/proof_system/relations/ecc_op_queue_relation.hpp"
-#include "barretenberg/proof_system/relations/elliptic_relation.hpp"
-#include "barretenberg/proof_system/relations/gen_perm_sort_relation.hpp"
-#include "barretenberg/proof_system/relations/lookup_relation.hpp"
-#include "barretenberg/proof_system/relations/permutation_relation.hpp"
-#include "barretenberg/proof_system/relations/relation_parameters.hpp"
-#include "barretenberg/proof_system/relations/ultra_arithmetic_relation.hpp"
+#include "barretenberg/flavor/goblin_translator.hpp"
+#include "barretenberg/flavor/goblin_ultra.hpp"
+#include "barretenberg/flavor/ultra.hpp"
#include
namespace {
@@ -78,4 +71,40 @@ void ultra_arithmetic_relation(::benchmark::State& state) noexcept
}
BENCHMARK(ultra_arithmetic_relation);
+void translator_decomposition_relation(::benchmark::State& state) noexcept
+{
+ execute_relation>(state);
+}
+BENCHMARK(translator_decomposition_relation);
+
+void translator_opcode_constraint_relation(::benchmark::State& state) noexcept
+{
+ execute_relation>(state);
+}
+BENCHMARK(translator_opcode_constraint_relation);
+
+void translator_accumulator_transfer_relation(::benchmark::State& state) noexcept
+{
+ execute_relation>(state);
+}
+BENCHMARK(translator_accumulator_transfer_relation);
+
+void translator_gen_perm_sort_relation(::benchmark::State& state) noexcept
+{
+ execute_relation>(state);
+}
+BENCHMARK(translator_gen_perm_sort_relation);
+
+void translator_non_native_field_relation(::benchmark::State& state) noexcept
+{
+ execute_relation>(state);
+}
+BENCHMARK(translator_non_native_field_relation);
+
+void translator_permutation_relation(::benchmark::State& state) noexcept
+{
+ execute_relation>(state);
+}
+BENCHMARK(translator_permutation_relation);
+
} // namespace proof_system::benchmark::relations
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/CMakeLists.txt
new file mode 100644
index 000000000000..35eebc6d27d3
--- /dev/null
+++ b/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/CMakeLists.txt
@@ -0,0 +1,21 @@
+# Each source represents a separate benchmark suite
+set(BENCHMARK_SOURCES
+ widget.bench.cpp
+)
+
+# Required libraries for benchmark suites
+set(LINKED_LIBRARIES
+ polynomials
+ proof_system
+ benchmark::benchmark
+ transcript
+ stdlib_primitives
+)
+
+# Add executable and custom target for each suite, e.g. ultra_honk_bench
+foreach(BENCHMARK_SOURCE ${BENCHMARK_SOURCES})
+ get_filename_component(BENCHMARK_NAME ${BENCHMARK_SOURCE} NAME_WE) # extract name without extension
+ add_executable(${BENCHMARK_NAME}_bench main.bench.cpp ${BENCHMARK_SOURCE})
+ target_link_libraries(${BENCHMARK_NAME}_bench ${LINKED_LIBRARIES})
+ add_custom_target(run_${BENCHMARK_NAME} COMMAND ${BENCHMARK_NAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
+endforeach()
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/main.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/main.bench.cpp
new file mode 100644
index 000000000000..71fefa047228
--- /dev/null
+++ b/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/main.bench.cpp
@@ -0,0 +1,3 @@
+#include
+
+BENCHMARK_MAIN();
diff --git a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/widget.bench.cpp b/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/widget.bench.cpp
similarity index 96%
rename from barretenberg/cpp/src/barretenberg/benchmark/relations_bench/widget.bench.cpp
rename to barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/widget.bench.cpp
index a47d1cc14603..eb2d7ec79da4 100644
--- a/barretenberg/cpp/src/barretenberg/benchmark/relations_bench/widget.bench.cpp
+++ b/barretenberg/cpp/src/barretenberg/benchmark/widgets_bench/widget.bench.cpp
@@ -1,6 +1,6 @@
#include "barretenberg/benchmark/honk_bench/benchmark_utilities.hpp"
-#include "barretenberg/honk/flavor/goblin_ultra.hpp"
-#include "barretenberg/honk/flavor/ultra.hpp"
+#include "barretenberg/flavor/goblin_ultra.hpp"
+#include "barretenberg/flavor/ultra.hpp"
#include "barretenberg/plonk/composer/standard_composer.hpp"
#include "barretenberg/plonk/composer/ultra_composer.hpp"
#include "barretenberg/plonk/proof_system/widgets/transition_widgets/plookup_auxiliary_widget.hpp"
diff --git a/barretenberg/cpp/src/barretenberg/commitment_schemes/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/commitment_schemes/CMakeLists.txt
new file mode 100644
index 000000000000..8467f3294d1a
--- /dev/null
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/CMakeLists.txt
@@ -0,0 +1 @@
+barretenberg_module(commitment_schemes common transcript polynomials ecc numeric srs)
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/claim.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp
similarity index 97%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/claim.hpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp
index 05f405494f8b..f532689e9817 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/claim.hpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/claim.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "barretenberg/honk/pcs/commitment_key.hpp"
+#include "barretenberg/commitment_schemes/commitment_key.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
namespace proof_system::honk::pcs {
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp
similarity index 100%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.hpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.hpp
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.test.hpp
similarity index 97%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.test.hpp
index 3f70e9d4789c..49e6dcd88388 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/commitment_key.test.hpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/commitment_key.test.hpp
@@ -1,22 +1,17 @@
#pragma once
-#include
-#include
-
+#include "barretenberg/commitment_schemes/commitment_key.hpp"
+#include "barretenberg/commitment_schemes/verification_key.hpp"
+#include "barretenberg/ecc/curves/bn254/g1.hpp"
+#include "barretenberg/polynomials/polynomial.hpp"
+#include "barretenberg/srs/factories/file_crs_factory.hpp"
+#include "claim.hpp"
#include
#include
#include
#include
-#include "barretenberg/ecc/curves/bn254/g1.hpp"
-#include "barretenberg/honk/pcs/commitment_key.hpp"
-#include "barretenberg/honk/pcs/verification_key.hpp"
-#include "barretenberg/polynomials/polynomial.hpp"
-#include "barretenberg/srs/factories/file_crs_factory.hpp"
-
-#include "../../transcript/transcript_wrappers.hpp"
-
-#include "claim.hpp"
+#include
namespace proof_system::honk::pcs {
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.cpp
similarity index 100%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.cpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.cpp
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.hpp
similarity index 99%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.hpp
index 526c7bd84d2a..f9c370bf3e7f 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.hpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.hpp
@@ -1,8 +1,8 @@
#pragma once
#include "../claim.hpp"
-#include "barretenberg/honk/transcript/transcript.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
+#include "barretenberg/transcript/transcript.hpp"
#include
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.test.cpp
similarity index 98%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.test.cpp
index 117b35d3cc49..203ebb523e21 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/gemini/gemini.test.cpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/gemini/gemini.test.cpp
@@ -1,8 +1,8 @@
#include "gemini.hpp"
#include "../commitment_key.test.hpp"
-#include "barretenberg/honk/transcript/transcript.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
+#include "barretenberg/transcript/transcript.hpp"
#include
#include
#include
@@ -25,7 +25,7 @@ template class GeminiTest : public CommitmentTest {
std::vector multilinear_commitments,
std::vector multilinear_commitments_to_be_shifted)
{
- auto prover_transcript = ProverTranscript::init_empty();
+ auto prover_transcript = BaseTranscript::prover_init_empty();
const Fr rho = Fr::random_element();
@@ -79,7 +79,7 @@ template class GeminiTest : public CommitmentTest {
// Check that the Fold polynomials have been evaluated correctly in the prover
this->verify_batch_opening_pair(prover_output.opening_pairs, prover_output.witnesses);
- auto verifier_transcript = VerifierTranscript::init_empty(prover_transcript);
+ auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
// Compute:
// - Single opening pair: {r, \hat{a}_0}
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.hpp
similarity index 96%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.hpp
index ae5b2fcfb24c..7a46a3eb71e4 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.hpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.hpp
@@ -1,9 +1,9 @@
#pragma once
+#include "barretenberg/commitment_schemes/claim.hpp"
+#include "barretenberg/commitment_schemes/verification_key.hpp"
#include "barretenberg/common/assert.hpp"
#include "barretenberg/ecc/scalar_multiplication/scalar_multiplication.hpp"
-#include "barretenberg/honk/pcs/claim.hpp"
-#include "barretenberg/honk/pcs/verification_key.hpp"
-#include "barretenberg/honk/transcript/transcript.hpp"
+#include "barretenberg/transcript/transcript.hpp"
#include
#include
#include
@@ -35,7 +35,7 @@ template class IPA {
static void compute_opening_proof(std::shared_ptr ck,
const OpeningPair& opening_pair,
const Polynomial& polynomial,
- ProverTranscript& transcript)
+ BaseTranscript& transcript)
{
ASSERT(opening_pair.challenge != 0 && "The challenge point should not be zero");
auto poly_degree = static_cast(polynomial.size());
@@ -134,9 +134,7 @@ template class IPA {
*
* @return true/false depending on if the proof verifies
*/
- static bool verify(std::shared_ptr vk,
- const OpeningClaim& opening_claim,
- VerifierTranscript& transcript)
+ static bool verify(std::shared_ptr vk, const OpeningClaim& opening_claim, BaseTranscript& transcript)
{
auto poly_degree = static_cast(transcript.template receive_from_prover("IPA:poly_degree"));
Fr generator_challenge = transcript.get_challenge("IPA:generator_challenge");
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.test.cpp
similarity index 95%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.test.cpp
index d015bfa6d21f..7527aa2a1eb3 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/ipa/ipa.test.cpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/ipa/ipa.test.cpp
@@ -1,10 +1,10 @@
#include "ipa.hpp"
#include "../gemini/gemini.hpp"
#include "../shplonk/shplonk.hpp"
+#include "barretenberg/commitment_schemes/commitment_key.test.hpp"
#include "barretenberg/common/mem.hpp"
#include "barretenberg/ecc/curves/bn254/fq12.hpp"
#include "barretenberg/ecc/curves/types.hpp"
-#include "barretenberg/honk/pcs/commitment_key.test.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/polynomial_arithmetic.hpp"
#include
@@ -70,11 +70,11 @@ TEST_F(IPATest, Open)
const OpeningClaim opening_claim{ opening_pair, commitment };
// initialize empty prover transcript
- ProverTranscript prover_transcript;
+ BaseTranscript prover_transcript;
IPA::compute_opening_proof(this->ck(), opening_pair, poly, prover_transcript);
// initialize verifier transcript from proof data
- VerifierTranscript verifier_transcript{ prover_transcript.proof_data };
+ BaseTranscript verifier_transcript{ prover_transcript.proof_data };
auto result = IPA::verify(this->vk(), opening_claim, verifier_transcript);
EXPECT_TRUE(result);
@@ -129,7 +129,7 @@ TEST_F(IPATest, GeminiShplonkIPAWithShift)
batched_commitment_unshifted = commitment1 * rhos[0] + commitment2 * rhos[1];
batched_commitment_to_be_shifted = commitment2 * rhos[2];
- auto prover_transcript = ProverTranscript::init_empty();
+ auto prover_transcript = BaseTranscript::prover_init_empty();
auto gemini_polynomials = GeminiProver::compute_gemini_polynomials(
mle_opening_point, std::move(batched_unshifted), std::move(batched_to_be_shifted));
@@ -162,7 +162,7 @@ TEST_F(IPATest, GeminiShplonkIPAWithShift)
IPA::compute_opening_proof(this->ck(), shplonk_opening_pair, shplonk_witness, prover_transcript);
- auto verifier_transcript = VerifierTranscript::init_empty(prover_transcript);
+ auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
auto gemini_verifier_claim = GeminiVerifier::reduce_verification(mle_opening_point,
batched_evaluation,
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.hpp
similarity index 93%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.hpp
index 6bd41ac7befb..f56018b2963e 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.hpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.hpp
@@ -1,10 +1,10 @@
#pragma once
#include "../claim.hpp"
-#include "barretenberg/honk/pcs/commitment_key.hpp"
-#include "barretenberg/honk/pcs/verification_key.hpp"
-#include "barretenberg/honk/transcript/transcript.hpp"
+#include "barretenberg/commitment_schemes/commitment_key.hpp"
+#include "barretenberg/commitment_schemes/verification_key.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
+#include "barretenberg/transcript/transcript.hpp"
#include
#include
@@ -31,7 +31,7 @@ template class KZG {
static void compute_opening_proof(std::shared_ptr ck,
const OpeningPair& opening_pair,
const Polynomial& polynomial,
- ProverTranscript& prover_trancript)
+ BaseTranscript& prover_trancript)
{
Polynomial quotient(polynomial);
quotient[0] -= opening_pair.evaluation;
@@ -55,7 +55,7 @@ template class KZG {
*/
static bool verify(std::shared_ptr vk,
const OpeningClaim& claim,
- VerifierTranscript& verifier_transcript)
+ BaseTranscript& verifier_transcript)
{
auto quotient_commitment = verifier_transcript.template receive_from_prover("KZG:W");
auto lhs = claim.commitment - (GroupElement::one() * claim.opening_pair.evaluation) +
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.test.cpp
similarity index 95%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.test.cpp
index 6fe4d1b2641a..9334ddaf4821 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/kzg/kzg.test.cpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/kzg/kzg.test.cpp
@@ -4,7 +4,7 @@
#include "../shplonk/shplonk.hpp"
#include "../commitment_key.test.hpp"
-#include "barretenberg/honk/pcs/claim.hpp"
+#include "barretenberg/commitment_schemes/claim.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/ecc/curves/bn254/g1.hpp"
@@ -39,11 +39,11 @@ TYPED_TEST(KZGTest, single)
auto opening_pair = OpeningPair{ challenge, evaluation };
auto opening_claim = OpeningClaim{ opening_pair, commitment };
- auto prover_transcript = ProverTranscript::init_empty();
+ auto prover_transcript = BaseTranscript::prover_init_empty();
KZG::compute_opening_proof(this->ck(), opening_pair, witness, prover_transcript);
- auto verifier_transcript = VerifierTranscript::init_empty(prover_transcript);
+ auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
bool verified = KZG::verify(this->vk(), opening_claim, verifier_transcript);
EXPECT_EQ(verified, true);
@@ -109,7 +109,7 @@ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift)
batched_commitment_unshifted = commitment1 * rhos[0] + commitment2 * rhos[1];
batched_commitment_to_be_shifted = commitment2 * rhos[2];
- auto prover_transcript = ProverTranscript::init_empty();
+ auto prover_transcript = BaseTranscript::prover_init_empty();
// Run the full prover PCS protocol:
@@ -154,7 +154,7 @@ TYPED_TEST(KZGTest, GeminiShplonkKzgWithShift)
// Run the full verifier PCS protocol with genuine opening claims (genuine commitment, genuine evaluation)
- auto verifier_transcript = VerifierTranscript::init_empty(prover_transcript);
+ auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
// Gemini verifier output:
// - claim: d+1 commitments to Fold_{r}^(0), Fold_{-r}^(0), Fold^(l), d+1 evaluations a_0_pos, a_l, l = 0:d-1
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.hpp
similarity index 98%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.hpp
index 784641012e1b..54fed18e9883 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.hpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.hpp
@@ -1,8 +1,8 @@
#pragma once
-#include "barretenberg/honk/pcs/claim.hpp"
-#include "barretenberg/honk/pcs/commitment_key.hpp"
-#include "barretenberg/honk/pcs/verification_key.hpp"
-#include "barretenberg/honk/transcript/transcript.hpp"
+#include "barretenberg/commitment_schemes/claim.hpp"
+#include "barretenberg/commitment_schemes/commitment_key.hpp"
+#include "barretenberg/commitment_schemes/verification_key.hpp"
+#include "barretenberg/transcript/transcript.hpp"
/**
* @brief Reduces multiple claims about commitments, each opened at a single point
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.test.cpp
similarity index 93%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.test.cpp
index a700b3b594c6..74cd152c21af 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/shplonk/shplonk.test.cpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/shplonk/shplonk.test.cpp
@@ -8,7 +8,7 @@
#include
#include "../commitment_key.test.hpp"
-#include "barretenberg/honk/pcs/claim.hpp"
+#include "barretenberg/commitment_schemes/claim.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
namespace proof_system::honk::pcs::shplonk {
template class ShplonkTest : public CommitmentTest {};
@@ -28,7 +28,7 @@ TYPED_TEST(ShplonkTest, ShplonkSimple)
const size_t n = 16;
- auto prover_transcript = ProverTranscript::init_empty();
+ auto prover_transcript = BaseTranscript::prover_init_empty();
// Generate two random (unrelated) polynomials of two different sizes, as well as their evaluations at a (single but
// different) random point and their commitments.
@@ -64,7 +64,7 @@ TYPED_TEST(ShplonkTest, ShplonkSimple)
opening_claims.emplace_back(OpeningClaim{ opening_pairs[0], commitment1 });
opening_claims.emplace_back(OpeningClaim{ opening_pairs[1], commitment2 });
- auto verifier_transcript = VerifierTranscript::init_empty(prover_transcript);
+ auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
// Execute the shplonk verifier functionality
const auto verifier_claim = ShplonkVerifier::reduce_verification(this->vk(), opening_claims, verifier_transcript);
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/verification_key.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/verification_key.hpp
similarity index 98%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/verification_key.hpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/verification_key.hpp
index 8dc4492815e6..49c77bebbdb4 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/verification_key.hpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/verification_key.hpp
@@ -5,11 +5,11 @@
*
*/
+#include "barretenberg/commitment_schemes/commitment_key.hpp"
#include "barretenberg/ecc/curves/bn254/bn254.hpp"
#include "barretenberg/ecc/curves/bn254/pairing.hpp"
#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
#include "barretenberg/ecc/scalar_multiplication/scalar_multiplication.hpp"
-#include "barretenberg/honk/pcs/commitment_key.hpp"
#include "barretenberg/numeric/bitop/pow.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/polynomials/polynomial_arithmetic.hpp"
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/wrapper.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/wrapper.hpp
similarity index 100%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/wrapper.hpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/wrapper.hpp
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/zeromorph/zeromorph.hpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.hpp
similarity index 100%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/zeromorph/zeromorph.hpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.hpp
diff --git a/barretenberg/cpp/src/barretenberg/honk/pcs/zeromorph/zeromorph.test.cpp b/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.test.cpp
similarity index 98%
rename from barretenberg/cpp/src/barretenberg/honk/pcs/zeromorph/zeromorph.test.cpp
rename to barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.test.cpp
index c4c4dd959844..82b6191eca2e 100644
--- a/barretenberg/cpp/src/barretenberg/honk/pcs/zeromorph/zeromorph.test.cpp
+++ b/barretenberg/cpp/src/barretenberg/commitment_schemes/zeromorph/zeromorph.test.cpp
@@ -1,6 +1,6 @@
#include "zeromorph.hpp"
#include "../commitment_key.test.hpp"
-#include "barretenberg/honk/transcript/transcript.hpp"
+#include "barretenberg/transcript/transcript.hpp"
#include
@@ -76,8 +76,8 @@ template class ZeroMorphTest : public CommitmentTest {
g_commitments.emplace_back(f_commitments[i]);
}
- // Initialize an empty ProverTranscript
- auto prover_transcript = ProverTranscript::init_empty();
+ // Initialize an empty BaseTranscript
+ auto prover_transcript = BaseTranscript::prover_init_empty();
// Execute Prover protocol
{
@@ -147,7 +147,7 @@ template class ZeroMorphTest : public CommitmentTest {
prover_transcript.send_to_verifier("ZM:PI", pi_commitment);
}
- auto verifier_transcript = VerifierTranscript::init_empty(prover_transcript);
+ auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
// Execute Verifier protocol
{
@@ -332,8 +332,8 @@ template class ZeroMorphWithConcatenationTest : public CommitmentT
concatenation_groups_commitments.emplace_back(concatenation_group_commitment);
}
- // Initialize an empty ProverTranscript
- auto prover_transcript = ProverTranscript::init_empty();
+ // Initialize an empty BaseTranscript
+ auto prover_transcript = BaseTranscript::prover_init_empty();
// Execute Prover protocol
{
@@ -417,7 +417,7 @@ template class ZeroMorphWithConcatenationTest : public CommitmentT
prover_transcript.send_to_verifier("ZM:PI", pi_commitment);
}
- auto verifier_transcript = VerifierTranscript::init_empty(prover_transcript);
+ auto verifier_transcript = BaseTranscript::verifier_init_empty(prover_transcript);
// Execute Verifier protocol
{
diff --git a/barretenberg/cpp/src/barretenberg/common/benchmark.hpp b/barretenberg/cpp/src/barretenberg/common/benchmark.hpp
new file mode 100644
index 000000000000..5d3034bbe6fd
--- /dev/null
+++ b/barretenberg/cpp/src/barretenberg/common/benchmark.hpp
@@ -0,0 +1,105 @@
+#include "barretenberg/common/throw_or_abort.hpp"
+#include "barretenberg/env/hardware_concurrency.hpp"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace {
+/**
+ * If user provides the env var BENCHMARK_FD write benchmarks to this fd, otherwise default to -1 (disable).
+ * e.g:
+ * BENCHMARK_FD=3 bb 3> benchmarks.jsonl
+ */
+auto bfd = []() {
+ try {
+ static auto bfd_str = std::getenv("BENCHMARK_FD");
+ int bfd = bfd_str ? (int)std::stoul(bfd_str) : -1;
+ if (bfd >= 0 && (fcntl(bfd, F_GETFD) == -1 || errno == EBADF)) {
+ throw_or_abort("fd is not open. Did you redirect in your shell?");
+ }
+ return bfd;
+ } catch (std::exception const& e) {
+ std::string inner_msg = e.what();
+ throw_or_abort("Invalid BENCHMARK_FD: " + inner_msg);
+ }
+}();
+} // namespace
+
+template struct TypeTraits;
+
+template struct TypeTraits::value>::type> {
+ static const char* type;
+};
+
+template
+const char* TypeTraits::value>::type>::type = "number";
+
+template <> struct TypeTraits {
+ static const char* type;
+};
+
+const char* TypeTraits::type = "string";
+
+template <> struct TypeTraits {
+ static const char* type;
+};
+
+const char* TypeTraits::type = "number";
+
+template <> struct TypeTraits {
+ static const char* type;
+};
+
+const char* TypeTraits::type = "bool";
+
+// Helper function to get the current timestamp in the desired format
+std::string getCurrentTimestamp()
+{
+ std::time_t now = std::time(nullptr);
+ std::tm* now_tm = std::gmtime(&now);
+ char buf[21] = { 0 };
+ strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%SZ", now_tm);
+ return std::string(buf);
+}
+
+template std::string toString(const T& value)
+{
+ std::ostringstream oss;
+ oss << value;
+ return oss.str();
+}
+
+void appendToStream(std::ostringstream&)
+{
+ // base case: do nothing
+}
+
+template
+void appendToStream(std::ostringstream& oss, const K& key, const V& value, Args... args)
+{
+ oss << ", \"" << key << "\": \"" << toString(value) << "\"";
+ appendToStream(oss, args...); // recursively process the remaining arguments
+}
+
+template void write_benchmark(const std::string& name, const T& value, Args... args)
+{
+ if (bfd == -1) {
+ return;
+ }
+ std::ostringstream oss;
+ oss << "{\"timestamp\": \"" << getCurrentTimestamp() << "\", "
+ << "\"name\": \"" << name << "\", "
+ << "\"type\": \"" << TypeTraits::type << "\", "
+ << "\"value\": " << value << ", "
+ << "\"threads\": " << env_hardware_concurrency();
+
+ appendToStream(oss, args...); // unpack and append the key-value pairs
+
+ oss << "}" << std::endl;
+ const std::string& tmp = oss.str();
+ write((int)bfd, tmp.c_str(), tmp.size());
+}
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/common/timer.hpp b/barretenberg/cpp/src/barretenberg/common/timer.hpp
index b291b3f213e4..b4d760e4393d 100644
--- a/barretenberg/cpp/src/barretenberg/common/timer.hpp
+++ b/barretenberg/cpp/src/barretenberg/common/timer.hpp
@@ -55,6 +55,15 @@ class Timer {
return nanos;
}
+ /**
+ * @brief Return the number of nanoseconds elapsed since the start of the timer.
+ */
+ [[nodiscard]] int64_t milliseconds() const
+ {
+ int64_t nanos = nanoseconds();
+ return nanos / 1000000;
+ }
+
/**
* @brief Return the number of seconds elapsed since the start of the timer.
*/
diff --git a/barretenberg/cpp/src/barretenberg/crypto/generators/generator_data.hpp b/barretenberg/cpp/src/barretenberg/crypto/generators/generator_data.hpp
index 03c08977153e..acbe76ef3cdd 100644
--- a/barretenberg/cpp/src/barretenberg/crypto/generators/generator_data.hpp
+++ b/barretenberg/cpp/src/barretenberg/crypto/generators/generator_data.hpp
@@ -126,7 +126,7 @@ template class generator_data {
mutable bool initialized_precomputed_generators = false;
// We wrap the std::map in a `std::optional` so that we can construct `generator_data` at compile time.
- // This allows us to mark `default_data` as `constinit`, which prevents static initialisation ordering fiasco
+ // This allows us to mark `default_data` as `constinit`, which prevents static initialization ordering fiasco
mutable std::optional> generator_map = {};
};
diff --git a/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.test.cpp b/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.test.cpp
new file mode 100644
index 000000000000..84c5fc2e68fd
--- /dev/null
+++ b/barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/pedersen.test.cpp
@@ -0,0 +1,19 @@
+#include "pedersen.hpp"
+#include "barretenberg/crypto/generators/generator_data.hpp"
+#include
+
+namespace crypto {
+
+using barretenberg::fr;
+
+TEST(Pedersen, Commitment)
+{
+ auto x = pedersen_commitment::Fq::one();
+ auto r = pedersen_commitment::commit_native({ x, x });
+ auto expected =
+ grumpkin::g1::affine_element(fr(uint256_t("2f7a8f9a6c96926682205fb73ee43215bf13523c19d7afe36f12760266cdfe15")),
+ fr(uint256_t("01916b316adbbf0e10e39b18c1d24b33ec84b46daddf72f43878bcc92b6057e6")));
+ EXPECT_EQ(r, expected);
+}
+
+} // namespace crypto
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.cpp b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.cpp
index 2fefa0dd8356..3dd91cb31714 100644
--- a/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.cpp
+++ b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/c_bind.cpp
@@ -9,7 +9,7 @@ WASM_EXPORT void pedersen__hash_with_hash_index(uint8_t const* inputs_buffer, ui
{
std::vector to_hash;
read(inputs_buffer, to_hash);
- crypto::GeneratorContext ctx; // todo fix
+ crypto::GeneratorContext ctx;
ctx.offset = static_cast(hash_index);
auto r = crypto::pedersen_hash::hash(to_hash, ctx);
barretenberg::fr::serialize_to_buffer(r, output);
diff --git a/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.test.cpp b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.test.cpp
new file mode 100644
index 000000000000..ed757d8cbaf5
--- /dev/null
+++ b/barretenberg/cpp/src/barretenberg/crypto/pedersen_hash/pedersen.test.cpp
@@ -0,0 +1,24 @@
+#include "pedersen.hpp"
+#include "barretenberg/crypto/generators/generator_data.hpp"
+#include "barretenberg/numeric/uint256/uint256.hpp"
+#include
+
+namespace crypto {
+
+using barretenberg::fr;
+
+TEST(Pedersen, Hash)
+{
+ auto x = pedersen_hash::Fq::one();
+ auto r = pedersen_hash::hash({ x, x });
+ EXPECT_EQ(r, fr(uint256_t("07ebfbf4df29888c6cd6dca13d4bb9d1a923013ddbbcbdc3378ab8845463297b")));
+}
+
+TEST(Pedersen, HashWithIndex)
+{
+ auto x = pedersen_hash::Fq::one();
+ auto r = pedersen_hash::hash({ x, x }, 5);
+ EXPECT_EQ(r, fr(uint256_t("1c446df60816b897cda124524e6b03f36df0cec333fad87617aab70d7861daa6")));
+}
+
+} // namespace crypto
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp
index fbe589bc5284..0e69aab847e0 100644
--- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp
+++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.cpp
@@ -1,8 +1,8 @@
#include "recursion_constraint.hpp"
#include "barretenberg/plonk/proof_system/verification_key/verification_key.hpp"
+#include "barretenberg/plonk/transcript/transcript_wrappers.hpp"
#include "barretenberg/stdlib/recursion/aggregation_state/aggregation_state.hpp"
#include "barretenberg/stdlib/recursion/verifier/verifier.hpp"
-#include "barretenberg/transcript/transcript_wrappers.hpp"
namespace acir_format {
diff --git a/barretenberg/cpp/src/barretenberg/eccvm/CMakeLists.txt b/barretenberg/cpp/src/barretenberg/eccvm/CMakeLists.txt
new file mode 100644
index 000000000000..b5b480745e75
--- /dev/null
+++ b/barretenberg/cpp/src/barretenberg/eccvm/CMakeLists.txt
@@ -0,0 +1 @@
+barretenberg_module(eccvm honk sumcheck)
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/eccvm_composer.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.cpp
similarity index 96%
rename from barretenberg/cpp/src/barretenberg/honk/composer/eccvm_composer.cpp
rename to barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.cpp
index 6b388cd7183c..7ed34e4990d1 100644
--- a/barretenberg/cpp/src/barretenberg/honk/composer/eccvm_composer.cpp
+++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.cpp
@@ -1,5 +1,4 @@
-#include "./eccvm_composer.hpp"
-#include "barretenberg/honk/proof_system/ultra_prover.hpp"
+#include "eccvm_composer.hpp"
#include "barretenberg/proof_system/composer/composer_lib.hpp"
#include "barretenberg/proof_system/composer/permutation_lib.hpp"
@@ -118,4 +117,4 @@ std::shared_ptr ECCVMComposer_::comput
template class ECCVMComposer_;
template class ECCVMComposer_;
-} // namespace proof_system::honk
+} // namespace proof_system::honk
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/eccvm_composer.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.hpp
similarity index 96%
rename from barretenberg/cpp/src/barretenberg/honk/composer/eccvm_composer.hpp
rename to barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.hpp
index 7d8dd2c6ebba..416e9154f467 100644
--- a/barretenberg/cpp/src/barretenberg/honk/composer/eccvm_composer.hpp
+++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include "barretenberg/honk/proof_system/eccvm_prover.hpp"
-#include "barretenberg/honk/proof_system/eccvm_verifier.hpp"
+#include "barretenberg/eccvm/eccvm_prover.hpp"
+#include "barretenberg/eccvm/eccvm_verifier.hpp"
#include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp"
#include "barretenberg/proof_system/composer/composer_lib.hpp"
#include "barretenberg/srs/factories/file_crs_factory.hpp"
diff --git a/barretenberg/cpp/src/barretenberg/honk/composer/eccvm_composer.test.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.test.cpp
similarity index 91%
rename from barretenberg/cpp/src/barretenberg/honk/composer/eccvm_composer.test.cpp
rename to barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.test.cpp
index aeeffba14186..e9296485e3d5 100644
--- a/barretenberg/cpp/src/barretenberg/honk/composer/eccvm_composer.test.cpp
+++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_composer.test.cpp
@@ -3,14 +3,14 @@
#include
#include
-#include "barretenberg/honk/composer/eccvm_composer.hpp"
-#include "barretenberg/honk/sumcheck/sumcheck_round.hpp"
-#include "barretenberg/honk/utils/grand_product_delta.hpp"
+#include "barretenberg/eccvm/eccvm_composer.hpp"
#include "barretenberg/numeric/uint256/uint256.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include "barretenberg/proof_system/circuit_builder/eccvm/eccvm_circuit_builder.hpp"
-#include "barretenberg/proof_system/relations/permutation_relation.hpp"
-#include "barretenberg/proof_system/relations/relation_parameters.hpp"
+#include "barretenberg/proof_system/library/grand_product_delta.hpp"
+#include "barretenberg/relations/permutation_relation.hpp"
+#include "barretenberg/relations/relation_parameters.hpp"
+#include "barretenberg/sumcheck/sumcheck_round.hpp"
using namespace proof_system::honk;
diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_prover.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp
similarity index 96%
rename from barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_prover.cpp
rename to barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp
index 9f5143ba028e..a5b885f6443e 100644
--- a/barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_prover.cpp
+++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.cpp
@@ -1,15 +1,14 @@
#include "eccvm_prover.hpp"
-#include "barretenberg/honk/pcs/claim.hpp"
-#include "barretenberg/honk/pcs/commitment_key.hpp"
+#include "barretenberg/commitment_schemes/claim.hpp"
+#include "barretenberg/commitment_schemes/commitment_key.hpp"
#include "barretenberg/honk/proof_system/lookup_library.hpp"
#include "barretenberg/honk/proof_system/permutation_library.hpp"
-#include "barretenberg/honk/sumcheck/sumcheck.hpp"
-#include "barretenberg/honk/utils/power_polynomial.hpp"
+#include "barretenberg/honk/proof_system/power_polynomial.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
-#include "barretenberg/polynomials/univariate.hpp" // will go away
-#include "barretenberg/proof_system/relations/lookup_relation.hpp"
-#include "barretenberg/proof_system/relations/permutation_relation.hpp"
-#include "barretenberg/transcript/transcript_wrappers.hpp"
+#include "barretenberg/proof_system/library/grand_product_library.hpp"
+#include "barretenberg/relations/lookup_relation.hpp"
+#include "barretenberg/relations/permutation_relation.hpp"
+#include "barretenberg/sumcheck/sumcheck.hpp"
#include
#include
#include
@@ -329,7 +328,7 @@ template plonk::proof& ECCVMProver_::construct_proo
// Compute sorted list accumulator and commitment
execute_log_derivative_commitments_round();
- // Fiat-Shamir: bbeta & gamma
+ // Fiat-Shamir: beta & gamma
// Compute grand product(s) and commitments.
execute_grand_product_computation_round();
diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_prover.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp
similarity index 86%
rename from barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_prover.hpp
rename to barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp
index d781fcb86c26..958c1bad95f8 100644
--- a/barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_prover.hpp
+++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_prover.hpp
@@ -1,11 +1,11 @@
#pragma once
-#include "barretenberg/honk/flavor/ecc_vm.hpp"
-#include "barretenberg/honk/pcs/gemini/gemini.hpp"
-#include "barretenberg/honk/pcs/shplonk/shplonk.hpp"
-#include "barretenberg/honk/sumcheck/sumcheck_output.hpp"
-#include "barretenberg/honk/transcript/transcript.hpp"
+#include "barretenberg/commitment_schemes/gemini/gemini.hpp"
+#include "barretenberg/commitment_schemes/shplonk/shplonk.hpp"
+#include "barretenberg/flavor/ecc_vm.hpp"
#include "barretenberg/plonk/proof_system/types/proof.hpp"
-#include "barretenberg/proof_system/relations/relation_parameters.hpp"
+#include "barretenberg/relations/relation_parameters.hpp"
+#include "barretenberg/sumcheck/sumcheck_output.hpp"
+#include "barretenberg/transcript/transcript.hpp"
namespace proof_system::honk {
@@ -21,6 +21,7 @@ template class ECCVMProver_ {
using ProverPolynomials = typename Flavor::ProverPolynomials;
using CommitmentLabels = typename Flavor::CommitmentLabels;
using Curve = typename Flavor::Curve;
+ using Transcript = typename Flavor::Transcript;
public:
explicit ECCVMProver_(std::shared_ptr input_key, std::shared_ptr commitment_key);
@@ -39,7 +40,7 @@ template class ECCVMProver_ {
plonk::proof& export_proof();
plonk::proof& construct_proof();
- ProverTranscript transcript;
+ Transcript transcript;
std::vector public_inputs;
diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_transcript.test.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_transcript.test.cpp
new file mode 100644
index 000000000000..423075428d50
--- /dev/null
+++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_transcript.test.cpp
@@ -0,0 +1,341 @@
+#include "barretenberg/ecc/curves/bn254/g1.hpp"
+#include "barretenberg/eccvm/eccvm_composer.hpp"
+#include "barretenberg/flavor/flavor.hpp"
+#include "barretenberg/numeric/bitop/get_msb.hpp"
+#include "barretenberg/polynomials/univariate.hpp"
+#include "barretenberg/transcript/transcript.hpp"
+#include
+
+using namespace proof_system::honk;
+
+template class ECCVMTranscriptTests : public ::testing::Test {
+ public:
+ void SetUp() override
+ {
+ if constexpr (std::is_same::value) {
+ barretenberg::srs::init_grumpkin_crs_factory("../srs_db/grumpkin");
+ } else {
+ barretenberg::srs::init_crs_factory("../srs_db/ignition");
+ }
+ };
+ using FF = typename Flavor::FF;
+
+ /**
+ * @brief Construct a manifest for a ECCVM Honk proof
+ *
+ * @details This is where we define the "Manifest" for a ECCVM Honk proof. The tests in this suite are
+ * intented to warn the developer if the Prover/Verifier has deviated from this manifest, however, the
+ * Transcript class is not otherwise contrained to follow the manifest.
+ *
+ * @note Entries in the manifest consist of a name string and a size (bytes), NOT actual data.
+ *
+ * @return TranscriptManifest
+ */
+ TranscriptManifest construct_eccvm_honk_manifest(size_t circuit_size, size_t ipa_poly_degree)
+ {
+ TranscriptManifest manifest_expected;
+
+ auto log_n = numeric::get_msb(circuit_size);
+
+ size_t MAX_PARTIAL_RELATION_LENGTH = Flavor::BATCHED_RELATION_PARTIAL_LENGTH;
+ size_t size_FF = sizeof(FF);
+ size_t size_G = 2 * size_FF;
+ size_t size_uni = MAX_PARTIAL_RELATION_LENGTH * size_FF;
+ size_t size_evals = (Flavor::NUM_ALL_ENTITIES)*size_FF;
+ size_t size_uint32 = 4;
+ size_t size_uint64 = 8;
+
+ size_t round = 0;
+ manifest_expected.add_entry(round, "circuit_size", size_uint32);
+ manifest_expected.add_entry(round, "TRANSCRIPT_ADD", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_MUL", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_EQ", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_COLLISION_CHECK", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_MSM_TRANSITION", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_PC", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_MSM_COUNT", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_X", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_Y", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_Z1", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_Z2", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_Z1ZERO", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_Z2ZERO", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_OP", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_ACCUMULATOR_X", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_ACCUMULATOR_Y", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_MSM_X", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_MSM_Y", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_PC", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_POINT_TRANSITION", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_ROUND", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_SCALAR_SUM", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_S1HI", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_S1LO", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_S2HI", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_S2LO", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_S3HI", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_S3LO", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_S4HI", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_S4LO", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_SKEW", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_DX", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_DY", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_TX", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_TY", size_G);
+ manifest_expected.add_entry(round, "MSM_TRANSITION", size_G);
+ manifest_expected.add_entry(round, "MSM_ADD", size_G);
+ manifest_expected.add_entry(round, "MSM_DOUBLE", size_G);
+ manifest_expected.add_entry(round, "MSM_SKEW", size_G);
+ manifest_expected.add_entry(round, "MSM_ACCUMULATOR_X", size_G);
+ manifest_expected.add_entry(round, "MSM_ACCUMULATOR_Y", size_G);
+ manifest_expected.add_entry(round, "MSM_PC", size_G);
+ manifest_expected.add_entry(round, "MSM_SIZE_OF_MSM", size_G);
+ manifest_expected.add_entry(round, "MSM_COUNT", size_G);
+ manifest_expected.add_entry(round, "MSM_ROUND", size_G);
+ manifest_expected.add_entry(round, "MSM_ADD1", size_G);
+ manifest_expected.add_entry(round, "MSM_ADD2", size_G);
+ manifest_expected.add_entry(round, "MSM_ADD3", size_G);
+ manifest_expected.add_entry(round, "MSM_ADD4", size_G);
+ manifest_expected.add_entry(round, "MSM_X1", size_G);
+ manifest_expected.add_entry(round, "MSM_Y1", size_G);
+ manifest_expected.add_entry(round, "MSM_X2", size_G);
+ manifest_expected.add_entry(round, "MSM_Y2", size_G);
+ manifest_expected.add_entry(round, "MSM_X3", size_G);
+ manifest_expected.add_entry(round, "MSM_Y3", size_G);
+ manifest_expected.add_entry(round, "MSM_X4", size_G);
+ manifest_expected.add_entry(round, "MSM_Y4", size_G);
+ manifest_expected.add_entry(round, "MSM_COLLISION_X1", size_G);
+ manifest_expected.add_entry(round, "MSM_COLLISION_X2", size_G);
+ manifest_expected.add_entry(round, "MSM_COLLISION_X3", size_G);
+ manifest_expected.add_entry(round, "MSM_COLLISION_X4", size_G);
+ manifest_expected.add_entry(round, "MSM_LAMBDA1", size_G);
+ manifest_expected.add_entry(round, "MSM_LAMBDA2", size_G);
+ manifest_expected.add_entry(round, "MSM_LAMBDA3", size_G);
+ manifest_expected.add_entry(round, "MSM_LAMBDA4", size_G);
+ manifest_expected.add_entry(round, "MSM_SLICE1", size_G);
+ manifest_expected.add_entry(round, "MSM_SLICE2", size_G);
+ manifest_expected.add_entry(round, "MSM_SLICE3", size_G);
+ manifest_expected.add_entry(round, "MSM_SLICE4", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_ACCUMULATOR_EMPTY", size_G);
+ manifest_expected.add_entry(round, "TRANSCRIPT_RESET_ACCUMULATOR", size_G);
+ manifest_expected.add_entry(round, "PRECOMPUTE_SELECT", size_G);
+ manifest_expected.add_entry(round, "LOOKUP_READ_COUNTS_0", size_G);
+ manifest_expected.add_entry(round, "LOOKUP_READ_COUNTS_1", size_G);
+ manifest_expected.add_challenge(round, "beta", "gamma");
+
+ round++;
+ manifest_expected.add_entry(round, "LOOKUP_INVERSES", size_G);
+ manifest_expected.add_entry(round, "Z_PERM", size_G);
+ manifest_expected.add_challenge(round, "Sumcheck:alpha", "Sumcheck:zeta");
+
+ for (size_t i = 0; i < log_n; ++i) {
+ round++;
+ std::string idx = std::to_string(i);
+ manifest_expected.add_entry(round, "Sumcheck:univariate_" + idx, size_uni);
+ std::string label = "Sumcheck:u_" + idx;
+ manifest_expected.add_challenge(round, label);
+ }
+
+ round++;
+ manifest_expected.add_entry(round, "Sumcheck:evaluations", size_evals);
+ manifest_expected.add_challenge(round, "rho");
+
+ round++;
+ for (size_t i = 1; i < log_n; ++i) {
+ std::string idx = std::to_string(i);
+ manifest_expected.add_entry(round, "Gemini:FOLD_" + idx, size_G);
+ }
+ manifest_expected.add_challenge(round, "Gemini:r");
+
+ round++;
+ for (size_t i = 0; i < log_n; ++i) {
+ std::string idx = std::to_string(i);
+ manifest_expected.add_entry(round, "Gemini:a_" + idx, size_FF);
+ }
+ manifest_expected.add_challenge(round, "Shplonk:nu");
+
+ round++;
+ manifest_expected.add_entry(round, "Shplonk:Q", size_G);
+ manifest_expected.add_challenge(round, "Shplonk:z");
+
+ // TODO(Mara): Make testing more flavor agnostic so we can test this with all flavors
+ if constexpr (proof_system::IsGrumpkinFlavor) {
+ round++;
+ manifest_expected.add_entry(round, "IPA:poly_degree", size_uint64);
+ manifest_expected.add_challenge(round, "IPA:generator_challenge");
+
+ auto log_poly_degree = static_cast(numeric::get_msb(ipa_poly_degree));
+ for (size_t i = 0; i < log_poly_degree; ++i) {
+ round++;
+ std::string idx = std::to_string(i);
+ manifest_expected.add_entry(round, "IPA:L_" + idx, size_G);
+ manifest_expected.add_entry(round, "IPA:R_" + idx, size_G);
+ std::string label = "IPA:round_challenge_" + idx;
+ manifest_expected.add_challenge(round, label);
+ }
+
+ round++;
+ manifest_expected.add_entry(round, "IPA:a_0", size_FF);
+ } else {
+ round++;
+ manifest_expected.add_entry(round, "KZG:W", size_G);
+ }
+
+ return manifest_expected;
+ }
+ proof_system::ECCVMCircuitBuilder generate_trace(numeric::random::Engine* engine = nullptr)
+ {
+ proof_system::ECCVMCircuitBuilder result;
+ using G1 = typename Flavor::CycleGroup;
+ using Fr = typename G1::Fr;
+
+ auto generators = G1::derive_generators("test generators", 3);
+
+ typename G1::element a = generators[0];
+ typename G1::element b = generators[1];
+ typename G1::element c = generators[2];
+ Fr x = Fr::random_element(engine);
+ Fr y = Fr::random_element(engine);
+
+ typename G1::element expected_1 = (a * x) + a + a + (b * y) + (b * x) + (b * x);
+ typename G1::element expected_2 = (a * x) + c + (b * x);
+
+ result.add_accumulate(a);
+ result.mul_accumulate(a, x);
+ result.mul_accumulate(b, x);
+ result.mul_accumulate(b, y);
+ result.add_accumulate(a);
+ result.mul_accumulate(b, x);
+ result.eq_and_reset(expected_1);
+ result.add_accumulate(c);
+ result.mul_accumulate(a, x);
+ result.mul_accumulate(b, x);
+ result.eq_and_reset(expected_2);
+ result.mul_accumulate(a, x);
+ result.mul_accumulate(b, x);
+ result.mul_accumulate(c, x);
+
+ return result;
+ }
+};
+
+numeric::random::Engine& engine = numeric::random::get_debug_engine();
+
+using FlavorTypes = testing::Types;
+
+TYPED_TEST_SUITE(ECCVMTranscriptTests, FlavorTypes);
+/**
+ * @brief Ensure consistency between the manifest hard coded in this testing suite and the one generated by the
+ * standard honk prover over the course of proof construction.
+ */
+TYPED_TEST(ECCVMTranscriptTests, ProverManifestConsistency)
+{
+ using Flavor = TypeParam;
+
+ // Construct a simple circuit
+ auto builder = this->generate_trace(&engine);
+
+ // Automatically generate a transcript manifest by constructing a proof
+ auto composer = ECCVMComposer_();
+ auto prover = composer.create_prover(builder);
+ auto proof = prover.construct_proof();
+
+ // Check that the prover generated manifest agrees with the manifest hard coded in this suite
+ auto manifest_expected =
+ this->construct_eccvm_honk_manifest(prover.key->circuit_size, prover.shplonk_output.witness.size());
+ auto prover_manifest = prover.transcript.get_manifest();
+
+ // Note: a manifest can be printed using manifest.print()
+ for (size_t round = 0; round < manifest_expected.size(); ++round) {
+ ASSERT_EQ(prover_manifest[round], manifest_expected[round]) << "Prover manifest discrepency in round " << round;
+ }
+}
+
+/**
+ * @brief Ensure consistency between the manifest generated by the ECCVM honk prover over the course of proof
+ * construction and the one generated by the verifier over the course of proof verification.
+ *
+ */
+TYPED_TEST(ECCVMTranscriptTests, VerifierManifestConsistency)
+{
+ using Flavor = TypeParam;
+
+ // Construct a simple circuit
+ auto builder = this->generate_trace(&engine);
+
+ // Automatically generate a transcript manifest in the prover by constructing a proof
+ auto composer = ECCVMComposer_();
+ auto prover = composer.create_prover(builder);
+ auto proof = prover.construct_proof();
+
+ // Automatically generate a transcript manifest in the verifier by verifying a proof
+ auto verifier = composer.create_verifier(builder);
+ verifier.verify_proof(proof);
+
+ // Check consistency between the manifests generated by the prover and verifier
+ auto prover_manifest = prover.transcript.get_manifest();
+ auto verifier_manifest = verifier.transcript.get_manifest();
+
+ // Note: a manifest can be printed using manifest.print()
+ for (size_t round = 0; round < prover_manifest.size(); ++round) {
+ ASSERT_EQ(prover_manifest[round], verifier_manifest[round])
+ << "Prover/Verifier manifest discrepency in round " << round;
+ }
+}
+
+/**
+ * @brief Check that multiple challenges can be generated and sanity check
+ * @details We generate 6 challenges that are each 128 bits, and check that they are not 0.
+ *
+ */
+TYPED_TEST(ECCVMTranscriptTests, ChallengeGenerationTest)
+{
+ using Flavor = TypeParam;
+ // initialized with random value sent to verifier
+ auto transcript = Flavor::Transcript::prover_init_empty();
+ // test a bunch of challenges
+ auto challenges = transcript.get_challenges("a", "b", "c", "d", "e", "f");
+ // check they are not 0
+ for (size_t i = 0; i < challenges.size(); ++i) {
+ ASSERT_NE(challenges[i], 0) << "Challenge " << i << " is 0";
+ }
+ constexpr uint32_t random_val{ 17 }; // arbitrary
+ transcript.send_to_verifier("random val", random_val);
+ // test more challenges
+ auto [a, b, c] = transcript.get_challenges("a", "b", "c");
+ ASSERT_NE(a, 0) << "Challenge a is 0";
+ ASSERT_NE(b, 0) << "Challenge a is 0";
+ ASSERT_NE(b, 0) << "Challenge a is 0";
+}
+
+TYPED_TEST(ECCVMTranscriptTests, StructureTest)
+{
+ using Flavor = TypeParam;
+
+ // Construct a simple circuit
+ auto builder = this->generate_trace(&engine);
+
+ // Automatically generate a transcript manifest by constructing a proof
+ auto composer = ECCVMComposer_();
+ auto prover = composer.create_prover(builder);
+ auto proof = prover.construct_proof();
+ auto verifier = composer.create_verifier(builder);
+ EXPECT_TRUE(verifier.verify_proof(proof));
+
+ // try deserializing and serializing with no changes and check proof is still valid
+ prover.transcript.deserialize_full_transcript();
+ prover.transcript.serialize_full_transcript();
+ EXPECT_TRUE(verifier.verify_proof(prover.export_proof())); // we have changed nothing so proof is still valid
+
+ typename Flavor::Commitment one_group_val = Flavor::Commitment::one();
+ typename Flavor::FF rand_val = Flavor::FF::random_element();
+ prover.transcript.transcript_x_comm = one_group_val * rand_val; // choose random object to modify
+ EXPECT_TRUE(verifier.verify_proof(
+ prover.export_proof())); // we have not serialized it back to the proof so it should still be fine
+
+ prover.transcript.serialize_full_transcript();
+ EXPECT_FALSE(verifier.verify_proof(prover.export_proof())); // the proof is now wrong after serializing it
+
+ prover.transcript.deserialize_full_transcript();
+ EXPECT_EQ(static_cast(prover.transcript.transcript_x_comm), one_group_val * rand_val);
+}
\ No newline at end of file
diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_verifier.cpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.cpp
similarity index 97%
rename from barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_verifier.cpp
rename to barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.cpp
index 80ff34bd587d..8f1039c6bf68 100644
--- a/barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_verifier.cpp
+++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.cpp
@@ -1,9 +1,9 @@
#include "./eccvm_verifier.hpp"
-#include "barretenberg/honk/pcs/gemini/gemini.hpp"
-#include "barretenberg/honk/pcs/shplonk/shplonk.hpp"
-#include "barretenberg/honk/transcript/transcript.hpp"
-#include "barretenberg/honk/utils/power_polynomial.hpp"
+#include "barretenberg/commitment_schemes/gemini/gemini.hpp"
+#include "barretenberg/commitment_schemes/shplonk/shplonk.hpp"
+#include "barretenberg/honk/proof_system/power_polynomial.hpp"
#include "barretenberg/numeric/bitop/get_msb.hpp"
+#include "barretenberg/transcript/transcript.hpp"
using namespace barretenberg;
using namespace proof_system::honk::sumcheck;
@@ -44,10 +44,11 @@ template bool ECCVMVerifier_::verify_proof(const plonk
using Shplonk = pcs::shplonk::ShplonkVerifier_;
using VerifierCommitments = typename Flavor::VerifierCommitments;
using CommitmentLabels = typename Flavor::CommitmentLabels;
+ using Transcript = typename Flavor::Transcript;
RelationParameters relation_parameters;
- transcript = VerifierTranscript{ proof.proof_data };
+ transcript = Transcript{ proof.proof_data };
auto commitments = VerifierCommitments(key, transcript);
auto commitment_labels = CommitmentLabels();
@@ -168,7 +169,7 @@ template bool ECCVMVerifier_::verify_proof(const plonk
transcript.template receive_from_prover(commitment_labels.lookup_read_counts_1);
// Get challenge for sorted list batching and wire four memory records
- auto [beta, gamma] = transcript.get_challenges("bbeta", "gamma");
+ auto [beta, gamma] = transcript.get_challenges("beta", "gamma");
relation_parameters.gamma = gamma;
auto beta_sqr = beta * beta;
relation_parameters.beta = beta;
diff --git a/barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_verifier.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.hpp
similarity index 89%
rename from barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_verifier.hpp
rename to barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.hpp
index c44ae39589c1..8145219d0248 100644
--- a/barretenberg/cpp/src/barretenberg/honk/proof_system/eccvm_verifier.hpp
+++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_verifier.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include "barretenberg/honk/flavor/ecc_vm.hpp"
-#include "barretenberg/honk/sumcheck/sumcheck.hpp"
+#include "barretenberg/flavor/ecc_vm.hpp"
#include "barretenberg/plonk/proof_system/types/proof.hpp"
+#include "barretenberg/sumcheck/sumcheck.hpp"
namespace proof_system::honk {
template class ECCVMVerifier_ {
@@ -9,6 +9,7 @@ template class ECCVMVerifier_ {
using Commitment = typename Flavor::Commitment;
using VerificationKey = typename Flavor::VerificationKey;
using VerifierCommitmentKey = typename Flavor::VerifierCommitmentKey;
+ using Transcript = typename Flavor::Transcript;
public:
explicit ECCVMVerifier_(std::shared_ptr verifier_key = nullptr);
@@ -16,7 +17,7 @@ template class ECCVMVerifier_ {
std::map commitments,
std::map