@@ -347,41 +347,3 @@ pub fn load_vk_from_json(json_data: &str) -> VerificationKey {
347347 lagrange_last,
348348 }
349349}
350-
351- /// Load a VerificationKey from a `vk` binary emitted by `bb write_vk --output_format bytes_and_fields`.
352- /// This parser assumes the `vk` file contains a flat sequence of BN254 G1 affine elements (x||y),
353- /// each coordinate encoded as 32-byte big-endian field element. If the length does not match an
354- /// integral number of points, or on-curve checks fail, this function returns None.
355-
356- /// Load a proof and public inputs from a byte array.
357- pub fn load_proof_and_public_inputs ( bytes : & [ u8 ] ) -> ( Vec < Fr > , Vec < u8 > ) {
358- // First 4 bytes = total number of field elements (big-endian)
359- let total_fields = u32:: from_be_bytes ( bytes[ 0 ..4 ] . try_into ( ) . unwrap ( ) ) as usize ;
360-
361- // Proof is always 440 field elements
362- const PROOF_NUM_FIELDS : usize = 440 ;
363- assert ! (
364- total_fields >= PROOF_NUM_FIELDS ,
365- "total_fields < proof field count"
366- ) ;
367- let num_inputs = total_fields - PROOF_NUM_FIELDS ;
368-
369- // Next num_inputs × 32 bytes = public inputs
370- let mut public_inputs = Vec :: with_capacity ( num_inputs) ;
371- let mut cursor = 4 ; // start right after the 4-byte header
372- for _ in 0 ..num_inputs {
373- let mut bytes32 = [ 0u8 ; 32 ] ;
374- bytes32. copy_from_slice ( & bytes[ cursor..cursor + 32 ] ) ;
375- public_inputs. push ( bytes_to_fr ( & bytes32) ) ;
376- cursor += 32 ;
377- }
378-
379- // Remaining bytes = proof (must be 440 × 32 bytes)
380- let proof_bytes = bytes[ cursor..] . to_vec ( ) ;
381- assert ! (
382- proof_bytes. len( ) == PROOF_NUM_FIELDS * 32 ,
383- "invalid proof length"
384- ) ;
385-
386- ( public_inputs, proof_bytes)
387- }
0 commit comments