@@ -82,21 +82,22 @@ use std::path::PathBuf;
8282#[ allow( clippy:: too_many_arguments) ] // TODO: Refactor this function, use NoncedVerificationData
8383pub async fn submit_multiple_and_wait_verification (
8484 eth_rpc_url : & str ,
85- network : & Network ,
85+ network : Network ,
8686 verification_data : & [ VerificationData ] ,
8787 max_fee : U256 ,
8888 wallet : Wallet < SigningKey > ,
8989 nonce : U256 ,
9090) -> Vec < Result < AlignedVerificationData , errors:: SubmitError > > {
9191 let mut aligned_verification_data =
92- submit_multiple ( network, verification_data, max_fee, wallet, nonce) . await ;
92+ submit_multiple ( network. clone ( ) , verification_data, max_fee, wallet, nonce) . await ;
9393
9494 // TODO: open issue: use a join to .await all at the same time, avoiding the loop
9595 // And await only once per batch, no need to await multiple proofs if they are in the same batch.
9696 let mut error_awaiting_batch_verification: Option < errors:: SubmitError > = None ;
9797 for aligned_verification_data_item in aligned_verification_data. iter ( ) . flatten ( ) {
9898 if let Err ( e) =
99- await_batch_verification ( aligned_verification_data_item, eth_rpc_url, network) . await
99+ await_batch_verification ( aligned_verification_data_item, eth_rpc_url, network. clone ( ) )
100+ . await
100101 {
101102 error_awaiting_batch_verification = Some ( e) ;
102103 break ;
@@ -229,13 +230,13 @@ async fn fetch_gas_price(
229230/// * `ProofQueueFlushed` if there is an error in the batcher and the proof queue is flushed.
230231/// * `GenericError` if the error doesn't match any of the previous ones.
231232pub async fn submit_multiple (
232- network : & Network ,
233+ network : Network ,
233234 verification_data : & [ VerificationData ] ,
234235 max_fee : U256 ,
235236 wallet : Wallet < SigningKey > ,
236237 nonce : U256 ,
237238) -> Vec < Result < AlignedVerificationData , errors:: SubmitError > > {
238- let ( ws_stream, _) = match connect_async ( network. get_batcher_url ( ) ) . await {
239+ let ( ws_stream, _) = match connect_async ( network. clone ( ) . get_batcher_url ( ) ) . await {
239240 Ok ( ( ws_stream, response) ) => ( ws_stream, response) ,
240241 Err ( e) => return vec ! [ Err ( errors:: SubmitError :: WebSocketConnectionError ( e) ) ] ,
241242 } ;
@@ -262,7 +263,7 @@ pub async fn submit_multiple(
262263async fn _submit_multiple (
263264 ws_write : Arc < Mutex < SplitSink < WebSocketStream < MaybeTlsStream < TcpStream > > , Message > > > ,
264265 mut ws_read : SplitStream < WebSocketStream < MaybeTlsStream < TcpStream > > > ,
265- network : & Network ,
266+ network : Network ,
266267 verification_data : & [ VerificationData ] ,
267268 max_fee : U256 ,
268269 wallet : Wallet < SigningKey > ,
@@ -350,7 +351,7 @@ async fn _submit_multiple(
350351#[ allow( clippy:: too_many_arguments) ] // TODO: Refactor this function, use NoncedVerificationData
351352pub async fn submit_and_wait_verification (
352353 eth_rpc_url : & str ,
353- network : & Network ,
354+ network : Network ,
354355 verification_data : & VerificationData ,
355356 max_fee : U256 ,
356357 wallet : Wallet < SigningKey > ,
@@ -405,7 +406,7 @@ pub async fn submit_and_wait_verification(
405406/// * `ProofQueueFlushed` if there is an error in the batcher and the proof queue is flushed.
406407/// * `GenericError` if the error doesn't match any of the previous ones.
407408pub async fn submit (
408- network : & Network ,
409+ network : Network ,
409410 verification_data : & VerificationData ,
410411 max_fee : U256 ,
411412 wallet : Wallet < SigningKey > ,
@@ -441,7 +442,7 @@ pub async fn submit(
441442/// * `HexDecodingError` if there is an error decoding the Aligned service manager contract address.
442443pub async fn is_proof_verified (
443444 aligned_verification_data : & AlignedVerificationData ,
444- network : & Network ,
445+ network : Network ,
445446 eth_rpc_url : & str ,
446447) -> Result < bool , errors:: VerificationError > {
447448 let eth_rpc_provider =
@@ -454,10 +455,10 @@ pub async fn is_proof_verified(
454455
455456async fn _is_proof_verified (
456457 aligned_verification_data : & AlignedVerificationData ,
457- network : & Network ,
458+ network : Network ,
458459 eth_rpc_provider : Provider < Http > ,
459460) -> Result < bool , errors:: VerificationError > {
460- let contract_address = network. get_aligned_service_manager_address ( ) ;
461+ let contract_address = network. clone ( ) . get_aligned_service_manager_address ( ) ;
461462 let payment_service_addr = network. get_batcher_payment_service_address ( ) ;
462463
463464 // All the elements from the merkle proof have to be concatenated
@@ -529,7 +530,7 @@ pub fn get_vk_commitment(
529530/// # Errors
530531/// * `EthRpcError` if the batcher has an error in the Ethereum call when retrieving the nonce if not already cached.
531532pub async fn get_nonce_from_batcher (
532- network : & Network ,
533+ network : Network ,
533534 address : Address ,
534535) -> Result < U256 , GetNonceError > {
535536 let ( ws_stream, _) = connect_async ( network. get_batcher_url ( ) )
@@ -605,7 +606,7 @@ pub async fn get_nonce_from_batcher(
605606pub async fn get_nonce_from_ethereum (
606607 eth_rpc_url : & str ,
607608 submitter_addr : Address ,
608- network : & Network ,
609+ network : Network ,
609610) -> Result < U256 , GetNonceError > {
610611 let eth_rpc_provider = Provider :: < Http > :: try_from ( eth_rpc_url)
611612 . map_err ( |e| GetNonceError :: EthRpcError ( e. to_string ( ) ) ) ?;
0 commit comments