Skip to content
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

Enable passing externally-generated witness via command line #746

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

georgwiese
Copy link
Collaborator

@georgwiese georgwiese commented Nov 2, 2023

This PR changes:

  • The currently custom-written CSV exporter has been rewritten. It now lives in number::write_polys_csv_file (analogous to number::write_polys_file) and uses the csv crate
    • One feature I removed is that common prefixes are removed. This is for compatibility with the read method; we want to preserve the full column names.
    • I recommend this viewer, which deals nicely with the slightly longer names.
  • Added a number::read_polys_csv_file, with a test that the two are compatible.
  • Added an --witness-values argument to the pil command that allows us to pass a CSV file with externally-computed witnesses to use during witness generation.

To test:

# Runs the simple sum example on some inputs, stores the trace in a CSV file
cargo run pil test_data/asm/simple_sum.asm --export-csv -i 1,1,1
# Creates a new witness.csv file with only the "main.X_free_value" (see python file below)
python column_subset.py
# Uses witness.csv as externally generated witness. Note that we don't have to provide inputs anymore.
cargo run pil test_data/asm/simple_sum.asm --export-csv --witness-values witness.csv -f

-> column_subset.py

@georgwiese georgwiese force-pushed the external-witgen-cli branch 2 times, most recently from 27d8335 to e265d81 Compare November 3, 2023 12:59
@georgwiese georgwiese marked this pull request as ready for review November 3, 2023 13:15
number/src/serialize.rs Outdated Show resolved Hide resolved
})
.unwrap_or(vec![]);

// Convert Vec<(String, Vec<T>)> to Vec<(&str, Vec<T>)>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my new PR I'm changing a lot of these column names as &str to String, so if you want to change more of that stuff feel free. Otherwise I can do it in my PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah cool! This would propagate all the way down to witgen, so I'll leave that for another PR. But the write_polys_csv_file() function I introduces already receives a &[(String, Vec<T>)], so you won't have to change that!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea that's why I thought of that

@georgwiese georgwiese added this pull request to the merge queue Nov 3, 2023
Merged via the queue into main with commit 86cd4b6 Nov 3, 2023
6 checks passed
@georgwiese georgwiese deleted the external-witgen-cli branch November 3, 2023 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants