@@ -5,13 +5,22 @@ pub mod serialization;
5
5
pub mod syscalls;
6
6
7
7
use {
8
+ solana_account:: WritableAccount ,
9
+ solana_bincode:: limited_deserialize,
10
+ solana_clock:: Slot ,
8
11
solana_compute_budget:: compute_budget:: MAX_INSTRUCTION_STACK_DEPTH ,
9
12
solana_feature_set:: {
10
13
bpf_account_data_direct_mapping, enable_bpf_loader_set_authority_checked_ix,
11
14
remove_accounts_executable_flag_checks,
12
15
} ,
16
+ solana_instruction:: { error:: InstructionError , AccountMeta } ,
13
17
solana_log_collector:: { ic_logger_msg, ic_msg, LogCollector } ,
14
18
solana_measure:: measure:: Measure ,
19
+ solana_program:: {
20
+ bpf_loader_upgradeable:: UpgradeableLoaderState ,
21
+ loader_upgradeable_instruction:: UpgradeableLoaderInstruction ,
22
+ } ,
23
+ solana_program_entrypoint:: { MAX_PERMITTED_DATA_INCREASE , SUCCESS } ,
15
24
solana_program_runtime:: {
16
25
invoke_context:: { BpfAllocator , InvokeContext , SerializedAccountMetadata , SyscallContext } ,
17
26
loaded_programs:: {
22
31
stable_log,
23
32
sysvar_cache:: get_sysvar_with_account_check,
24
33
} ,
34
+ solana_pubkey:: Pubkey ,
25
35
solana_sbpf:: {
26
36
declare_builtin_function,
27
37
ebpf:: { self , MM_HEAP_START } ,
@@ -32,20 +42,11 @@ use {
32
42
verifier:: RequisiteVerifier ,
33
43
vm:: { ContextObject , EbpfVm } ,
34
44
} ,
35
- solana_sdk:: {
36
- account:: WritableAccount ,
37
- bpf_loader, bpf_loader_deprecated,
38
- bpf_loader_upgradeable:: { self , UpgradeableLoaderState } ,
39
- clock:: Slot ,
40
- entrypoint:: { MAX_PERMITTED_DATA_INCREASE , SUCCESS } ,
41
- instruction:: { AccountMeta , InstructionError } ,
42
- loader_upgradeable_instruction:: UpgradeableLoaderInstruction ,
43
- loader_v4, native_loader,
44
- program_utils:: limited_deserialize,
45
- pubkey:: Pubkey ,
46
- system_instruction:: { self , MAX_PERMITTED_DATA_LENGTH } ,
47
- transaction_context:: { IndexOfAccount , InstructionContext , TransactionContext } ,
45
+ solana_sdk_ids:: {
46
+ bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable, loader_v4, native_loader,
48
47
} ,
48
+ solana_system_interface:: { instruction as system_instruction, MAX_PERMITTED_DATA_LENGTH } ,
49
+ solana_transaction_context:: { IndexOfAccount , InstructionContext , TransactionContext } ,
49
50
solana_type_overrides:: sync:: { atomic:: Ordering , Arc } ,
50
51
std:: { cell:: RefCell , mem, rc:: Rc } ,
51
52
syscalls:: { create_program_runtime_environment_v1, morph_into_deployment_environment_v1} ,
@@ -511,7 +512,7 @@ fn process_loader_upgradeable_instruction(
511
512
let instruction_data = instruction_context. get_instruction_data ( ) ;
512
513
let program_id = instruction_context. get_last_program_key ( transaction_context) ?;
513
514
514
- match limited_deserialize ( instruction_data) ? {
515
+ match limited_deserialize ( instruction_data, solana_packet :: PACKET_DATA_SIZE as u64 ) ? {
515
516
UpgradeableLoaderInstruction :: InitializeBuffer => {
516
517
instruction_context. check_number_of_instruction_accounts ( 2 ) ?;
517
518
let mut buffer =
@@ -677,7 +678,7 @@ fn process_loader_upgradeable_instruction(
677
678
let signers = [ [ new_program_id. as_ref ( ) , & [ bump_seed] ] ]
678
679
. iter ( )
679
680
. map ( |seeds| Pubkey :: create_program_address ( seeds, caller_program_id) )
680
- . collect :: < Result < Vec < Pubkey > , solana_sdk :: pubkey :: PubkeyError > > ( ) ?;
681
+ . collect :: < Result < Vec < Pubkey > , solana_pubkey :: PubkeyError > > ( ) ?;
681
682
invoke_context. native_invoke ( instruction. into ( ) , signers. as_slice ( ) ) ?;
682
683
683
684
// Load and verify the program bits
@@ -1572,9 +1573,8 @@ pub fn execute<'a, 'b: 'a>(
1572
1573
1573
1574
pub mod test_utils {
1574
1575
use {
1575
- super :: * ,
1576
+ super :: * , solana_account :: ReadableAccount , solana_program :: loader_v4 :: LoaderV4State ,
1576
1577
solana_program_runtime:: loaded_programs:: DELAY_VISIBILITY_SLOT_OFFSET ,
1577
- solana_sdk:: { account:: ReadableAccount , loader_v4:: LoaderV4State } ,
1578
1578
} ;
1579
1579
1580
1580
pub fn load_all_invoked_programs ( invoke_context : & mut InvokeContext ) {
@@ -1637,22 +1637,19 @@ mod tests {
1637
1637
super :: * ,
1638
1638
assert_matches:: assert_matches,
1639
1639
rand:: Rng ,
1640
+ solana_account:: {
1641
+ create_account_shared_data_for_test as create_account_for_test, state_traits:: StateMut ,
1642
+ AccountSharedData , ReadableAccount , WritableAccount ,
1643
+ } ,
1644
+ solana_clock:: Clock ,
1645
+ solana_epoch_schedule:: EpochSchedule ,
1646
+ solana_instruction:: { error:: InstructionError , AccountMeta } ,
1640
1647
solana_program_runtime:: {
1641
1648
invoke_context:: mock_process_instruction, with_mock_invoke_context,
1642
1649
} ,
1643
- solana_sdk:: {
1644
- account:: {
1645
- create_account_shared_data_for_test as create_account_for_test, AccountSharedData ,
1646
- ReadableAccount , WritableAccount ,
1647
- } ,
1648
- account_utils:: StateMut ,
1649
- clock:: Clock ,
1650
- epoch_schedule:: EpochSchedule ,
1651
- instruction:: { AccountMeta , InstructionError } ,
1652
- pubkey:: Pubkey ,
1653
- rent:: Rent ,
1654
- system_program, sysvar,
1655
- } ,
1650
+ solana_pubkey:: Pubkey ,
1651
+ solana_rent:: Rent ,
1652
+ solana_sdk_ids:: { system_program, sysvar} ,
1656
1653
std:: { fs:: File , io:: Read , ops:: Range , sync:: atomic:: AtomicU64 } ,
1657
1654
} ;
1658
1655
0 commit comments