diff --git a/.github/workflows/publish-dfxvm-install-script.yml b/.github/workflows/publish-dfxvm-install-script.yml new file mode 100644 index 0000000000..5ab630cdcc --- /dev/null +++ b/.github/workflows/publish-dfxvm-install-script.yml @@ -0,0 +1,44 @@ +name: Publish dfxvm install script + +on: + push: + branches: + - sdk-1278-dfxvm-install-script + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + # When getting Rust dependencies, retry on network error: + CARGO_NET_RETRY: 10 + # Use the local .curlrc + CURL_HOME: . + +jobs: + publish-manifest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install shfmt + run: go install mvdan.cc/sh/v3/cmd/shfmt@latest + - name: Generate + run: | + shellcheck --shell=sh public/install/*.sh --exclude SC2154,SC2034,SC3003,SC3014,SC3043 + ~/go/bin/shfmt -d -p -i 4 -ci -bn -s public/install/*.sh + sed -i "s/@revision@/${GITHUB_SHA}/" public/install/999_footer.sh + mkdir _out + cat public/install/*.sh > _out/install.sh + sed -i " + /#!.*/p + /##.*/p + /^ *$/d + /^ *#/d + s/ *#.*// + " _out/install.sh + - name: Upload Artifacts + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + single_commit: yes + branch: dfxvm-install-script + folder: _out/ diff --git a/CHANGELOG.md b/CHANGELOG.md index c594f4f3c9..fae22bc965 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ # UNRELEASED +### feat: `dfx ledger top-up` also accepts canister names + +Previously, `dfx ledger top-up` only accepted canister principals. Now it accepts both principals and canister names. + +### fix: installer once again detects if curl supports tlsv1.2 + +A change to `curl --help` output made it so the install script did not detect +that the `--proto` and `--tlsv1.2` options are available. + +# 0.15.2 + ### fix: `dfx canister delete ` removes the related entry from the canister id store Previously, deleting a canister in the project by id rather than by name diff --git a/Cargo.lock b/Cargo.lock index c7d45434fc..86b31e3f8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3935,9 +3935,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.58" +version = "0.10.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9dfc0783362704e97ef3bd24261995a699468440099ef95d869b4d9732f829a" +checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" dependencies = [ "bitflags 2.4.1", "cfg-if 1.0.0", @@ -3976,9 +3976,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.94" +version = "0.9.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f55da20b29f956fb01f0add8683eb26ee13ebe3ebd935e49898717c6b4b2830" +checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" dependencies = [ "cc", "libc", diff --git a/docs/cli-reference/dfx-ledger.md b/docs/cli-reference/dfx-ledger.md index 25906e3a07..20f64b56a6 100644 --- a/docs/cli-reference/dfx-ledger.md +++ b/docs/cli-reference/dfx-ledger.md @@ -276,9 +276,9 @@ dfx ledger top-up [options] canister [flag] --network ic You can specify the following argument for the `dfx ledger top-up` command. -| Argument | Description | -|------------|------------------------------------------------------------------| -| `canister` | Specifies the canister identifier that you would like to top up. | +| Argument | Description | +|------------|--------------------------------------------------------------------------| +| `canister` | Specifies the canister identifier or name that you would like to top up. | ### Options diff --git a/e2e/tests-dfx/ledger.bash b/e2e/tests-dfx/ledger.bash index 56a0375a87..b22c6f0c99 100644 --- a/e2e/tests-dfx/ledger.bash +++ b/e2e/tests-dfx/ledger.bash @@ -184,6 +184,12 @@ tc_to_num() { assert_contains "Using transfer at block height $block_height" "$stdout" # shellcheck disable=SC2154 assert_contains "Canister was topped up with" "$stdout" + + # Top up canister by name instead of principal + dfx_new + assert_command dfx canister create e2e_project_backend + assert_command dfx ledger top-up e2e_project_backend --amount 5 + assert_contains "Canister was topped up with 617283500000000 cycles" } @test "ledger create-canister" { diff --git a/e2e/utils/cycles-ledger.bash b/e2e/utils/cycles-ledger.bash index c58fa1cde2..0409faa0e4 100644 --- a/e2e/utils/cycles-ledger.bash +++ b/e2e/utils/cycles-ledger.bash @@ -1,7 +1,7 @@ CYCLES_LEDGER_VERSION="0.2.1" build_artifact_url() { - echo "https://raw.githubusercontent.com/dfinity/sdk/cycles-ledger-prerelease/cycles-ledger-v$CYCLES_LEDGER_VERSION/${1}" + echo "https://github.com/dfinity/cycles-ledger/releases/download/cycles-ledger-v$CYCLES_LEDGER_VERSION/${1}" } downloaded_cycles_ledger_canisters_dir() { @@ -22,7 +22,7 @@ download_cycles_ledger_canisters() { for name in cycles-ledger cycles-depositor; do for ext in wasm.gz wasm.gz.sha256 did; do URL=$(build_artifact_url "${name}.${ext}") - curl -v --fail -o "$DOWNLOAD_DIR/${name}.${ext}" "$URL" + curl -v -L --fail -o "$DOWNLOAD_DIR/${name}.${ext}" "$URL" done done diff --git a/public/install/200_downloader.sh b/public/install/200_downloader.sh index 4916e4a216..db2a8b7f8e 100644 --- a/public/install/200_downloader.sh +++ b/public/install/200_downloader.sh @@ -26,7 +26,7 @@ check_help_for() { fi for _arg in "$@"; do - if ! "$_cmd" --help | grep -q -- "$_arg"; then + if ! "$_cmd" --help all | grep -q -- "$_arg"; then _ok="n" fi done diff --git a/public/manifest.json b/public/manifest.json index 9aae0ffe24..d302e1a0e0 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,6 +1,6 @@ { "tags": { - "latest": "0.15.1" + "latest": "0.15.2" }, "versions": [ "0.5.0", @@ -59,6 +59,7 @@ "0.14.3", "0.14.4", "0.15.0", - "0.15.1" + "0.15.1", + "0.15.2" ] } diff --git a/src/dfx/src/commands/ledger/top_up.rs b/src/dfx/src/commands/ledger/top_up.rs index 80265460f0..2c3defd80a 100644 --- a/src/dfx/src/commands/ledger/top_up.rs +++ b/src/dfx/src/commands/ledger/top_up.rs @@ -17,7 +17,7 @@ const MEMO_TOP_UP_CANISTER: u64 = 1347768404_u64; /// Top up a canister with cycles minted from ICP #[derive(Parser)] pub struct TopUpOpts { - /// Specify the canister id to top up + /// Specify the canister id or name to top up canister: String, /// Subaccount to withdraw from @@ -58,12 +58,14 @@ pub async fn exec(env: &dyn Environment, opts: TopUpOpts) -> DfxResult { let memo = Memo(MEMO_TOP_UP_CANISTER); - let to = Principal::from_text(&opts.canister).with_context(|| { - format!( - "Failed to parse {:?} as target canister principal.", - &opts.canister - ) - })?; + let to = Principal::from_text(&opts.canister) + .or_else(|_| env.get_canister_id_store()?.get(&opts.canister)) + .with_context(|| { + format!( + "Failed to parse {:?} as target canister principal or name.", + &opts.canister + ) + })?; let agent = env.get_agent();