-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Barretenberg C++ binary overhaul (#11459)
Overhaul the Barretenberg binary and its API. - Breaks up bb main into different files organized by proving system / IVC scheme. - Make UltraHonk conform to the new API interface introduced earlier for Client IVC. - Refines the API a bit. - Introduces [CLI11](https://github.com/CLIUtils/CLI11) to: provide help / documentation; validate opts (options can be required, exlusive of each other, validated against predicates like "path exists" or "string is in list"); also allows for easy environment variable aliasing. This could definitely use some more a help. - Lots of documentation needed - Defaults are set in a weird and inconsistent way and that information isn't included in the documentation. - The help menus are perhaps too verbose. Subcommands can't inherit options or flags so we end up repeating. - Empty string cannot be passed and parsed to a "nothing argument" which can lead to frustrating debugging... - Little option validation is actually implemented. - Deprecated options aren't noted but they could be. It was requested that the default change from UltraPlonk to UltraHonk, but we get rid of a default set of commands altogether. As a workaround, we can have users set `BB_SCHEME=ultra_honk`. Newly created issues: #1252, #1253, #1254, #1255, #1256, #1257, #1258, #1259 Resolves #1260 NB the line count is large because 1) CLI11 is a single 11k-line header; 2) I moved a lot of functions and some git mvs didn't show up as such. Main new code is api_ultra_honk.hpp. --------- Co-authored-by: ludamad <adam.domurad@gmail.com>
- Loading branch information
Showing
69 changed files
with
13,881 additions
and
2,197 deletions.
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
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
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,28 +1,34 @@ | ||
#!/bin/sh | ||
set -eux | ||
set -eu | ||
|
||
VFLAG=${VERBOSE:+-v} | ||
BFLAG="-b ./target/program.json" | ||
FLAGS="-c $CRS_PATH $VFLAG" | ||
FLAGS="-c $CRS_PATH $VFLAG --scheme ultra_honk" | ||
[ "${RECURSIVE}" = "true" ] && FLAGS+=" --recursive" | ||
PROVE_FLAGS="$FLAGS $BFLAG --oracle_hash keccak --output_data bytes_and_fields --output_content proof_and_vk --input_type single_circuit" | ||
VERIFY_FLAGS="$FLAGS --oracle_hash keccak" | ||
|
||
export PROOF="$PWD/sol_honk_proof" | ||
export PROOF_AS_FIELDS="$PWD/sol_honk_proof_fields.json" | ||
export VK="$PWD/sol_honk_vk" | ||
outdir=$(mktemp -d) | ||
trap "rm -rf $outdir" EXIT | ||
|
||
# Export the paths to the environment variables for the js test runner | ||
export PROOF="$outdir/proof" | ||
export PROOF_AS_FIELDS="$outdir/proof_fields.json" | ||
export VK="$outdir/vk" | ||
export VERIFIER_CONTRACT="$outdir/Verifier.sol" | ||
|
||
# Create a proof, write the solidity contract, write the proof as fields in order to extract the public inputs | ||
$BIN prove_ultra_keccak_honk -o $PROOF $FLAGS $BFLAG | ||
$BIN write_vk_ultra_keccak_honk -o $VK $FLAGS $BFLAG | ||
$BIN verify_ultra_keccak_honk -k $VK -p $PROOF $FLAGS | ||
$BIN proof_as_fields_honk $FLAGS -p $PROOF -o $PROOF_AS_FIELDS | ||
$BIN contract_ultra_honk -k $VK $FLAGS -o Verifier.sol | ||
$BIN prove $PROVE_FLAGS -o $outdir | ||
$BIN verify $VERIFY_FLAGS -k $VK -p $PROOF | ||
$BIN write_contract $FLAGS -k $VK -o $VERIFIER_CONTRACT | ||
|
||
# Export the paths to the environment variables for the js test runner | ||
export VERIFIER_PATH="$PWD/Verifier.sol" | ||
export VERIFIER_PATH="$outdir/Verifier.sol" | ||
export TEST_PATH=$(realpath "../../sol-test/HonkTest.sol") | ||
export TESTING_HONK="true" | ||
|
||
# Use solcjs to compile the generated key contract with the template verifier and test contract | ||
# index.js will start an anvil, on a random port | ||
# Deploy the verifier then send a test transaction | ||
export TEST_NAME=$(basename $PWD) | ||
export TEST_NAME=$(basename $outdir) | ||
node ../../sol-test/src/index.js |
Oops, something went wrong.