@@ -307,9 +307,11 @@ impl<A: Storage<Address, Account>, R: Storage<RequestId, bool>> VAppState<A, R>
307307 let domain = B256 :: try_from ( body. domain . as_slice ( ) )
308308 . map_err ( |_| VAppPanic :: DomainDeserializationFailed ) ?;
309309 if domain != self . domain {
310- return Err (
311- VAppPanic :: DomainMismatch { expected : self . domain , actual : domain } . into ( )
312- ) ;
310+ return Err ( VAppPanic :: DomainMismatch {
311+ expected : self . domain ,
312+ actual : domain,
313+ }
314+ . into ( ) ) ;
313315 }
314316
315317 // Verify the proto signature.
@@ -364,9 +366,11 @@ impl<A: Storage<Address, Account>, R: Storage<RequestId, bool>> VAppState<A, R>
364366 let domain = B256 :: try_from ( body. domain . as_slice ( ) )
365367 . map_err ( |_| VAppPanic :: DomainDeserializationFailed ) ?;
366368 if domain != self . domain {
367- return Err (
368- VAppPanic :: DomainMismatch { expected : self . domain , actual : domain } . into ( )
369- ) ;
369+ return Err ( VAppPanic :: DomainMismatch {
370+ expected : self . domain ,
371+ actual : domain,
372+ }
373+ . into ( ) ) ;
370374 }
371375
372376 // Transfer the amount from the requester to the recipient.
@@ -446,10 +450,10 @@ impl<A: Storage<Address, Account>, R: Storage<RequestId, bool>> VAppState<A, R>
446450
447451 // Validate that the request ID is the same for all proto bodies.
448452 debug ! ( "validate that request ID is the same for all proto bodies" ) ;
449- if request_id. as_slice ( ) != bid. request_id . as_slice ( ) ||
450- request_id. as_slice ( ) != settle. request_id . as_slice ( ) ||
451- request_id. as_slice ( ) != execute. request_id . as_slice ( ) ||
452- request_id. as_slice ( ) != fulfill. request_id . as_slice ( )
453+ if request_id. as_slice ( ) != bid. request_id . as_slice ( )
454+ || request_id. as_slice ( ) != settle. request_id . as_slice ( )
455+ || request_id. as_slice ( ) != execute. request_id . as_slice ( )
456+ || request_id. as_slice ( ) != fulfill. request_id . as_slice ( )
453457 {
454458 return Err ( VAppPanic :: RequestIdMismatch {
455459 request_id : address ( & request_id) ?,
@@ -476,8 +480,8 @@ impl<A: Storage<Address, Account>, R: Storage<RequestId, bool>> VAppState<A, R>
476480
477481 // Validate that the prover is in the request whitelist, if a whitelist is provided.
478482 debug ! ( "validate prover is in whitelist" ) ;
479- if !request. whitelist . is_empty ( ) &&
480- !request. whitelist . contains ( & prover_address. to_vec ( ) )
483+ if !request. whitelist . is_empty ( )
484+ && !request. whitelist . contains ( & prover_address. to_vec ( ) )
481485 {
482486 return Err ( VAppPanic :: ProverNotInWhitelist { prover : prover_address } . into ( ) ) ;
483487 }
@@ -518,7 +522,13 @@ impl<A: Storage<Address, Account>, R: Storage<RequestId, bool>> VAppState<A, R>
518522 debug ! ( "verify proof" ) ;
519523 let mode = ProofMode :: try_from ( request. mode )
520524 . map_err ( |_| VAppPanic :: UnsupportedProofMode { mode : request. mode } ) ?;
521- let vk = bytes_to_words_be ( & request. vk_hash . clone ( ) . try_into ( ) . unwrap ( ) ) ;
525+ let vk = bytes_to_words_be (
526+ & request
527+ . vk_hash
528+ . clone ( )
529+ . try_into ( )
530+ . map_err ( |_| VAppPanic :: FailedToParseBytes ) ?,
531+ ) ?;
522532 match mode {
523533 ProofMode :: Compressed => {
524534 let verifier = V :: default ( ) ;
@@ -527,7 +537,12 @@ impl<A: Storage<Address, Account>, R: Storage<RequestId, bool>> VAppState<A, R>
527537 vk,
528538 // TODO(jtguibas): this should be either execute.public_values_hash
529539 // or request.public_values_hash
530- execute. public_values_hash . clone ( ) . unwrap ( ) . try_into ( ) . unwrap ( ) ,
540+ execute
541+ . public_values_hash
542+ . clone ( )
543+ . ok_or ( VAppPanic :: MissingPublicValuesHash ) ?
544+ . try_into ( )
545+ . map_err ( |_| VAppPanic :: FailedToParseBytes ) ?,
531546 )
532547 . map_err ( |_| VAppPanic :: InvalidProof ) ?;
533548 }
@@ -589,8 +604,15 @@ impl<A: Storage<Address, Account>, R: Storage<RequestId, bool>> VAppState<A, R>
589604
590605 // Log the clear event.
591606 debug ! ( "log clear event" ) ;
592- let request_id: [ u8 ; 32 ] =
593- clear. fulfill . body . as_ref ( ) . unwrap ( ) . request_id . clone ( ) . try_into ( ) . unwrap ( ) ;
607+ let request_id: [ u8 ; 32 ] = clear
608+ . fulfill
609+ . body
610+ . as_ref ( )
611+ . ok_or ( VAppPanic :: MissingProtoBody ) ?
612+ . request_id
613+ . clone ( )
614+ . try_into ( )
615+ . map_err ( |_| VAppPanic :: FailedToParseBytes ) ?;
594616 info ! (
595617 "STEP {}: CLEAR(request_id={}, requester={}, prover={}, cost={})" ,
596618 self . tx_id,
0 commit comments