Repository navigation
Confidential Token: pass G and H to multi_scalar_mul as witnesses
#945
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ce5f830
Confidential circuits: pass G and H to multi_scalar_mul as witnesses
brozorec 76b01a5
Confidential README: document the verifier backend and the non-zk set…
brozorec 0041d62
Fail the lookup guard closed on unparsable MSM operands
brozorec 062e5ef
Tighten the non-zk privacy wording in the README and as_witness docs
brozorec 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
74 changes: 74 additions & 0 deletions
74
packages/confidential/circuits/scripts/check_witness_lookups.sh
This file contains hidden or 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,74 @@ | ||
| #!/usr/bin/env bash | ||
| # Fails if any compiled package could feed witness data into Barretenberg's | ||
| # plookup argument. | ||
| # | ||
| # Proofs are generated without `--zk`, so `lookup_read_counts` and | ||
| # `lookup_read_tags` are committed in the clear and every lookup whose table | ||
| # row depends on a witness exposes that row. bb lowers MULTI_SCALAR_MUL to its | ||
| # fixed-base lookup tables whenever a base point is an ACIR constant equal to | ||
| # one of its precomputed generators, which `G` and `H` are; `commit` and | ||
| # `scalar_mul` in `lib/src/lib.nr` pass them as witnesses to prevent that. | ||
| # This script inspects the compiled ACIR for the two ways that can regress: a | ||
| # blackbox outside the plookup-free set below, or a MULTI_SCALAR_MUL base | ||
| # point with a constant coordinate. | ||
| # | ||
| # Requires the pinned `nargo` (which ships `noir-inspector`) declared in | ||
| # `.github/workflows/noir.yml`. Run from anywhere; the script anchors to the | ||
| # circuits/ root. | ||
| set -euo pipefail | ||
|
|
||
| cd "$(dirname "$0")/.." | ||
|
|
||
| # Blackboxes that bb 0.87.0 lowers without plookup: POSEIDON2_PERMUTATION to | ||
| # Poseidon2 gates, RANGE to delta-range gates, MULTI_SCALAR_MUL with witness | ||
| # bases to ROM-based Straus tables. | ||
| ALLOWED="MULTI_SCALAR_MUL POSEIDON2_PERMUTATION RANGE" | ||
|
|
||
| nargo compile --workspace >/dev/null | ||
|
|
||
| status=0 | ||
| for artifact in target/*.json; do | ||
| if ! noir-inspector print-acir "$artifact" | awk -v file="$artifact" -v allowed="$ALLOWED" ' | ||
| BEGIN { n = split(allowed, a, " "); for (i = 1; i <= n; i++) ok[a[i]] = 1 } | ||
| match($0, /BLACKBOX::[A-Z0-9_]+/) { | ||
| name = substr($0, RSTART + 10, RLENGTH - 10) | ||
| if (!(name in ok)) { | ||
| printf "%s: BLACKBOX::%s is not in the plookup-free set\n", file, name | ||
| bad = 1 | ||
| next | ||
| } | ||
| if (name != "MULTI_SCALAR_MUL") next | ||
| # Operands are 3 per point (x, y, is_infinite), then 2 per scalar. | ||
| ops = $0 | ||
| sub(/^[^[]*\[/, "", ops) | ||
| sub(/\].*$/, "", ops) | ||
| k = 0 | ||
| while (match(ops, /\([^)]*\)/)) { | ||
| op = substr(ops, RSTART + 1, RLENGTH - 2) | ||
| sub(/,.*/, "", op) | ||
| vals[k++] = op | ||
| ops = substr(ops, RSTART + RLENGTH) | ||
| } | ||
| if (k == 0 || k % 5 != 0) { | ||
| printf "%s: cannot parse MULTI_SCALAR_MUL operands: %s\n", file, $0 | ||
| bad = 1 | ||
| next | ||
| } | ||
| for (p = 0; p < k / 5; p++) { | ||
| if (vals[3 * p] !~ /^_/ || vals[3 * p + 1] !~ /^_/) { | ||
| printf "%s: MULTI_SCALAR_MUL takes a constant base point\n", file | ||
| bad = 1 | ||
| break | ||
| } | ||
| } | ||
| } | ||
| END { exit bad } | ||
| '; then | ||
| status=1 | ||
| fi | ||
| done | ||
|
|
||
| if [ "$status" -ne 0 ]; then | ||
| echo "Witness data can reach a lookup table; see the header of $0." >&2 | ||
| fi | ||
| exit "$status" | ||
Binary file not shown.
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.
Uh oh!
There was an error while loading. Please reload this page.