22use std:: collections:: HashMap ;
33
44use proofs:: {
5- circuits:: construct_setup_data,
65 program:: {
7- data:: { Offline , SetupParams } ,
6+ data:: { Offline , SetupParams , UninitializedSetup } ,
87 manifest:: { EncryptionInput , OrigoManifest , TLSEncryption } ,
98 } ,
109 F , G1 , G2 ,
@@ -107,7 +106,7 @@ pub async fn verify(
107106 } ;
108107
109108 let response = client. post ( url) . json ( & verify_body) . send ( ) . await ?;
110- assert ! ( response. status( ) == hyper:: StatusCode :: OK , "response={:?}" , response) ;
109+ assert_eq ! ( response. status( ) , hyper:: StatusCode :: OK , "response={:?}" , response) ;
111110 let verify_response = response. json :: < SignedVerificationReply > ( ) . await ?;
112111
113112 debug ! ( "\n {:?}\n \n " , verify_response. clone( ) ) ;
@@ -119,6 +118,7 @@ pub async fn verify(
119118pub ( crate ) async fn proxy_and_sign_and_generate_proof (
120119 config : config:: Config ,
121120 proving_params : Option < Vec < u8 > > ,
121+ setup_data : UninitializedSetup ,
122122) -> Result < OrigoProof , ClientErrors > {
123123 let session_id = config. session_id . clone ( ) ;
124124
@@ -138,7 +138,6 @@ pub(crate) async fn proxy_and_sign_and_generate_proof(
138138
139139 let _sign_data = crate :: origo:: sign ( config. clone ( ) , session_id. clone ( ) , sb) . await ;
140140
141- debug ! ( "generating program data!" ) ;
142141 let witness = origo_conn. to_witness_data ( ) ;
143142
144143 // decrypt TLS ciphertext for request and response and create NIVC inputs
@@ -151,6 +150,7 @@ pub(crate) async fn proxy_and_sign_and_generate_proof(
151150 let mut proof = generate_proof (
152151 & manifest. clone ( ) . into ( ) ,
153152 & proving_params. unwrap ( ) ,
153+ & setup_data,
154154 & request_inputs,
155155 & response_inputs,
156156 )
@@ -170,28 +170,28 @@ pub(crate) async fn proxy_and_sign_and_generate_proof(
170170pub ( crate ) async fn generate_proof (
171171 manifest : & OrigoManifest ,
172172 proving_params : & [ u8 ] ,
173+ setup_data : & UninitializedSetup ,
173174 request_inputs : & EncryptionInput ,
174175 response_inputs : & EncryptionInput ,
175176) -> Result < OrigoProof , ClientErrors > {
176- let setup_data = construct_setup_data :: < { proofs:: circuits:: CIRCUIT_SIZE_512 } > ( ) ?;
177- let program_data = SetupParams :: < Offline > {
178- public_params : proving_params. to_vec ( ) ,
179- vk_digest_primary : F :: < G1 > :: from ( 0 ) , // These need to be right.
177+ let setup_params = SetupParams :: < Offline > {
178+ public_params : proving_params. to_vec ( ) ,
179+ vk_digest_primary : F :: < G1 > :: from ( 0 ) , // These need to be right.
180180 vk_digest_secondary : F :: < G2 > :: from ( 0 ) ,
181- setup_data,
182- rom_data : HashMap :: new ( ) ,
181+ setup_data : setup_data . clone ( ) ,
182+ rom_data : HashMap :: new ( ) ,
183183 }
184184 . into_online ( ) ?;
185185
186- let vk_digest_primary = program_data . vk_digest_primary ;
187- let vk_digest_secondary = program_data . vk_digest_secondary ;
186+ let vk_digest_primary = setup_params . vk_digest_primary ;
187+ let vk_digest_secondary = setup_params . vk_digest_secondary ;
188188 crate :: proof:: construct_program_data_and_proof :: < { proofs:: circuits:: CIRCUIT_SIZE_512 } > (
189189 manifest,
190190 request_inputs,
191191 response_inputs,
192192 ( vk_digest_primary, vk_digest_secondary) ,
193- program_data . public_params ,
194- program_data . setup_data ,
193+ setup_params . public_params ,
194+ setup_params . setup_data ,
195195 )
196196 . await
197197
0 commit comments