diff --git a/rs/tests/execution/general_execution_test.rs b/rs/tests/execution/general_execution_test.rs index a317c029208..63702ad15e9 100644 --- a/rs/tests/execution/general_execution_test.rs +++ b/rs/tests/execution/general_execution_test.rs @@ -84,13 +84,7 @@ fn main() -> Result<()> { .add_test(systest!(canister_only_accepts_ingress_with_payload)) .add_test(systest!(canister_rejects_ingress_only_from_one_caller)) .add_test(systest!(query_reply_sizes)) - .add_test(systest!( - mint_cycles_supported_only_on_cycles_minting_canister - )) .add_test(systest!(mint_cycles_not_supported_on_application_subnet)) - .add_test(systest!( - mint_cycles128_supported_only_on_cycles_minting_canister - )) .add_test(systest!(mint_cycles128_not_supported_on_application_subnet)) .add_test(systest!(no_cycle_balance_limit_on_nns_subnet)) .add_test(systest!(app_canister_attempt_initiating_dkg_fails)) diff --git a/rs/tests/execution/general_execution_tests/nns_shielding.rs b/rs/tests/execution/general_execution_tests/nns_shielding.rs index 4ebab5b8a4a..f2c1cb01719 100644 --- a/rs/tests/execution/general_execution_tests/nns_shielding.rs +++ b/rs/tests/execution/general_execution_tests/nns_shielding.rs @@ -47,53 +47,6 @@ const MINT_CYCLES: &str = r#"(module (export "memory" (memory $memory)) )"#; -pub fn mint_cycles_supported_only_on_cycles_minting_canister(env: TestEnv) { - let nns_node = env.get_first_healthy_nns_node_snapshot(); - let specified_id = nns_node.get_last_canister_id_in_allocation_ranges(); - // Check that 'specified_id' is not 'CYCLES_MINTING_CANISTER_ID'. - assert_ne!(specified_id, CYCLES_MINTING_CANISTER_ID.into()); - let nns_agent = nns_node.build_default_agent(); - block_on(async move { - let wasm = wat::parse_str(MINT_CYCLES).unwrap(); - let nns_canister_id: Principal = create_and_install_with_cycles_and_specified_id( - &nns_agent, - specified_id, - wasm.as_slice(), - *INITIAL_CYCLES, - ) - .await; - - let before_balance = get_balance(&nns_canister_id, &nns_agent).await; - assert_eq!(INITIAL_CYCLES.get(), before_balance); - - let res = nns_agent - .update(&nns_canister_id, "test") - .call_and_wait() - .await - .expect_err("should not succeed"); - - assert_eq!( - res, - AgentError::CertifiedReject( - RejectResponse { - reject_code: RejectCode::CanisterError, - reject_message: format!( - "Error from Canister {}: Canister violated contract: ic0.mint_cycles cannot be executed on non Cycles Minting Canister: {} != {}.\nThis is likely an error with the compiler/CDK toolchain being used to build the canister. Please report the error to IC devs on the forum: https://forum.dfinity.org and include which language/CDK was used to create the canister.", - nns_canister_id, nns_canister_id, - CYCLES_MINTING_CANISTER_ID), - error_code: Some("IC0504".to_string())}) - ); - - let after_balance = get_balance(&nns_canister_id, &nns_agent).await; - assert!( - after_balance == before_balance, - "expected {} == {}", - after_balance, - before_balance - ); - }); -} - pub fn mint_cycles_not_supported_on_application_subnet(env: TestEnv) { let initial_cycles = CANISTER_FREEZE_BALANCE_RESERVE + Cycles::new(5_000_000_000_000); let app_node = env.get_first_healthy_application_node_snapshot(); @@ -141,13 +94,20 @@ fn setup_ucan_and_try_mint128(node: IcNodeSnapshot) -> (AgentError, u128, u128, let agent = node.build_default_agent(); let effective_canister_id = node.get_last_canister_id_in_allocation_ranges(); block_on(async move { - let canister_id = + let mut canister_id = UniversalCanister::new_with_cycles(&agent, effective_canister_id, *INITIAL_CYCLES) .await .unwrap() .canister_id(); - // Check that 'canister_id' is not 'CYCLES_MINTING_CANISTER_ID'. - assert_ne!(canister_id, CYCLES_MINTING_CANISTER_ID.into()); + // Make sure that 'canister_id' is not 'CYCLES_MINTING_CANISTER_ID'. + if canister_id == CYCLES_MINTING_CANISTER_ID.into() { + let effective_canister_id = node.get_last_canister_id_in_allocation_ranges(); + canister_id = + UniversalCanister::new_with_cycles(&agent, effective_canister_id, *INITIAL_CYCLES) + .await + .unwrap() + .canister_id(); + } let before_balance = get_balance(&canister_id, &agent).await; let res = agent .update(&canister_id, "update") @@ -166,28 +126,6 @@ fn setup_ucan_and_try_mint128(node: IcNodeSnapshot) -> (AgentError, u128, u128, }) } -pub fn mint_cycles128_supported_only_on_cycles_minting_canister(env: TestEnv) { - let nns_node = env.get_first_healthy_nns_node_snapshot(); - let (res, before_balance, after_balance, canister_id) = setup_ucan_and_try_mint128(nns_node); - assert_eq!( - res, - AgentError::CertifiedReject( - RejectResponse { - reject_code: RejectCode::CanisterError, - reject_message: format!( - "Error from Canister {}: Canister violated contract: ic0.mint_cycles cannot be executed on non Cycles Minting Canister: {} != {}.\nThis is likely an error with the compiler/CDK toolchain being used to build the canister. Please report the error to IC devs on the forum: https://forum.dfinity.org and include which language/CDK was used to create the canister.", - canister_id, canister_id, - CYCLES_MINTING_CANISTER_ID), - error_code: Some("IC0504".to_string())}) - ); - assert!( - after_balance == before_balance, - "expected {} == {}", - after_balance, - before_balance - ); -} - pub fn mint_cycles128_not_supported_on_application_subnet(env: TestEnv) { let app_node = env.get_first_healthy_application_node_snapshot(); let (res, before_balance, after_balance, canister_id) = setup_ucan_and_try_mint128(app_node);