@@ -19,8 +19,8 @@ use tokio::join;
1919use tokio_tungstenite:: connect_async;
2020
2121use crate :: structs:: {
22- GenerateAndFundWalletsArgs , GenerateProofsArgs , InfiniteProofType , ProofType , SendInfiniteProofsArgs ,
23- TestConnectionsArgs ,
22+ GenerateAndFundWalletsArgs , GenerateProofsArgs , InfiniteProofType , ProofType ,
23+ SendInfiniteProofsArgs , TestConnectionsArgs ,
2424} ;
2525
2626const GROTH_16_PROOF_GENERATOR_FILE_PATH : & str =
@@ -271,8 +271,8 @@ async fn load_senders_from_file(
271271 let mut senders = vec ! [ ] ;
272272
273273 for line in reader. lines ( ) {
274- let private_key_str = line
275- . map_err ( |err| format ! ( "Could not read line from private keys file: {}" , err) ) ?;
274+ let private_key_str =
275+ line . map_err ( |err| format ! ( "Could not read line from private keys file: {}" , err) ) ?;
276276 let wallet = Wallet :: from_str ( private_key_str. trim ( ) )
277277 . map_err ( |_| "Invalid private key" . to_string ( ) ) ?
278278 . with_chain_id ( chain_id. as_u64 ( ) ) ;
@@ -297,7 +297,7 @@ async fn run_infinite_proof_sender(
297297 random_address : bool ,
298298) {
299299 let mut handles = vec ! [ ] ;
300-
300+
301301 for ( i, sender) in senders. iter ( ) . enumerate ( ) {
302302 let wallet = sender. wallet . clone ( ) ;
303303 let verification_data = verification_data. clone ( ) ;
@@ -382,7 +382,8 @@ pub async fn send_infinite_proofs(args: SendInfiniteProofsArgs) {
382382
383383 // Load wallets using shared function
384384 info ! ( "Loading wallets" ) ;
385- let senders = match load_senders_from_file ( & args. eth_rpc_url , & args. private_keys_filepath ) . await {
385+ let senders = match load_senders_from_file ( & args. eth_rpc_url , & args. private_keys_filepath ) . await
386+ {
386387 Ok ( senders) => senders,
387388 Err ( err) => {
388389 error ! ( "{}" , err) ;
@@ -396,16 +397,20 @@ pub async fn send_infinite_proofs(args: SendInfiniteProofsArgs) {
396397 InfiniteProofType :: GnarkGroth16 { proofs_dir } => {
397398 info ! ( "Loading Groth16 proofs from directory structure" ) ;
398399 let data = get_verification_data_from_proofs_folder (
399- proofs_dir. clone ( ) ,
400- senders[ 0 ] . wallet . address ( )
400+ proofs_dir. clone ( ) ,
401+ senders[ 0 ] . wallet . address ( ) ,
401402 ) ;
402403 if data. is_empty ( ) {
403404 error ! ( "Verification data empty, not continuing" ) ;
404405 return ;
405406 }
406407 data
407408 }
408- InfiniteProofType :: Risc0 { proof_path, bin_path, pub_path } => {
409+ InfiniteProofType :: Risc0 {
410+ proof_path,
411+ bin_path,
412+ pub_path,
413+ } => {
409414 info ! ( "Loading RISC Zero proof files" ) ;
410415 let Ok ( proof) = std:: fs:: read ( proof_path) else {
411416 error ! ( "Could not read proof file: {}" , proof_path) ;
@@ -432,12 +437,12 @@ pub async fn send_infinite_proofs(args: SendInfiniteProofsArgs) {
432437 } ]
433438 }
434439 } ;
435-
440+
436441 info ! ( "Proofs loaded!" ) ;
437442
438443 let max_fee = U256 :: from_dec_str ( & args. max_fee ) . expect ( "Invalid max fee" ) ;
439444 let network: Network = args. network . into ( ) ;
440-
445+
441446 info ! ( "Starting senders!" ) ;
442447 run_infinite_proof_sender (
443448 senders,
@@ -447,10 +452,14 @@ pub async fn send_infinite_proofs(args: SendInfiniteProofsArgs) {
447452 args. burst_time_secs ,
448453 max_fee,
449454 args. random_address ,
450- ) . await ;
455+ )
456+ . await ;
451457}
452458
453- fn load_groth16_proof_files ( dir_path : & std:: path:: Path , base_name : & str ) -> Option < VerificationData > {
459+ fn load_groth16_proof_files (
460+ dir_path : & std:: path:: Path ,
461+ base_name : & str ,
462+ ) -> Option < VerificationData > {
454463 let proof_path = dir_path. join ( format ! ( "{}.proof" , base_name) ) ;
455464 let public_input_path = dir_path. join ( format ! ( "{}.pub" , base_name) ) ;
456465 let vk_path = dir_path. join ( format ! ( "{}.vk" , base_name) ) ;
@@ -482,7 +491,9 @@ fn load_from_subdirectories(dir_path: &str) -> Vec<VerificationData> {
482491 . and_then ( |dir| dir. flatten ( ) . map ( |e| e. path ( ) ) . find ( |path| path. is_file ( ) ) )
483492 {
484493 if let Some ( base_name) = first_file. file_stem ( ) . and_then ( |s| s. to_str ( ) ) {
485- if let Some ( verification_data) = load_groth16_proof_files ( & proof_folder_dir, base_name) {
494+ if let Some ( verification_data) =
495+ load_groth16_proof_files ( & proof_folder_dir, base_name)
496+ {
486497 verifications_data. push ( verification_data) ;
487498 }
488499 }
@@ -496,7 +507,7 @@ fn load_from_subdirectories(dir_path: &str) -> Vec<VerificationData> {
496507fn load_from_flat_directory ( dir_path : & str ) -> Vec < VerificationData > {
497508 let mut verifications_data = vec ! [ ] ;
498509 let mut base_names = std:: collections:: HashSet :: new ( ) ;
499-
510+
500511 // Collect all unique base names from .proof files
501512 if let Ok ( dir) = std:: fs:: read_dir ( dir_path) {
502513 for entry in dir. flatten ( ) {
@@ -530,8 +541,9 @@ fn get_verification_data_from_proofs_folder(
530541 // Check if we have subdirectories with groth16 in the name
531542 let has_groth16_subdirs = std:: fs:: read_dir ( & dir_path)
532543 . map ( |dir| {
533- dir. flatten ( )
534- . any ( |entry| entry. path ( ) . is_dir ( ) && entry. path ( ) . to_str ( ) . unwrap ( ) . contains ( "groth16" ) )
544+ dir. flatten ( ) . any ( |entry| {
545+ entry. path ( ) . is_dir ( ) && entry. path ( ) . to_str ( ) . unwrap ( ) . contains ( "groth16" )
546+ } )
535547 } )
536548 . unwrap_or ( false ) ;
537549
@@ -548,4 +560,3 @@ fn get_verification_data_from_proofs_folder(
548560
549561 verifications_data
550562}
551-
0 commit comments