@@ -96,11 +96,12 @@ fn test_to_compressed_token_account_metas_with_optional_accounts() {
96
96
let registered_program_pda = Pubkey :: new_unique ( ) ;
97
97
let account_compression_authority = Pubkey :: new_unique ( ) ;
98
98
let system_program = Pubkey :: default ( ) ;
99
+ let cpi_authority = Pubkey :: from ( CPI_AUTHORITY_PDA ) ;
99
100
100
101
// Optional accounts
101
102
let token_pool_pda = Pubkey :: new_unique ( ) ;
102
103
let compress_or_decompress_token_account = Pubkey :: new_unique ( ) ;
103
- let token_program = Pubkey :: new_unique ( ) ;
104
+ let spl_token_program = Pubkey :: new_unique ( ) ;
104
105
105
106
// Create TestAccounts and get AccountInfo references
106
107
let mut fee_payer_account = TestAccount :: new ( fee_payer, Pubkey :: default ( ) , 0 ) ;
@@ -109,6 +110,7 @@ fn test_to_compressed_token_account_metas_with_optional_accounts() {
109
110
let mut light_system_account =
110
111
TestAccount :: new ( Pubkey :: from ( LIGHT_SYSTEM_PROGRAM_ID ) , Pubkey :: default ( ) , 0 ) ;
111
112
let mut authority_account = TestAccount :: new ( authority, Pubkey :: default ( ) , 0 ) ;
113
+ let mut cpi_authority_account = TestAccount :: new ( cpi_authority, Pubkey :: default ( ) , 0 ) ;
112
114
let mut registered_program_account =
113
115
TestAccount :: new ( registered_program_pda, Pubkey :: default ( ) , 0 ) ;
114
116
let mut noop_account = TestAccount :: new ( Pubkey :: from ( NOOP_PROGRAM_ID ) , Pubkey :: default ( ) , 0 ) ;
@@ -119,7 +121,7 @@ fn test_to_compressed_token_account_metas_with_optional_accounts() {
119
121
Pubkey :: default ( ) ,
120
122
0 ,
121
123
) ;
122
- let mut token_program_account = TestAccount :: new (
124
+ let mut ctoken_program_account = TestAccount :: new (
123
125
Pubkey :: from ( COMPRESSED_TOKEN_PROGRAM_ID ) ,
124
126
Pubkey :: default ( ) ,
125
127
0 ,
@@ -132,45 +134,45 @@ fn test_to_compressed_token_account_metas_with_optional_accounts() {
132
134
let mut compress_decompress_account =
133
135
TestAccount :: new ( compress_or_decompress_token_account, Pubkey :: default ( ) , 0 ) ;
134
136
compress_decompress_account. writable = true ;
135
- let mut token_program_ctx_account = TestAccount :: new ( token_program , Pubkey :: default ( ) , 0 ) ;
137
+ let mut spl_token_program_account = TestAccount :: new ( spl_token_program , Pubkey :: default ( ) , 0 ) ;
136
138
137
139
let fee_payer_info = fee_payer_account. get_account_info ( ) ;
138
140
let authority_info = authority_account. get_account_info ( ) ;
139
141
140
142
// Create account infos in the correct order for CpiAccounts with all optional accounts
141
143
let account_infos = vec ! [
142
- light_system_account . get_account_info( ) , // 0: light_system_program
143
- authority_info . clone ( ) , // 1: authority
144
+ cpi_authority_account . get_account_info( ) , // 1: authority (not cpi_authority)
145
+ light_system_account . get_account_info ( ) , // 0: light_system_program
144
146
registered_program_account. get_account_info( ) , // 2: registered_program_pda
145
- noop_account. get_account_info( ) , // 3: noop_program
147
+ noop_account. get_account_info( ) , // 3: noop_program
146
148
compression_authority_account. get_account_info( ) , // 4: account_compression_authority
147
149
compression_program_account. get_account_info( ) , // 5: account_compression_program
148
- token_program_account . get_account_info( ) , // 6: invoking_program (self_program)
149
- token_pool_account. get_account_info( ) , // 7: token_pool_pda
150
+ ctoken_program_account . get_account_info( ) , // 6: invoking_program (self_program)
151
+ token_pool_account. get_account_info( ) , // 7: token_pool_pda
150
152
compress_decompress_account. get_account_info( ) , // 8: decompression_recipient (compress_or_decompress_token_account)
153
+ spl_token_program_account. get_account_info( ) , // 10: cpi_context (spl_token_program)
151
154
system_program_account. get_account_info( ) , // 9: system_program
152
- token_program_ctx_account. get_account_info( ) , // 10: cpi_context (token_program)
153
155
] ;
154
156
155
157
let reference = light_compressed_token:: accounts:: TransferInstruction {
156
158
fee_payer,
157
159
authority,
160
+ light_system_program : Pubkey :: from ( LIGHT_SYSTEM_PROGRAM_ID ) ,
161
+ cpi_authority_pda : Pubkey :: from ( CPI_AUTHORITY_PDA ) ,
158
162
registered_program_pda,
159
163
noop_program : Pubkey :: from ( NOOP_PROGRAM_ID ) ,
160
164
account_compression_authority,
161
165
account_compression_program : Pubkey :: from ( ACCOUNT_COMPRESSION_PROGRAM_ID ) ,
162
166
self_program : Pubkey :: from ( COMPRESSED_TOKEN_PROGRAM_ID ) ,
163
- cpi_authority_pda : Pubkey :: from ( CPI_AUTHORITY_PDA ) ,
164
- light_system_program : Pubkey :: from ( LIGHT_SYSTEM_PROGRAM_ID ) ,
165
167
token_pool_pda : Some ( token_pool_pda) ,
166
168
compress_or_decompress_token_account : Some ( compress_or_decompress_token_account) ,
167
- token_program : Some ( token_program ) ,
169
+ token_program : Some ( spl_token_program ) ,
168
170
system_program,
169
171
} ;
170
172
171
173
// Create CpiAccounts with config that enables all optional accounts
172
174
let config = CpiAccountsConfig {
173
- cpi_context : true ,
175
+ cpi_context : false ,
174
176
compress : true ,
175
177
decompress : false ,
176
178
} ;
@@ -193,13 +195,4 @@ fn test_to_compressed_token_account_metas_with_optional_accounts() {
193
195
* cpi_accounts. light_system_program( ) . unwrap( ) . key,
194
196
Pubkey :: from( LIGHT_SYSTEM_PROGRAM_ID )
195
197
) ;
196
- // assert_eq!(
197
- // cpi_accounts.account_compression_authority(),
198
- // Some(account_compression_authority)
199
- // );
200
- // assert_eq!(cpi_accounts.fee_payer(), Some(fee_payer_info));
201
- // assert_eq!(
202
- // cpi_accounts.account_compression_authority(),
203
- // Some(account_compression_authority)
204
- // );
205
198
}
0 commit comments