(
program_id: &solana_program::pubkey::Pubkey,
signer_pubkey: &solana_program::pubkey::Pubkey,
signer_keypair: &solana_sdk::signature::Keypair,
tmp_storage_pda_pubkey: &solana_program:
| 65 | mod test_utils; |
| 66 | |
| 67 | async fn compute_prepared_inputs( |
| 68 | program_id: &solana_program::pubkey::Pubkey, |
| 69 | signer_pubkey: &solana_program::pubkey::Pubkey, |
| 70 | signer_keypair: &solana_sdk::signature::Keypair, |
| 71 | tmp_storage_pda_pubkey: &solana_program::pubkey::Pubkey, |
| 72 | program_context: &mut ProgramTestContext, |
| 73 | accounts_vector: &mut std::vec::Vec<( |
| 74 | &solana_program::pubkey::Pubkey, |
| 75 | usize, |
| 76 | std::option::Option<std::vec::Vec<u8>>, |
| 77 | )>, |
| 78 | ) { |
| 79 | // We're supplying i=0; i++ here because |
| 80 | // we must make sure we're not having the exact same ix_data/ix in the same block. |
| 81 | // Since the runtime dedupes any exactly equivalent ix within the same block. |
| 82 | let mut i = 0usize; |
| 83 | for _id in 0..463usize { |
| 84 | let mut success = false; |
| 85 | let mut retries_left = 2; |
| 86 | while retries_left > 0 && success != true { |
| 87 | let mut transaction = Transaction::new_with_payer( |
| 88 | &[Instruction::new_with_bincode( |
| 89 | *program_id, |
| 90 | &vec![98, 99, i], |
| 91 | vec![ |
| 92 | AccountMeta::new(*signer_pubkey, true), |
| 93 | AccountMeta::new(*tmp_storage_pda_pubkey, false), |
| 94 | ], |
| 95 | )], |
| 96 | Some(&signer_pubkey), |
| 97 | ); |
| 98 | transaction.sign(&[&*signer_keypair], program_context.last_blockhash); |
| 99 | let res_request = timeout( |
| 100 | time::Duration::from_millis(500), |
| 101 | program_context |
| 102 | .banks_client |
| 103 | .process_transaction(transaction), |
| 104 | ) |
| 105 | .await; |
| 106 | |
| 107 | match res_request { |
| 108 | Ok(_) => success = true, |
| 109 | Err(_e) => { |
| 110 | println!("retries_left {}", retries_left); |
| 111 | retries_left -= 1; |
| 112 | |
| 113 | restart_program( |
| 114 | accounts_vector, |
| 115 | None, |
| 116 | &program_id, |
| 117 | &signer_pubkey, |
| 118 | program_context, |
| 119 | ) |
| 120 | .await; |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | i += 1; |
no test coverage detected