@@ -1303,7 +1303,13 @@ pub async fn check_attestation(
13031303 log:: info!( "Querying attestation contract: {:#x}" , contract. address) ;
13041304
13051305 let attestation = match get_attestation_details ( web3. clone ( ) , uid, contract. address ) . await {
1306- Ok ( attestation) => attestation,
1306+ Ok ( Some ( attestation) ) => attestation,
1307+ Ok ( None ) => {
1308+ return Err ( ErrorBadRequest ( format ! (
1309+ "Attestation with uid: {:#x} not found on chain {}" ,
1310+ uid, chain_name
1311+ ) ) ) ;
1312+ }
13071313 Err ( e) => {
13081314 log:: error!( "Failed to get attestation details: {}" , e) ;
13091315 return Err ( ErrorBadRequest ( format ! (
@@ -1343,17 +1349,13 @@ pub async fn check_attestation(
13431349 ) ) ) ?
13441350 ) ;
13451351
1346- let items = attestation_schema
1347- . schema
1348- . split ( "," )
1349- . into_iter ( )
1350- . collect :: < Vec < & str > > ( ) ;
1352+ let items = attestation_schema. schema . split ( ',' ) . collect :: < Vec < & str > > ( ) ;
13511353 log:: debug!( "There are {} items in the schema" , items. len( ) ) ;
13521354 let mut param_types = Vec :: new ( ) ;
13531355 let mut param_names = Vec :: new ( ) ;
13541356
13551357 for item in items {
1356- let items2 = item. trim ( ) . split ( " " ) . into_iter ( ) . collect :: < Vec < & str > > ( ) ;
1358+ let items2 = item. trim ( ) . split ( ' ' ) . collect :: < Vec < & str > > ( ) ;
13571359 if items2. len ( ) != 2 {
13581360 log:: error!( "Invalid item in schema: {}" , item) ;
13591361 return Err ( ErrorBadRequest ( format ! ( "Invalid item in schema: {}" , item) ) ) ;
@@ -1385,13 +1387,13 @@ pub async fn check_attestation(
13851387 } ) ;
13861388 }
13871389
1388- return Ok ( web:: Json ( AttestationCheckResult {
1390+ Ok ( web:: Json ( AttestationCheckResult {
13891391 chain_id : chain. chain_id as u64 ,
13901392 chain : chain_name. to_string ( ) ,
13911393 attestation,
13921394 schema : attestation_schema,
13931395 params : decoded_items,
1394- } ) ) ;
1396+ } ) )
13951397}
13961398
13971399pub fn runtime_web_scope (
0 commit comments