-
Notifications
You must be signed in to change notification settings - Fork 327
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: folding acir programs #6685
Merged
Merged
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
8009652
WiP fails to verify with any recursive verifier
ledwards2225 5c1bdf8
basic integration test setup
ledwards2225 1e4efca
add and use program stack struct
ledwards2225 2c0b89c
integration test for program stack
ledwards2225 e328d2c
client ivc prove and verify method
ledwards2225 aaf1550
updates to inegration tests, client ivc test failing
ledwards2225 436f751
minimal test showing issue with adding RAM post
ledwards2225 5e9072f
test cleanup
ledwards2225 6a1de02
Merge branch 'master' into lde/acir_folding
ledwards2225 492b2ed
client ivc test passes
ledwards2225 6e7162f
move adding of mock ops into client ivc
ledwards2225 f3a91e0
fold and verify flow passes
ledwards2225 deb9658
add cbinds for fold and verify
ledwards2225 bfc2db9
Merge branch 'master' into lde/acir_folding
ledwards2225 5adc97a
add fold tests to CI for bb and bbjs
ledwards2225 e3088ef
Merge branch 'master' into lde/acir_folding
ledwards2225 5e5784c
update integration tests after merge
ledwards2225 248d4ba
Merge branch 'master' into lde/acir_folding
ledwards2225 adcbe99
fix binding
ledwards2225 0cacb52
fix CI setup
ledwards2225 bea3d67
clean up
ledwards2225 bba7d2d
clean up
ledwards2225 ee002d6
Merge branch 'master' into lde/acir_folding
ledwards2225 db19d39
Merge branch 'master' into lde/acir_folding
ledwards2225 233ff93
mega name fix
ledwards2225 7d03507
disable tests at risk for intermittent failure
ledwards2225 a41fe29
Address issue 1003
codygunton 92fd298
Merge remote-tracking branch 'origin/master' into lde/acir_folding
codygunton e7ace4a
update mega naming
ledwards2225 c4c1843
Merge branch 'master' into lde/acir_folding
ledwards2225 922d83e
update name
ledwards2225 ffc3622
disable last integration test
ledwards2225 837de7e
Merge branch 'master' into lde/acir_folding
ledwards2225 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
VFLAG=${VERBOSE:+-v} | ||
|
||
$BIN fold_and_verify_program $VFLAG -c $CRS_PATH -b ./target/program.json |
6 changes: 6 additions & 0 deletions
6
barretenberg/acir_tests/flows/prove_and_verify_goblin_ultra_honk_program.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
VFLAG=${VERBOSE:+-v} | ||
|
||
$BIN prove_and_verify_goblin_ultra_honk_program $VFLAG -c $CRS_PATH -b ./target/program.json | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include "barretenberg/bb/file_io.hpp" | ||
#include "barretenberg/client_ivc/client_ivc.hpp" | ||
#include "barretenberg/common/serialize.hpp" | ||
#include "barretenberg/dsl/acir_format/acir_format.hpp" | ||
#include "barretenberg/dsl/types.hpp" | ||
|
@@ -219,6 +220,34 @@ bool proveAndVerifyHonkProgram(const std::string& bytecodePath, const std::strin | |
return true; | ||
} | ||
|
||
bool foldAndVerifyProgram(const std::string& bytecodePath, const std::string& witnessPath) | ||
{ | ||
using Flavor = MegaFlavor; // This is the only option | ||
using Builder = Flavor::CircuitBuilder; | ||
|
||
init_bn254_crs(1 << 18); | ||
init_grumpkin_crs(1 << 14); | ||
|
||
ClientIVC ivc; | ||
ivc.structured_flag = true; | ||
|
||
auto program_stack = acir_format::get_acir_program_stack(bytecodePath, witnessPath); | ||
|
||
// Accumulate the entire program stack into the IVC | ||
while (!program_stack.empty()) { | ||
auto stack_item = program_stack.back(); | ||
|
||
// Construct a bberg circuit from the acir representation | ||
auto circuit = acir_format::create_circuit<Builder>( | ||
stack_item.constraints, 0, stack_item.witness, false, ivc.goblin.op_queue); | ||
|
||
ivc.accumulate(circuit); | ||
|
||
program_stack.pop_back(); | ||
} | ||
return ivc.prove_and_verify(); | ||
} | ||
|
||
/** | ||
* @brief Proves and Verifies an ACIR circuit | ||
* | ||
|
@@ -832,6 +861,12 @@ int main(int argc, char* argv[]) | |
if (command == "prove_and_verify_ultra_honk_program") { | ||
return proveAndVerifyHonkProgram<UltraFlavor>(bytecode_path, witness_path) ? 0 : 1; | ||
} | ||
if (command == "prove_and_verify_goblin_ultra_honk_program") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks |
||
return proveAndVerifyHonkProgram<MegaFlavor>(bytecode_path, witness_path) ? 0 : 1; | ||
} | ||
if (command == "fold_and_verify_program") { | ||
return foldAndVerifyProgram(bytecode_path, witness_path) ? 0 : 1; | ||
} | ||
if (command == "prove_and_verify_goblin") { | ||
return proveAndVerifyGoblin(bytecode_path, witness_path) ? 0 : 1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ barretenberg_module( | |
dsl | ||
plonk | ||
ultra_honk | ||
client_ivc | ||
stdlib_sha256 | ||
stdlib_aes128 | ||
stdlib_keccak | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename file and flow to mega?