From 76d0f3e6ba754c8621d032adae06368d955779be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:33:19 +0000 Subject: [PATCH 1/6] build(deps): Bump openssl from 0.10.58 to 0.10.60 (#3456) --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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", From 0626571032b7f68b016e3d68cc7a428c74166be8 Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Wed, 29 Nov 2023 13:17:49 +0100 Subject: [PATCH 2/6] chore: change to permanent cycles ledger url (#3457) Now that the cycles ledger repo is open-sourced we can use it as the place to download the cycles ledger wasm --- e2e/utils/cycles-ledger.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 29f3a83ebc92703d70b286e33446c51d9d188420 Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Fri, 1 Dec 2023 16:50:49 +0100 Subject: [PATCH 3/6] feat: dfx ledger top-up also accepts canister names (#3458) `dfx ledger top-up` so far only accepts canister principals, but not names. With this PR it will also accept canister names like every other command does. --- CHANGELOG.md | 4 ++++ docs/cli-reference/dfx-ledger.md | 6 +++--- e2e/tests-dfx/ledger.bash | 6 ++++++ src/dfx/src/commands/ledger/top_up.rs | 16 +++++++++------- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c594f4f3c9..515e2de4fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,10 @@ Certain suffixes that replace a number of zeros are now supported. The (case-ins For cycles an additional `c` or `C` is also acceptable. For example: `dfx canister deposit-cycles 3TC mycanister` +### 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. + ### feat: added `dfx cycles` command This won't work on mainnet yet, but can work locally after installing the cycles ledger. 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/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(); From 8732f01781e6fdfaf49dc4e5621b1a481562017b Mon Sep 17 00:00:00 2001 From: Marcin Nowak-Liebiediew Date: Fri, 1 Dec 2023 18:31:34 +0100 Subject: [PATCH 4/6] chore: promote dfx 0.15.2 (#3460) --- CHANGELOG.md | 10 ++++++---- public/manifest.json | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 515e2de4fe..00b780ca57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ # 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. + +# 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 @@ -48,10 +54,6 @@ Certain suffixes that replace a number of zeros are now supported. The (case-ins For cycles an additional `c` or `C` is also acceptable. For example: `dfx canister deposit-cycles 3TC mycanister` -### 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. - ### feat: added `dfx cycles` command This won't work on mainnet yet, but can work locally after installing the cycles ledger. 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" ] } From 20583ed80121e82b94c21a03129938af5330e35d Mon Sep 17 00:00:00 2001 From: Eric Swanson <64809312+ericswanson-dfinity@users.noreply.github.com> Date: Fri, 1 Dec 2023 17:50:21 -0800 Subject: [PATCH 5/6] feat: publish dfxvm install script from feature branch (#3461) --- .../publish-dfxvm-install-script.yml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/publish-dfxvm-install-script.yml 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/ From b179e5111af820a37293adf8bf0d26df77a358d5 Mon Sep 17 00:00:00 2001 From: Eric Swanson <64809312+ericswanson-dfinity@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:49:40 -0800 Subject: [PATCH 6/6] fix: enable tlsv1.2 if curl supports it (#3464) curl 7.73 (see https://github.com/curl/curl/commit/aa8777f63febca6a13f6b86e141a832232560037) changed the output of `curl --help` to display categories, rather than all of the options, unless you pass `--help all`. This caused the install script to run in a less secure mode. The install script also calls "wget --help". "wget --help all" works at least as far back as 1.5.3 (~2015). Also checked "curl --help all" with curl 7.54.0. It shows the same output as "curl --help" and returns exit code 0. --- CHANGELOG.md | 5 +++++ public/install/200_downloader.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00b780ca57..fae22bc965 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ 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 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