88 solana_config_program:: { error:: ConfigError , state:: ConfigKeys } ,
99 solana_config_program_client:: instructions_bincode:: { self as config_instruction, ConfigState } ,
1010 solana_sdk:: {
11- account:: AccountSharedData ,
11+ account:: Account ,
1212 instruction:: { AccountMeta , Instruction } ,
1313 program_error:: ProgramError ,
1414 pubkey:: Pubkey ,
@@ -48,10 +48,10 @@ fn get_config_space(key_len: usize) -> usize {
4848 serialized_size. checked_add ( total_keys_size) . unwrap ( )
4949}
5050
51- fn create_config_account ( mollusk : & Mollusk , keys : Vec < ( Pubkey , bool ) > ) -> AccountSharedData {
51+ fn create_config_account ( mollusk : & Mollusk , keys : Vec < ( Pubkey , bool ) > ) -> Account {
5252 let space = get_config_space ( keys. len ( ) ) ;
5353 let lamports = mollusk. sysvars . rent . minimum_balance ( space) ;
54- AccountSharedData :: new_data (
54+ Account :: new_data (
5555 lamports,
5656 & ( ConfigKeys { keys } , MyConfig :: default ( ) ) ,
5757 & solana_config_program:: id ( ) ,
@@ -67,7 +67,7 @@ fn test_process_create_ok() {
6767 let config_account = {
6868 let space = get_config_space ( 0 ) ;
6969 let lamports = mollusk. sysvars . rent . minimum_balance ( space) ;
70- AccountSharedData :: new ( lamports, space, & solana_config_program:: id ( ) )
70+ Account :: new ( lamports, space, & solana_config_program:: id ( ) )
7171 } ;
7272
7373 // `instruction::initialize_account` without making it public...
@@ -180,8 +180,8 @@ fn test_process_store_with_additional_signers() {
180180 & instruction,
181181 & [
182182 ( config, config_account) ,
183- ( signer0, AccountSharedData :: default ( ) ) ,
184- ( signer1, AccountSharedData :: default ( ) ) ,
183+ ( signer0, Account :: default ( ) ) ,
184+ ( signer1, Account :: default ( ) ) ,
185185 ] ,
186186 & [
187187 Check :: success ( ) ,
@@ -213,7 +213,7 @@ fn test_process_store_bad_config_account() {
213213 // Config missing from accounts.
214214 (
215215 signer0,
216- AccountSharedData :: new ( 100_000 , 0 , & solana_config_program:: id ( ) ) ,
216+ Account :: new ( 100_000 , 0 , & solana_config_program:: id ( ) ) ,
217217 ) ,
218218 ] ,
219219 & [ Check :: err ( ProgramError :: InvalidAccountData ) ] ,
@@ -242,7 +242,7 @@ fn test_process_store_with_bad_additional_signer() {
242242 & instruction,
243243 & [
244244 ( config, config_account. clone ( ) ) ,
245- ( bad_signer, AccountSharedData :: default ( ) ) ,
245+ ( bad_signer, Account :: default ( ) ) ,
246246 ] ,
247247 & [ Check :: err ( ProgramError :: MissingRequiredSignature ) ] ,
248248 ) ;
@@ -253,10 +253,7 @@ fn test_process_store_with_bad_additional_signer() {
253253
254254 mollusk. process_and_validate_instruction (
255255 & instruction,
256- & [
257- ( config, config_account) ,
258- ( signer0, AccountSharedData :: default ( ) ) ,
259- ] ,
256+ & [ ( config, config_account) , ( signer0, Account :: default ( ) ) ] ,
260257 & [ Check :: err ( ProgramError :: MissingRequiredSignature ) ] ,
261258 ) ;
262259}
@@ -277,15 +274,15 @@ fn test_store_requiring_config() {
277274 // uninitalized.
278275 let space = get_config_space ( new_keys. len ( ) ) ;
279276 let lamports = mollusk. sysvars . rent . minimum_balance ( space) ;
280- AccountSharedData :: new ( lamports, space, & solana_config_program:: id ( ) )
277+ Account :: new ( lamports, space, & solana_config_program:: id ( ) )
281278 } ;
282279
283280 let mut instruction = config_instruction:: store ( & config, true , new_keys, & my_config) ;
284281 mollusk. process_and_validate_instruction (
285282 & instruction,
286283 & [
287284 ( config, config_account. clone ( ) ) ,
288- ( signer, AccountSharedData :: default ( ) ) ,
285+ ( signer, Account :: default ( ) ) ,
289286 ] ,
290287 & [ Check :: err ( ProgramError :: MissingRequiredSignature ) ] ,
291288 ) ;
@@ -302,10 +299,7 @@ fn test_store_requiring_config() {
302299 ] ;
303300 mollusk. process_and_validate_instruction (
304301 & instruction,
305- & [
306- ( config, config_account) ,
307- ( signer, AccountSharedData :: default ( ) ) ,
308- ] ,
302+ & [ ( config, config_account) , ( signer, Account :: default ( ) ) ] ,
309303 & [ Check :: success ( ) ] ,
310304 ) ;
311305}
@@ -330,8 +324,8 @@ fn test_config_updates() {
330324 & instruction,
331325 & [
332326 ( config, config_account) ,
333- ( signer0, AccountSharedData :: default ( ) ) ,
334- ( signer1, AccountSharedData :: default ( ) ) ,
327+ ( signer0, Account :: default ( ) ) ,
328+ ( signer1, Account :: default ( ) ) ,
335329 ] ,
336330 & [ Check :: success ( ) , Check :: compute_units ( 3_241 ) ] ,
337331 ) ;
@@ -346,8 +340,8 @@ fn test_config_updates() {
346340 & instruction,
347341 & [
348342 ( config, updated_config_account) ,
349- ( signer0, AccountSharedData :: default ( ) ) ,
350- ( signer1, AccountSharedData :: default ( ) ) ,
343+ ( signer0, Account :: default ( ) ) ,
344+ ( signer1, Account :: default ( ) ) ,
351345 ] ,
352346 & [
353347 Check :: success ( ) ,
@@ -372,7 +366,7 @@ fn test_config_updates() {
372366 & [
373367 ( config, updated_config_account. clone ( ) ) ,
374368 // Missing signer0.
375- ( signer1, AccountSharedData :: default ( ) ) ,
369+ ( signer1, Account :: default ( ) ) ,
376370 ] ,
377371 & [ Check :: err ( ProgramError :: MissingRequiredSignature ) ] ,
378372 ) ;
@@ -387,7 +381,7 @@ fn test_config_updates() {
387381 & instruction,
388382 & [
389383 ( config, updated_config_account. clone ( ) ) ,
390- ( signer0, AccountSharedData :: default ( ) ) ,
384+ ( signer0, Account :: default ( ) ) ,
391385 // Missing signer1.
392386 ] ,
393387 & [ Check :: err ( ProgramError :: MissingRequiredSignature ) ] ,
@@ -404,8 +398,8 @@ fn test_config_updates() {
404398 & instruction,
405399 & [
406400 ( config, updated_config_account. clone ( ) ) ,
407- ( signer0, AccountSharedData :: default ( ) ) ,
408- ( signer2, AccountSharedData :: default ( ) ) , // Incorrect signer1.
401+ ( signer0, Account :: default ( ) ) ,
402+ ( signer2, Account :: default ( ) ) , // Incorrect signer1.
409403 ] ,
410404 & [ Check :: err ( ProgramError :: MissingRequiredSignature ) ] ,
411405 ) ;
@@ -435,8 +429,8 @@ fn test_config_initialize_contains_duplicates_fails() {
435429 & instruction,
436430 & [
437431 ( config, config_account) ,
438- ( signer0, AccountSharedData :: default ( ) ) ,
439- ( signer0, AccountSharedData :: default ( ) ) , // Duplicate signer0.
432+ ( signer0, Account :: default ( ) ) ,
433+ ( signer0, Account :: default ( ) ) , // Duplicate signer0.
440434 ] ,
441435 & [ Check :: err ( ProgramError :: InvalidArgument ) ] ,
442436 ) ;
@@ -461,8 +455,8 @@ fn test_config_update_contains_duplicates_fails() {
461455 & instruction,
462456 & [
463457 ( config, config_account. clone ( ) ) ,
464- ( signer0, AccountSharedData :: default ( ) ) ,
465- ( signer1, AccountSharedData :: default ( ) ) ,
458+ ( signer0, Account :: default ( ) ) ,
459+ ( signer1, Account :: default ( ) ) ,
466460 ] ,
467461 & [ Check :: success ( ) , Check :: compute_units ( 3_241 ) ] ,
468462 ) ;
@@ -479,8 +473,8 @@ fn test_config_update_contains_duplicates_fails() {
479473 & instruction,
480474 & [
481475 ( config, config_account) ,
482- ( signer0, AccountSharedData :: default ( ) ) ,
483- ( signer0, AccountSharedData :: default ( ) ) , // Duplicate signer0.
476+ ( signer0, Account :: default ( ) ) ,
477+ ( signer0, Account :: default ( ) ) , // Duplicate signer0.
484478 ] ,
485479 & [ Check :: err ( ProgramError :: InvalidArgument ) ] ,
486480 ) ;
@@ -502,10 +496,7 @@ fn test_config_updates_requiring_config() {
502496 let instruction = config_instruction:: store ( & config, true , keys. clone ( ) , & my_config) ;
503497 let result = mollusk. process_and_validate_instruction (
504498 & instruction,
505- & [
506- ( config, config_account) ,
507- ( signer0, AccountSharedData :: default ( ) ) ,
508- ] ,
499+ & [ ( config, config_account) , ( signer0, Account :: default ( ) ) ] ,
509500 & [
510501 Check :: success ( ) ,
511502 Check :: compute_units ( 3_338 ) ,
@@ -525,7 +516,7 @@ fn test_config_updates_requiring_config() {
525516 & instruction,
526517 & [
527518 ( config, updated_config_account) ,
528- ( signer0, AccountSharedData :: default ( ) ) ,
519+ ( signer0, Account :: default ( ) ) ,
529520 ] ,
530521 & [
531522 Check :: success ( ) ,
@@ -547,7 +538,7 @@ fn test_config_updates_requiring_config() {
547538 & instruction,
548539 & [
549540 ( config, updated_config_account) ,
550- ( signer0, AccountSharedData :: default ( ) ) ,
541+ ( signer0, Account :: default ( ) ) ,
551542 ] ,
552543 & [ Check :: err ( ProgramError :: MissingRequiredSignature ) ] ,
553544 ) ;
@@ -586,17 +577,14 @@ fn test_config_bad_owner() {
586577 let config_account = {
587578 let space = get_config_space ( keys. len ( ) ) ;
588579 let lamports = mollusk. sysvars . rent . minimum_balance ( space) ;
589- AccountSharedData :: new ( lamports, 0 , & Pubkey :: new_unique ( ) )
580+ Account :: new ( lamports, 0 , & Pubkey :: new_unique ( ) )
590581 } ;
591582
592583 let instruction = config_instruction:: store ( & config, true , keys, & my_config) ;
593584
594585 mollusk. process_and_validate_instruction (
595586 & instruction,
596- & [
597- ( config, config_account) ,
598- ( signer0, AccountSharedData :: default ( ) ) ,
599- ] ,
587+ & [ ( config, config_account) , ( signer0, Account :: default ( ) ) ] ,
600588 & [ Check :: err ( ProgramError :: InvalidAccountOwner ) ] ,
601589 ) ;
602590}
@@ -736,8 +724,8 @@ fn test_safe_deserialize_from_state() {
736724 bincode:: serialize_into ( & mut data, & ConfigKeys { keys } ) . unwrap ( ) ;
737725 data[ 0 ] = 255 ; // length of 255.
738726
739- let mut account = AccountSharedData :: new ( lamports, space, & solana_config_program:: id ( ) ) ;
740- account. set_data_from_slice ( & data) ;
727+ let mut account = Account :: new ( lamports, space, & solana_config_program:: id ( ) ) ;
728+ account. data = data ;
741729 account
742730 } ;
743731
0 commit comments