Skip to content

feat: Make public inputs the start of the UH and MH proof#12266

Merged
lucasxia01 merged 52 commits intomasterfrom
lx/public-inputs-at-proof-start
Mar 12, 2025
Merged

feat: Make public inputs the start of the UH and MH proof#12266
lucasxia01 merged 52 commits intomasterfrom
lx/public-inputs-at-proof-start

Conversation

@lucasxia01
Copy link
Contributor

@lucasxia01 lucasxia01 commented Feb 25, 2025

Closes AztecProtocol/barretenberg#1089.

Removes the circuitSize, numPublicInputs, and pubInputsOffset metadata from the proof. The result is that the public inputs are at the beginning of the proof.

Followup work includes:

Base automatically changed from lx/transcript-allow-hashing-without-sending to master February 25, 2025 22:18
@lucasxia01 lucasxia01 marked this pull request as ready for review February 26, 2025 14:45
@Maddiaa0
Copy link
Member

Question, if there is no offset anymore can it just be removed? What was it for ?

@lucasxia01
Copy link
Contributor Author

Question, if there is no offset anymore can it just be removed? What was it for ?

No its still there in the vk, just not redundantly in the proof. The pub_inputs_offset basically represents the number of ecc_ops. I'm not sure if it needs to exist anymore if we don't use MegaHonk with an unstructured trace.

@lucasxia01
Copy link
Contributor Author

Will #11024 eventually be handled by your series of works?

@codygunton yep, Saleel brought that up as well and that's on my radar as a followup in the immediate future.

@lucasxia01 lucasxia01 added the ci-full Run all master checks. label Mar 6, 2025
@lucasxia01 lucasxia01 merged commit b6294ad into master Mar 12, 2025
6 checks passed
@lucasxia01 lucasxia01 deleted the lx/public-inputs-at-proof-start branch March 12, 2025 18:53
aakoshh added a commit that referenced this pull request Mar 14, 2025
TomAFrench added a commit that referenced this pull request Mar 14, 2025
Contains the changes from
#12574 to replace
the copy of the noir-repo with a `noir-repo-ref` file to point at the
nightly version which we pull during the build.

Updated `noir-repo-ref` in the PR to match the last merge sync PR
#12624
Alternatively it could be set to include the commits from the open
#12669 by setting it
to
[nightly-2025-03-14](https://github.com/noir-lang/noir/commits/nightly-2025-03-14)

Added a patch to replicate the changes to honk test programs in
#12266
Opened noir-lang/noir#7706 to migrate the patch
back to Noir

---------

Co-authored-by: Akosh Farkash <aakoshh@gmail.com>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Co-authored-by: aakoshh <akosh@aztecprotocol.com>
AztecBot pushed a commit to AztecProtocol/barretenberg that referenced this pull request Mar 15, 2025
Contains the changes from
AztecProtocol/aztec-packages#12574 to replace
the copy of the noir-repo with a `noir-repo-ref` file to point at the
nightly version which we pull during the build.

Updated `noir-repo-ref` in the PR to match the last merge sync PR
AztecProtocol/aztec-packages#12624
Alternatively it could be set to include the commits from the open
AztecProtocol/aztec-packages#12669 by setting it
to
[nightly-2025-03-14](https://github.com/noir-lang/noir/commits/nightly-2025-03-14)

Added a patch to replicate the changes to honk test programs in
AztecProtocol/aztec-packages#12266
Opened noir-lang/noir#7706 to migrate the patch
back to Noir

---------

Co-authored-by: Akosh Farkash <aakoshh@gmail.com>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Co-authored-by: aakoshh <akosh@aztecprotocol.com>
@ihyunnam
Copy link

ihyunnam commented Mar 27, 2025

For UltraHonk used as Noir backend, where can the verifier retrieve public inputs? It seems like previous discussions are saying the proof now begins with public inputs (with no metadata before them), but when I actually print out an UltraHonk proof that I'm using with Noir, the first 4 bytes seem to be metadata and public input bytes are not found anywhere in the proof. bb --version returns 0.82.2 and verify prints Scheme is: ultra_honk.

FYI, I'm using the following bbup commands.

bb prove -b /workspace/target/hello_world.json -w /workspace/target/hello_world.gz -o /workspace/target/proof
bb write_vk -b /workspace/target/hello_world.json -o /workspace/target/vk
bb verify -k /workspace/target/vk -p /workspace/target/proof

@saleel
Copy link
Member

saleel commented Mar 27, 2025

@ihyunnam Public inputs are after the 4 bytes of metadata - 32 bytes each.

FYI this will get even better once #12816 is merged in, after which the proof and public inputs are saved as separate files.

@lucasxia01
Copy link
Contributor Author

lucasxia01 commented Mar 27, 2025

Hi Ihyun :)

You're right that there's 4 bytes of metadata that exist at the beginning of the proof, which are used for deserialization. The public inputs in the current release of bb should exist right after those 4 bytes, in 32 byte chunks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run all master checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move public inputs to the front of proof

7 participants