11use anchor_lang:: { InstructionData , ToAccountMetas } ;
2- use light_program_test:: { program_test:: LightProgramTest , Indexer , ProgramTestConfig , Rpc , RpcError } ;
3- use solana_sdk:: { instruction:: Instruction , pubkey:: Pubkey , signature:: Signer } ;
2+ use light_program_test:: {
3+ program_test:: LightProgramTest , Indexer , ProgramTestConfig , Rpc , RpcError ,
4+ } ;
45use nullifier:: nullifier_creation:: NullifierInstructionData ;
6+ use solana_sdk:: { instruction:: Instruction , pubkey:: Pubkey , signature:: Signer } ;
57
68#[ tokio:: test]
79async fn test_create_single_nullifier ( ) {
@@ -11,12 +13,10 @@ async fn test_create_single_nullifier() {
1113
1214 let nullifier = Pubkey :: new_unique ( ) . to_bytes ( ) ;
1315
14- let ( data, remaining_accounts) = build_create_nullifier_instruction_data (
15- & mut rpc,
16- & [ nullifier] ,
17- )
18- . await
19- . unwrap ( ) ;
16+ let ( data, remaining_accounts) =
17+ build_create_nullifier_instruction_data ( & mut rpc, & [ nullifier] )
18+ . await
19+ . unwrap ( ) ;
2020
2121 let instruction_data = nullifier:: instruction:: CreateNullifier {
2222 data,
@@ -38,12 +38,10 @@ async fn test_create_single_nullifier() {
3838 assert_nullifiers_exist ( & mut rpc, & [ nullifier] ) . await ;
3939
4040 // Duplicate should fail
41- let ( dup_data, dup_remaining_accounts) = build_create_nullifier_instruction_data (
42- & mut rpc,
43- & [ nullifier] ,
44- )
45- . await
46- . unwrap ( ) ;
41+ let ( dup_data, dup_remaining_accounts) =
42+ build_create_nullifier_instruction_data ( & mut rpc, & [ nullifier] )
43+ . await
44+ . unwrap ( ) ;
4745
4846 let dup_instruction_data = nullifier:: instruction:: CreateNullifier {
4947 data : dup_data,
@@ -72,12 +70,9 @@ async fn test_create_multiple_nullifiers() {
7270
7371 let nullifiers: Vec < [ u8 ; 32 ] > = ( 0 ..3 ) . map ( |_| Pubkey :: new_unique ( ) . to_bytes ( ) ) . collect ( ) ;
7472
75- let ( data, remaining_accounts) = build_create_nullifier_instruction_data (
76- & mut rpc,
77- & nullifiers,
78- )
79- . await
80- . unwrap ( ) ;
73+ let ( data, remaining_accounts) = build_create_nullifier_instruction_data ( & mut rpc, & nullifiers)
74+ . await
75+ . unwrap ( ) ;
8176
8277 let instruction_data = nullifier:: instruction:: CreateNullifier {
8378 data,
@@ -132,12 +127,21 @@ where
132127async fn build_create_nullifier_instruction_data < R > (
133128 rpc : & mut R ,
134129 nullifiers : & [ [ u8 ; 32 ] ] ,
135- ) -> Result < ( NullifierInstructionData , Vec < solana_sdk:: instruction:: AccountMeta > ) , RpcError >
130+ ) -> Result <
131+ (
132+ NullifierInstructionData ,
133+ Vec < solana_sdk:: instruction:: AccountMeta > ,
134+ ) ,
135+ RpcError ,
136+ >
136137where
137138 R : Rpc + Indexer ,
138139{
139140 use light_program_test:: AddressWithTree ;
140- use light_sdk:: { address:: v2:: derive_address, instruction:: { PackedAccounts , SystemAccountMetaConfig } } ;
141+ use light_sdk:: {
142+ address:: v2:: derive_address,
143+ instruction:: { PackedAccounts , SystemAccountMetaConfig } ,
144+ } ;
141145 use nullifier:: nullifier_creation:: NULLIFIER_PREFIX ;
142146
143147 let address_tree_info = rpc. get_address_tree_v2 ( ) ;
@@ -174,7 +178,8 @@ where
174178 . get_random_state_tree_info ( ) ?
175179 . pack_output_tree_index ( & mut remaining_accounts) ?;
176180
177- let ( remaining_accounts_metas, system_accounts_offset, _) = remaining_accounts. to_account_metas ( ) ;
181+ let ( remaining_accounts_metas, system_accounts_offset, _) =
182+ remaining_accounts. to_account_metas ( ) ;
178183
179184 let data = NullifierInstructionData {
180185 proof : rpc_result. proof ,
0 commit comments