feat: support JSON input files for bb verify command#19800
Merged
Conversation
Auto-detects JSON format by inspecting file content (starts with '{')
rather than relying on file extension.
ecb001c to
580353a
Compare
ludamad
reviewed
Jan 22, 2026
| } | ||
|
|
||
| std::vector<uint256_t> result; | ||
| result.reserve(json["fields"].size()); |
Collaborator
There was a problem hiding this comment.
i would expect this field to be 'proof', 'vk' etc not just fields maybe. and that we'd have proper structs that represent the different forms, so this would look more like the rest of our deserialization. Those structs could have a method for reading a json object
ludamad
approved these changes
Jan 22, 2026
ludamad
left a comment
Collaborator
There was a problem hiding this comment.
good overall left some comments
Address review comment: use `proof`, `vk`, and `public_inputs` as the JSON field names instead of generic `fields` array. Also use `hash` instead of `vk_hash` in VkJson since the context is already clear. Each type now has its own struct with build/parse methods: - VkJson: build() for output, parse_to_bytes() for input - ProofJson: build() for output, parse() for input - PublicInputsJson: build() for output, parse() for input
johnathan79717
added a commit
that referenced
this pull request
Jan 27, 2026
This reverts commit c1b30da.
4 tasks
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Jan 27, 2026
BEGIN_COMMIT_OVERRIDE feat: support JSON input files for bb verify command (#19800) fix: update bootstrap.sh to use new JSON field names chore: Update `index.js` so that `HAS_ZK` and `PUBLIC_INPUTS` variables must always be set in tests (#19884) chore: pippenger int audit (#19302) chore: deduplicate batch affine addition trick (#19788) chore: transcript+codec+poseidon2 fixes (#19419) chore!: explicitly constrain inputs and intermediate witnesses (#19826) fix: exclude nlohmann/json from WASM builds in json_output.hpp chore: translator circuit builder and flavor audit (#19798) Revert "fix: exclude nlohmann/json from WASM builds in json_output.hpp" Revert "feat: support JSON input files for bb verify command (#19800)" Revert "fix: update bootstrap.sh to use new JSON field names" END_COMMIT_OVERRIDE
danielntmd
pushed a commit
that referenced
this pull request
Jan 27, 2026
## Summary Adds support for reading JSON-formatted proof, public inputs, and VK files in the `bb verify` command. This complements the existing `--output_format json` feature by allowing the JSON files to be consumed for verification. This enables users who receive JSON proof artifacts from third parties to verify the proof before using it in their circuits (e.g., for recursive verification). ### Format Detection The format is **auto-detected by attempting to parse as JSON**. If parsing succeeds, the file is treated as JSON; otherwise it falls back to binary format. This is robust and works regardless of file extension. ### Usage ```bash # Verify using JSON files bb verify --scheme ultra_honk -p proof.json -i public_inputs.json -k vk.json # Works even without .json extension (content-based detection) bb verify --scheme ultra_honk -p my_proof -i my_inputs -k my_vk # Mix and match: JSON proof with binary VK bb verify --scheme ultra_honk -p proof.json -i public_inputs.json -k vk ``` ## Test plan - [x] Build passes - [x] Tested verify with JSON files - [x] Tested verify with binary files (no false positive JSON detection) - [x] Tested verify with mixed JSON and binary files - [x] acir_tests bb_prove tests pass
danielntmd
pushed a commit
that referenced
this pull request
Jan 27, 2026
This reverts commit c1b30da.
johnathan79717
added a commit
that referenced
this pull request
Jan 28, 2026
## Summary - Re-land of #19800 with fixes for WASM build and bootstrap.sh field names - Add type-specific JSON structs (VkJson, ProofJson, PublicInputsJson) with named fields per review feedback - Auto-detect JSON vs binary format in verify command - Update bootstrap.sh to use new field names (.vk, .proof, .public_inputs, .hash) - Suppress nlohmann/json sign-conversion warnings for WASM builds using pragma ## Size Impact | Build | Without nlohmann/json | With nlohmann/json | Difference | |-------|----------------------|-------------------|------------| | Native `bb` | 63.18 MB | 63.20 MB | **+19 KB (0.03%)** | | WASM `bb` | 13.49 MB | 13.52 MB | **+30 KB (0.22%)** | ## Test plan - [x] Native build passes - [x] WASM build passes (with `--target bb`) - [x] `regenerate_recursive_inputs` passes - [x] JSON prove and verify works end-to-end
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Jan 28, 2026
## Summary - Re-land of #19800 with fixes for WASM build and bootstrap.sh field names - Add type-specific JSON structs (VkJson, ProofJson, PublicInputsJson) with named fields per review feedback - Auto-detect JSON vs binary format in verify command - Update bootstrap.sh to use new field names (.vk, .proof, .public_inputs, .hash) - Suppress nlohmann/json sign-conversion warnings for WASM builds using pragma ## Size Impact | Build | Without nlohmann/json | With nlohmann/json | Difference | |-------|----------------------|-------------------|------------| | Native `bb` | 63.18 MB | 63.20 MB | **+19 KB (0.03%)** | | WASM `bb` | 13.49 MB | 13.52 MB | **+30 KB (0.22%)** | ## Test plan - [x] Native build passes - [x] WASM build passes (with `--target bb`) - [x] `regenerate_recursive_inputs` passes - [x] JSON prove and verify works end-to-end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for reading JSON-formatted proof, public inputs, and VK files in the
bb verifycommand. This complements the existing--output_format jsonfeature by allowing the JSON files to be consumed for verification.This enables users who receive JSON proof artifacts from third parties to verify the proof before using it in their circuits (e.g., for recursive verification).
Format Detection
The format is auto-detected by attempting to parse as JSON. If parsing succeeds, the file is treated as JSON; otherwise it falls back to binary format. This is robust and works regardless of file extension.
Usage
Test plan