forked from celo-org/snark-setup
-
Notifications
You must be signed in to change notification settings - Fork 96
Include chunked phase2 script #439
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
Open
emmorais
wants to merge
18
commits into
phase2
Choose a base branch
from
phase2_chunked_script
base: phase2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
b894388
Include chunked phase2 script
emmorais 8f4d840
Update script and include NewOpts fields
emmorais 128d72c
Include all missing parameters into NewOpt
emmorais 82ba6db
Fix curve-kind
Pratyush f7cd635
Better logging and perf improvements
Pratyush 44d92ec
Optimizatin
Pratyush 29a0f40
Updates
Pratyush 13bc54d
Upgrade to latest snarkvm where appropriate
Pratyush 003705b
Update Cargo.lock
Pratyush f639d42
Working `new` command in `setup2`
Pratyush 3509c96
Fix compilatin for `setup1-contributor`
Pratyush f7766f4
Completely remove old `snarkvm`
Pratyush 0f22458
Update `setup1-verifier`
Pratyush 2ac6f63
Tweaks
Pratyush 3d0f600
Progress
Pratyush 86e3754
Merge
Pratyush 81ab4f5
Implement some more commands
Pratyush b0715cc
Implement combine command
Pratyush 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| #!/bin/bash -e | ||
|
|
||
| rm -f challenge* response* new_challenge* new_response* new_new_challenge_* processed* initial_ceremony* response_list* combined* seed* chunk* | ||
|
|
||
| export RUSTFLAGS="-C target-feature=+bmi2,+adx" | ||
| CARGO_VER="" | ||
| PROVING_SYSTEM=groth16 | ||
| POWER=18 | ||
| BATCH=131072 | ||
| CHUNK_SIZE=131072 | ||
| CURVE="bw6" | ||
| PATH_PHASE1="../../phase1-cli/scripts/combined" | ||
| SEED1=$(tr -dc 'A-F0-9' < /dev/urandom | head -c32) | ||
| echo $SEED1 > seed1 | ||
| SEED2=$(tr -dc 'A-F0-9' < /dev/urandom | head -c32) | ||
| echo $SEED2 > seed2 | ||
|
|
||
| function check_hash() { | ||
| test "`xxd -p -c 64 $1.hash`" = "`b2sum $1 | awk '{print $1}'`" | ||
| } | ||
|
|
||
| cargo $CARGO_VER build --release --bin setup2 | ||
|
|
||
| phase2_new="cargo run --release --features cli -- new --curve-type $CURVE --chunk-size $CHUNK_SIZE --batch-size $BATCH --contribution-mode full" | ||
| phase2_chunked="cargo run --release --bin setup2 --features cli -- --curve-type $CURVE --chunk-size $CHUNK_SIZE --batch-size $BATCH --contribution-mode full --proving-system $PROVING_SYSTEM" | ||
| phase2_1="cargo run --release --bin setup2 --features cli -- --curve-type $CURVE --batch-size $BATCH --contribution-mode chunked --chunk-size $CHUNK_SIZE --seed seed1 --proving-system $PROVING_SYSTEM" | ||
| phase2_2="cargo run --release --bin setup2 --features cli -- --curve-type $CURVE --batch-size $BATCH --contribution-mode chunked --chunk-size $CHUNK_SIZE --seed seed2 --proving-system $PROVING_SYSTEM" | ||
|
Comment on lines
+26
to
+27
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. Same for these two? 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. ditto |
||
| ####### Phase 2 | ||
|
|
||
| MAX_CHUNK_INDEX=1 | ||
|
|
||
| pwd | ||
|
|
||
| ls $PATH_PHASE1 | ||
|
|
||
| $phase2_new --challenge-fname challenge --challenge-hash-fname challenge.verified.hash --phase1-fname $PATH_PHASE1 --phase1-powers $POWER --num-validators 1 --num-epochs 1 | ||
| for i in $(seq 0 $(($MAX_CHUNK_INDEX/2))); do | ||
| echo "Contributing and verifying chunk $i..." | ||
| $phase2_1 --chunk-index $i contribute --challenge-fname challenge.$i --challenge-hash-fname challenge.$i.hash --response-fname response_$i --response-hash-fname response_$i.hash | ||
| check_hash challenge.$i | ||
| check_hash response_$i | ||
| $phase2_1 --chunk-index $i verify --challenge-fname challenge.$i --challenge-hash-fname challenge_$i.verified.hash --response-fname response_$i --response-hash-fname response_$i.verified.hash | ||
| rm response_$i.hash | ||
| $phase2_2 --chunk-index $i contribute --challenge-fname response_$i --challenge-hash-fname response_$i.hash --response-fname new_response_$i --response-hash-fname new_response_$i.hash | ||
| check_hash new_response_$i | ||
| $phase2_2 --chunk-index $i verify --challenge-fname response_$i --challenge-hash-fname response_$i.verified.hash --response-fname new_response_$i --response-hash-fname new_response_$i.verified.hash | ||
| rm challenge.$i response_$i # no longer needed | ||
| echo new_response_$i >> response_list | ||
| done | ||
|
|
||
| for i in $(seq $(($MAX_CHUNK_INDEX/2 + 1)) $MAX_CHUNK_INDEX); do | ||
| echo "Contributing and verifying chunk $i..." | ||
| $phase2_2 --chunk-index $i contribute --challenge-fname challenge.$i --challenge-hash-fname challenge.$i.hash --response-fname response_$i --response-hash-fname response_$i.hash | ||
| check_hash challenge.$i | ||
| check_hash response_$i | ||
| $phase2_2 --chunk-index $i verify --challenge-fname challenge.$i --challenge-hash-fname challenge_$i.verified.hash --response-fname response_$i --response-hash-fname response_$i.verified.hash | ||
| rm response_$i.hash | ||
| $phase2_1 --chunk-index $i contribute --challenge-fname response_$i --challenge-hash-fname response_$i.hash --response-fname new_response_$i --response-hash-fname new_response_$i.hash | ||
| check_hash new_response_$i | ||
| $phase2_1 --chunk-index $i verify --challenge-fname response_$i --challenge-hash-fname response_$i.verified.hash --response-fname new_response_$i --response-hash-fname new_response_$i.verified.hash | ||
| rm challenge.$i response_$i # no longer needed | ||
| echo new_response_$i >> response_list | ||
| done | ||
|
|
||
| $phase2_chunked combine --response-list-fname response_list --initial-query-fname challenge.query --initial-full-fname challenge.full --combined-fname combined | ||
|
|
||
| echo "Done!" | ||
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
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.
This should come with an argument for the binary, right? That is, one of
new,contribute, etc?Uh oh!
There was an error while loading. Please reload this page.
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.
Looks like we're still missing the
seedand theproving_systemin the related struct (edit: and possibly more judging by the rest of the script, and assuming it is correct).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.
The command is actually specified lower in the script.
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.
@emmorais are these commands currently complete?