From 71db5fbb3fcadaffd1bacb0ea16e9c4a12a2fc0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Garillot?= <4142+huitseeker@users.noreply.github.com> Date: Wed, 3 Jan 2024 16:03:30 -0500 Subject: [PATCH] fix: allow SuperNova compressed proof serialization and size computation (#1016) - Added serialization for the compressed proof using bincode in `sha256_nivc.rs` - Implemented computation and display of serialized compressed proof size - Introduced `serde` bound attribute to the `Proof` enum in `supernova.rs` Fixes #1006 --- examples/sha256_ivc.rs | 3 +++ examples/sha256_nivc.rs | 3 +++ src/proof/supernova.rs | 1 + 3 files changed, 7 insertions(+) diff --git a/examples/sha256_ivc.rs b/examples/sha256_ivc.rs index a694934c1c..8cbac9caaa 100644 --- a/examples/sha256_ivc.rs +++ b/examples/sha256_ivc.rs @@ -112,6 +112,9 @@ fn main() { println!("Compression took {:?}", compress_end); + let buf = bincode::serialize(&compressed_proof).unwrap(); + println!("proof size : {:}B", buf.len()); + let compressed_verify_start = Instant::now(); let res = compressed_proof.verify(&pp, &z0, &zi).unwrap(); let compressed_verify_end = compressed_verify_start.elapsed(); diff --git a/examples/sha256_nivc.rs b/examples/sha256_nivc.rs index 72b7605936..71392dfa67 100644 --- a/examples/sha256_nivc.rs +++ b/examples/sha256_nivc.rs @@ -116,6 +116,9 @@ fn main() { println!("Compression took {:?}", compress_end); + let buf = bincode::serialize(&compressed_proof).unwrap(); + println!("proof size : {:}B", buf.len()); + let compressed_verify_start = Instant::now(); let res = compressed_proof.verify(&pp, &z0, &zi).unwrap(); let compressed_verify_end = compressed_verify_start.elapsed(); diff --git a/src/proof/supernova.rs b/src/proof/supernova.rs index f8e28ed7aa..7ad385fc2d 100644 --- a/src/proof/supernova.rs +++ b/src/proof/supernova.rs @@ -127,6 +127,7 @@ where /// An enum representing the two types of proofs that can be generated and verified. #[derive(Serialize, Deserialize)] +#[serde(bound = "")] pub enum Proof< 'a, F: CurveCycleEquipped,