diff --git a/e2e/tests-dfx/cycles-ledger.bash b/e2e/tests-dfx/cycles-ledger.bash index d9c995134a..540fa6c470 100644 --- a/e2e/tests-dfx/cycles-ledger.bash +++ b/e2e/tests-dfx/cycles-ledger.bash @@ -30,7 +30,7 @@ add_cycles_ledger_canisters_to_project() { } deploy_cycles_ledger() { - assert_command dfx deploy cycles-ledger --specified-id "um5iw-rqaaa-aaaaq-qaaba-cai" + assert_command dfx deploy cycles-ledger --specified-id "um5iw-rqaaa-aaaaq-qaaba-cai" --argument '(variant { Init = record { max_transactions_per_request = 100; index_id = null; } })' assert_command dfx deploy cycles-depositor --argument "(record {ledger_id = principal \"$(dfx canister id cycles-ledger)\"})" --with-cycles 10000000000000 --specified-id "ul4oc-4iaaa-aaaaq-qaabq-cai" } @@ -446,24 +446,24 @@ current_time_nanoseconds() { dfx identity use alice export DFX_DISABLE_AUTO_WALLET=1 t=$(current_time_nanoseconds) - assert_command dfx canister create e2e_project_backend --with-cycles 1T --created-at-time "$t" --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" + assert_command dfx canister create e2e_project_backend --with-cycles 1T --created-at-time "$t" assert_command dfx canister id e2e_project_backend E2E_PROJECT_BACKEND_CANISTER_ID=$(dfx canister id e2e_project_backend) - assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --precise + assert_command dfx cycles balance --precise assert_eq "12399900000000 cycles." # forget about canister. If --created-at-time is a valid idempotency key we should end up with the same canister id rm .dfx/local/canister_ids.json - assert_command dfx canister create e2e_project_backend --with-cycles 1T --created-at-time "$t" --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" + assert_command dfx canister create e2e_project_backend --with-cycles 1T --created-at-time "$t" assert_command dfx canister id e2e_project_backend assert_contains "$E2E_PROJECT_BACKEND_CANISTER_ID" - assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --precise + assert_command dfx cycles balance --precise assert_eq "12399900000000 cycles." dfx canister stop e2e_project_backend dfx canister delete e2e_project_backend - assert_command dfx canister create e2e_project_backend --with-cycles 0.5T --from-subaccount "$ALICE_SUBACCT1" --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" + assert_command dfx canister create e2e_project_backend --with-cycles 0.5T --from-subaccount "$ALICE_SUBACCT1" assert_command dfx canister id e2e_project_backend - assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --subaccount "$ALICE_SUBACCT1" --precise + assert_command dfx cycles balance --subaccount "$ALICE_SUBACCT1" --precise assert_eq "2099900000000 cycles." # reset deployment status @@ -471,33 +471,33 @@ current_time_nanoseconds() { # using dfx deploy t=$(current_time_nanoseconds) - assert_command dfx deploy e2e_project_backend --with-cycles 1T --created-at-time "$t" --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" + assert_command dfx deploy e2e_project_backend --with-cycles 1T --created-at-time "$t" assert_command dfx canister id e2e_project_backend E2E_PROJECT_BACKEND_CANISTER_ID=$(dfx canister id e2e_project_backend) - assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --precise + assert_command dfx cycles balance --precise assert_eq "11399800000000 cycles." # reset and forget about canister. If --created-at-time is a valid idempotency key we should end up with the same canister id dfx canister uninstall-code e2e_project_backend rm .dfx/local/canister_ids.json - assert_command dfx deploy e2e_project_backend --with-cycles 1T --created-at-time "$t" --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" -vv + assert_command dfx deploy e2e_project_backend --with-cycles 1T --created-at-time "$t" -vv assert_command dfx canister id e2e_project_backend assert_contains "$E2E_PROJECT_BACKEND_CANISTER_ID" - assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --precise + assert_command dfx cycles balance --precise assert_eq "11399800000000 cycles." dfx canister stop e2e_project_backend dfx canister delete e2e_project_backend - assert_command dfx deploy e2e_project_backend --with-cycles 0.5T --from-subaccount "$ALICE_SUBACCT1" --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" + assert_command dfx deploy e2e_project_backend --with-cycles 0.5T --from-subaccount "$ALICE_SUBACCT1" assert_command dfx canister id e2e_project_backend - assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --subaccount "$ALICE_SUBACCT1" --precise + assert_command dfx cycles balance --subaccount "$ALICE_SUBACCT1" --precise assert_eq "1599800000000 cycles." dfx canister stop e2e_project_backend dfx canister delete e2e_project_backend - assert_command dfx deploy --with-cycles 1T --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" + assert_command dfx deploy --with-cycles 1T assert_command dfx canister id e2e_project_backend assert_command dfx canister id e2e_project_frontend assert_not_contains "$(dfx canister id e2e_project_backend)" - assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --precise + assert_command dfx cycles balance --precise assert_eq "9399600000000 cycles." } diff --git a/e2e/utils/cycles-ledger.bash b/e2e/utils/cycles-ledger.bash index fa35e6a6a4..0abce204ce 100644 --- a/e2e/utils/cycles-ledger.bash +++ b/e2e/utils/cycles-ledger.bash @@ -34,7 +34,3 @@ install_cycles_ledger_canisters() { download_cycles_ledger_canisters cp "$(downloaded_cycles_ledger_canisters_dir)"/* . } - -deploy_cycles_ledger() { - dfx deploy cycles-ledger --argument '(variant { Init = record { max_transactions_per_request = 100; index_id = null; } })' -} diff --git a/src/dfx/src/commands/canister/create.rs b/src/dfx/src/commands/canister/create.rs index a5ba194086..256142a1cd 100644 --- a/src/dfx/src/commands/canister/create.rs +++ b/src/dfx/src/commands/canister/create.rs @@ -93,12 +93,6 @@ pub struct CanisterCreateOpts { //TODO(SDK-1331): unhide #[arg(long, value_parser = icrc_subaccount_parser, hide = true)] from_subaccount: Option, - - /// Canister ID of the cycles ledger canister. - /// If not specified, the default cycles ledger canister ID will be used. - // todo: remove this. See https://dfinity.atlassian.net/browse/SDK-1262 - #[arg(long, hide = true)] - cycles_ledger_canister_id: Option, } pub async fn exec( @@ -225,7 +219,6 @@ pub async fn exec( reserved_cycles_limit, }, opts.created_at_time, - opts.cycles_ledger_canister_id, ) .await?; Ok(()) @@ -296,7 +289,6 @@ pub async fn exec( reserved_cycles_limit, }, opts.created_at_time, - opts.cycles_ledger_canister_id, ) .await?; } diff --git a/src/dfx/src/commands/deploy.rs b/src/dfx/src/commands/deploy.rs index f41bb1eb27..b546047c57 100644 --- a/src/dfx/src/commands/deploy.rs +++ b/src/dfx/src/commands/deploy.rs @@ -111,12 +111,6 @@ pub struct DeployOpts { //TODO(SDK-1331): unhide #[arg(long, value_parser = icrc_subaccount_parser, hide = true)] from_subaccount: Option, - - /// Canister ID of the cycles ledger canister. - /// If not specified, the default cycles ledger canister ID will be used. - // todo: remove this. See https://dfinity.atlassian.net/browse/SDK-1262 - #[arg(long, hide = true)] - cycles_ledger_canister_id: Option, } pub fn exec(env: &dyn Environment, opts: DeployOpts) -> DfxResult { @@ -193,7 +187,6 @@ pub fn exec(env: &dyn Environment, opts: DeployOpts) -> DfxResult { opts.yes, env_file, opts.no_asset_upgrade, - opts.cycles_ledger_canister_id, ))?; if matches!(deploy_mode, NormalDeploy | ForceReinstallSingleCanister(_)) { diff --git a/src/dfx/src/lib/operations/canister/create_canister.rs b/src/dfx/src/lib/operations/canister/create_canister.rs index 96ef2325e7..7e0f0c0fef 100644 --- a/src/dfx/src/lib/operations/canister/create_canister.rs +++ b/src/dfx/src/lib/operations/canister/create_canister.rs @@ -33,7 +33,6 @@ pub async fn create_canister( from_subaccount: Option, settings: DfxCanisterSettings, created_at_time: Option, - cycles_ledger_canister_id: Option, ) -> DfxResult { let log = env.get_logger(); info!(log, "Creating canister {}...", canister_name); @@ -84,7 +83,6 @@ pub async fn create_canister( let auto_wallet_disabled = std::env::var("DFX_DISABLE_AUTO_WALLET").is_ok(); let ic_network = env.get_network_descriptor().is_ic; if CYCLES_LEDGER_ENABLED && (ic_network || auto_wallet_disabled) { - let Some(cycles_ledger_canister_id) = cycles_ledger_canister_id else { bail!("Must specify cycles ledger canister id")}; create_with_cycles_ledger( env, agent, @@ -93,7 +91,6 @@ pub async fn create_canister( from_subaccount, settings, created_at_time, - cycles_ledger_canister_id, ) .await } else { diff --git a/src/dfx/src/lib/operations/canister/deploy_canisters.rs b/src/dfx/src/lib/operations/canister/deploy_canisters.rs index 1ecfc695f6..ecf1baa015 100644 --- a/src/dfx/src/lib/operations/canister/deploy_canisters.rs +++ b/src/dfx/src/lib/operations/canister/deploy_canisters.rs @@ -53,7 +53,6 @@ pub async fn deploy_canisters( skip_consent: bool, env_file: Option, no_asset_upgrade: bool, - cycles_ledger_canister_id: Option, ) -> DfxResult { let log = env.get_logger(); @@ -144,7 +143,6 @@ pub async fn deploy_canisters( from_subaccount, created_at_time, &config, - cycles_ledger_canister_id, ) .await?; } else { @@ -217,7 +215,6 @@ async fn register_canisters( from_subaccount: Option, created_at_time: Option, config: &Config, - cycles_ledger_canister_id: Option, ) -> DfxResult { let canisters_to_create = canister_names .iter() @@ -282,7 +279,6 @@ async fn register_canisters( reserved_cycles_limit, }, created_at_time, - cycles_ledger_canister_id, ) .await?; } diff --git a/src/dfx/src/lib/operations/cycles_ledger.rs b/src/dfx/src/lib/operations/cycles_ledger.rs index 81ee442890..52925384c5 100644 --- a/src/dfx/src/lib/operations/cycles_ledger.rs +++ b/src/dfx/src/lib/operations/cycles_ledger.rs @@ -196,7 +196,6 @@ pub async fn create_with_cycles_ledger( from_subaccount: Option, settings: DfxCanisterSettings, created_at_time: Option, - cycles_ledger_canister_id: Principal, ) -> DfxResult { #[derive(CandidType, Clone, Debug)] // TODO(FI-1022): Import types from cycles ledger crate once available @@ -268,7 +267,7 @@ pub async fn create_with_cycles_ledger( let result = loop { match agent - .update(&cycles_ledger_canister_id, CREATE_CANISTER_METHOD) + .update(&CYCLES_LEDGER_CANISTER_ID, CREATE_CANISTER_METHOD) .with_arg( Encode!(&CreateCanisterArgs { from_subaccount,