Skip to content

Commit

Permalink
Adding another file for storing LPC commitment state.
Browse files Browse the repository at this point in the history
  • Loading branch information
martun committed Sep 3, 2024
1 parent 3895693 commit bbdf375
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,20 @@ 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.
Making a call to preprocessor:
```bash
./build/bin/proof-producer/proof-producer-single-threaded --stage="preprocess" --common-data="preprocessed_common_data.dat" --preprocessed-data="preprocessed.dat" --commitment-state-file="commitment_state.dat" --circuit="circuit.crct" --assignment-table="assignment.tbl"
```

Making a call to prover:

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

11 changes: 4 additions & 7 deletions bin/proof-producer/include/nil/proof-generator/prover.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ namespace nil {
BOOST_ASSERT(table_description_);
BOOST_ASSERT(constraint_system_);
BOOST_ASSERT(lpc_scheme_);
BOOST_ASSERT(fri_params_);

BOOST_LOG_TRIVIAL(info) << "Generating proof...";
Proof proof = nil::crypto3::zk::snark::placeholder_prover<BlueprintField, PlaceholderParams>::process(
Expand All @@ -178,7 +177,7 @@ namespace nil {

BOOST_LOG_TRIVIAL(info) << "Writing proof to " << proof_file_;
auto filled_placeholder_proof =
nil::crypto3::marshalling::types::fill_placeholder_proof<Endianness, Proof>(proof, *fri_params_);
nil::crypto3::marshalling::types::fill_placeholder_proof<Endianness, Proof>(proof, lpc_scheme_->get_fri_params());
bool res = nil::proof_generator::detail::encode_marshalling_to_file(
proof_file_,
filled_placeholder_proof,
Expand Down Expand Up @@ -302,9 +301,9 @@ namespace nil {
commitment_scheme_state_file << std::endl;
using Endianness = nil::marshalling::option::big_endian;
using TTypeBase = nil::marshalling::field_type<Endianness>;
std::optional<LpcScheme> lpc_scheme_;

auto marshalled_lpc_state = fill_commitment_scheme<Endianness, LpcScheme>(*lpc_scheme_);
auto marshalled_lpc_state = fill_commitment_scheme<Endianness, LpcScheme>(
*lpc_scheme_);
bool res = nil::proof_generator::detail::encode_marshalling_to_file(
commitment_scheme_state_file,
marshalled_lpc_state
Expand Down Expand Up @@ -415,8 +414,7 @@ namespace nil {
// Lambdas and grinding bits should be passed through preprocessor directives
std::size_t table_rows_log = std::ceil(std::log2(table_description_->rows_amount));

fri_params_.emplace(FriParams(1, table_rows_log, lambda_, expand_factor_));
lpc_scheme_.emplace(*fri_params_);
lpc_scheme_.emplace(FriParams(1, table_rows_log, lambda_, expand_factor_));

BOOST_LOG_TRIVIAL(info) << "Preprocessing public data";
public_preprocessed_data_.emplace(
Expand Down Expand Up @@ -461,7 +459,6 @@ namespace nil {
std::optional<TableDescription> table_description_;
std::optional<ConstraintSystem> constraint_system_;
std::optional<AssignmentTable> assignment_table_;
std::optional<FriParams> fri_params_;
std::optional<LpcScheme> lpc_scheme_;
};

Expand Down

0 comments on commit bbdf375

Please sign in to comment.