docs(bb): add initial cli reference#17244
Conversation
|
@critesjosh feel free to add reviewers 🙏 |
| curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/bbup/install | bash | ||
| bbup | ||
| ``` | ||
|
|
There was a problem hiding this comment.
For more bbup commands, see: https://github.com/AztecProtocol/aztec-packages/tree/next/barretenberg/bbup
iAmMichaelConnor
left a comment
There was a problem hiding this comment.
Hi! I'm probably not the best person to review this, unfortunately. I've been away from barretenberg for ~3 years. I've hastily written lots of questions that jumped out to me as someone who doesn't understand the latest bb stuff. But I was short on time.
This would benefit from being reviewed by someone on Luke's team, as they wrote and maintain this code.
| sidebar_position: 1000000 | ||
| --- | ||
|
|
||
| # Barretenberg CLI Reference |
There was a problem hiding this comment.
I was going to suggest perhaps this could live in a section within the barretenberg readme: https://github.com/AztecProtocol/aztec-packages/blob/master/barretenberg/README.md#usage <-- that's the master branch, and you can see an incomplete "usage" section.
But then I switched to the next branch (which is where development happens) and there is no "Usage" section anymore https://github.com/AztecProtocol/aztec-packages/blob/next/barretenberg/README.md. Not sure what the team's plan is.
There was a problem hiding this comment.
Our team has not paid enough attention here; I'm willing to spend some time here. Thanks for the suggestions Mike
| [Barretenberg](https://github.com/AztecProtocol/barretenberg) is Aztec's cryptography backend. This page covers `bb`, the command-line interface for Barretenberg. | ||
|
|
||
| Usage: `bb [OPTIONS] [SUBCOMMAND]` | ||
|
|
There was a problem hiding this comment.
| If you'd rather look directly at the code, you can jump here: https://github.com/AztecProtocol/aztec-packages/blob/next/barretenberg/cpp/src/barretenberg/bb/cli.cpp (Note: the `next` branch is for ongoing development, and might not exactly reflect released versions). |
Not sure exactly where on this page this should go, but early on seems sensible. It's where I'd want to go if I got stuck.
|
|
||
| #### Options | ||
|
|
||
| - `-s, --scheme [BB_SCHEME]` - The type of proof to be constructed. Specifies a proving system, an accumulation scheme, or a type of circuit to be constructed and proven for some implicit scheme. Options: `{client_ivc`, `avm`, `ultra_honk}` |
There was a problem hiding this comment.
Consider making these suboptions a consistent format to others in this list: i.e. an indented list of bullet points.
There was a problem hiding this comment.
Any AVM mentions should reference an AVM stub document that explains that for now the AVM is not user-facing and used with our yarn packages, maybe
| - `bytes_and_fields` - Both `bytes` and `fields`. | ||
| - `fields_msgpack` - MessagePack buffer of `Fr` elements. | ||
| - `--write_vk` - Writes the circuit's verification key. | ||
| - `--zk` - Uses a zero-knowledge version of the specified `--scheme`, if available. |
There was a problem hiding this comment.
Does it throw if not available? Hopefully it does.
There was a problem hiding this comment.
I'm not actually sure what 'if available' means here, but there's some combinations that don't make sense and likely should error out. the most problematic right now is --ipa_accumulation that single handedly makes other options ignored and is the bundle of rollup defaults. that one is awkward
| - `fields` - String representation of array of field elements. | ||
| - `bytes_and_fields` - Both `bytes` and `fields`. | ||
| - `fields_msgpack` - MessagePack buffer of `Fr` elements. | ||
| - `--write_vk` - Writes the circuit's verification key. |
There was a problem hiding this comment.
Does it write it to a separate file? What name does it give the file?
There was a problem hiding this comment.
its written to /vk. This is written as 32 byte field chunks, except if using the keccak oracle then it is optimized for solidity consumption
| - `-c, --crs_path` - Path to Common Reference String (CRS) directory. CRS files will be downloaded automatically as needed. | ||
| - `--version` - Prints the version string. | ||
|
|
||
| ## Subcommands |
There was a problem hiding this comment.
What's the expected workflow? In what order would a dev typically run these commands? It seems like usage of Noir is implied. What kind of Noir commands do I need to run, in order to generate the files needed for some of the below commands?
There was a problem hiding this comment.
I can either help figuring this out, or just handle this ask
| - `-b, --bytecode_path` - Path to ACIR bytecode generated by Noir. | ||
| - `-w, --witness_path` - Path to partial witness generated by Noir. |
There was a problem hiding this comment.
What kind of files are these? What are their file extensions? What's the default name of the file?
There was a problem hiding this comment.
for posterity (possibly for myself if I do a pass):
- bytecode can be a json with a 'bytecode' key (e.g. Noir ABI json), with serialized ACIR gzip-compressed then encoded in base64
- or a gzip-compressed file of serialized ACIR
Witnesses can be
- a gzip-compressed file of serialized witness data (output by Noir)
| - `--ipa_accumulation` - Accumulates/aggregates Inner Product Argument (IPA) claims. | ||
| - `--init_kzg_accumulator` - Initializes pairing point accumulator. | ||
| - `--honk_recursion` - Informs the prover that this circuit will be recursively verified with UltraHonk (`1`) or with UltraRollupHonk (`2`). Ensures that a pairing point accumulator is added to the public inputs of the proof. (For UltraRollupHonk, an IPA claim is also added.) | ||
| - `--recursive` - Enables recursive verification and KZG features. |
There was a problem hiding this comment.
I'm not sure what this means
There was a problem hiding this comment.
Recursive and honk recursion shouldnt be a part of --help, I wonder how this got picked up? I nuked them, quite confused how they got into the source material or prompt or whatever
| - `starknet` - For Starknet smart contract verification (use with Garaga library). | ||
| - `--zk` - Uses a zero-knowledge version of the specified `--scheme`, if available. | ||
| - `--ipa_accumulation` - Accumulates/aggregates Inner Product Argument (IPA) claims. | ||
| - `--init_kzg_accumulator` - Initializes pairing point accumulator. |
There was a problem hiding this comment.
Probably needs a more detailed explanation of what this means
There was a problem hiding this comment.
This is probably best explained in use cases and show the prover and verifier commands for both use cases. the AVM and starknet use cases should explain that one is beyond scope, another is in experimental dev and not turned on by default
| - `keccak` - For Ethereum smart contract verification (uses EVM precompile). | ||
| - `starknet` - For Starknet smart contract verification (use with Garaga library). | ||
| - `--zk` - Uses a zero-knowledge version of the specified `--scheme`, if available. | ||
| - `--ipa_accumulation` - Accumulates/aggregates Inner Product Argument (IPA) claims. |
There was a problem hiding this comment.
Probably needs a more detailed explanation of what this means
|
Thanks for giving it a look, @iAmMichaelConnor. Will follow up separately -- I wasn't really thinking you'd do a substantive review but more wanted to use this to chat through edits/tone/etc. 🙂 But I appreciate your comments; will address them in a future iteration but they will no doubt make this all clearer! |
|
Hey guys, feel free to leave this with TODO notes for more context heavy stuff and I'm happy to work through it (the integration with the rest of the docs is the part I'd have a bit of trouble with, so thanks for doing that). If desired of course I can give all the context too. Thanks for your helpful notes @iAmMichaelConnor . |
|
I DM'd Marci - I will take on a second pass of this |
BEGIN_COMMIT_OVERRIDE fix: secp256k1 ecdsa mul - fix handling of point at infinity (#16679) fix: secp256k1 ecdsa mul handling of stagger point additions (#16685) chore: biggroup audit of lookup and rom tables (#16895) fix(bb): oversight that disabled batch commits (#17278) docs(bb): add initial cli reference (#17244) chore!: cycle group #6 (#17174) fix: mac bb publish (#17276) END_COMMIT_OVERRIDE
redo of #17215 on a clean branch
This PR adds documentation for the
bbCLI, based on help output from v0.87.0.Changes:
bb-cli-reference.mdbbcommands and options, with examplesNotes for reviewers:
Addresses https://linear.app/aztec-labs/issue/ECODR-145/add-bb-cli-docs-to-barretenberg-docs (TODOs tracked there)