Skip to content

Commit

Permalink
chore: hex encoded (optional) proof field
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-camuto committed Dec 17, 2023
1 parent 5ddb1c6 commit b738978
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,7 @@ pub(crate) fn fuzz(
transcript_type: transcript,
split: None,
pretty_public_inputs: None,
hex_proof: None,
timestamp: None,
};

Expand Down Expand Up @@ -1581,6 +1582,7 @@ pub(crate) fn fuzz(
protocol: proof.protocol.clone(),
transcript_type: transcript,
split: None,
hex_proof: None,
pretty_public_inputs: None,
timestamp: None,
};
Expand Down
18 changes: 16 additions & 2 deletions src/pfsys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ where
pub instances: Vec<Vec<F>>,
/// the proof
pub proof: Vec<u8>,
/// hex encoded proof
pub hex_proof: Option<String>,
/// transcript type
pub transcript_type: TranscriptType,
/// the split proof
Expand Down Expand Up @@ -281,6 +283,7 @@ where
protocol: Option<PlonkProtocol<C>>,
instances: Vec<Vec<F>>,
proof: Vec<u8>,
hex_proof: Option<String>,
transcript_type: TranscriptType,
split: Option<ProofSplitCommit>,
pretty_public_inputs: Option<PrettyElements>,
Expand All @@ -289,6 +292,7 @@ where
protocol,
instances,
proof,
hex_proof,
transcript_type,
split,
pretty_public_inputs,
Expand Down Expand Up @@ -523,8 +527,17 @@ where
&mut transcript,
)?;
let proof = transcript.finalize();

let checkable_pf = Snark::new(protocol, instances, proof, transcript_type, split, None);
let hex_proof = hex::encode(&proof);

let checkable_pf = Snark::new(
protocol,
instances,
proof,
Some(hex_proof),
transcript_type,
split,
None,
);

// sanity check that the generated proof is valid
if check_mode == CheckMode::SAFE {
Expand Down Expand Up @@ -894,6 +907,7 @@ mod tests {
instances: vec![vec![Fr::from(1)], vec![Fr::from(2)]],
transcript_type: TranscriptType::EVM,
protocol: None,
hex_proof: None,
split: None,
pretty_public_inputs: None,
timestamp: None,
Expand Down

0 comments on commit b738978

Please sign in to comment.