Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Keep witness argument immutable on halo2_mock_prover #175

Merged

Conversation

sraver
Copy link
Contributor

@sraver sraver commented Nov 4, 2023

Closes #170


On the SuperCircuit's halo2_mock_prover method, we are currently overriding the super_witness dict object.
Initially it holds the TraceWitness objects of each internal circuit, but after the loop it holds the JSON representation of the witness of the circuit.

Since the elements in the dict are indexed by their rust_id, after the loop all the elements have been replaced, leaving the caller of halo2_mock_prover with a "modified" witness.

It's not a big problem, but it's confusing sometimes when writing tests, if you want to verify some of the assignments, because the order of lines becomes relevant.

I didn't add the return of the witness_json because so far I've seen no use for it. Maybe it could be interesting.

@sraver sraver changed the title store witness JSON in a separate variable Keep witness argument immutable on halo2_mock_prover Nov 4, 2023
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f1e7491) 49.67% compared to head (29ba210) 49.67%.

❗ Current head 29ba210 differs from pull request most recent head ba932e5. Consider uploading reports for the commit ba932e5 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #175   +/-   ##
=======================================
  Coverage   49.67%   49.67%           
=======================================
  Files          21       21           
  Lines        5751     5751           
=======================================
  Hits         2857     2857           
  Misses       2894     2894           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@qwang98 qwang98 left a comment

Choose a reason for hiding this comment

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

LGTM and thanks for suggesting this change! We don't need to return witness JSON as it's only used to serialize a Python object to be parsed by Rust.

@qwang98
Copy link
Collaborator

qwang98 commented Nov 6, 2023

@sraver I'd just request that you change the version number below to the format [[0.1.YYYYMMDDVV]] where [[VV]] can be 00 if it's the first pull request we merge to the main on a day. Only this will trigger the update for the published Python package.

https://github.com/privacy-scaling-explorations/chiquito/blob/main/Cargo.toml#L3

After that, feel free to merge. :)

@sraver
Copy link
Contributor Author

sraver commented Nov 7, 2023

@qwang98, just updated the version.

I can't merge tho, please proceed for me ^_^

@qwang98 qwang98 added this pull request to the merge queue Nov 7, 2023
Merged via the queue into privacy-scaling-explorations:main with commit cfdb6dc Nov 7, 2023
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mock prover modifies the given witness
3 participants