@@ -99,14 +99,12 @@ pub async fn submit_multiple_and_wait_verification(
9999 // TODO: open issue: use a join to .await all at the same time, avoiding the loop
100100 // And await only once per batch, no need to await multiple proofs if they are in the same batch.
101101 let mut error_awaiting_batch_verification: Option < errors:: SubmitError > = None ;
102- for aligned_verification_data_item in aligned_verification_data. iter ( ) {
103- if let Ok ( aligned_verification_data_item) = aligned_verification_data_item {
104- if let Err ( e) =
105- await_batch_verification ( aligned_verification_data_item, eth_rpc_url, network) . await
106- {
107- error_awaiting_batch_verification = Some ( e) ;
108- break ;
109- }
102+ for aligned_verification_data_item in aligned_verification_data. iter ( ) . flatten ( ) {
103+ if let Err ( e) =
104+ await_batch_verification ( aligned_verification_data_item, eth_rpc_url, network) . await
105+ {
106+ error_awaiting_batch_verification = Some ( e) ;
107+ break ;
110108 }
111109 }
112110 if let Some ( error_awaiting_batch_verification) = error_awaiting_batch_verification {
@@ -404,7 +402,7 @@ pub async fn submit_and_wait_verification(
404402 )
405403 . await ;
406404
407- match aligned_verification_data. get ( 0 ) {
405+ match aligned_verification_data. first ( ) {
408406 Some ( Ok ( aligned_verification_data) ) => Ok ( aligned_verification_data. clone ( ) ) ,
409407 Some ( Err ( e) ) => Err ( errors:: SubmitError :: GenericError ( e. to_string ( ) ) ) ,
410408 None => Err ( errors:: SubmitError :: GenericError (
@@ -459,7 +457,7 @@ pub async fn submit(
459457 )
460458 . await ;
461459
462- match aligned_verification_data. get ( 0 ) {
460+ match aligned_verification_data. first ( ) {
463461 Some ( Ok ( aligned_verification_data) ) => Ok ( aligned_verification_data. clone ( ) ) ,
464462 Some ( Err ( e) ) => Err ( errors:: SubmitError :: GenericError ( e. to_string ( ) ) ) ,
465463 None => Err ( errors:: SubmitError :: GenericError (
@@ -719,7 +717,7 @@ fn save_response_cbor(
719717
720718 let data = cbor_serialize ( & aligned_verification_data) ?;
721719
722- let mut file = File :: create ( & batch_inclusion_data_path) ?;
720+ let mut file = File :: create ( batch_inclusion_data_path) ?;
723721 file. write_all ( data. as_slice ( ) ) ?;
724722
725723 Ok ( ( ) )
@@ -753,7 +751,7 @@ fn save_response_json(
753751 "verification_data_batch_index" : aligned_verification_data. index_in_batch,
754752 "merkle_proof" : merkle_proof,
755753 } ) ;
756- let mut file = File :: create ( & batch_inclusion_data_path) ?;
754+ let mut file = File :: create ( batch_inclusion_data_path) ?;
757755 file. write_all ( serde_json:: to_string_pretty ( & data) . unwrap ( ) . as_bytes ( ) ) ?;
758756
759757 Ok ( ( ) )
0 commit comments