@@ -21,8 +21,8 @@ use ic_cycles_account_manager::{CyclesAccountManager, ResourceSaturation};
21
21
use ic_error_types:: { ErrorCode , UserError } ;
22
22
use ic_ic00_types:: {
23
23
CanisterChange , CanisterChangeDetails , CanisterChangeOrigin , CanisterIdRecord ,
24
- CanisterInstallMode , CanisterSettingsArgsBuilder , CanisterStatusType , CreateCanisterArgs ,
25
- EmptyBlob , InstallCodeArgs , Method , Payload , UpdateSettingsArgs ,
24
+ CanisterInstallMode , CanisterInstallModeV2 , CanisterSettingsArgsBuilder , CanisterStatusType ,
25
+ CreateCanisterArgs , EmptyBlob , InstallCodeArgsV2 , Method , Payload , UpdateSettingsArgs ,
26
26
} ;
27
27
use ic_interfaces:: execution_environment:: {
28
28
ExecutionComplexity , ExecutionMode , HypervisorError , SubnetAvailableMemory ,
@@ -167,7 +167,7 @@ impl InstallCodeContextBuilder {
167
167
self
168
168
}
169
169
170
- pub fn mode ( mut self , mode : CanisterInstallMode ) -> Self {
170
+ pub fn mode ( mut self , mode : CanisterInstallModeV2 ) -> Self {
171
171
self . ctx . mode = mode;
172
172
self
173
173
}
@@ -187,7 +187,7 @@ impl Default for InstallCodeContextBuilder {
187
187
arg : vec ! [ ] ,
188
188
compute_allocation : None ,
189
189
memory_allocation : None ,
190
- mode : CanisterInstallMode :: Install ,
190
+ mode : CanisterInstallModeV2 :: Install ,
191
191
query_allocation : QueryAllocation :: default ( ) ,
192
192
} ,
193
193
}
@@ -316,7 +316,7 @@ fn install_code(
316
316
..EXECUTION_PARAMETERS . clone ( )
317
317
} ;
318
318
319
- let args = InstallCodeArgs :: new (
319
+ let args = InstallCodeArgsV2 :: new (
320
320
context. mode ,
321
321
context. canister_id ,
322
322
context. wasm_module . as_slice ( ) . into ( ) ,
@@ -487,7 +487,7 @@ fn upgrade_non_existing_canister_fails() {
487
487
install_code(
488
488
& canister_manager,
489
489
InstallCodeContextBuilder :: default ( )
490
- . mode( CanisterInstallMode :: Upgrade )
490
+ . mode( CanisterInstallModeV2 :: Upgrade ( None ) )
491
491
. wasm_module(
492
492
ic_test_utilities:: universal_canister:: UNIVERSAL_CANISTER_WASM . to_vec( ) ,
493
493
)
@@ -533,7 +533,7 @@ fn upgrade_canister_with_no_wasm_fails() {
533
533
& canister_manager,
534
534
InstallCodeContextBuilder :: default ( )
535
535
. sender ( sender)
536
- . mode ( CanisterInstallMode :: Upgrade )
536
+ . mode ( CanisterInstallModeV2 :: Upgrade ( None ) )
537
537
. wasm_module (
538
538
ic_test_utilities:: universal_canister:: UNIVERSAL_CANISTER_WASM . to_vec ( ) ,
539
539
)
@@ -612,7 +612,7 @@ fn can_update_compute_allocation_during_upgrade() {
612
612
. sender ( sender)
613
613
. canister_id ( canister_id1)
614
614
. compute_allocation ( ComputeAllocation :: try_from ( 80 ) . unwrap ( ) )
615
- . mode ( CanisterInstallMode :: Upgrade )
615
+ . mode ( CanisterInstallModeV2 :: Upgrade ( None ) )
616
616
. build ( ) ,
617
617
& mut state,
618
618
& mut round_limits,
@@ -738,7 +738,7 @@ fn upgrading_canister_makes_subnet_oversubscribed() {
738
738
ic_test_utilities:: universal_canister:: UNIVERSAL_CANISTER_WASM . to_vec ( ) ,
739
739
)
740
740
. compute_allocation ( ComputeAllocation :: try_from ( 30 ) . unwrap ( ) )
741
- . mode ( CanisterInstallMode :: Upgrade )
741
+ . mode ( CanisterInstallModeV2 :: Upgrade ( None ) )
742
742
. build ( ) ,
743
743
& mut state,
744
744
& mut round_limits,
@@ -911,7 +911,7 @@ fn can_update_memory_allocation_during_upgrade() {
911
911
. sender ( sender)
912
912
. canister_id ( canister_id)
913
913
. memory_allocation ( final_memory_allocation)
914
- . mode ( CanisterInstallMode :: Upgrade )
914
+ . mode ( CanisterInstallModeV2 :: Upgrade ( None ) )
915
915
. build ( ) ,
916
916
& mut state,
917
917
& mut round_limits,
@@ -1198,7 +1198,7 @@ fn install_code_with_wrong_controller_fails() {
1198
1198
. 0
1199
1199
. unwrap ( ) ;
1200
1200
1201
- for mode in CanisterInstallMode :: iter ( ) {
1201
+ for mode in CanisterInstallModeV2 :: iter ( ) {
1202
1202
// Try to install_code with canister_test_id 2. Should fail.
1203
1203
let res = install_code (
1204
1204
& canister_manager,
@@ -1395,7 +1395,7 @@ fn reinstall_on_empty_canister_succeeds() {
1395
1395
InstallCodeContextBuilder :: default ( )
1396
1396
. sender ( sender)
1397
1397
. canister_id ( canister_id)
1398
- . mode ( CanisterInstallMode :: Reinstall )
1398
+ . mode ( CanisterInstallModeV2 :: Reinstall )
1399
1399
. build ( ) ,
1400
1400
& mut state,
1401
1401
& mut round_limits,
@@ -1603,7 +1603,7 @@ fn reinstall_clears_stable_memory() {
1603
1603
InstallCodeContextBuilder :: default ( )
1604
1604
. sender ( sender)
1605
1605
. canister_id ( canister_id)
1606
- . mode ( CanisterInstallMode :: Reinstall )
1606
+ . mode ( CanisterInstallModeV2 :: Reinstall )
1607
1607
. build ( ) ,
1608
1608
& mut state,
1609
1609
& mut round_limits,
@@ -2716,7 +2716,7 @@ fn installing_a_canister_with_not_enough_memory_allocation_fails() {
2716
2716
InstallCodeContextBuilder :: default ( )
2717
2717
. sender ( sender)
2718
2718
. canister_id ( canister_id)
2719
- . mode ( CanisterInstallMode :: Reinstall )
2719
+ . mode ( CanisterInstallModeV2 :: Reinstall )
2720
2720
. wasm_module (
2721
2721
ic_test_utilities:: universal_canister:: UNIVERSAL_CANISTER_WASM . to_vec ( ) ,
2722
2722
)
@@ -2785,7 +2785,7 @@ fn upgrading_canister_with_not_enough_memory_allocation_fails() {
2785
2785
ic_test_utilities:: universal_canister:: UNIVERSAL_CANISTER_WASM . to_vec( )
2786
2786
)
2787
2787
. memory_allocation( memory_allocation)
2788
- . mode( CanisterInstallMode :: Upgrade )
2788
+ . mode( CanisterInstallModeV2 :: Upgrade ( None ) )
2789
2789
. build( ) ,
2790
2790
& mut state,
2791
2791
& mut round_limits,
@@ -3013,7 +3013,7 @@ fn failed_upgrade_hooks_consume_instructions() {
3013
3013
arg : vec ! [ ] ,
3014
3014
compute_allocation : None ,
3015
3015
memory_allocation : None ,
3016
- mode : CanisterInstallMode :: Install ,
3016
+ mode : CanisterInstallModeV2 :: Install ,
3017
3017
query_allocation : QueryAllocation :: default ( ) ,
3018
3018
} ,
3019
3019
& mut state,
@@ -3039,7 +3039,7 @@ fn failed_upgrade_hooks_consume_instructions() {
3039
3039
arg : vec ! [ ] ,
3040
3040
compute_allocation : None ,
3041
3041
memory_allocation : None ,
3042
- mode : CanisterInstallMode :: Upgrade ,
3042
+ mode : CanisterInstallModeV2 :: Upgrade ( None ) ,
3043
3043
query_allocation : QueryAllocation :: default ( ) ,
3044
3044
} ,
3045
3045
& mut state,
@@ -3158,7 +3158,7 @@ fn failed_install_hooks_consume_instructions() {
3158
3158
arg : vec ! [ ] ,
3159
3159
compute_allocation : None ,
3160
3160
memory_allocation : None ,
3161
- mode : CanisterInstallMode :: Install ,
3161
+ mode : CanisterInstallModeV2 :: Install ,
3162
3162
query_allocation : QueryAllocation :: default ( ) ,
3163
3163
} ,
3164
3164
& mut state,
@@ -3276,7 +3276,7 @@ fn install_code_respects_instruction_limit() {
3276
3276
arg : vec ! [ ] ,
3277
3277
compute_allocation : None ,
3278
3278
memory_allocation : None ,
3279
- mode : CanisterInstallMode :: Install ,
3279
+ mode : CanisterInstallModeV2 :: Install ,
3280
3280
query_allocation : QueryAllocation :: default ( ) ,
3281
3281
} ,
3282
3282
& mut state,
@@ -3308,7 +3308,7 @@ fn install_code_respects_instruction_limit() {
3308
3308
arg : vec ! [ ] ,
3309
3309
compute_allocation : None ,
3310
3310
memory_allocation : None ,
3311
- mode : CanisterInstallMode :: Install ,
3311
+ mode : CanisterInstallModeV2 :: Install ,
3312
3312
query_allocation : QueryAllocation :: default ( ) ,
3313
3313
} ,
3314
3314
& mut state,
@@ -3334,7 +3334,7 @@ fn install_code_respects_instruction_limit() {
3334
3334
arg : vec ! [ ] ,
3335
3335
compute_allocation : None ,
3336
3336
memory_allocation : None ,
3337
- mode : CanisterInstallMode :: Upgrade ,
3337
+ mode : CanisterInstallModeV2 :: Upgrade ( None ) ,
3338
3338
query_allocation : QueryAllocation :: default ( ) ,
3339
3339
} ,
3340
3340
& mut state,
@@ -3366,7 +3366,7 @@ fn install_code_respects_instruction_limit() {
3366
3366
arg : vec ! [ ] ,
3367
3367
compute_allocation : None ,
3368
3368
memory_allocation : None ,
3369
- mode : CanisterInstallMode :: Upgrade ,
3369
+ mode : CanisterInstallModeV2 :: Upgrade ( None ) ,
3370
3370
query_allocation : QueryAllocation :: default ( ) ,
3371
3371
} ,
3372
3372
& mut state,
@@ -3420,14 +3420,14 @@ fn install_code_preserves_system_state_and_scheduler_state() {
3420
3420
3421
3421
// 1. INSTALL
3422
3422
let install_code_context = InstallCodeContextBuilder :: default ( )
3423
- . mode ( CanisterInstallMode :: Install )
3423
+ . mode ( CanisterInstallModeV2 :: Install )
3424
3424
. sender ( controller. into ( ) )
3425
3425
. canister_id ( canister_id)
3426
3426
. build ( ) ;
3427
3427
let compilation_cost = wasm_compilation_cost ( install_code_context. wasm_module . as_slice ( ) ) ;
3428
3428
3429
3429
let ctxt = InstallCodeContextBuilder :: default ( )
3430
- . mode ( CanisterInstallMode :: Install )
3430
+ . mode ( CanisterInstallModeV2 :: Install )
3431
3431
. sender ( controller. into ( ) )
3432
3432
. canister_id ( canister_id)
3433
3433
. build ( ) ;
@@ -3469,7 +3469,7 @@ fn install_code_preserves_system_state_and_scheduler_state() {
3469
3469
3470
3470
let instructions_before_reinstall = as_num_instructions ( round_limits. instructions ) ;
3471
3471
let ctxt = InstallCodeContextBuilder :: default ( )
3472
- . mode ( CanisterInstallMode :: Reinstall )
3472
+ . mode ( CanisterInstallModeV2 :: Reinstall )
3473
3473
. sender ( controller. into ( ) )
3474
3474
. canister_id ( canister_id)
3475
3475
. build ( ) ;
@@ -3520,7 +3520,7 @@ fn install_code_preserves_system_state_and_scheduler_state() {
3520
3520
. certified_data = certified_data;
3521
3521
let instructions_before_upgrade = as_num_instructions ( round_limits. instructions ) ;
3522
3522
let ctxt = InstallCodeContextBuilder :: default ( )
3523
- . mode ( CanisterInstallMode :: Upgrade )
3523
+ . mode ( CanisterInstallModeV2 :: Upgrade ( None ) )
3524
3524
. sender ( controller. into ( ) )
3525
3525
. canister_id ( canister_id)
3526
3526
. build ( ) ;
@@ -3600,7 +3600,7 @@ fn lower_memory_allocation_than_usage_fails() {
3600
3600
arg : vec ! [ ] ,
3601
3601
compute_allocation : None ,
3602
3602
memory_allocation : None ,
3603
- mode : CanisterInstallMode :: Install ,
3603
+ mode : CanisterInstallModeV2 :: Install ,
3604
3604
query_allocation : QueryAllocation :: default ( ) ,
3605
3605
} ,
3606
3606
& mut state,
@@ -3668,7 +3668,7 @@ fn test_install_when_updating_memory_allocation_via_canister_settings() {
3668
3668
arg : vec ! [ ] ,
3669
3669
compute_allocation : None ,
3670
3670
memory_allocation : None ,
3671
- mode : CanisterInstallMode :: Install ,
3671
+ mode : CanisterInstallModeV2 :: Install ,
3672
3672
query_allocation : QueryAllocation :: default ( ) ,
3673
3673
} ,
3674
3674
& mut state,
@@ -3710,7 +3710,7 @@ fn test_install_when_updating_memory_allocation_via_canister_settings() {
3710
3710
arg : vec ! [ ] ,
3711
3711
compute_allocation : None ,
3712
3712
memory_allocation : None ,
3713
- mode : CanisterInstallMode :: Install ,
3713
+ mode : CanisterInstallModeV2 :: Install ,
3714
3714
query_allocation : QueryAllocation :: default ( ) ,
3715
3715
} ,
3716
3716
& mut state,
@@ -3769,7 +3769,7 @@ fn test_upgrade_when_updating_memory_allocation_via_canister_settings() {
3769
3769
arg : vec ! [ ] ,
3770
3770
compute_allocation : None ,
3771
3771
memory_allocation : None ,
3772
- mode : CanisterInstallMode :: Install ,
3772
+ mode : CanisterInstallModeV2 :: Install ,
3773
3773
query_allocation : QueryAllocation :: default ( ) ,
3774
3774
} ,
3775
3775
& mut state,
@@ -3795,7 +3795,7 @@ fn test_upgrade_when_updating_memory_allocation_via_canister_settings() {
3795
3795
arg : vec ! [ ] ,
3796
3796
compute_allocation : None ,
3797
3797
memory_allocation : None ,
3798
- mode : CanisterInstallMode :: Upgrade ,
3798
+ mode : CanisterInstallModeV2 :: Upgrade ( None ) ,
3799
3799
query_allocation : QueryAllocation :: default ( ) ,
3800
3800
} ,
3801
3801
& mut state,
@@ -3842,7 +3842,7 @@ fn test_upgrade_when_updating_memory_allocation_via_canister_settings() {
3842
3842
arg : vec ! [ ] ,
3843
3843
compute_allocation : None ,
3844
3844
memory_allocation : None ,
3845
- mode : CanisterInstallMode :: Upgrade ,
3845
+ mode : CanisterInstallModeV2 :: Upgrade ( None ) ,
3846
3846
query_allocation : QueryAllocation :: default ( ) ,
3847
3847
} ,
3848
3848
& mut state,
@@ -3947,7 +3947,7 @@ fn test_install_when_setting_memory_allocation_to_zero() {
3947
3947
arg : vec ! [ ] ,
3948
3948
compute_allocation : None ,
3949
3949
memory_allocation : None ,
3950
- mode : CanisterInstallMode :: Install ,
3950
+ mode : CanisterInstallModeV2 :: Install ,
3951
3951
query_allocation : QueryAllocation :: default ( ) ,
3952
3952
} ,
3953
3953
& mut state,
@@ -3998,7 +3998,7 @@ fn test_upgrade_when_setting_memory_allocation_to_zero() {
3998
3998
arg : vec ! [ ] ,
3999
3999
compute_allocation : None ,
4000
4000
memory_allocation : None ,
4001
- mode : CanisterInstallMode :: Install ,
4001
+ mode : CanisterInstallModeV2 :: Install ,
4002
4002
query_allocation : QueryAllocation :: default ( ) ,
4003
4003
} ,
4004
4004
& mut state,
@@ -4034,7 +4034,7 @@ fn test_upgrade_when_setting_memory_allocation_to_zero() {
4034
4034
arg : vec ! [ ] ,
4035
4035
compute_allocation : None ,
4036
4036
memory_allocation : None ,
4037
- mode : CanisterInstallMode :: Upgrade ,
4037
+ mode : CanisterInstallModeV2 :: Upgrade ( None ) ,
4038
4038
query_allocation : QueryAllocation :: default ( ) ,
4039
4039
} ,
4040
4040
& mut state,
@@ -4306,8 +4306,8 @@ fn test_install_code_rate_limiting_disabled() {
4306
4306
4307
4307
#[ test]
4308
4308
fn install_code_context_conversion_u128 ( ) {
4309
- let install_args = InstallCodeArgs {
4310
- mode : CanisterInstallMode :: Install ,
4309
+ let install_args = InstallCodeArgsV2 {
4310
+ mode : CanisterInstallModeV2 :: Install ,
4311
4311
canister_id : PrincipalId :: try_from ( [ 1 , 2 , 3 ] . as_ref ( ) ) . unwrap ( ) ,
4312
4312
wasm_module : vec ! [ ] ,
4313
4313
arg : vec ! [ ] ,
0 commit comments