@@ -74,24 +74,24 @@ impl EuclidV2Handler {
7474#[ async_trait]
7575impl CircuitsHandler for Arc < Mutex < EuclidV2Handler > > {
7676 fn get_vk ( & self , task_type : ProofType ) -> String {
77- self . try_lock ( ) . unwrap ( ) . get_vk_and_cache ( task_type)
77+ self . try_lock ( )
78+ . expect ( "get vk is on called before other entry is used" )
79+ . get_vk_and_cache ( task_type)
7880 }
7981
8082 async fn get_proof_data ( & self , prove_request : ProveRequest ) -> Result < String > {
83+ let handler_self = self . lock ( ) . await ;
8184 let u_task: ProvingTask = serde_json:: from_str ( & prove_request. input ) ?;
82- let handler_self = self . try_lock ( ) . unwrap ( ) ;
83- // current coordinator do not send vk and in fact it has been checked while login
84- // checking here is not need unless considering a malicious coordinator
85- /* let expected_vk = handler_self.get_vk_and_cache(prove_request.proof_type);
86- if BASE64_STANDARD.encode(&u_task.vk) != expected_vk {
87- eyre::bail!(
88- "vk is not match!, prove type {:?}, expected {}, get {}",
89- prove_request.proof_type,
90- expected_vk,
91- BASE64_STANDARD.encode(&u_task.vk),
92- );
93- }
94- */
85+ let expected_vk = handler_self. get_vk_and_cache ( prove_request. proof_type ) ;
86+ if BASE64_STANDARD . encode ( & u_task. vk ) != expected_vk {
87+ eyre:: bail!(
88+ "vk is not match!, prove type {:?}, expected {}, get {}" ,
89+ prove_request. proof_type,
90+ expected_vk,
91+ BASE64_STANDARD . encode( & u_task. vk) ,
92+ ) ;
93+ }
94+
9595 let proof = match prove_request. proof_type {
9696 ProofType :: Chunk => handler_self
9797 . chunk_prover
0 commit comments