- Install Rust
- Install Risc0 toolchain:
cargo install cargo-binstall
yes | cargo binstall cargo-risczero
cargo risczero install
- Install GNU Time:
for Linux:
sudo apt-get install time
for MacOS:
brew install gnu-time
- Add wasm32-unknown-unknown target:
rustup target add wasm32-unknown-unknown
- Add rust-src:
rustup component add rust-src --toolchain nightly-2024-01-16
- Install Node version 18.12.1
cargo build --release
target/release/ballot_generator --badgeholder_count <usize> --ballot_count <usize>
target/release/ballot_preprocess --badgeholder_count <uszie> --processed_inputs <path_to_output_file>
This command will run the guest code that hashes vote amounts for the specified project id, commiting the single hash.
cargo run --release --bin op-rpgf -- --project_id <hex_string>
--receipt <path_to_store_receipt_file> --image_id <path_to_store_image_file> --votes_table <path_to_votes_table_file>
Pass the --aggregate
flag to hash the vote amounts for all of the projects, commiting to a vector of hashes.
cargo run --release --bin op-rpgf -- --aggregate --receipt <path_to_receipt_file> --votes_table <path_to_votes_table_file>
npm test -- --<BROWSER>
cargo nextest run benchmarking_tests::run_rpgf_ballots_benchmarks_wasm_ --no-capture
cargo nextest run benchmarking_tests::run_rpgf_ballots_benchmarks_native_ --no-capture
Make sure to install go first before running the following command:
RISC0_PPROF_OUT=op_rpgf.pb RISC0_DEV_MODE=1 cargo run --release -F metal --bin op-rpgf -- --aggregate
go tool pprof -http 127.0.0.1:8000 op_rpgf.pb
Stark to groth16 proof conversion (This feat is only for x86 architecture. For Mac you will need to run the following commands in a Rosetta 2 terminal)
First, build the prover image:
cd compact_proof
bash ./scripts/install_prover.sh
Then, generate the groth16 proof by passing the --groth16
flag to the op-rpgf
command:
cargo run --release --bin op-rpgf -- --aggregate --groth16 --receipt <path_to_receipt_file> --votes_table <path_to_votes_table_file>