Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Integrate new proving systems in e2e #6971

Merged
merged 246 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 190 commits
Commits
Show all changes
246 commits
Select commit Hold shift + click to select a range
be738f9
Start
codygunton Jun 3, 2024
77fd1d3
More TODOs
codygunton Jun 3, 2024
c051062
Merge branch 'master' into cg-lde/integrate-client-ivc
ledwards2225 Jun 3, 2024
d6e34c9
luke: some LONDONTODO comments
ledwards2225 Jun 3, 2024
4d823cb
More thinking
codygunton Jun 4, 2024
11bc182
added new flow
lucasxia01 Jun 4, 2024
c0edfae
More
codygunton Jun 4, 2024
070abed
some comments and fix build
ledwards2225 Jun 4, 2024
f308681
write full.test circuit data to a fixtures file
ledwards2225 Jun 5, 2024
bb0cc2b
Try to do real proving; no executionResult;
codygunton Jun 5, 2024
eba2b37
I want to merge
maramihali Jun 5, 2024
46e2f1d
Merge remote-tracking branch 'origin/master' into mm/rollup-tube
maramihali Jun 5, 2024
baaa716
hacking towards getting a folding ivc proof
ludamad Jun 5, 2024
f7f2414
flow work
maramihali Jun 6, 2024
653c67b
introduce libdeflate, turned off for wasm
ludamad Jun 6, 2024
52053ac
fix wasm build
ludamad Jun 6, 2024
df3dcb8
needs shared transcript
maramihali Jun 6, 2024
f3aa95b
stash
ludamad Jun 6, 2024
da714fe
support disabling aztec vm in non-wasm builds
ludamad Jun 6, 2024
8715cbd
Change sumcheck, tests pass
codygunton Jun 6, 2024
cd048ea
almost working ivc
ludamad Jun 6, 2024
95cdb6e
Merge remote-tracking branch 'origin/master' into cg-lde-ad/integrate…
ludamad Jun 6, 2024
b14723f
Fix problem ultra_honk_tests
codygunton Jun 6, 2024
b038df5
added fake write_vk_honk and prove_honk_output_all commands
lucasxia01 Jun 6, 2024
dd50460
pad ZM
ledwards2225 Jun 6, 2024
2daabbd
use local for MAX_LOG so everything builds
ledwards2225 Jun 6, 2024
20b3184
updates to make transcrpt tests pass (eccvm hack)
ledwards2225 Jun 6, 2024
5c54954
Add and use DISABLE_AZTEC_VM
codygunton Jun 7, 2024
5aa6e11
attempt to fix program stacks
ludamad Jun 7, 2024
5bb2145
Merge github.com:AztecProtocol/aztec-packages into cg-lde-ad/integrat…
ludamad Jun 7, 2024
729c7fc
serialisation and deserialisation work
maramihali Jun 7, 2024
a6bb02c
verifying!
ludamad Jun 7, 2024
0db641c
Merge remote-tracking branch 'origin/master' into mm/rollup-tube
maramihali Jun 7, 2024
844cfd9
Merge branch 'master' into cg-lde-ad/integrate-client-ivc
ludamad Jun 7, 2024
92d3475
Merge remote-tracking branch 'origin/mm/rollup-tube' into cg-lde-ad/i…
ludamad Jun 7, 2024
2f016d9
lots of hacking towards client ivc proving
ludamad Jun 7, 2024
5c762de
prove_then_verify flow acir test passes
codygunton Jun 7, 2024
2b3634c
fix bad merge
ludamad Jun 7, 2024
95267a7
Merge remote-tracking branch 'origin/cg/constant-honk-proof-size' int…
lucasxia01 Jun 7, 2024
8dd3b82
hacking and changing constants to use honk in rollup circuits
lucasxia01 Jun 7, 2024
128197e
bump arithmetic
ludamad Jun 7, 2024
fea3b18
replace tail proof with ivc, get verifier failure
ludamad Jun 7, 2024
9414601
add prove tube script for testing the tube related flows
maramihali Jun 10, 2024
6985494
Merge remote-tracking branch 'origin/master' into cg-lde-ad/integrate…
codygunton Jun 10, 2024
6dad5ad
stuff
maramihali Jun 10, 2024
c7c759f
Merge remote-tracking branch 'origin/master' into mm/tube-typescript
maramihali Jun 10, 2024
30c10e9
fix bad merge
ludamad Jun 7, 2024
93ec8df
fix errors
maramihali Jun 10, 2024
4c73e3a
removed aggregation obj and got the base rollup test passing
lucasxia01 Jun 10, 2024
8bcf0d1
Toward client ivc proof size
codygunton Jun 11, 2024
dfec90d
Merge remote-tracking branch 'origin/master' into lx/honk-in-rollup
codygunton Jun 11, 2024
f6df506
client ivc proof hacking
ludamad Jun 11, 2024
b193e7a
Merge remote-tracking branch 'origin/master' into cg-lde-ad/integrate…
ludamad Jun 11, 2024
5494185
tube works, need to add proof as json
maramihali Jun 11, 2024
ec09910
Merge remote-tracking branch 'origin/master' into mm/tube-typescript
maramihali Jun 11, 2024
1051138
Hacking
ludamad Jun 11, 2024
45be902
Merge remote-tracking branch 'origin/master' into mm/tube-typescript
maramihali Jun 11, 2024
7490944
cleanup
maramihali Jun 11, 2024
1fb8657
fix comment
maramihali Jun 11, 2024
2d55f5d
add tube test
maramihali Jun 11, 2024
1c9506d
remove vk hacks
maramihali Jun 11, 2024
c3674f9
Step toward adding new constants
codygunton Jun 11, 2024
af0a9e7
Kernel data uses tube proof length
codygunton Jun 11, 2024
4ceb5d4
Create PaddingProcessedTxFromTube and change constants; fail at mapRe…
codygunton Jun 11, 2024
5777f0d
Introduce tube proof length
codygunton Jun 12, 2024
40d25f2
add notes
codygunton Jun 12, 2024
fb8ab2c
squash; prove_then_verify flow acir test passes
codygunton Jun 12, 2024
8039b6b
add serialization for hacky ivc proofs
ludamad Jun 12, 2024
6e62157
Merge branch 'cg/constant-honk-proof-size' into lx/honk-in-rollup
codygunton Jun 12, 2024
d658799
Merge remote-tracking branch 'origin/master' into mm/tube-typescript
maramihali Jun 12, 2024
f6fe71e
serialization for clientivcproof
ludamad Jun 12, 2024
2b5518a
Fix merge
codygunton Jun 12, 2024
ad41ab5
Merge remote-tracking branch 'origin/lx/honk-in-rollup' into mm-lx/li…
maramihali Jun 12, 2024
305b534
bb changes
ludamad Jun 12, 2024
92eab29
Merge remote-tracking branch 'origin/mm/tube-typescript' into cg-lde-…
ludamad Jun 12, 2024
6f671b6
Merge branch 'master' into cg-lde-ad/integrate-client-ivc
ludamad Jun 12, 2024
3da2f66
post merge
ludamad Jun 12, 2024
da5c7e2
Merge remote-tracking branch 'origin/cg-lde-ad/integrate-client-ivc' …
ludamad Jun 12, 2024
a69b11d
working tube
ludamad Jun 12, 2024
d200329
pain after merging
ludamad Jun 12, 2024
19b5464
WIP
codygunton Jun 12, 2024
22574b6
proof
ludamad Jun 12, 2024
17372c3
refactoring, _2 suffix to _msgpack, extra file writing methods
ludamad Jun 12, 2024
99b9b7e
Merge branch 'master' into cg/constant-honk-proof-size
codygunton Jun 12, 2024
3bec7b1
things run, a path is wrong
maramihali Jun 12, 2024
be4412f
fix wrong path
maramihali Jun 12, 2024
6b050fa
bb_prover_base_rollup passed with creating tube
maramihali Jun 13, 2024
8e6d43f
summer time cleaning: add some comments, remove unnecessary stuff tha…
maramihali Jun 13, 2024
c251b9a
Fix tube (for me)
codygunton Jun 17, 2024
2a53d79
Reinstate public part of full test; it passes but...
codygunton Jun 18, 2024
7ff8124
Reinstate public part of full test; it passes but...
codygunton Jun 18, 2024
0fb7ef9
Merge branch 'cg-lde-ad/integrate-client-ivc' of github.com:AztecProt…
ludamad Jun 18, 2024
c427376
proof cache fix to not reprove
ludamad Jun 18, 2024
4becd59
ability for proofs to be sent out
ludamad Jun 18, 2024
861f2a1
use dir
ludamad Jun 18, 2024
15de17c
Merge remote-tracking branch 'origin/mm-lx/linking-work' into cg-lde-…
ludamad Jun 18, 2024
69d3505
Merge
ludamad Jun 18, 2024
e748edd
use test circuit verifier for now
ludamad Jun 19, 2024
a9745fa
disable cleanup for now
ludamad Jun 19, 2024
6fa276b
Remove recursive verifications; passes tube verification (+caching bu…
codygunton Jun 20, 2024
fd23590
try to implement tube caching
ludamad Jun 20, 2024
f3a11a1
wire TubeInputs
ludamad Jun 20, 2024
1b58393
Patch from Adam
codygunton Jun 20, 2024
84ebc99
WIP try to bring verifiers back for public (proof construction makes …
codygunton Jun 21, 2024
2edb0e8
Make stdlib Zm verifier test; it fails.
codygunton Jun 23, 2024
3e6e746
Trying to debug
codygunton Jun 24, 2024
8ffeda0
It passes
codygunton Jun 24, 2024
15beef5
WIP including sumcheck (need more stuff from lx/)
codygunton Jun 24, 2024
c22a8e7
getting it to build (with hacks)
lucasxia01 Jun 24, 2024
63dd3bc
modified dummy rounds to be end of sumcheck, native ultra_honk tests …
lucasxia01 Jun 24, 2024
7afccfe
passed dummy_round to univariate_eval - recursive verifier test passes
lucasxia01 Jun 24, 2024
0dd7530
cherrypicked - Implement vk hash and check
codygunton Jun 21, 2024
d6e1efb
moved recursive verifier changes to this branch from honk-in-rollup
lucasxia01 Jun 24, 2024
fe85e03
updating acir/prover.toml of test programs - prove_then_verify flow p…
lucasxia01 Jun 24, 2024
25d0a15
don't pass the witness to the write_vk_honk flow
lucasxia01 Jun 24, 2024
ebe4115
Detect rec ver vk changes in test
codygunton Jun 24, 2024
0036183
Note bad values
codygunton Jun 25, 2024
5db6800
check outer circuit vk not inner
ledwards2225 Jun 25, 2024
cc9962a
Try running public stuff
codygunton Jun 25, 2024
302945a
Merge branch 'master' into cg/constant-honk-proof-size
ledwards2225 Jun 25, 2024
ff23a57
missed test suite updates
ledwards2225 Jun 25, 2024
ad22a00
add back in PCS round missed in merge
ledwards2225 Jun 25, 2024
3e881e3
Merge branch 'master' into cg/constant-honk-proof-size
ledwards2225 Jun 25, 2024
d138cbc
fix wrapping size_t exponent in ZM
ledwards2225 Jun 25, 2024
41e8e50
update Prover.toml and disable tube acir test for now
ledwards2225 Jun 25, 2024
48605a7
Merge branch 'cg/constant-honk-proof-size' into cg-lde-ad/integrate-c…
codygunton Jun 26, 2024
6f1767a
Fix AcirHonkRecursionConstraint.TestFullRecursiveComposition
codygunton Jun 26, 2024
dcd01e3
updating proof size and prover toml
ledwards2225 Jun 26, 2024
e4c553b
moving changes to honk_recursion_constraint over from other branch
lucasxia01 Jun 26, 2024
503adcc
revert rebuild script changes
ledwards2225 Jun 26, 2024
d23f83d
Fix typescript IVC. Tube
codygunton Jun 26, 2024
d520d8f
Build AVM
codygunton Jun 26, 2024
87c9984
Adjust logging
codygunton Jun 26, 2024
fd378aa
vk hash agrees for verify_honk_proof thru sumcheck
ledwards2225 Jun 26, 2024
84ba6fa
infinite llopy?
ledwards2225 Jun 26, 2024
5fe6080
Build avm
codygunton Jun 26, 2024
61b6744
No infinite llopy
codygunton Jun 26, 2024
4ede58a
Pow in Zm uses witness
codygunton Jun 26, 2024
6d460c0
Skip it
codygunton Jun 26, 2024
5ca1060
prove_then_verify passes!
codygunton Jun 26, 2024
08d7f98
Merge branch 'cg/constant-honk-proof-size' into cg-lde-ad/integrate-c…
codygunton Jun 26, 2024
97d7112
Fix bootstrap
codygunton Jun 26, 2024
5e4ea9d
Merge branch 'master' into cg/constant-honk-proof-size
ledwards2225 Jun 26, 2024
41677b7
revert rebuild changes
ledwards2225 Jun 26, 2024
60006b3
Fix build bb-prover and prover-client
codygunton Jun 26, 2024
ecf2cec
delete recusion kernel pinning and fix build
ledwards2225 Jun 26, 2024
938c39e
Merge remote-tracking branch 'origin/cg/constant-honk-proof-size' int…
codygunton Jun 26, 2024
a6831b4
Update constants
codygunton Jun 26, 2024
137ab4e
fix gcc
ledwards2225 Jun 26, 2024
6fe0cc1
AVM fails to verify
codygunton Jun 27, 2024
82810ff
SkipAVM verification; Tube verifies; PUBLIC_KERNEL_NON_TAIL does not
codygunton Jun 27, 2024
b1fbd1e
remove lookup delta, maybe fix build?
ledwards2225 Jun 27, 2024
8c48c76
Merge branch 'master' into cg/constant-honk-proof-size
lucasxia01 Jun 27, 2024
97f736b
Trying to cut out tube proving from public side; one base parity does…
codygunton Jun 27, 2024
3d871a7
Merge remote-tracking branch 'origin/cg/constant-honk-proof-size' int…
lucasxia01 Jun 27, 2024
1732337
passes base rollup test, different error in full test (actually 1 out…
lucasxia01 Jun 27, 2024
20ea9aa
runInDirectory
ludamad Jun 27, 2024
4ac928d
Merge remote-tracking branch 'origin/lx/ultrahonk-in-rollup' into cg-…
codygunton Jun 27, 2024
cc6e1a6
Post-merge fix
codygunton Jun 27, 2024
aeb461a
Merge remote-tracking branch 'origin/master' into cg-lde-ad/integrate…
codygunton Jun 27, 2024
2aaf7f5
Fix build
codygunton Jun 27, 2024
25f161f
Revert this that demonstrates base & full rollup tests pass
codygunton Jun 27, 2024
81eb07c
Revert "Revert this that demonstrates base & full rollup tests pass"
codygunton Jun 27, 2024
a0b1150
pxe/kernel_prover.ts: conditional artifact fofor PrivateKernelTailToP…
ludamad Jun 27, 2024
70008b8
Merge github.com:AztecProtocol/aztec-packages into cg-lde-ad/integrat…
ludamad Jun 27, 2024
1623459
Merge remote-tracking branch 'origin/cg-lde-ad/integrate-client-ivc' …
ludamad Jun 27, 2024
8040b0e
Change to mirror change in base rollup!
codygunton Jun 27, 2024
3972408
cleanup and trying to get tube proof in
ludamad Jun 27, 2024
026d7c6
fix compile
ludamad Jun 28, 2024
e96145d
log
ludamad Jun 28, 2024
9d1802e
log
ludamad Jun 28, 2024
a7c184d
Fix kernel
codygunton Jun 28, 2024
2e224f7
Cleanup and note // PUBLIC KERNEl
codygunton Jun 28, 2024
6776c26
debug adjustment
ludamad Jun 28, 2024
e8f0657
We get to the public kernel tail
codygunton Jun 28, 2024
6bd6dc8
It passed
codygunton Jun 28, 2024
c6a1495
It passed a second time
codygunton Jun 28, 2024
e5a7944
Delete logs to get better sense of PR size
codygunton Jun 28, 2024
b46e174
Remove huge log
codygunton Jun 28, 2024
704c756
Merge remote-tracking branch 'origin/master' into cg-lde-ad/integrate…
codygunton Jun 28, 2024
8d0d6f1
Fix Bb build from "accept all incoming changes"
codygunton Jun 28, 2024
1f4dbf3
Perhaps I was overzealous checking out all of Bb
codygunton Jun 29, 2024
7fa4f0a
It fails
codygunton Jun 29, 2024
204235c
Passes again!--TODO: handle agg object.
codygunton Jun 29, 2024
25149e9
Remove log
codygunton Jun 29, 2024
0a7671f
Some cleanup
codygunton Jun 29, 2024
419acbf
Clean up logs, comments, todos. It passes
codygunton Jun 29, 2024
28c2f4c
Remove log
codygunton Jun 29, 2024
c74c41f
Merge branch 'master' into cg-lde-ad/integrate-client-ivc
ledwards2225 Jul 1, 2024
1acb679
formatting in nr protocol circuits
ledwards2225 Jul 1, 2024
b047ada
max block size tracker
ledwards2225 Jul 1, 2024
94e7677
increment poseidon external size
ledwards2225 Jul 1, 2024
d272c74
honk recursion constraint test fix
lucasxia01 Jul 1, 2024
bb2b0b3
decrease fixed block sizes where possible
ledwards2225 Jul 1, 2024
fd506b7
bump srs sizes in fold and verify
ledwards2225 Jul 2, 2024
abfc338
Merge branch 'master' into cg-lde-ad/integrate-client-ivc
ledwards2225 Jul 2, 2024
cfcf053
verify honk proof test program inputs/circuit fixed
lucasxia01 Jul 2, 2024
b2887db
Merge remote-tracking branch 'origin/master' into cg-lde-ad/integrate…
lucasxia01 Jul 2, 2024
1ddce94
try skip
ludamad Jul 2, 2024
23f3dba
try fix runner
ludamad Jul 3, 2024
efb0389
adding some bberg issues, fxing some LONDONTODOS, cleaning up
ledwards2225 Jul 3, 2024
824e867
add aggregation obj todos
lucasxia01 Jul 3, 2024
0a6f120
ci
ludamad Jul 3, 2024
f96b69c
Revert "try fix runner"
ludamad Jul 3, 2024
e87a4f6
redo earthly-ci fix
ludamad Jul 3, 2024
1cceac5
feat(ivc): make private kernels only prove thru IVC flow (#7348)
ludamad Jul 8, 2024
32f44ba
fixes for public_processor.test.ts
ludamad Jul 8, 2024
555c2dd
fix gates_report script to use honk
lucasxia01 Jul 8, 2024
de800b0
fix: revert bad invalidation
ludamad Jul 8, 2024
0059685
Merge remote-tracking branch 'origin/cg-lde-ad/integrate-client-ivc' …
ludamad Jul 8, 2024
51adb5d
fix kernel_prover.test.ts
ludamad Jul 8, 2024
165cb85
Increase tester ttl
ludamad Jul 8, 2024
6a69fe0
try proving test fix
ludamad Jul 8, 2024
f32a3a3
some cleanup (yarn formatting and console.errors)
lucasxia01 Jul 8, 2024
bd01afc
p2p fixes
ludamad Jul 8, 2024
6a4274b
Undo STACK call
ludamad Jul 8, 2024
650636e
Proof yarn format fix
ludamad Jul 8, 2024
fd23db5
ci
ludamad Jul 9, 2024
a8538b8
try delay 2 pxes e2e to avoid race condition
ludamad Jul 9, 2024
a860ce2
Merge remote-tracking branch 'origin/master' into cg-lde-ad/integrate…
ludamad Jul 9, 2024
7984a0b
merge conflict fixing
ludamad Jul 9, 2024
64b2032
try write_vk_ultra_honk
ludamad Jul 9, 2024
335ac76
its building
ludamad Jul 9, 2024
926e1e8
remake constants
ludamad Jul 9, 2024
f6be505
building again
ludamad Jul 9, 2024
2beb482
Ultrahonk
ludamad Jul 10, 2024
5458ea6
bb hash
ludamad Jul 10, 2024
865e7c4
bb hash
ludamad Jul 10, 2024
e75f148
disabled
ludamad Jul 10, 2024
f5b675c
Merge remote-tracking branch 'origin/master' into cg-lde-ad/integrate…
ludamad Jul 10, 2024
29003ff
fixes
ludamad Jul 10, 2024
8ef64b5
fixes
ludamad Jul 10, 2024
12dc35c
Revert "try write_vk_ultra_honk"
ludamad Jul 10, 2024
57c7b9c
fix vk mismerge
ludamad Jul 10, 2024
2bf44ff
fix
ludamad Jul 10, 2024
2b984af
honking
ludamad Jul 10, 2024
e86bd9b
Merge branch 'fixes' into cg-lde-ad/integrate-client-ivc
ludamad Jul 10, 2024
bbfb6e3
nargo fmt
ludamad Jul 10, 2024
7aded71
try to change vk hash?
ludamad Jul 10, 2024
f5e7f68
full test rever t master
ludamad Jul 10, 2024
79eac15
yarn formatting:fix
ludamad Jul 10, 2024
4e8d769
fix expect-error
ludamad Jul 10, 2024
b3c91a0
yarn formatting:fix
ludamad Jul 10, 2024
26174fd
yarn formatting:fix
ludamad Jul 10, 2024
549ecb4
ci
ludamad Jul 10, 2024
b3e0a21
Merge remote-tracking branch 'origin/master' into cg-lde-ad/integrate…
ludamad Jul 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
"version": "0.2.0",
"configurations": [
{
"address": "${config:mainframeAddress}",
"port": 9221,
"port": 9229,
"type": "node",
"request": "attach",
"name": "Attach to Remote",
"skipFiles": ["<node_internals>/**"],
"localRoot": "${workspaceFolder}",
"sourceMaps": true
},
{
"type": "node",
"request": "attach",
"name": "Attach",
"port": 9229
}
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"editor.defaultFormatter": "hashicorp.terraform"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
Expand Down
20 changes: 20 additions & 0 deletions barretenberg/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "LLDB: Prove Ultra Honk Output All",
"type": "lldb",
"request": "launch",
"program": "/mnt/user-data/adam/aztec-packages/barretenberg/cpp/build-debug/bin/bb",
"args": [
"prove_ultra_honk_output_all",
"-o", "/tmp/bb-095XQV/tmp-PPXk0y",
"-b", "/tmp/bb-095XQV/tmp-PPXk0y/PrivateKernelInitArtifact-bytecode",
"-w", "/tmp/bb-095XQV/tmp-PPXk0y/witness.gz",
"-v"
],
"cwd": "${workspaceFolder}",
"stopOnEntry": false
}
]
}
3 changes: 1 addition & 2 deletions barretenberg/acir_tests/reset_acir_tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Run from barretenberg/acir_tests
# Run from within barretenberg/acir_tests
cd ../../noir/noir-repo
cargo clean
noirup -p .
cd test_programs && ./rebuild.sh

Expand Down
10 changes: 10 additions & 0 deletions barretenberg/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ include(cmake/gtest.cmake)
include(cmake/benchmark.cmake)
include(cmake/module.cmake)
include(cmake/msgpack.cmake)

# We do not need to bloat barretenberg.wasm with gzip functionality in a browser context as the browser can do this
if (NOT WASM)
include(cmake/libdeflate.cmake)
else()
set(DISABLE_AZTEC_VM ON)
endif()
if(DISABLE_AZTEC_VM)
add_definitions(-DDISABLE_AZTEC_VM=1)
endif()
include(cmake/backward-cpp.cmake)

if (WASM)
Expand Down
10 changes: 10 additions & 0 deletions barretenberg/cpp/cmake/libdeflate.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include(FetchContent)

FetchContent_Declare(
libdeflate
GIT_REPOSITORY https://github.com/ebiggers/libdeflate.git
GIT_TAG b03254d978d7af21a7512dee8fdc3367bc15c656
)

# Download and populate libdeflate
FetchContent_MakeAvailable(libdeflate)
4 changes: 3 additions & 1 deletion barretenberg/cpp/src/barretenberg/bb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if (NOT(FUZZING))
if (NOT(FUZZING) AND NOT(WASM))
add_executable(
bb
main.cpp
Expand All @@ -11,6 +11,8 @@ if (NOT(FUZZING))
PRIVATE
barretenberg
env
circuit_checker
libdeflate::libdeflate_static
)
if(CHECK_CIRCUIT_STACKTRACES)
target_link_libraries(
Expand Down
175 changes: 171 additions & 4 deletions barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#include "barretenberg/dsl/acir_format/acir_format.hpp"
#include "barretenberg/honk/proof_system/types/proof.hpp"
#include "barretenberg/plonk/proof_system/proving_key/serialize.hpp"
#include "barretenberg/serialize/cbind.hpp"
#include "barretenberg/stdlib/honk_recursion/verifier/client_ivc_recursive_verifier.hpp"
#include <cstddef>
#ifndef DISABLE_AZTEC_VM
#include "barretenberg/vm/avm_trace/avm_common.hpp"
#include "barretenberg/vm/avm_trace/avm_execution.hpp"
Expand All @@ -14,6 +16,7 @@
#include "get_bn254_crs.hpp"
#include "get_bytecode.hpp"
#include "get_grumpkin_crs.hpp"
#include "libdeflate.h"
#include "log.hpp"
#include <barretenberg/common/benchmark.hpp>
#include <barretenberg/common/container.hpp>
Expand All @@ -23,6 +26,7 @@
#include <barretenberg/dsl/acir_proofs/acir_composer.hpp>
#include <barretenberg/srs/global_crs.hpp>
#include <cstdint>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <string>
Expand Down Expand Up @@ -240,6 +244,148 @@ bool proveAndVerifyHonkProgram(const std::string& bytecodePath, const std::strin
return true;
}

struct VectorOfAcirAndWitnesses {
std::vector<std::vector<uint8_t>> acirGzippedBincoes;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo?

std::vector<std::map<uint8_t, std::string>> witnessMaps;
};

// LONDONTODO(AD): this could probably be more idiomatic
template <typename T> T unpack_from_file(const std::string& filename)
{
std::ifstream fin;
fin.open(filename, std::ios::ate | std::ios::binary);
if (!fin.is_open()) {
throw std::invalid_argument("file not found");
}
if (fin.tellg() == -1) {
throw std::invalid_argument("something went wrong");
}

uint64_t fsize = static_cast<uint64_t>(fin.tellg());
fin.seekg(0, std::ios_base::beg);

T result;
char* encoded_data = new char[fsize];
fin.read(encoded_data, static_cast<std::streamsize>(fsize));
msgpack::unpack(encoded_data, fsize).get().convert(result);
return result;
}

// LONDONTODO find a home for this
acir_format::WitnessVector witness_map_to_witness_vector(std::map<std::string, std::string> const& witness_map)
{
acir_format::WitnessVector wv;
size_t index = 0;
for (auto& e : witness_map) {
uint64_t value = std::stoull(e.first);
// ACIR uses a sparse format for WitnessMap where unused witness indices may be left unassigned.
// To ensure that witnesses sit at the correct indices in the `WitnessVector`, we fill any indices
// which do not exist within the `WitnessMap` with the dummy value of zero.
while (index < value) {
wv.push_back(fr(0));
index++;
}
wv.push_back(fr(uint256_t(e.second)));
index++;
}
return wv;
}

std::vector<uint8_t> decompressedBuffer(uint8_t* bytes, size_t size)
{
std::vector<uint8_t> content;
// initial size guess
content.resize(1024ULL * 128ULL);
for (;;) {
auto decompressor = std::unique_ptr<libdeflate_decompressor, void (*)(libdeflate_decompressor*)>{
libdeflate_alloc_decompressor(), libdeflate_free_decompressor
};
size_t actual_size = 0;
libdeflate_result decompress_result = libdeflate_gzip_decompress(
decompressor.get(), bytes, size, std::data(content), std::size(content), &actual_size);
if (decompress_result == LIBDEFLATE_INSUFFICIENT_SPACE) {
// need a bigger buffer
content.resize(content.size() * 2);
continue;
}
if (decompress_result == LIBDEFLATE_BAD_DATA) {
throw std::invalid_argument("bad gzip data in bb main");
}
content.resize(actual_size);
break;
}
return content;
}

void client_ivc_prove_output_all_msgpack(const std::string& bytecodePath,
const std::string& witnessPath,
const std::string& outputPath)
{
using Flavor = MegaFlavor; // This is the only option
using Builder = Flavor::CircuitBuilder;
using Program = acir_format::AcirProgram;
using ECCVMVK = ECCVMFlavor::VerificationKey;
using TranslatorVK = TranslatorFlavor::VerificationKey;

init_bn254_crs(1 << 24);
init_grumpkin_crs(1 << 14);

auto gzippedBincodes = unpack_from_file<std::vector<std::string>>(bytecodePath);
auto witnessMaps = unpack_from_file<std::vector<std::string>>(witnessPath);
std::vector<Program> folding_stack;
for (size_t i = 0; i < gzippedBincodes.size(); i++) {
// LONDONTODO(AD) there is a lot of copying going on in bincode, we should make sure this writes as a buffer in
// the future
std::vector<uint8_t> buffer =
decompressedBuffer(reinterpret_cast<uint8_t*>(&gzippedBincodes[i][0]), gzippedBincodes[i].size()); // NOLINT

std::vector<acir_format::AcirFormat> constraint_systems = acir_format::program_buf_to_acir_format(
buffer,
false); // LONDONTODO(https://github.com/AztecProtocol/barretenberg/issues/1013):
// this assumes that folding is never done with ultrahonk.
std::vector<uint8_t> witnessBuffer =
decompressedBuffer(reinterpret_cast<uint8_t*>(&witnessMaps[i][0]), witnessMaps[i].size()); // NOLINT
acir_format::WitnessVectorStack witness_stack = acir_format::witness_buf_to_witness_stack(witnessBuffer);
acir_format::AcirProgramStack program_stack{ constraint_systems, witness_stack };
folding_stack.push_back(program_stack.back());
}
// LONDONTODO(AD) dedupe this with the rest of the similar code
ClientIVC ivc;
ivc.structured_flag = true;
// Accumulate the entire program stack into the IVC
for (Program& program : folding_stack) {
// auto& stack_item = program_stack.witness_stack[i];

// Construct a bberg circuit from the acir representation
auto circuit =
acir_format::create_circuit<Builder>(program.constraints, 0, program.witness, false, ivc.goblin.op_queue);
ivc.accumulate(circuit);
}

// Write the proof and verification keys into the working directory in 'binary' format (in practice it seems this
// directory is passed by bb.js)
std::string vkPath = outputPath + "/inst_vk"; // the vk of the last instance
std::string accPath = outputPath + "/pg_acc";
std::string proofPath = outputPath + "/client_ivc_proof";
std::string translatorVkPath = outputPath + "/translator_vk";
std::string eccVkPath = outputPath + "/ecc_vk";

auto proof = ivc.prove();
auto eccvm_vk = std::make_shared<ECCVMVK>(ivc.goblin.get_eccvm_proving_key());
auto translator_vk = std::make_shared<TranslatorVK>(ivc.goblin.get_translator_proving_key());

auto last_instance = std::make_shared<ClientIVC::VerifierInstance>(ivc.instance_vk);
// LONDONTODO(AD): this can eventually be dropped
vinfo("ensure valid proof: ", ivc.verify(proof, { ivc.verifier_accumulator, last_instance }));

vinfo("write proof and vk data to files..");
write_file(proofPath, to_buffer(proof));
write_file(vkPath, to_buffer(ivc.instance_vk));
write_file(accPath, to_buffer(ivc.verifier_accumulator));
write_file(translatorVkPath, to_buffer(translator_vk));
write_file(eccVkPath, to_buffer(eccvm_vk));
}

bool foldAndVerifyProgram(const std::string& bytecodePath, const std::string& witnessPath)
{
using Flavor = MegaFlavor; // This is the only option
Expand Down Expand Up @@ -287,8 +433,8 @@ void client_ivc_prove_output_all(const std::string& bytecodePath,
using ECCVMVK = ECCVMFlavor::VerificationKey;
using TranslatorVK = TranslatorFlavor::VerificationKey;

init_bn254_crs(1 << 18);
init_grumpkin_crs(1 << 14);
init_bn254_crs(1 << 22);
init_grumpkin_crs(1 << 16);

ClientIVC ivc;
ivc.structured_flag = true;
Expand Down Expand Up @@ -385,17 +531,32 @@ void prove_tube(const std::string& outputPath)
info("num gates: ", builder->get_num_gates());
info("generating proof");
using Prover = UltraProver_<UltraFlavor>;
using Verifier = UltraVerifier_<UltraFlavor>;

Prover tube_prover{ *builder };
auto tube_proof = tube_prover.construct_proof();

std::string tubeProofPath = outputPath + "/proof";
write_file(tubeProofPath, to_buffer<true>(tube_proof));

std::string tubeProofAsFieldsPath = outputPath + "/proof_fields.json";
auto proof_data = to_json(tube_proof);
write_file(tubeProofAsFieldsPath, { proof_data.begin(), proof_data.end() });

std::string tubeVkPath = outputPath + "/vk";
auto tube_verification_key =
std::make_shared<typename UltraFlavor::VerificationKey>(tube_prover.instance->proving_key);
write_file(tubeVkPath, to_buffer(tube_verification_key));

std::string tubeAsFieldsVkPath = outputPath + "/vk_fields.json";
auto field_els = tube_verification_key->to_field_elements();
info("verificaton key length in fields:", field_els.size());
auto data = to_json(field_els);
write_file(tubeAsFieldsVkPath, { data.begin(), data.end() });

info("Native verification of the tube_proof");
Verifier tube_verifier(tube_verification_key);
bool verified = tube_verifier.verify_proof(tube_proof);
info("Tube proof verification: ", verified);
}

/**
Expand Down Expand Up @@ -1066,7 +1227,6 @@ int main(int argc, char* argv[])
}

std::string command = args[0];

std::string bytecode_path = get_option(args, "-b", "./target/program.json");
std::string witness_path = get_option(args, "-w", "./target/witness.gz");
std::string proof_path = get_option(args, "-p", "./proofs/proof");
Expand Down Expand Up @@ -1095,6 +1255,13 @@ int main(int argc, char* argv[])
if (command == "prove_and_verify_mega_honk_program") {
return proveAndVerifyHonkProgram<MegaFlavor>(bytecode_path, witness_path) ? 0 : 1;
}
// LONDONTOD(AD): We will eventually want to get rid of this version when we correctly
// create the bincode that client_ivc_prove_output_all expects
if (command == "client_ivc_prove_output_all_msgpack") {
std::string output_path = get_option(args, "-o", "./proofs/proof");
client_ivc_prove_output_all_msgpack(bytecode_path, witness_path, output_path);
return 0;
}
if (command == "fold_and_verify_program") {
return foldAndVerifyProgram(bytecode_path, witness_path) ? 0 : 1;
}
Expand Down
2 changes: 2 additions & 0 deletions barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class ClientIVC {
HonkProof decider_proof;
GoblinProof goblin_proof;

size_t size() const { return folding_proof.size() + decider_proof.size() + goblin_proof.size(); }

MSGPACK_FIELDS(folding_proof, decider_proof, goblin_proof);
};

Expand Down
3 changes: 2 additions & 1 deletion barretenberg/cpp/src/barretenberg/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <cstdint>

namespace bb {
// The log of the max circuit size assumed in order to achieve constant sized proofs
// The log of the max circuit size assumed in order to achieve constant sized Honk proofs
// LONDONTODO(CONSTANT SIEZ): This shoudl go away. In the short term, will this be a problem for the AVM?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ledwards2225 is there anything to do here?

static constexpr uint32_t CONST_PROOF_SIZE_LOG_N = 28;
} // namespace bb
16 changes: 13 additions & 3 deletions barretenberg/cpp/src/barretenberg/dsl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
barretenberg_module(
dsl

# We do not need to bloat barretenberg.wasm with gzip functionality in a browser context as the browser can do this

set(DSL_DEPENDENCIES
plonk
ultra_honk
client_ivc
Expand All @@ -10,5 +12,13 @@ barretenberg_module(
crypto_merkle_tree
stdlib_schnorr
ultra_honk
stdlib_honk_recursion
stdlib_honk_recursion)

if (NOT WASM)
list(APPEND DSL_DEPENDENCIES libdeflate::libdeflate_static)
endif()

barretenberg_module(
dsl
${DSL_DEPENDENCIES}
)
Loading
Loading