Skip to content

Conversation

@OttoVT
Copy link

@OttoVT OttoVT commented Nov 4, 2025

What ❔

This PR fixes incomplete log23 proof verification support in the CLI verification pipeline and introduces a new utility tool for converting bincode proofs to JSON.


Changes in this PR

🧩 CLI Verification Fixes

  • Implements the previously unimplemented verify_all() function for log23 proofs (todo!() removed)
  • Adds log23 proof handling to flatten_all() function
  • Updates flatten_two() assertions to accept both reduced and log23 proof types
  • Adds dynamic verifier selection in verify_all_program_proof() to call the correct verifier based on proof type
  • Fixes recursion strategy decision logic in UseReducedLog23Machine to count both reduced and log23 proofs

These updates ensure that ProgramProof objects converted via to_metadata_and_proof_list()
(which now always produces reduced_log_23_proofs) can be properly verified through all CLI verification paths.


🧰 New Tool: convert_bincode_to_json.rs

A standalone CLI utility for converting serialized ProgramProof data from bincode format to JSON,
making it easier to inspect and debug proofs generated in binary form.

File: tools/cli/src/bin/convert_bincode_to_json.rs

use execution_utils::ProgramProof;
use std::env;
use std::fs;

fn main() {
    let args: Vec<String> = env::args().collect();
    if args.len() != 3 {
        eprintln!("Usage: {} <input.bin> <output.json>", args[0]);
        std::process::exit(1);
    }

    let input_path = &args[1];
    let output_path = &args[2];

    println!("Reading bincode from: {}", input_path);
    let bincode_data = fs::read(input_path).expect("Failed to read input file");

    println!("Deserializing ProgramProof from bincode...");
    let program_proof: ProgramProof =
        bincode::serde::decode_from_slice(&bincode_data, bincode::config::standard())
            .expect("Failed to deserialize ProgramProof")
            .0;

    println!("Serializing to JSON...");
    let json_data =
        serde_json::to_string_pretty(&program_proof).expect("Failed to serialize to JSON");

    println!("Writing JSON to: {}", output_path);
    fs::write(output_path, json_data).expect("Failed to write output file");

    println!("Conversion complete!");
}

Usage Example:

$ cargo run --bin convert_bincode_to_json -- proof.bin proof.json
Reading bincode from: proof.bin
Deserializing ProgramProof from bincode...
Serializing to JSON...
Writing JSON to: proof.json
Conversion complete!

Why ❔

The method ProgramProof::to_metadata_and_proof_list() (lines 135–158 in execution_utils/src/proofs.rs) was modified to convert all base layer proofs to reduced_log_23_proofs instead of reduced_proofs.

However, the CLI verification pipeline was not updated to handle this new proof type, causing:

  • ❌ Runtime panics when verifying log23 proofs due to unimplemented code paths
  • ⚠️ False negatives ("No proofs") when log23 proofs were present but unverified
  • 🧩 Assertion failures in functions expecting only reduced proofs
  • πŸ”„ Incorrect verifier calls (verify_recursion_layer() instead of verify_recursion_log_23_layer())
  • πŸ“Š Incorrect recursion strategy decisions not accounting for log23 proof counts

These issues broke the verification pipeline for proofs generated through the updated to_metadata_and_proof_list() conversion.

This PR restores full functionality and ensures consistency between proof generation and verification.


Is this a breaking change?

  • Yes
  • No

Note: While this addresses behavior resulting from a prior breaking change in ProgramProof serialization, this PR itself is not breaking β€” it restores expected functionality and remains backward compatible with existing reduced proofs.


Checklist βœ…

  • PR title corresponds to the body of the PR (for changelog generation)
  • Tests for the changes have been added/updated
    • Manually verified with:
      ./target/release/cli verify-all --program-proof /tmp/proof1.json
    • βœ… Successful verification output
  • Documentation comments have been added/updated
    • Code is self-documenting with clear conditional logic and print statements
  • Code has been formatted (cargo check passes successfully)

Additional Context 🧠

Files Modified:

  • tools/cli/src/main.rs β€” 4 functions updated for log23 support
  • execution_utils/src/recursion_strategy.rs β€” 1 function updated to count both proof types
  • tools/cli/src/bin/convert_bincode_to_json.rs β€” new tool added

Verification:

I checked it on tag dev-v0.7.0, cause I can't compile dev locally.
$ ./target/release/cli verify-all --program-proof /tmp/proof1.json
Running continue recursive (log23)
Output is: [3683996259, 1058365644, ..., 1605092683]
βœ… Verification successful with correct verifier selection

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.

1 participant