Skip to content

Commit

Permalink
Separate preprocessing from proving and verification by adding a para…
Browse files Browse the repository at this point in the history
…meter --stage to proof producer
  • Loading branch information
martun committed Sep 12, 2024
1 parent 9928ef4 commit 9cd637c
Show file tree
Hide file tree
Showing 6 changed files with 399 additions and 123 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,29 @@ proof-generator --circuit <circuit-file> --assignment <assignment-file> --proof
cmake ..
make -j $(nrpoc)
```
# Sample calls to proof-producer
In all the calls you can change the executable name from proof-producer-single-threaded to proof-producer-multi-threaded to run on all the CPUs of your machine.
Generate a proof and verify it:
```bash
./build/bin/proof-producer/proof-producer-single-threaded --circuit="circuit.crct" --assignment-table="assignment.tbl" --proof="proof.bin" -q 10
```

Making a call to preprocessor:

```bash
./build/bin/proof-producer/proof-producer-single-threaded --stage="preprocess" --circuit="circuit.crct" --assignment-table="assignment.tbl" --common-data="preprocessed_common_data.dat" --preprocessed-data="preprocessed.dat" --commitment-state-file="commitment_state.dat" --assignment-description-file="assignment-description.dat" -q 10
```

Making a call to prover:

```bash
./build/bin/proof-producer/proof-producer-single-threaded --stage="prove" --circuit="circuit.crct" --assignment-table="assignment.tbl" --common-data="preprocessed_common_data.dat" --preprocessed-data="preprocessed.dat" --commitment-state-file="commitment_state.dat" --proof="proof.bin" -q 10
```

Verify generated proof:
```bash
./build/bin/proof-producer/proof-producer-single-threaded --stage="verify" --circuit="circuit.crct" --common-data="preprocessed_common_data.dat" --proof="proof.bin" --assignment-description-file="assignment-description.dat" -q 10
```
6 changes: 4 additions & 2 deletions bin/proof-producer/include/nil/proof-generator/arg_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ namespace nil {
typename tuple_to_variant<typename transform_tuple<HashTypes, to_type_identity>::type>::type;

struct ProverOptions {
std::string stage = "all";
boost::filesystem::path proof_file_path = "proof.bin";
boost::filesystem::path json_file_path = "proof.json";
boost::filesystem::path preprocessed_common_data_path = "preprocessed_common_data.dat";
boost::filesystem::path preprocessed_public_data_path = "preprocessed_data.dat";
boost::filesystem::path commitment_scheme_state_path = "commitment_scheme_state.dat";
boost::filesystem::path circuit_file_path;
boost::filesystem::path assignment_table_file_path;
boost::filesystem::path assignment_description_file_path;
boost::log::trivial::severity_level log_level = boost::log::trivial::severity_level::info;
bool skip_verification = false;
bool verification_only = false;
CurvesVariant elliptic_curve_type = type_identity<nil::crypto3::algebra::curves::pallas>{};
HashesVariant hash_type = type_identity<nil::crypto3::hashes::keccak_1600<256>>{};

Expand Down
Loading

0 comments on commit 9cd637c

Please sign in to comment.