mirror of
https://github.com/powdr-labs/powdr.git
synced 2026-04-20 03:03:25 -04:00
Step towards #1633 This PR adds witness generation for any public that is referenced from an identity. Note that publics and public references are now existing independently: - A public is still defined as a pointer to a cell in the trace. The prover extracts the values from the trace and returns them to the verifier; witgen has nothing to do with them (except providing the values in the trace). - A public reference (i.e., a public that is referenced by a constraint) was previously unimplemented. Now, witgen would solve for this value. This value might not be the same as the value of the public being referenced! We don't check for consistency. After #1633 is completed, publics will no longer be defined in terms of trace cells, so the values returned by witgen will be the ones that are returned to the verifier. For now, the values are not returned yet (and different machines might find conflicting values for the same public). But the solving works, and I added a log message, e.g.: ``` $ cargo run pil test_data/pil/fibonacci_with_public.pil -o output -f Writing output/fibonacci_with_public_analyzed.pil. done. Optimizing pil... Removed 0 witness and 0 fixed columns. Total count now: 2 witness and 1 fixed columns. Writing output/fibonacci_with_public_opt.pil. Evaluating fixed columns... Fixed column generation took 0.001645084s Writing output/constants.bin. Deducing witness columns... Running main machine for 4 rows [00:00:00 (ETA: 00:00:00)] ░░░░░░░░░░░░░░░░░░░░ 0% - Starting... => out (public) = 5 [00:00:00 (ETA: 00:00:00)] ████████████████████ 100% - Starting... Witness generation took 0.00259025s Writing output/commits.bin. ```