diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 94b4d4c803..78f1ed852e 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -156,6 +156,7 @@ jobs: runs-on: ${{ matrix.os }} needs: [build_dfx] strategy: + fail-fast: false matrix: os: [macos-12, ubuntu-20.04, ubuntu-22.04] steps: @@ -191,6 +192,12 @@ jobs: --frontend_url "$FRONTEND_URL" \ --candid_url "$CANDID_URL" \ --browser chromium firefox webkit + export FRONTEND_URL_LOCALHOST="${FRONTEND_URL/127\.0\.0\.1/localhost}" + export CANDID_URL_LOCALHOST="${CANDID_URL/127\.0\.0\.1/localhost}" + python scripts/test-uis.py \ + --frontend_url "$FRONTEND_URL_LOCALHOST" \ + --candid_url "$CANDID_URL_LOCALHOST" \ + --browser chromium firefox webkit aggregate: name: e2e:required diff --git a/.gitignore b/.gitignore index 57b04341e9..5e2c1a7804 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,6 @@ target/ # Backup files *.bak + +# DB repo for cargo-audit +advisory-db/ diff --git a/CHANGELOG.md b/CHANGELOG.md index f230c1dddd..8a4982270d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,34 @@ # UNRELEASED +### fix!: always fetch did file from canister when making canister calls + +`dfx canister call` will always fetch did file from the canister metadata. This is especially helpful for calling remote canisters. It's a breaking change in the sense that if the canister doesn't have the `candid:service` metadata, we will not read the local did file from build artifact, and dfx will issue a warning in this case to encourage canister developers to put the did file into canister metadata. + +### fix: support `import` for local did file + +If the local did file contains `import` or init args, dfx will rewrite the did file when storing in canister metadata. +Due to current limitations of the Candid parser, comments will be dropped during rewriting. +If the local did file doesn't contain `import` or init args, we will not perform the rewriting, thus preserving the comments. + +### fix: subtyping check reports the special opt rule as error + +### fix: can now run several dfx canister commands outside of a project + +The following commands now work outside of a project: +- `dfx canister start ` +- `dfx canister stop ` +- `dfx canister deposit-cycles ` +- `dfx canister uninstall-code ` + +# 0.16.0 + +### feat: large canister modules now supported + +When using `dfx deploy` or `dfx canister install`, previously WASM modules larger than 2MiB would be rejected. +They are now automatically submitted via the chunking API if they are large enough. +From a user perspective the limitation will simply have been lifted. + ### feat: dfx deps: wasm_hash_url and loose the hash check Providers can provide the hash through `wasm_hash_url` instead of hard coding the hash directly. @@ -34,6 +62,10 @@ Updated to candid 0.10, ic-cdk 0.12, and ic-cdk-timers 0.6 They've always been stored with nanosecond precisions on Linux and Macos. Now they are stored with nanosecond precision on Windows too. +### fix: dfx canister delete, when using an HSM identity, no longer fails by trying to open two sessions to the HSM + +Previously, this would fail with a PKCS#11: CKR_CRYPTOKI_ALREADY_INITIALIZED error. + ## Dependencies ### Motoko @@ -42,7 +74,32 @@ Updated Motoko to [0.10.4](https://github.com/dfinity/motoko/releases/tag/0.10.4 ### Frontend canister -Module hash: b625e04115725038808dcd6db1e398def28e981f8d6de464bb8438b2656864c8 +Module hash: 3c86d912ead6de7133b9f787df4ca9feee07bea8835d3ed594b47ee89e6cb730 + +### Candid UI + +Module hash: b91e3dd381aedb002633352f8ebad03b6eee330b7e30c3d15a5657e6f428d815 + +Fix the routing error when deploying to gitpod/github workspace. +Fix that Candid UI cannot be opened using localhost URL. + +### Replica + +Updated replica to elected commit 324eb99eb7531369a5ef75560f1a1a652d123714. +This incorporates the following executed proposals: + +- [127096](https://dashboard.internetcomputer.org/proposal/127096) +- [127094](https://dashboard.internetcomputer.org/proposal/127094) +- [127034](https://dashboard.internetcomputer.org/proposal/127034) +- [127031](https://dashboard.internetcomputer.org/proposal/127031) +- [126879](https://dashboard.internetcomputer.org/proposal/126879) +- [126878](https://dashboard.internetcomputer.org/proposal/126878) +- [126730](https://dashboard.internetcomputer.org/proposal/126730) +- [126729](https://dashboard.internetcomputer.org/proposal/126729) +- [126727](https://dashboard.internetcomputer.org/proposal/126727) +- [126366](https://dashboard.internetcomputer.org/proposal/126366) +- [126365](https://dashboard.internetcomputer.org/proposal/126365) +- [126293](https://dashboard.internetcomputer.org/proposal/126293) # 0.15.3 diff --git a/Cargo.lock b/Cargo.lock index f57c19b0d9..0cefd278cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -329,6 +329,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + [[package]] name = "async-io" version = "1.13.0" @@ -433,12 +439,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23ce669cd6c8588f79e15cf450314f9638f967fc5770ff1c7c1deb0925ea7cfa" -[[package]] -name = "base64" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" - [[package]] name = "base64" version = "0.13.1" @@ -734,34 +734,38 @@ dependencies = [ ] [[package]] -name = "candid" -version = "0.8.4" +name = "cached" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "244005a1917bb7614cd775ca8a5d59efeb5ac74397bb14ba29a19347ebd78591" +checksum = "69b0116662497bc24e4b177c90eaf8870e39e2714c3fcfa296327a93f593fc21" dependencies = [ - "anyhow", - "binread", - "byteorder", - "candid_derive 0.5.0", - "codespan-reporting", - "crc32fast", - "data-encoding", - "hex", - "lalrpop 0.19.12", - "lalrpop-util 0.19.12", - "leb128", - "logos 0.12.1", - "num-bigint 0.4.4", - "num-traits", - "num_enum", - "paste", - "pretty 0.10.0", - "serde", - "serde_bytes", - "sha2 0.10.8", + "ahash 0.8.6", + "cached_proc_macro", + "cached_proc_macro_types", + "hashbrown 0.14.2", + "instant", + "once_cell", "thiserror", ] +[[package]] +name = "cached_proc_macro" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c878c71c2821aa2058722038a59a67583a4240524687c6028571c9b395ded61f" +dependencies = [ + "darling 0.14.4", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cached_proc_macro_types" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a4f925191b4367301851c6d99b09890311d74b0d43f274c0b34c86d308a3663" + [[package]] name = "candid" version = "0.10.2" @@ -771,7 +775,7 @@ dependencies = [ "anyhow", "binread", "byteorder", - "candid_derive 0.6.5", + "candid_derive", "hex", "ic_principal", "leb128", @@ -785,18 +789,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "candid_derive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f1f4db7c7d04b87b70b3a35c5dc5c2c9dd73cef8bdf6760e2f18a0d45350dd" -dependencies = [ - "lazy_static", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "candid_derive" version = "0.6.5" @@ -817,14 +809,14 @@ checksum = "36381de3ba8a312deb028552c0d63f7c7fe6e204f44bae4c58a3643308cfa9d5" dependencies = [ "anyhow", "arbitrary", - "candid 0.10.2", + "candid", "codespan-reporting", "convert_case 0.6.0", "fake", "hex", - "lalrpop 0.20.0", - "lalrpop-util 0.20.0", - "logos 0.13.0", + "lalrpop", + "lalrpop-util", + "logos", "num-bigint 0.4.4", "num-traits", "pretty 0.12.3", @@ -872,6 +864,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-targets 0.48.5", ] @@ -1039,6 +1032,16 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen", +] + [[package]] name = "const-oid" version = "0.9.5" @@ -1303,8 +1306,18 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.13.4", + "darling_macro 0.13.4", +] + +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core 0.14.4", + "darling_macro 0.14.4", ] [[package]] @@ -1321,13 +1334,38 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 1.0.109", +] + [[package]] name = "darling_macro" version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ - "darling_core", + "darling_core 0.13.4", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core 0.14.4", "quote", "syn 1.0.109", ] @@ -1390,7 +1428,7 @@ dependencies = [ [[package]] name = "derive_more" version = "0.99.8-alpha.0" -source = "git+https://github.com/dfinity-lab/derive_more?branch=master#9f1b894e6fde640da4e9ea71a8fc0e4dd98d01da" +source = "git+https://github.com/dfinity-lab/derive_more?rev=9f1b894e6fde640da4e9ea71a8fc0e4dd98d01da#9f1b894e6fde640da4e9ea71a8fc0e4dd98d01da" dependencies = [ "proc-macro2", "quote", @@ -1417,7 +1455,7 @@ dependencies = [ "base64 0.13.1", "byte-unit", "bytes", - "candid 0.10.2", + "candid", "candid_parser", "ci_info", "clap", @@ -1502,8 +1540,7 @@ dependencies = [ "bip32", "byte-unit", "bytes", - "candid 0.10.2", - "candid_parser", + "candid", "clap", "dialoguer", "directories-next", @@ -1572,13 +1609,14 @@ dependencies = [ [[package]] name = "dialoguer" -version = "0.10.4" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87" +checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de" dependencies = [ "console", "shell-words", "tempfile", + "thiserror", "zeroize", ] @@ -1885,15 +1923,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" -[[package]] -name = "features" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83072b3c84e55f9d0c0ff36a4575d0fd2e543ae4a56e04e7f5a9222188d574e3" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "ff" version = "0.12.1" @@ -1943,15 +1972,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "float-cmp" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" -dependencies = [ - "num-traits", -] - [[package]] name = "fn-error-context" version = "0.2.1" @@ -2211,9 +2231,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -2221,7 +2241,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap 2.1.0", "slab", "tokio", "tokio-util", @@ -2474,17 +2494,17 @@ dependencies = [ [[package]] name = "ic-agent" version = "0.31.0" -source = "git+https://github.com/dfinity/agent-rs.git?rev=a7f44ad05e77fc89b8447dd65b345e7a62fd1042#a7f44ad05e77fc89b8447dd65b345e7a62fd1042" +source = "git+https://github.com/dfinity/agent-rs.git?rev=6b02f649a569f354a0a1b370368ba28d31dd8702#6b02f649a569f354a0a1b370368ba28d31dd8702" dependencies = [ "backoff", "cached 0.46.1", - "candid 0.10.2", + "candid", "ed25519-consensus", "futures-util", "hex", "http", "http-body", - "ic-certification 2.3.0", + "ic-certification 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ic-transport-types", "ic-verify-bls-signature", "k256 0.13.1", @@ -2514,7 +2534,7 @@ name = "ic-asset" version = "0.20.0" dependencies = [ "backoff", - "candid 0.10.2", + "candid", "derivative", "dfx-core", "flate2", @@ -2543,53 +2563,68 @@ dependencies = [ [[package]] name = "ic-base-types" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ "base32", "byte-unit", "bytes", - "candid 0.8.4", + "candid", "comparable", "crc32fast", - "ic-crypto-sha", + "ic-crypto-sha2", "ic-protobuf", + "ic-stable-structures", "phantom_newtype", "prost", "serde", - "strum 0.23.0", - "strum_macros 0.23.1", + "strum 0.25.0", + "strum_macros 0.25.3", ] [[package]] -name = "ic-btc-types" +name = "ic-btc-interface" version = "0.1.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +source = "git+https://github.com/dfinity/bitcoin-canister?rev=9b239d1d67253eb14a35be6061e3967d5ec9db9d#9b239d1d67253eb14a35be6061e3967d5ec9db9d" dependencies = [ - "candid 0.8.4", + "candid", "serde", "serde_bytes", ] [[package]] name = "ic-btc-types-internal" -version = "0.1.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ - "candid 0.8.4", - "ic-btc-types", + "candid", + "ic-btc-interface", + "ic-error-types", "ic-protobuf", "serde", "serde_bytes", ] +[[package]] +name = "ic-cbor" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "027916ece94814fc7eebad43f91d691988ac8294121f54e8f22f4611c7d17f17" +dependencies = [ + "candid", + "ic-certification 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "leb128", + "nom", + "thiserror", +] + [[package]] name = "ic-cdk" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f3d204af0b11c45715169c997858edb58fa8407d08f4fae78a6b415dd39a362" dependencies = [ - "candid 0.10.2", + "candid", "ic-cdk-macros", "ic0", "serde", @@ -2602,7 +2637,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5a618e4020cea88e933d8d2f8c7f86d570ec06213506a80d4f2c520a9bba512" dependencies = [ - "candid 0.10.2", + "candid", "proc-macro2", "quote", "serde", @@ -2611,20 +2646,29 @@ dependencies = [ ] [[package]] -name = "ic-certification" -version = "0.23.2" +name = "ic-certificate-verification" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb68e0ea2fe6b533ddab6ae2142274f9669acacbacd83ac64bb1cd268d33104" +checksum = "74807b58655db518e68de1d65e1734da76af43949569b752aa27237e206bd4ad" dependencies = [ - "hex", + "cached 0.47.0", + "candid", + "ic-cbor", + "ic-certification 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "leb128", + "miracl_core_bls12381", + "nom", + "parking_lot 0.12.1", "sha2 0.10.8", + "thiserror", ] [[package]] name = "ic-certification" -version = "1.3.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c04340437a32c8b9c80d36f09715909c1e0a755327503a2e2906dcd662ba4e" +checksum = "b79fd38f674173bd0af3c80b9dab6fedd3391b81a2fc0f87a2e393fb723fe13b" dependencies = [ "hex", "serde", @@ -2635,8 +2679,7 @@ dependencies = [ [[package]] name = "ic-certification" version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b79fd38f674173bd0af3c80b9dab6fedd3391b81a2fc0f87a2e393fb723fe13b" +source = "git+https://github.com/dfinity/response-verification.git?rev=a65009624b61736df6d2dc17756bdbd02a84f599#a65009624b61736df6d2dc17756bdbd02a84f599" dependencies = [ "hex", "serde", @@ -2644,17 +2687,44 @@ dependencies = [ "sha2 0.10.8", ] +[[package]] +name = "ic-certification-testing" +version = "2.3.0" +source = "git+https://github.com/dfinity/response-verification.git?rev=a65009624b61736df6d2dc17756bdbd02a84f599#a65009624b61736df6d2dc17756bdbd02a84f599" +dependencies = [ + "console_error_panic_hook", + "getrandom", + "ic-crypto-internal-seed", + "ic-crypto-internal-threshold-sig-bls12381", + "ic-crypto-internal-types", + "ic-crypto-tree-hash", + "ic-types", + "js-sys", + "leb128", + "log", + "rand", + "serde", + "serde-wasm-bindgen", + "serde_cbor", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-console-logger", +] + [[package]] name = "ic-certified-assets" version = "0.2.5" dependencies = [ + "anyhow", "base64 0.13.1", - "candid 0.10.2", + "candid", "candid_parser", "hex", "ic-cdk", - "ic-certification 1.3.0", + "ic-certification 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ic-certification-testing", "ic-crypto-tree-hash", + "ic-http-certification", "ic-representation-independent-hash", "ic-response-verification", "ic-response-verification-test-utils", @@ -2666,38 +2736,28 @@ dependencies = [ "sha2 0.10.8", ] -[[package]] -name = "ic-certified-map" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6adc65afeffc619a7cd19553c66c79820908c12f42191af90cfb39e2e93c4431" -dependencies = [ - "serde", - "serde_bytes", - "sha2 0.10.8", -] - [[package]] name = "ic-constants" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" [[package]] name = "ic-crypto-getrandom-for-wasm" -version = "0.1.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ "getrandom", ] [[package]] name = "ic-crypto-internal-bls12-381-type" -version = "0.1.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ "hex", "ic-crypto-getrandom-for-wasm", "ic_bls12_381", + "itertools 0.12.0", "lazy_static", "pairing", "paste", @@ -2710,11 +2770,11 @@ dependencies = [ [[package]] name = "ic-crypto-internal-seed" -version = "0.1.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ "hex", - "ic-crypto-sha", + "ic-crypto-sha2", "ic-types", "rand", "rand_chacha", @@ -2724,27 +2784,26 @@ dependencies = [ [[package]] name = "ic-crypto-internal-sha2" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ - "openssl", - "sha2 0.9.9", + "sha2 0.10.8", ] [[package]] name = "ic-crypto-internal-threshold-sig-bls12381" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ - "arrayvec 0.5.2", - "base64 0.11.0", + "base64 0.13.1", "cached 0.41.0", "hex", "ic-crypto-internal-bls12-381-type", "ic-crypto-internal-seed", "ic-crypto-internal-threshold-sig-bls12381-der", "ic-crypto-internal-types", - "ic-crypto-sha", + "ic-crypto-secrets-containers", + "ic-crypto-sha2", "ic-types", "lazy_static", "parking_lot 0.12.1", @@ -2753,96 +2812,110 @@ dependencies = [ "serde", "serde_bytes", "serde_cbor", - "strum_macros 0.23.1", + "strum_macros 0.25.3", "subtle", "zeroize", ] [[package]] name = "ic-crypto-internal-threshold-sig-bls12381-der" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ "simple_asn1", ] [[package]] name = "ic-crypto-internal-types" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ - "arrayvec 0.5.2", - "base64 0.11.0", + "arrayvec 0.7.4", "hex", "ic-protobuf", "phantom_newtype", "serde", "serde_cbor", - "strum 0.23.0", - "strum_macros 0.23.1", + "strum 0.25.0", + "strum_macros 0.25.3", "thiserror", "zeroize", ] [[package]] -name = "ic-crypto-sha" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +name = "ic-crypto-secrets-containers" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" +dependencies = [ + "serde", + "zeroize", +] + +[[package]] +name = "ic-crypto-sha2" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ "ic-crypto-internal-sha2", ] [[package]] name = "ic-crypto-tree-hash" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ + "assert_matches", "ic-crypto-internal-types", - "ic-crypto-sha", + "ic-crypto-sha2", "ic-protobuf", "serde", "serde_bytes", -] - -[[package]] -name = "ic-crypto-utils-threshold-sig-der" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" -dependencies = [ - "base64 0.11.0", - "ic-crypto-internal-threshold-sig-bls12381-der", - "ic-crypto-internal-types", - "ic-types", + "thiserror", ] [[package]] name = "ic-error-types" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ + "ic-utils 0.9.0", "serde", - "strum 0.23.0", - "strum_macros 0.23.1", + "strum 0.25.0", + "strum_macros 0.25.3", ] [[package]] name = "ic-frontend-canister" version = "0.2.5" dependencies = [ - "candid 0.10.2", + "candid", "ic-cdk", "ic-certified-assets", ] +[[package]] +name = "ic-http-certification" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1920329afced339a770ca2a56b00fb8229a63ab0dcf1bb119bdeb54b5b70dbfd" +dependencies = [ + "candid", + "http", + "ic-certification 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ic-representation-independent-hash", + "serde", + "thiserror", + "urlencoding", +] + [[package]] name = "ic-ic00-types" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ - "candid 0.8.4", - "float-cmp", + "candid", "ic-base-types", - "ic-btc-types", + "ic-btc-interface", "ic-btc-types-internal", "ic-error-types", "ic-protobuf", @@ -2850,14 +2923,14 @@ dependencies = [ "serde", "serde_bytes", "serde_cbor", - "strum 0.23.0", - "strum_macros 0.23.1", + "strum 0.25.0", + "strum_macros 0.25.3", ] [[package]] name = "ic-identity-hsm" version = "0.31.0" -source = "git+https://github.com/dfinity/agent-rs.git?rev=a7f44ad05e77fc89b8447dd65b345e7a62fd1042#a7f44ad05e77fc89b8447dd65b345e7a62fd1042" +source = "git+https://github.com/dfinity/agent-rs.git?rev=6b02f649a569f354a0a1b370368ba28d31dd8702#6b02f649a569f354a0a1b370368ba28d31dd8702" dependencies = [ "hex", "ic-agent", @@ -2869,11 +2942,11 @@ dependencies = [ [[package]] name = "ic-protobuf" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ "bincode", - "candid 0.8.4", + "candid", "erased-serde", "maplit", "prost", @@ -2884,9 +2957,9 @@ dependencies = [ [[package]] name = "ic-representation-independent-hash" -version = "0.3.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5790ff4b3752ce648d83554b3b0df1039a94bea24119d29a0f9874d796075e" +checksum = "be48db2f8b954b9b2a0f46424ddedda2728703d7b361bc65328ed17dcacd1e21" dependencies = [ "leb128", "sha2 0.10.8", @@ -2894,70 +2967,74 @@ dependencies = [ [[package]] name = "ic-response-verification" -version = "0.3.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736044d69c526fa8a2a5e54d3debd878bbd4ec10c259fd21d9e6804aef67687b" +checksum = "dd4b20dcd2bc7b1098c79dd545fa9ff7cb8cdca4345e2a823ffa73ebaf542b2b" dependencies = [ - "base64 0.13.1", - "candid 0.8.4", + "base64 0.21.5", + "candid", "flate2", + "hex", "http", - "ic-certification 0.23.2", + "ic-cbor", + "ic-certificate-verification", + "ic-certification 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ic-http-certification", "ic-representation-independent-hash", "leb128", "log", - "miracl_core_bls12381", "nom", "sha2 0.10.8", "thiserror", + "urlencoding", ] [[package]] name = "ic-response-verification-test-utils" -version = "0.3.0" -source = "git+https://github.com/dfinity/response-verification.git?rev=4686895c6070ac36109a01f4bd642caf2369b97b#4686895c6070ac36109a01f4bd642caf2369b97b" +version = "2.3.0" +source = "git+https://github.com/dfinity/response-verification.git?rev=a65009624b61736df6d2dc17756bdbd02a84f599#a65009624b61736df6d2dc17756bdbd02a84f599" dependencies = [ "base64 0.21.5", "flate2", - "getrandom", "hex", - "ic-base-types", - "ic-certified-map", - "ic-crypto-internal-seed", - "ic-crypto-internal-threshold-sig-bls12381", - "ic-crypto-internal-types", - "ic-crypto-tree-hash", - "ic-crypto-utils-threshold-sig-der", + "ic-certification 2.3.0 (git+https://github.com/dfinity/response-verification.git?rev=a65009624b61736df6d2dc17756bdbd02a84f599)", + "ic-certification-testing", "ic-types", "leb128", - "rand", "serde", "serde_cbor", - "sha256", + "sha2 0.10.8", ] +[[package]] +name = "ic-stable-structures" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95dce29e3ceb0e6da3e78b305d95365530f2efd2146ca18590c0ef3aa6038568" + [[package]] name = "ic-sys" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ "hex", - "ic-crypto-sha", + "ic-crypto-sha2", "lazy_static", "libc", - "nix 0.23.2", + "nix 0.24.3", "phantom_newtype", + "tokio", "wsl", ] [[package]] name = "ic-transport-types" version = "0.31.0" -source = "git+https://github.com/dfinity/agent-rs.git?rev=a7f44ad05e77fc89b8447dd65b345e7a62fd1042#a7f44ad05e77fc89b8447dd65b345e7a62fd1042" +source = "git+https://github.com/dfinity/agent-rs.git?rev=6b02f649a569f354a0a1b370368ba28d31dd8702#6b02f649a569f354a0a1b370368ba28d31dd8702" dependencies = [ - "candid 0.10.2", + "candid", "hex", - "ic-certification 2.3.0", + "ic-certification 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "leb128", "serde", "serde_bytes", @@ -2968,29 +3045,26 @@ dependencies = [ [[package]] name = "ic-types" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ - "base32", - "base64 0.11.0", + "base64 0.13.1", "bincode", - "candid 0.8.4", + "candid", "chrono", "derive_more", "hex", - "http", "ic-base-types", "ic-btc-types-internal", "ic-constants", "ic-crypto-internal-types", - "ic-crypto-sha", + "ic-crypto-sha2", "ic-crypto-tree-hash", "ic-error-types", "ic-ic00-types", "ic-protobuf", - "ic-utils 0.8.0", + "ic-utils 0.9.0", "maplit", - "num-traits", "once_cell", "phantom_newtype", "prost", @@ -2999,25 +3073,22 @@ dependencies = [ "serde_cbor", "serde_json", "serde_with", - "strum 0.23.0", - "strum_macros 0.23.1", + "strum 0.25.0", + "strum_macros 0.25.3", "thiserror", "thousands", - "url", ] [[package]] name = "ic-utils" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ - "bitflags 1.3.2", "cvt", - "features", "hex", "ic-sys", "libc", - "nix 0.23.2", + "nix 0.24.3", "prost", "rand", "scoped_threadpool", @@ -3028,15 +3099,17 @@ dependencies = [ [[package]] name = "ic-utils" version = "0.31.0" -source = "git+https://github.com/dfinity/agent-rs.git?rev=a7f44ad05e77fc89b8447dd65b345e7a62fd1042#a7f44ad05e77fc89b8447dd65b345e7a62fd1042" +source = "git+https://github.com/dfinity/agent-rs.git?rev=6b02f649a569f354a0a1b370368ba28d31dd8702#6b02f649a569f354a0a1b370368ba28d31dd8702" dependencies = [ "async-trait", - "candid 0.10.2", + "candid", + "futures-util", "ic-agent", "once_cell", "semver", "serde", "serde_bytes", + "sha2 0.10.8", "strum 0.24.1", "strum_macros 0.24.3", "thiserror", @@ -3062,7 +3135,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d2aa0d7deeb38f18fcec6e4c25c5004422e2e9f8c3fbad15bb795ebac37aca6" dependencies = [ "anyhow", - "candid 0.10.2", + "candid", "clap", "rustc-demangle", "serde", @@ -3081,9 +3154,9 @@ checksum = "a54b5297861c651551676e8c43df805dad175cc33bc97dbd992edbbb85dcbcdf" [[package]] name = "ic_bls12_381" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a180f02c79a71fcbc10b194406dbffd6a883c916f96be4f17ae3aeb96348c5" +checksum = "c682cb199cd8fcb582a6023325d571a6464edda26c8063fe04b6f6082a1a363c" dependencies = [ "digest 0.9.0", "ff 0.12.1", @@ -3115,7 +3188,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "804c892bf95652101660a25cea10f059f73eb8973f6b04e0349758fda1190447" dependencies = [ "base32", - "candid 0.10.2", + "candid", "crc32fast", "hex", "num-bigint 0.4.4", @@ -3131,7 +3204,7 @@ version = "0.20.0" dependencies = [ "anstyle", "anyhow", - "candid 0.10.2", + "candid", "clap", "delay", "humantime", @@ -3277,6 +3350,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -3382,28 +3464,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "lalrpop" -version = "0.19.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1cbf952127589f2851ab2046af368fd20645491bb4b376f04b7f94d7a9837b" -dependencies = [ - "ascii-canvas", - "bit-set", - "diff", - "ena", - "is-terminal", - "itertools 0.10.5", - "lalrpop-util 0.19.12", - "petgraph", - "regex", - "regex-syntax 0.6.29", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", -] - [[package]] name = "lalrpop" version = "0.20.0" @@ -3416,7 +3476,7 @@ dependencies = [ "ena", "is-terminal", "itertools 0.10.5", - "lalrpop-util 0.20.0", + "lalrpop-util", "petgraph", "pico-args", "regex", @@ -3427,15 +3487,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "lalrpop-util" -version = "0.19.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3c48237b9604c5a4702de6b824e02006c3214327564636aef27c1028a8fa0ed" -dependencies = [ - "regex", -] - [[package]] name = "lalrpop-util" version = "0.20.0" @@ -3546,22 +3597,13 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[package]] -name = "logos" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf8b031682c67a8e3d5446840f9573eb7fe26efe7ec8d195c9ac4c0647c502f1" -dependencies = [ - "logos-derive 0.12.1", -] - [[package]] name = "logos" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c000ca4d908ff18ac99b93a062cb8958d331c3220719c52e77cb19cc6ac5d2c1" dependencies = [ - "logos-derive 0.13.0", + "logos-derive", ] [[package]] @@ -3578,20 +3620,6 @@ dependencies = [ "syn 2.0.38", ] -[[package]] -name = "logos-derive" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d849148dbaf9661a6151d1ca82b13bb4c4c128146a88d05253b38d4e2f496c" -dependencies = [ - "beef", - "fnv", - "proc-macro2", - "quote", - "regex-syntax 0.6.29", - "syn 1.0.109", -] - [[package]] name = "logos-derive" version = "0.13.0" @@ -3757,12 +3785,11 @@ dependencies = [ [[package]] name = "nix" -version = "0.23.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags 1.3.2", - "cc", "cfg-if 1.0.0", "libc", "memoffset 0.6.5", @@ -3908,27 +3935,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "num_threads" version = "0.1.6" @@ -4250,10 +4256,10 @@ dependencies = [ [[package]] name = "phantom_newtype" -version = "0.8.0" -source = "git+https://github.com/dfinity/ic.git?rev=a533346f63f4091eb64692891de0d5b2ffd5b22a#a533346f63f4091eb64692891de0d5b2ffd5b22a" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic.git?rev=1290256484f59c3d950c5e9a098e97383b248ad6#1290256484f59c3d950c5e9a098e97383b248ad6" dependencies = [ - "candid 0.8.4", + "candid", "serde", "slog", ] @@ -4367,16 +4373,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -[[package]] -name = "pretty" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad9940b913ee56ddd94aec2d3cd179dd47068236f42a1a6415ccf9d880ce2a61" -dependencies = [ - "arrayvec 0.5.2", - "typed-arena", -] - [[package]] name = "pretty" version = "0.11.3" @@ -4492,9 +4488,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.9" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ "bytes", "prost-derive", @@ -4502,15 +4498,15 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", "itertools 0.10.5", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] @@ -5147,6 +5143,17 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-wasm-bindgen" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + [[package]] name = "serde_bytes" version = "0.11.12" @@ -5271,7 +5278,7 @@ version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" dependencies = [ - "darling", + "darling 0.13.4", "proc-macro2", "quote", "syn 1.0.109", @@ -5301,19 +5308,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "sha256" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7895c8ae88588ccead14ff438b939b0c569cd619116f14b4d13fdff7b8333386" -dependencies = [ - "async-trait", - "bytes", - "hex", - "sha2 0.10.8", - "tokio", -] - [[package]] name = "sha3" version = "0.10.8" @@ -5536,23 +5530,26 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" [[package]] name = "strum" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros 0.25.3", +] [[package]] name = "strum_macros" -version = "0.23.1" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "heck 0.3.3", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", @@ -5561,15 +5558,15 @@ dependencies = [ [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] @@ -6101,9 +6098,14 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", - "serde", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf8-width" version = "0.1.6" @@ -6227,6 +6229,16 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-console-logger" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7530a275e7faf7b5b83aabdf78244fb8d9a68a2ec4b26935a05ecc0c9b0185ed" +dependencies = [ + "log", + "wasm-bindgen", +] + [[package]] name = "wasm-bindgen-futures" version = "0.4.38" diff --git a/Cargo.toml b/Cargo.toml index b3a9ad6814..2b00b9bc87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,22 +9,23 @@ members = [ "src/canisters/frontend/ic-frontend-canister", ] default-members = ["src/dfx"] +resolver = "2" [workspace.package] authors = ["DFINITY Stiftung "] edition = "2021" repository = "https://github.com/dfinity/sdk" -rust-version = "1.71.1" +rust-version = "1.75.0" license = "Apache-2.0" [workspace.dependencies] candid = "0.10.0" candid_parser = "0.1.2" -ic-agent = { git = "https://github.com/dfinity/agent-rs.git", rev = "a7f44ad05e77fc89b8447dd65b345e7a62fd1042" } +ic-agent = { git = "https://github.com/dfinity/agent-rs.git", rev = "6b02f649a569f354a0a1b370368ba28d31dd8702" } ic-asset = { path = "src/canisters/frontend/ic-asset" } ic-cdk = "0.12.0" -ic-identity-hsm = { git = "https://github.com/dfinity/agent-rs.git", rev = "a7f44ad05e77fc89b8447dd65b345e7a62fd1042" } -ic-utils = { git = "https://github.com/dfinity/agent-rs.git", rev = "a7f44ad05e77fc89b8447dd65b345e7a62fd1042" } +ic-identity-hsm = { git = "https://github.com/dfinity/agent-rs.git", rev = "6b02f649a569f354a0a1b370368ba28d31dd8702" } +ic-utils = { git = "https://github.com/dfinity/agent-rs.git", rev = "6b02f649a569f354a0a1b370368ba28d31dd8702" } aes-gcm = "0.10.3" anyhow = "1.0.56" @@ -35,7 +36,7 @@ base64 = "0.13.0" byte-unit = "4.0.14" bytes = "1.2.1" clap = "4.2.0" -dialoguer = "0.10.0" +dialoguer = "0.11.0" directories-next = "2.0.0" flate2 = { version = "1.0.11", default-features = false } futures = "0.3.21" @@ -65,7 +66,7 @@ semver = "1.0.6" tempfile = "3.3.0" thiserror = "1.0.24" time = "0.3.9" -tokio = "1.24.2" +tokio = "1.35" url = "2.1.0" walkdir = "2.3.2" diff --git a/docs/cli-reference/dfx-identity.md b/docs/cli-reference/dfx-identity.md index b993171ced..52185f3af4 100644 --- a/docs/cli-reference/dfx-identity.md +++ b/docs/cli-reference/dfx-identity.md @@ -22,6 +22,7 @@ For reference information and examples that illustrate using `dfx identity` comm | [`get-principal`](#dfx-identity-get-principal) | Shows the textual representation of the principal associated with the current identity. | | [`get-wallet`](#dfx-identity-get-wallet) | Shows the canister identifier for the wallet associated with your current identity principal. | | `help` | Displays this usage message or the help of the given subcommand(s). | +| [`export`](#dfx-identity-export) | Exports the PEM definition for an identity. | | [`import`](#dfx-identity-import) | Creates a new identity by importing a PEM file that contains the key information or security certificate for a principal. | | [`list`](#dfx-identity-list) | Lists existing identities. | | [`new`](#dfx-identity-new) | Creates a new identity. | @@ -110,6 +111,25 @@ To display the canister identifier for the wallet canister associated with your dfx identity get-wallet --network=https://192.168.74.4 ``` +## dfx identity export + +Use the `dfx identity export` command to export the PEM definition of an existing identity. You can import this definition elsewhere using [`dfx identity import`](#dfx-identity-import). + +### Basic usage + +``` bash +dfx identity export identity-name +``` + +### Examples + +The following will export a PEM file for an existing identity. If you transferred this file to another computer, the +example below for `dfx identity import` would import it. + +``` bash +dfx identity export alice >generated-id.pem +``` + ## dfx identity import Use the `dfx identity import` command to create a user identity by importing the user’s key information or security certificate from a PEM file. diff --git a/e2e/assets/large_canister/Cargo.toml b/e2e/assets/large_canister/Cargo.toml new file mode 100644 index 0000000000..63c2f1a2ae --- /dev/null +++ b/e2e/assets/large_canister/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "large" +version = "0.0.0" +edition = "2021" + +[lib] +crate-type = ["cdylib"] + +[workspace] diff --git a/e2e/assets/large_canister/dfx.json b/e2e/assets/large_canister/dfx.json new file mode 100644 index 0000000000..ad4d443cf6 --- /dev/null +++ b/e2e/assets/large_canister/dfx.json @@ -0,0 +1,9 @@ +{ + "canisters": { + "large": { + "type": "rust", + "package": "large", + "candid": "large.did" + } + } +} diff --git a/e2e/assets/large_canister/large.did b/e2e/assets/large_canister/large.did new file mode 100644 index 0000000000..f424d81e86 --- /dev/null +++ b/e2e/assets/large_canister/large.did @@ -0,0 +1 @@ +service : {} diff --git a/e2e/assets/large_canister/patch.bash b/e2e/assets/large_canister/patch.bash new file mode 100644 index 0000000000..7f6fccde43 --- /dev/null +++ b/e2e/assets/large_canister/patch.bash @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +head -c $((1024 * 1024 * 8)) /dev/urandom >garbage.bin diff --git a/e2e/assets/large_canister/rust-toolchain.toml b/e2e/assets/large_canister/rust-toolchain.toml new file mode 100644 index 0000000000..e918eb3dbf --- /dev/null +++ b/e2e/assets/large_canister/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "stable" +targets = ["wasm32-unknown-unknown"] diff --git a/e2e/assets/large_canister/src/lib.rs b/e2e/assets/large_canister/src/lib.rs new file mode 100644 index 0000000000..3ef35d26ab --- /dev/null +++ b/e2e/assets/large_canister/src/lib.rs @@ -0,0 +1,3 @@ +#[used] +#[no_mangle] +pub static LARGE: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/garbage.bin")); diff --git a/e2e/assets/prebuilt_custom_canister/dfx.json b/e2e/assets/prebuilt_custom_canister/dfx.json index dea4e33388..5e0b21bbb9 100644 --- a/e2e/assets/prebuilt_custom_canister/dfx.json +++ b/e2e/assets/prebuilt_custom_canister/dfx.json @@ -29,6 +29,15 @@ "candid": "custom_with_build_step.did", "wasm": "main.wasm", "build": "echo just a build step" + }, + "prebuilt_local_import": { + "type": "custom", + "candid": "local_import.did", + "wasm": "main.wasm", + "build": [], + "metadata": [ + { "name": "candid:service" } + ] } }, "networks": { diff --git a/e2e/assets/prebuilt_custom_canister/local_import.did b/e2e/assets/prebuilt_custom_canister/local_import.did new file mode 100644 index 0000000000..f926f50663 --- /dev/null +++ b/e2e/assets/prebuilt_custom_canister/local_import.did @@ -0,0 +1,2 @@ +import service "prebuilt_custom_no_build.did"; + diff --git a/e2e/assets/upgrade/v1.mo b/e2e/assets/upgrade/v1.mo index 29e3722bcf..5a8765075f 100644 --- a/e2e/assets/upgrade/v1.mo +++ b/e2e/assets/upgrade/v1.mo @@ -4,6 +4,9 @@ actor { state += 1; return state; }; + public func f() : async ?Int { + return ?42; + }; public query func read() : async Int { return state; }; } diff --git a/e2e/assets/upgrade/v2.mo b/e2e/assets/upgrade/v2.mo index 5a9b295832..64dc2af3ec 100644 --- a/e2e/assets/upgrade/v2.mo +++ b/e2e/assets/upgrade/v2.mo @@ -6,6 +6,9 @@ actor { new_state += 1; return new_state; }; + public func f() : async ?Int { + return ?42; + }; public query func read() : async Nat { return new_state; }; } diff --git a/e2e/assets/upgrade/v2_bad.mo b/e2e/assets/upgrade/v2_bad.mo index 58ef15b8d5..3b50c9bd6a 100644 --- a/e2e/assets/upgrade/v2_bad.mo +++ b/e2e/assets/upgrade/v2_bad.mo @@ -4,6 +4,9 @@ actor { state += 1; return state; }; + public func f() : async ?Int { + return ?42; + }; public query func read() : async Nat { return state; }; } diff --git a/e2e/assets/upgrade/v3_bad.mo b/e2e/assets/upgrade/v3_bad.mo index 6b794e54c9..c5be37f070 100644 --- a/e2e/assets/upgrade/v3_bad.mo +++ b/e2e/assets/upgrade/v3_bad.mo @@ -4,6 +4,9 @@ actor { state += 1; return state; }; + public func f() : async ?Int { + return ?42; + }; public query func read2() : async Int { return state; }; } diff --git a/e2e/assets/upgrade/v4_bad.mo b/e2e/assets/upgrade/v4_bad.mo new file mode 100644 index 0000000000..dc7c35da1d --- /dev/null +++ b/e2e/assets/upgrade/v4_bad.mo @@ -0,0 +1,12 @@ +actor { + stable var state : Int = 0; + public func inc() : async Int { + state += 1; + return state; + }; + public func f() : async ?Text { + return ?""; + }; + public query func read() : async Int { return state; }; +} + diff --git a/e2e/tests-dfx/assetscanister.bash b/e2e/tests-dfx/assetscanister.bash index 6656c6849b..bb55041959 100644 --- a/e2e/tests-dfx/assetscanister.bash +++ b/e2e/tests-dfx/assetscanister.bash @@ -266,7 +266,7 @@ check_permission_failure() { FE_CANISTER_ID="$(dfx canister id e2e_project_frontend)" rm .dfx/local/canister_ids.json assert_command_fail dfx canister call "$FE_CANISTER_ID" validate_revoke_permission "(record { of_principal=principal \"$PREPARE_PRINCIPAL\"; permission = variant { FlyBeFree }; })" - assert_contains "trapped" + assert_contains "FlyBeFree not found" } @test "access control - fine-grained" { @@ -905,10 +905,12 @@ check_permission_failure() { dfx canister install e2e_project_frontend assert_command dfx canister call --query e2e_project_frontend retrieve '("/binary/noise.txt")' --output idl - assert_eq '(blob "\b8\01\20\80\0a\77\31\32\20\00\78\79\0a\4b\4c\0b\0a\6a\6b")' + # shellcheck disable=SC2154 + assert_eq '(blob "\b8\01\20\80\0a\77\31\32\20\00\78\79\0a\4b\4c\0b\0a\6a\6b")' "$stdout" assert_command dfx canister call --query e2e_project_frontend retrieve '("/text-with-newlines.txt")' --output idl - assert_eq '(blob "cherries\0ait\27s cherry season\0aCHERRIES")' + # shellcheck disable=SC2154 + assert_eq '(blob "cherries\0ait\27s cherry season\0aCHERRIES")' "$stdout" assert_command dfx canister call --update e2e_project_frontend store '(record{key="AA"; content_type="text/plain"; content_encoding="identity"; content=blob "hello, world!"})' assert_eq '()' @@ -916,13 +918,16 @@ check_permission_failure() { assert_eq '()' assert_command dfx canister call --query e2e_project_frontend retrieve '("B")' --output idl - assert_eq '(blob "XWV")' + # shellcheck disable=SC2154 + assert_eq '(blob "XWV")' "$stdout" assert_command dfx canister call --query e2e_project_frontend retrieve '("AA")' --output idl - assert_eq '(blob "hello, world!")' + # shellcheck disable=SC2154 + assert_eq '(blob "hello, world!")' "$stdout" assert_command dfx canister call --query e2e_project_frontend retrieve '("B")' --output idl - assert_eq '(blob "XWV")' + # shellcheck disable=SC2154 + assert_eq '(blob "XWV")' "$stdout" assert_command_fail dfx canister call --query e2e_project_frontend retrieve '("C")' } diff --git a/e2e/tests-dfx/basic-project.bash b/e2e/tests-dfx/basic-project.bash index 8e77ee3ec9..766a90f6fb 100644 --- a/e2e/tests-dfx/basic-project.bash +++ b/e2e/tests-dfx/basic-project.bash @@ -108,7 +108,6 @@ teardown() { 17_724 = record { 153_986_224 = blob "\44\49\44\4c\00\01\7d\b9\0a" } }, )' - } @test "build + install + call -- counter_idl_mo" { diff --git a/e2e/tests-dfx/build_granular.bash b/e2e/tests-dfx/build_granular.bash index 3b50ec9d94..d614d63d4d 100644 --- a/e2e/tests-dfx/build_granular.bash +++ b/e2e/tests-dfx/build_granular.bash @@ -67,10 +67,12 @@ teardown() { dfx canister install e2e_project_frontend assert_command dfx canister call --query e2e_project_frontend retrieve '("/binary/noise.txt")' --output idl - assert_eq '(blob "\b8\01\20\80\0a\77\31\32\20\00\78\79\0a\4b\4c\0b\0a\6a\6b")' + # shellcheck disable=SC2154 + assert_eq '(blob "\b8\01\20\80\0a\77\31\32\20\00\78\79\0a\4b\4c\0b\0a\6a\6b")' "$stdout" assert_command dfx canister call --query e2e_project_frontend retrieve '("/text-with-newlines.txt")' --output idl - assert_eq '(blob "cherries\0ait\27s cherry season\0aCHERRIES")' + # shellcheck disable=SC2154 + assert_eq '(blob "cherries\0ait\27s cherry season\0aCHERRIES")' "$stdout" } @test "cyclic dependencies are detected" { diff --git a/e2e/tests-dfx/call.bash b/e2e/tests-dfx/call.bash index 0b2e54b8df..2619e738e6 100644 --- a/e2e/tests-dfx/call.bash +++ b/e2e/tests-dfx/call.bash @@ -26,9 +26,9 @@ teardown() { CANISTER_ID=$(dfx canister id hello_backend) rm .dfx/local/canister_ids.json - # if no candid file known, then no field names + # given a canister id, fetch the did file from metadata assert_command dfx canister call "$CANISTER_ID" make_struct '("A", "B")' - assert_eq '(record { 99 = "A"; 100 = "B" })' + assert_eq '(record { c = "A"; d = "B" })' # if passing the candid file, field names available assert_command dfx canister call --candid .dfx/local/canisters/hello_backend/hello_backend.did "$CANISTER_ID" make_struct '("A", "B")' diff --git a/e2e/tests-dfx/identity.bash b/e2e/tests-dfx/identity.bash index 4550368a5a..aae4f5bc36 100644 --- a/e2e/tests-dfx/identity.bash +++ b/e2e/tests-dfx/identity.bash @@ -155,7 +155,8 @@ teardown() { assert_command dfx canister call e2e_project_frontend store '(record{key="B"; content_type="application/octet-stream"; content_encoding="identity"; content=blob"XWV"})' --identity alice assert_eq '()' assert_command dfx canister call --output idl e2e_project_frontend retrieve '("B")' - assert_eq '(blob "XWV")' + # shellcheck disable=SC2154 + assert_eq '(blob "XWV")' "$stdout" } @test "after renaming an identity, the renamed identity is still initializer" { @@ -181,7 +182,8 @@ teardown() { assert_command dfx canister call e2e_project_frontend store '(record{key="B"; content_type="application/octet-stream"; content_encoding="identity"; content=blob "hello"})' --identity bob assert_eq '()' assert_command dfx canister call --output idl e2e_project_frontend retrieve '("B")' - assert_eq '(blob "hello")' + # shellcheck disable=SC2154 + assert_eq '(blob "hello")' "$stdout" } @test "using an unencrypted identity on mainnet provokes a warning" { diff --git a/e2e/tests-dfx/install.bash b/e2e/tests-dfx/install.bash index bd4a4f3d02..966c02e0da 100644 --- a/e2e/tests-dfx/install.bash +++ b/e2e/tests-dfx/install.bash @@ -152,6 +152,17 @@ teardown() { assert_eq "$BUILD_HASH" "$ONCHAIN_HASH" } +@test "can install >2MiB wasm" { + install_asset large_canister + dfx_start + dfx canister create --all + assert_command dfx build + assert_command dfx canister install --all + assert_command dfx canister info large + HASH="$(sha256sum .dfx/local/canisters/large/large.wasm | head -c 64)" + assert_match "Module hash: 0x$HASH" +} + @test "--mode=auto selects install or upgrade automatically" { dfx_start assert_command dfx canister create e2e_project_backend diff --git a/e2e/tests-dfx/metadata.bash b/e2e/tests-dfx/metadata.bash index 9790de9178..8fee87cdf2 100644 --- a/e2e/tests-dfx/metadata.bash +++ b/e2e/tests-dfx/metadata.bash @@ -169,6 +169,10 @@ teardown() { # this canister has a build step, but it is an empty array, so dfx leaves the candid:service metadata as-is dfx canister metadata prebuilt_custom_empty_build candid:service >from_canister.txt diff main.did from_canister.txt + + # this canister has a local import in did file, the metadata should flatten the definitions + assert_command dfx canister metadata prebuilt_local_import candid:service + assert_eq "service : { getCanisterId : () -> (principal) query }" } @test "can read canister metadata from replica" { diff --git a/e2e/tests-dfx/start.bash b/e2e/tests-dfx/start.bash index 52a735bda6..276f430ee7 100644 --- a/e2e/tests-dfx/start.bash +++ b/e2e/tests-dfx/start.bash @@ -12,6 +12,43 @@ teardown() { standard_teardown } +@test "start and stop outside project" { + dfx_start + + mkdir subdir + cd subdir || exit 1 + dfx_new + assert_command dfx deploy + CANISTER_ID="$(dfx canister id e2e_project_backend)" + cd .. + assert_command dfx canister status "$CANISTER_ID" + assert_contains "Status: Running" + assert_command dfx canister stop "$CANISTER_ID" + assert_command dfx canister status "$CANISTER_ID" + assert_contains "Status: Stopped" + assert_command dfx canister start "$CANISTER_ID" + assert_command dfx canister status "$CANISTER_ID" + assert_contains "Status: Running" +} + +@test "uninstall-code outside of a project" { + dfx_start + + mkdir subdir + cd subdir || exit 1 + dfx_new + assert_command dfx deploy + CANISTER_ID="$(dfx canister id e2e_project_backend)" + cd .. + assert_command dfx canister status "$CANISTER_ID" + assert_contains "Module hash: 0x" + assert_command dfx canister uninstall-code "$CANISTER_ID" + assert_contains "Uninstalling code for canister $CANISTER_ID" + assert_command dfx canister status "$CANISTER_ID" + assert_contains "Module hash: None" +} + + @test "icx-proxy domain configuration in string form" { create_networks_json jq '.local.proxy.domain="xyz.domain"' "$E2E_NETWORKS_JSON" | sponge "$E2E_NETWORKS_JSON" diff --git a/e2e/tests-dfx/upgrade_check.bash b/e2e/tests-dfx/upgrade_check.bash index f4d93fc025..986bb90b62 100644 --- a/e2e/tests-dfx/upgrade_check.bash +++ b/e2e/tests-dfx/upgrade_check.bash @@ -64,3 +64,17 @@ teardown() { assert_command dfx canister call hello_backend read2 '()' assert_match "(1 : int)" } + +@test "warning for using special opt rule" { + install_asset upgrade + dfx_start + dfx deploy + dfx canister call hello_backend f '()' + jq '.canisters.hello_backend.main="v4_bad.mo"' dfx.json | sponge dfx.json + echo yes | ( + assert_command dfx deploy + assert_match "Candid interface compatibility check failed" + ) + assert_command dfx canister call hello_backend f '()' + assert_match "(opt \"\")" +} diff --git a/e2e/tests-dfx/wallet.bash b/e2e/tests-dfx/wallet.bash index 66bd979f98..8c2fb9a52b 100644 --- a/e2e/tests-dfx/wallet.bash +++ b/e2e/tests-dfx/wallet.bash @@ -12,6 +12,28 @@ teardown() { standard_teardown } +@test "deposit cycles inside a project" { + dfx_start + + dfx_new + assert_command dfx deploy + assert_command dfx canister deposit-cycles 47 e2e_project_backend + assert_contains "Deposited 47 cycles" +} + +@test "deposit cycles outside a project" { + dfx_start + + mkdir subdir + cd subdir || exit 1 + dfx_new + assert_command dfx deploy + CANISTER_ID="$(dfx canister id e2e_project_backend)" + cd .. + assert_command dfx canister deposit-cycles 42 "$CANISTER_ID" + assert_contains "Deposited 42 cycles" +} + @test "DFX_WALLET_WASM environment variable overrides wallet module wasm at installation" { dfx_new hello dfx_start @@ -131,7 +153,8 @@ teardown() { assert_command dfx canister call "$WALLET" wallet_call \ "(record { canister = principal \"$(dfx canister id e2e_project_backend)\"; method_name = \"amInitializer\"; args = blob \"DIDL\00\00\"; cycles = (0:nat64)})" - assert_eq '(variant { 17_724 = record { 153_986_224 = blob "\44\49\44\4c\00\01\7e\01" } })' # True in DIDL. + # shellcheck disable=SC2154 + assert_eq '(variant { 17_724 = record { 153_986_224 = blob "\44\49\44\4c\00\01\7e\01" } })' "$stdout" # True in DIDL. } @test "forward user call through wallet: deploy" { @@ -147,7 +170,8 @@ teardown() { assert_command dfx canister call e2e_project_backend amInitializer assert_command dfx canister call "$WALLET" wallet_call \ "(record { canister = principal \"$(dfx canister id e2e_project_backend)\"; method_name = \"amInitializer\"; args = blob \"DIDL\00\00\"; cycles = (0:nat64)})" - assert_eq '(variant { 17_724 = record { 153_986_224 = blob "\44\49\44\4c\00\01\7e\01" } })' # True in DIDL. + # shellcheck disable=SC2154 + assert_eq '(variant { 17_724 = record { 153_986_224 = blob "\44\49\44\4c\00\01\7e\01" } })' "$stdout" # True in DIDL. } @test "a 64-bit wallet can still be called in the 128-bit context" { diff --git a/nix/sources.json b/nix/sources.json index 1a8ef923db..43a4856d87 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -6,63 +6,63 @@ "homepage": "https://rustsec.org", "owner": "RustSec", "repo": "advisory-db", - "rev": "a5fb72de318a74eb69a2c241c0e46705684a35d0", - "sha256": "1cypbsjjv6c1azi3lhh8gf368c0zilrddpnf2mi0qym9hj1by7dz", + "rev": "fbc3b29acacf335c5fced02566d8f86e59eb1d7a", + "sha256": "1bs2ddk14lsqr9sr1ai7qkszpifaaq81c5b1i3bddi5j7kb43zz6", "type": "tarball", - "url": "https://github.com/RustSec/advisory-db/archive/a5fb72de318a74eb69a2c241c0e46705684a35d0.tar.gz", + "url": "https://github.com/RustSec/advisory-db/archive/fbc3b29acacf335c5fced02566d8f86e59eb1d7a.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "canister_sandbox-x86_64-darwin": { "builtin": false, "description": "The canister_sandbox binary. It must be updated together with the replica binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "049hfmpi7njn439hry1z5qb3k45z300jvrvcgycbxrdiz5nd9kaa", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "1h6r06fkrmk6b4rfyg8dfgxfaw9bqrsvfzgaqc39myg47nswi9a0", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/canister_sandbox.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-darwin/canister_sandbox.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/canister_sandbox.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-darwin/canister_sandbox.gz" }, "canister_sandbox-x86_64-linux": { "builtin": false, "description": "The canister_sandbox binary. It must be updated together with the replica binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "04r9rs47ky6715jwia5qzpj5983y2xyg246wncjhybqn79a9m10i", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "17p1jq77kcqgc058kli6wsyiksyh66ghgv6k2hxvif3fmnpfnxz7", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/canister_sandbox.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-linux/canister_sandbox.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/canister_sandbox.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-linux/canister_sandbox.gz" }, "ic-admin-x86_64-darwin": { "builtin": false, "description": "The ic-admin binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "15r1ymcrhb1z859cpjhg3y9nswskh94sxr8l1gqbw5lsf6y8ygsb", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "09p1l9jvb0f8whdv4dy3mbrl4nf695aps4l4i8dpvl9ia41s7hjm", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-admin.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-darwin/ic-admin.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/ic-admin.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-darwin/ic-admin.gz" }, "ic-admin-x86_64-linux": { "builtin": false, "description": "The ic-admin binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "00hry4mjramd8dwx88v8crrzjj0rzkvd23ckqig3bglvaisnsspf", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "0aprgricbmc8glagcfhsl3r33pg7fcyxyyw2kpjg42j2hzyb7hbp", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-admin.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-linux/ic-admin.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/ic-admin.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-linux/ic-admin.gz" }, "ic-btc-adapter-x86_64-darwin": { "builtin": false, - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "0y79j7rzi12896808sai0nhfzslmgrg1gvm7kfprf89jrikh1v9w", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "1wp1pk97a1d6fl1d0gblw0bzz80cjm1brkl50h42sp0cxzgzvz4c", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-btc-adapter.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-darwin/ic-btc-adapter.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/ic-btc-adapter.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-darwin/ic-btc-adapter.gz" }, "ic-btc-adapter-x86_64-linux": { "builtin": false, - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "1silh7jx2i6ln7r1k49ndgddm4fm10f9f3f822lyz90vz7dml6yk", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "1h1vmnawi1rwwhjqdczci3hfbvpdy5rkf9h9qdznmh1s9sqlad19", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-btc-adapter.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-linux/ic-btc-adapter.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/ic-btc-adapter.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-linux/ic-btc-adapter.gz" }, "ic-btc-canister": { "owner": "dfinity", @@ -74,69 +74,69 @@ }, "ic-https-outcalls-adapter-x86_64-darwin": { "builtin": false, - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "14nivx59ww4y0phpwxfcisc4an2sny5r4f3qrmalqk4vi445mszy", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "0l4xlqwsmgmh9yqkabq172m4i2q27ifbihmr9pxiqrfsz585qk79", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-https-outcalls-adapter.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-darwin/ic-https-outcalls-adapter.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/ic-https-outcalls-adapter.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-darwin/ic-https-outcalls-adapter.gz" }, "ic-https-outcalls-adapter-x86_64-linux": { "builtin": false, - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "0qgxzfzym8gh91bsg5krmlrh39anlcgnff330w4jgiwql95ayvr7", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "15zsn11ijamgz20s5ylla4bi6b5jrpjsy4a3f303xashykhm8p1v", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-https-outcalls-adapter.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-linux/ic-https-outcalls-adapter.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/ic-https-outcalls-adapter.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-linux/ic-https-outcalls-adapter.gz" }, "ic-nns-init-x86_64-darwin": { "builtin": false, "description": "The ic-nns-init binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "0c59dsi9gwxzj9l2d94k48yk2vdz0gb1yjfh58ky1sx4w28hxzc5", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "0d4m42g12bgsg9xpjv7p4apycdacc753pff7cq7fhyw989m5q136", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-nns-init.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-darwin/ic-nns-init.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/ic-nns-init.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-darwin/ic-nns-init.gz" }, "ic-nns-init-x86_64-linux": { "builtin": false, "description": "The ic-nns-init binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "15v8a6d71rg7xgl3nvy5l839qxyvkig1mlldpdr4bmmwp3yqx3nm", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "0vsw23bxzb7afha765353s97ai9h96gsxqk1s04x3b0ga88qhbq9", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-nns-init.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-linux/ic-nns-init.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/ic-nns-init.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-linux/ic-nns-init.gz" }, "ic-starter-x86_64-darwin": { "builtin": false, - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "1ar30xi3vnrwpyl0cir3m4dvdzdwm09xji33w25krj5n9503acqz", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "0skkhacdl129vnyx6q0bjx8mgzkgiwrxsnkciyp6434v72sr2ky8", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-starter.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-darwin/ic-starter.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/ic-starter.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-darwin/ic-starter.gz" }, "ic-starter-x86_64-linux": { "builtin": false, - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "1ddgxd9pnybnjiqhgggxlkbq8ml99ca4iq54kh221kdj7h1m334d", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "11zxvvb6q86ssj130i0nacy39pzl3pm29zgv32hjkz2si41qg2p5", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-starter.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-linux/ic-starter.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/ic-starter.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-linux/ic-starter.gz" }, "icx-proxy-x86_64-darwin": { "builtin": false, - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "1p9gmlz85j514s6da189hwaghg18p62pbknkn3q59jyxmf22fzxh", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "187ww64jpjzmyp996b3zmm5j9liz2mwbf6vm561xnic1pg4px571", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/icx-proxy-dev.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-darwin/icx-proxy-dev.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/icx-proxy-dev.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-darwin/icx-proxy-dev.gz" }, "icx-proxy-x86_64-linux": { "builtin": false, - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "105jm3px6ky88jc86am8dkxz1vnhzcxy0p7skzs98baylr96kzrb", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "1sdpavhcnmnjf29r3k5afxjk6fvsv1sz830sbay5mx5b5q4x7wh3", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/icx-proxy-dev.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-linux/icx-proxy-dev.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/icx-proxy-dev.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-linux/icx-proxy-dev.gz" }, "motoko-base": { "builtin": false, @@ -167,55 +167,55 @@ "replica-x86_64-darwin": { "builtin": false, "description": "The replica binary. It must be updated together with the canister_sandbox binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "12z1lvhv257ywf1b4gknywdimh5yqnfx20yxn37f30iifg2zw87k", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "06y9kqikzkw3cxsp04vxhfymd5dicvfkrr59b5fjbj3bi40ivn5i", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/replica.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-darwin/replica.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/replica.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-darwin/replica.gz" }, "replica-x86_64-linux": { "builtin": false, "description": "The replica binary. It must be updated together with the canister_sandbox binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "120iinjcybvc346wf1iq6r964a3w5dhhif6rnf2ngf0q3350rlrc", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "0af7mz8k86fxchybmfy43w2l1xw8dp1qnxl5dldwbhyrr1x1x48r", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/replica.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-linux/replica.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/replica.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-linux/replica.gz" }, "sandbox_launcher-x86_64-darwin": { "builtin": false, "description": "The sandbox_launcher binary. It must be updated together with the replica binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "12pz2i2yhfl2saab3rc5sf0dr24l6siirpsx8z414818mzpc42zd", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "1mnmm9kjljng8gj4g9wak9abm9iyzcf2z2awvlm2bkrnh936m401", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/sandbox_launcher.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-darwin/sandbox_launcher.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/sandbox_launcher.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-darwin/sandbox_launcher.gz" }, "sandbox_launcher-x86_64-linux": { "builtin": false, "description": "The sandbox_launcher binary. It must be updated together with the replica binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "0zzpr02vc14ibx1qzd31a9jzh1zhb7ahcg85fazs6jkjk2zidi4n", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "07aiwbjgj08n1511c5mldwniipq7nf5dpl72g4f1908z23ndljwp", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/sandbox_launcher.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-linux/sandbox_launcher.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/sandbox_launcher.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-linux/sandbox_launcher.gz" }, "sns-x86_64-darwin": { "builtin": false, "description": "The sns binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "12xkvxp3jprxw0205ml4ad3gdksi0x5c3kf7skcmkvqk744nml04", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "0l8812c1z4pkza8qn0vydrd6q4k2saahj0kg74725x158fndnc4i", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/sns.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-darwin/sns.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/sns.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-darwin/sns.gz" }, "sns-x86_64-linux": { "builtin": false, "description": "The sns binary.", - "rev": "69e1408347723dbaa7a6cd2faa9b65c42abbe861", - "sha256": "02aqj9qcpvk216sdvkz25q1pf32bwb6wnf8v704rw133wpqq8sln", + "rev": "324eb99eb7531369a5ef75560f1a1a652d123714", + "sha256": "0r9npfkm9b3pg5388mxnj6aldvjpc6y2604gc7lahlyc25rqvl9y", "type": "file", - "url": "https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/sns.gz", - "url_template": "https://download.dfinity.systems/ic//openssl-static-binaries/x86_64-linux/sns.gz" + "url": "https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/sns.gz", + "url_template": "https://download.dfinity.systems/ic//binaries/x86_64-linux/sns.gz" } } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index ebd21eff3f..a0f945fbbb 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.71.1" +channel = "1.75.0" components = ["rustfmt", "clippy"] targets = ["wasm32-unknown-unknown"] diff --git a/scripts/update-frontend-canister.Dockerfile b/scripts/update-frontend-canister.Dockerfile index e864086a39..36b1d00125 100644 --- a/scripts/update-frontend-canister.Dockerfile +++ b/scripts/update-frontend-canister.Dockerfile @@ -3,7 +3,7 @@ ARG RUST_VERSION FROM scratch AS registry FROM rust:${RUST_VERSION} AS builder COPY --from=registry . ${CARGO_HOME}/registry/index -RUN cargo install ic-wasm --version 0.2.0 +RUN cargo install ic-wasm --version 0.7.0 COPY . /build # defined in update-frontend-canister.sh WORKDIR /build diff --git a/src/canisters/frontend/ic-certified-assets/Cargo.toml b/src/canisters/frontend/ic-certified-assets/Cargo.toml index 4a96baca33..7f5028204a 100644 --- a/src/canisters/frontend/ic-certified-assets/Cargo.toml +++ b/src/canisters/frontend/ic-certified-assets/Cargo.toml @@ -16,9 +16,9 @@ base64.workspace = true candid.workspace = true hex.workspace = true ic-cdk.workspace = true -ic-certification = "1.3.0" -ic-response-verification = "0.3.0" -ic-representation-independent-hash = "0.3.0" +ic-certification = "2.3.0" +ic-response-verification = "2.3.0" +ic-representation-independent-hash = "2.3.0" itertools.workspace = true num-traits.workspace = true serde.workspace = true @@ -27,6 +27,9 @@ serde_cbor.workspace = true sha2.workspace = true [dev-dependencies] +ic-http-certification = "2.3.0" candid_parser.workspace = true -ic-response-verification-test-utils = { git = "https://github.com/dfinity/response-verification.git", rev = "4686895c6070ac36109a01f4bd642caf2369b97b" } -ic-crypto-tree-hash = { git = "https://github.com/dfinity/ic.git", rev = "a533346f63f4091eb64692891de0d5b2ffd5b22a" } +anyhow.workspace = true +ic-response-verification-test-utils = { git = "https://github.com/dfinity/response-verification.git", rev = "a65009624b61736df6d2dc17756bdbd02a84f599" } +ic-certification-testing = { git = "https://github.com/dfinity/response-verification.git", rev = "a65009624b61736df6d2dc17756bdbd02a84f599" } +ic-crypto-tree-hash = { git = "https://github.com/dfinity/ic.git", rev = "1290256484f59c3d950c5e9a098e97383b248ad6" } diff --git a/src/canisters/frontend/ic-certified-assets/src/asset_certification/tree.rs b/src/canisters/frontend/ic-certified-assets/src/asset_certification/tree.rs index d46c4dfec9..22b4af451a 100644 --- a/src/canisters/frontend/ic-certified-assets/src/asset_certification/tree.rs +++ b/src/canisters/frontend/ic-certified-assets/src/asset_certification/tree.rs @@ -36,7 +36,7 @@ impl AsHashTree fo impl NestedTree { #[allow(dead_code)] pub fn get(&self, path: &[K]) -> Option<&V> { - if let Some(key) = path.get(0) { + if let Some(key) = path.first() { match self { NestedTree::Leaf(_) => None, NestedTree::Nested(tree) => tree @@ -53,7 +53,7 @@ impl NestedTree bool { - if let Some(key) = path.get(0) { + if let Some(key) = path.first() { match self { NestedTree::Leaf(_) => false, NestedTree::Nested(tree) => tree @@ -68,7 +68,7 @@ impl NestedTree bool { - if let Some(key) = path.get(0) { + if let Some(key) = path.first() { match self { NestedTree::Leaf(_) => false, NestedTree::Nested(tree) => tree @@ -82,7 +82,7 @@ impl NestedTree { *self = NestedTree::default(); @@ -103,7 +103,7 @@ impl NestedTree {} NestedTree::Nested(tree) => { @@ -116,7 +116,7 @@ impl NestedTree HashTree { - if let Some(key) = path.get(0) { + if let Some(key) = path.first() { match self { NestedTree::Leaf(value) => value.as_hash_tree(), NestedTree::Nested(tree) => { diff --git a/src/canisters/frontend/ic-certified-assets/src/lib.rs b/src/canisters/frontend/ic-certified-assets/src/lib.rs index 087f81bc59..6a81fe6284 100644 --- a/src/canisters/frontend/ic-certified-assets/src/lib.rs +++ b/src/canisters/frontend/ic-certified-assets/src/lib.rs @@ -415,7 +415,9 @@ fn is_controller() -> Result<(), String> { pub fn init(args: Option) { if let Some(upgrade_arg) = args { - let AssetCanisterArgs::Init(InitArgs {}) = upgrade_arg else { ic_cdk::trap("Cannot initialize the canister with an Upgrade argument. Please provide an Init argument.")}; + let AssetCanisterArgs::Init(InitArgs {}) = upgrade_arg else { + ic_cdk::trap("Cannot initialize the canister with an Upgrade argument. Please provide an Init argument.") + }; } STATE.with(|s| { let mut s = s.borrow_mut(); diff --git a/src/canisters/frontend/ic-certified-assets/src/tests.rs b/src/canisters/frontend/ic-certified-assets/src/tests.rs index 7e77c6c9aa..033b289a37 100644 --- a/src/canisters/frontend/ic-certified-assets/src/tests.rs +++ b/src/canisters/frontend/ic-certified-assets/src/tests.rs @@ -10,11 +10,10 @@ use crate::types::{ }; use crate::url_decode::{url_decode, UrlDecodeError}; use candid::{Nat, Principal}; +use ic_certification_testing::CertificateBuilder; use ic_crypto_tree_hash::Digest; -use ic_response_verification::ResponseVerificationError; use ic_response_verification_test_utils::{ - base64_encode, create_canister_id, get_current_timestamp, CanisterData, CertificateBuilder, - CertificateData, + base64_encode, create_canister_id, get_current_timestamp, }; use serde_bytes::ByteBuf; use std::collections::HashMap; @@ -34,21 +33,20 @@ pub fn verify_response( state: &State, request: &HttpRequest, response: &HttpResponse, -) -> Result { +) -> anyhow::Result { let mut response = response.clone(); let current_time = get_current_timestamp(); let canister_id = create_canister_id("rdmx6-jaaaa-aaaaa-aaadq-cai"); let min_requested_verification_version = request.get_certificate_version(); // inject certificate into IC-Certificate header with 'certificate=::' - let (_cert, root_key, cert_cbor) = - CertificateBuilder::new(CertificateData::CanisterData(CanisterData { - canister_id, - certified_data: Digest(state.root_hash()), - })) - .with_time(current_time) - .build(); - let replacement_cert_value = base64_encode(&cert_cbor); + let data = CertificateBuilder::new( + &canister_id.to_string(), + Digest(state.root_hash()).as_bytes(), + )? + .with_time(current_time) + .build()?; + let replacement_cert_value = base64_encode(&data.cbor_encoded_certificate); let (_, header_value) = response .headers .iter_mut() @@ -60,26 +58,28 @@ pub fn verify_response( ); // actual verification - let request = ic_response_verification::types::Request { + let request = ic_http_certification::http::HttpRequest { method: request.method.clone(), url: request.url.clone(), headers: request.headers.clone(), + body: request.body[..].into(), }; - let response = ic_response_verification::types::Response { + let response = ic_http_certification::http::HttpResponse { status_code: response.status_code, headers: response.headers, body: response.body[..].into(), + upgrade: None, }; - ic_response_verification::verify_request_response_pair( + Ok(ic_response_verification::verify_request_response_pair( request, response, canister_id.as_ref(), current_time, MAX_CERT_TIME_OFFSET_NS, - &root_key, + &data.root_key, min_requested_verification_version.try_into().unwrap(), ) - .map(|res| res.passed) + .map(|res| res.response.is_some())?) } fn certified_http_request(state: &State, request: HttpRequest) -> HttpResponse { diff --git a/src/dfx-core/Cargo.toml b/src/dfx-core/Cargo.toml index 01b37aca02..2f7a12daff 100644 --- a/src/dfx-core/Cargo.toml +++ b/src/dfx-core/Cargo.toml @@ -14,9 +14,8 @@ bip32 = "0.4.0" byte-unit = { workspace = true, features = ["serde"] } bytes.workspace = true candid = { workspace = true } -candid_parser = { workspace = true, features = ["random"] } clap = { workspace = true, features = ["string"] } -dialoguer = "0.10.0" +dialoguer = { workspace = true } directories-next.workspace = true dunce = "1.0" flate2 = { workspace = true, default-features = false, features = ["zlib-ng"] } diff --git a/src/dfx-core/src/canister/mod.rs b/src/dfx-core/src/canister/mod.rs index 032f578915..9ef051589a 100644 --- a/src/dfx-core/src/canister/mod.rs +++ b/src/dfx-core/src/canister/mod.rs @@ -6,7 +6,6 @@ use crate::{ use candid::Principal; use ic_agent::Agent; use ic_utils::{ - call::AsyncCall, interfaces::{ management_canister::builders::{CanisterInstall, InstallMode}, ManagementCanister, WalletCanister, @@ -58,7 +57,7 @@ YOU WILL LOSE ALL DATA IN THE CANISTER. let mode_str = match mode { InstallMode::Install => "Installing", InstallMode::Reinstall => "Reinstalling", - InstallMode::Upgrade => "Upgrading", + InstallMode::Upgrade { .. } => "Upgrading", }; if let Some(name) = canister_name { info!( @@ -71,12 +70,10 @@ YOU WILL LOSE ALL DATA IN THE CANISTER. match call_sender { CallSender::SelectedId => { let install_builder = mgr - .install_code(&canister_id, &wasm_module) + .install(&canister_id, &wasm_module) .with_raw_arg(args.to_vec()) .with_mode(mode); install_builder - .build() - .map_err(CanisterBuilderError::CallSenderBuildError)? .call_and_wait() .await .map_err(CanisterInstallError::InstallWasmError) diff --git a/src/dfx-core/src/config/model/dfinity.rs b/src/dfx-core/src/config/model/dfinity.rs index e829c14f7f..f2ebd389cb 100644 --- a/src/dfx-core/src/config/model/dfinity.rs +++ b/src/dfx-core/src/config/model/dfinity.rs @@ -101,7 +101,6 @@ pub enum WasmOptLevel { Oz, Os, } - impl std::fmt::Display for WasmOptLevel { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { std::fmt::Debug::fmt(self, f) diff --git a/src/dfx-core/src/config/model/network_descriptor.rs b/src/dfx-core/src/config/model/network_descriptor.rs index 73c2e217a8..2565348353 100644 --- a/src/dfx-core/src/config/model/network_descriptor.rs +++ b/src/dfx-core/src/config/model/network_descriptor.rs @@ -85,7 +85,7 @@ impl NetworkDescriptor { let provider_match = { providers.len() == 1 && matches!( - providers.get(0).unwrap().as_str(), + providers.first().unwrap().as_str(), DEFAULT_IC_GATEWAY | DEFAULT_IC_GATEWAY_TRAILING_SLASH ) }; diff --git a/src/dfx-core/src/error/encryption.rs b/src/dfx-core/src/error/encryption.rs index fff651a7f3..d7cf2bee0d 100644 --- a/src/dfx-core/src/error/encryption.rs +++ b/src/dfx-core/src/error/encryption.rs @@ -15,7 +15,7 @@ pub enum EncryptionError { NonceGenerationFailed(ring::error::Unspecified), #[error("Failed to read user input: {0}")] - ReadUserPasswordFailed(std::io::Error), + ReadUserPasswordFailed(dialoguer::Error), #[error("Failed to generate salt: {0}")] SaltGenerationFailed(ring::error::Unspecified), diff --git a/src/dfx/assets/dfx-asset-sources.toml b/src/dfx/assets/dfx-asset-sources.toml index 7e21b9f154..7afe09c44a 100644 --- a/src/dfx/assets/dfx-asset-sources.toml +++ b/src/dfx/assets/dfx-asset-sources.toml @@ -1,29 +1,29 @@ # generated by write-dfx-asset-sources.sh -replica-rev = '69e1408347723dbaa7a6cd2faa9b65c42abbe861' +replica-rev = '324eb99eb7531369a5ef75560f1a1a652d123714' [x86_64-darwin.icx-proxy] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/icx-proxy-dev.gz' -sha256 = 'b07f2784abddcb54f0b0d3ce7585b9283cf814870905d58c26a1c8823ead2fdd' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/icx-proxy-dev.gz' +sha256 = 'e1947ec9bb8145db8329751bb778153fd2244bad7f2c93d2f5f5cb2b89e1fca0' [x86_64-darwin.ic-admin] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-admin.gz' -sha256 = '4b3f8fbc719a16bef00b14e5ae498253736d931f0fcacb52413f2c9859f52197' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/ic-admin.gz' +sha256 = '55c2a3035131d17d1b8a84127d5549c65942f3aac337b21be4c881b565a2e126' [x86_64-darwin.ic-btc-adapter] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-btc-adapter.gz' -sha256 = '3ced0067cc322197af9ba7ee175e7e95eaefa00551690490494884f8f391e978' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/ic-btc-adapter.gz' +sha256 = '8cfcfddfef0c5c2d080485cebc42950ca0ff17e0743dd00275a60575d2bce1f2' [x86_64-darwin.ic-https-outcalls-adapter] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-https-outcalls-adapter.gz' -sha256 = 'feeb5a08899b4c4c55cd7838928bb75a5845988ecc757ee1059e709e4adfd192' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/ic-https-outcalls-adapter.gz' +sha256 = 'e94c5c50f9da651cfb4db9c2b85c3c028b48aa38012f35b14fb0beaa39a69d50' [x86_64-darwin.ic-nns-init] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-nns-init.gz' -sha256 = '85fd0e91e0a4ebe0272ad0491fd603bf6d313d2293a4266892bff397a26ea930' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/ic-nns-init.gz' +sha256 = '66045c6a42897be80e66c7b93bca614c35e6af22f76c797b7afa2d119e209534' [x86_64-darwin.ic-starter] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-starter.gz' -sha256 = '1f33354049b6c83c8be06344d913a8bcfdb61ba9234706a8bf3cdb3d620723ab' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/ic-starter.gz' +sha256 = 'c84f91b5389b0c62ae8f6c5add338f6ffe5751970b60d3bddd4904da9882736a' [x86_64-darwin.motoko] url = 'https://github.com/dfinity/motoko/releases/download/0.10.4/motoko-Darwin-x86_64-0.10.4.tar.gz' @@ -31,21 +31,21 @@ sha256 = '21cb1e976d4970c64e5335bba74cb76a5b056811b9a6460d1bf9432229026757' # The replica and canister_sandbox binaries must have the same revision. [x86_64-darwin.replica] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/replica.gz' -sha256 = 'f320fec5733182e1ceb0dd03d19dc5bec01a1bf7763eb282e3fe14b1e1a6e18b' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/replica.gz' +sha256 = 'b1d81d01896bc8255d59a9e43cdd66b19556bd837d1370756783cf3f239ec91b' # The replica and canister_sandbox binaries must have the same revision. [x86_64-darwin.canister_sandbox] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/canister_sandbox.gz' -sha256 = '4acdd46cf9b1e5be987f6ce72d0118bf9039162e3ff80cd32056da136f753011' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/canister_sandbox.gz' +sha256 = '40a5c8b53de4f99a06c3ea7db775c62b71e5fa730d3def325966d63c9d01d9c0' [x86_64-darwin.sandbox_launcher] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/sandbox_launcher.gz' -sha256 = 'ed0bc2eeaf282012c8475ddf1ca3369488dc80d385e5b194d2823ae84514ff8a' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/sandbox_launcher.gz' +sha256 = '01906a468236cf252add5c892f1cfb3ea6ba549a8aa747e443cf4a2a67aad5d6' [x86_64-darwin.sns] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/sns.gz' -sha256 = '04d06a093913ef59d9d4c7cdc14a0751cff6465384d60204e03d5f396edfb38b' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-darwin/sns.gz' +sha256 = '9130dbac4325f4220e396f020995d262126c5a6e7e038b91faf3921f98080851' [x86_64-darwin.motoko-base] url = 'https://github.com/dfinity/motoko/releases/download/0.10.4/motoko-base-library.tar.gz' @@ -56,28 +56,28 @@ url = 'https://github.com/dfinity/bitcoin-canister/releases/download/release%2F2 sha256 = '09f5647a45ff6d5d05b2b0ed48613fb2365b5fe6573ba0e901509c39fb9564ac' [x86_64-linux.icx-proxy] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/icx-proxy-dev.gz' -sha256 = '2bff6952a65e2d94f49ffa5ce03bfbd0eef0fb6ca82a839844c84fd3efa8b280' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/icx-proxy-dev.gz' +sha256 = '03f2d3092eabf45abc5a1a0cf475d87a3b336577aacc919370d256cbe056b7e9' [x86_64-linux.ic-admin] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-admin.gz' -sha256 = 'ee6a6d75549bbe355ec4930dd1f6fc1948f973666823d47943adaa2c2bf11902' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/ic-admin.gz' +sha256 = '77c1b3fc87420af2e49d827bdf3d73e7dd31f2a01a3af6147d88d5c5627ef92a' [x86_64-linux.ic-btc-adapter] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-btc-adapter.gz' -sha256 = 'd31b5adbf91ba4efa910c80d971c08d591dada6b369119f2b1d444d1e58134ea' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/ic-btc-adapter.gz' +sha256 = '293445b14e3ac06a7fc309263773f1edeee5e088ecb38625e43c87c895ad3bc0' [x86_64-linux.ic-https-outcalls-adapter] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-https-outcalls-adapter.gz' -sha256 = '276faf4aa298c72709076338671fa356a50133ad7996a75748f0a1eabffbfd61' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/ic-https-outcalls-adapter.gz' +sha256 = '3b5c54e1f450ab3ec0704311afe5cdb22c13175194faa281f8af2a1943b0fa97' [x86_64-linux.ic-nns-init] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-nns-init.gz' -sha256 = 'd58e8efdb8bcd64572bb8dd21a5e9cdb779c06a2c56f3be8ebe7e5709a516897' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/ic-nns-init.gz' +sha256 = '092f8811520facd109d061e2ae9f49304575921e6514731474eaacdfd7105c6f' [x86_64-linux.ic-starter] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-starter.gz' -sha256 = '8d8c51033cb2cd20049ca4e048144b895684d7a4fdbd07719476797b53ebafb5' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/ic-starter.gz' +sha256 = 'e58a8703895afc29a118fbfd24ea1df4df343c5316443082d4da206cd6defd87' [x86_64-linux.motoko] url = 'https://github.com/dfinity/motoko/releases/download/0.10.4/motoko-Linux-x86_64-0.10.4.tar.gz' @@ -85,21 +85,21 @@ sha256 = '48beb994fe4fc1630e83cc98979e0f77130b23bb909ecf7a1b108140d6088856' # The replica and canister_sandbox binaries must have the same revision. [x86_64-linux.replica] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/replica.gz' -sha256 = '2cd30cca1818b86785b3d9b808612b7c286252363806c70d196c2fcfa48d1188' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/replica.gz' +sha256 = '19911e7ac8d9c3c51b6d85768bc36d88f740051fc4bbba3c64dd1934d1afc729' # The replica and canister_sandbox binaries must have the same revision. [x86_64-linux.canister_sandbox] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/canister_sandbox.gz' -sha256 = '11849a543a162f0f25b3dc10f17c177ea054e4fdb8a8c86509c7f87988ce2913' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/canister_sandbox.gz' +sha256 = 'e777ebaead6eb8b83b14d3ec079f31d0eb19bde626d2890a600fb3790e96e19e' [x86_64-linux.sandbox_launcher] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/sandbox_launcher.gz' -sha256 = '96c416bf98724aa3bf72053d06d559f007f8655261b48f435f9104b605c8f77f' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/sandbox_launcher.gz' +sha256 = '974bdaec101f81141c79e2d0db8ab307df182d6fb4161642091601f9e4e2511d' [x86_64-linux.sns] -url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/sns.gz' -sha256 = '966a84f1e563049e09381b39cbcde24b0c77032ee2cfddb40962eecb70925809' +url = 'https://download.dfinity.systems/ic/324eb99eb7531369a5ef75560f1a1a652d123714/binaries/x86_64-linux/sns.gz' +sha256 = '3ed18d7311cc53a8e8618f0023bc6157ee469591b65784467977ac54a7bb3665' [x86_64-linux.motoko-base] url = 'https://github.com/dfinity/motoko/releases/download/0.10.4/motoko-base-library.tar.gz' diff --git a/src/dfx/src/commands/build.rs b/src/dfx/src/commands/build.rs index 22d58f3dcf..c8aef8c17c 100644 --- a/src/dfx/src/commands/build.rs +++ b/src/dfx/src/commands/build.rs @@ -112,8 +112,8 @@ fn collect_extra_canisters(env: &AgentEnvironment, config: &Config) -> Vec>() }) .unwrap_or_default() diff --git a/src/dfx/src/commands/canister/call.rs b/src/dfx/src/commands/canister/call.rs index eb034120f6..70f9a642c9 100644 --- a/src/dfx/src/commands/canister/call.rs +++ b/src/dfx/src/commands/canister/call.rs @@ -4,10 +4,13 @@ use crate::lib::error::DfxResult; use crate::lib::operations::canister::get_local_cid_and_candid_path; use crate::lib::root_key::fetch_root_key_if_needed; use crate::util::clap::parsers::{cycle_amount_parser, file_or_stdin_parser}; -use crate::util::{arguments_from_file, blob_from_arguments, get_candid_type, print_idl_blob}; +use crate::util::{ + arguments_from_file, blob_from_arguments, get_candid_type, print_idl_blob, read_module_metadata, +}; use anyhow::{anyhow, Context}; use candid::Principal as CanisterId; use candid::{CandidType, Decode, Deserialize, Principal}; +use candid_parser::utils::CandidSource; use clap::Parser; use dfx_core::canister::build_wallet_canister; use dfx_core::identity::CallSender; @@ -183,7 +186,10 @@ pub fn get_effective_canister_id( | MgmtMethod::DeleteCanister | MgmtMethod::DepositCycles | MgmtMethod::UninstallCode - | MgmtMethod::ProvisionalTopUpCanister => { + | MgmtMethod::ProvisionalTopUpCanister + | MgmtMethod::UploadChunk + | MgmtMethod::ClearChunkStore + | MgmtMethod::StoredChunks => { #[derive(CandidType, Deserialize)] struct In { canister_id: CanisterId, @@ -195,6 +201,15 @@ pub fn get_effective_canister_id( MgmtMethod::ProvisionalCreateCanisterWithCycles => { Ok(CanisterId::management_canister()) } + MgmtMethod::InstallChunkedCode => { + #[derive(CandidType, Deserialize)] + struct In { + target_canister: Principal, + } + let in_args = Decode!(arg_value, In) + .context("Argument is not valid for InstallChunkedCode")?; + Ok(in_args.target_canister) + } } } else { Ok(canister_id) @@ -206,29 +221,32 @@ pub async fn exec( opts: CanisterCallOpts, call_sender: &CallSender, ) -> DfxResult { + let agent = env.get_agent(); + fetch_root_key_if_needed(env).await?; + let callee_canister = opts.canister_name.as_str(); let method_name = opts.method_name.as_str(); let canister_id_store = env.get_canister_id_store()?; - let (canister_id, maybe_candid_path) = match CanisterId::from_text(callee_canister) { - Ok(id) => { - if let Some(canister_name) = canister_id_store.get_name(callee_canister) { - get_local_cid_and_candid_path(env, canister_name, Some(id))? - } else { - // TODO fetch candid file from remote canister - (id, None) - } - } + let canister_id = match CanisterId::from_text(callee_canister) { + Ok(id) => id, Err(_) => { let canister_id = canister_id_store.get(callee_canister)?; - get_local_cid_and_candid_path(env, callee_canister, Some(canister_id))? + get_local_cid_and_candid_path(env, callee_canister, Some(canister_id))?.0 } }; - let maybe_candid_path = opts.candid.or(maybe_candid_path); + let method_type = if let Some(path) = opts.candid { + get_candid_type(CandidSource::File(&path), method_name) + } else { + read_module_metadata(agent, canister_id, "candid:service") + .await + .and_then(|did| get_candid_type(CandidSource::Text(&did), method_name)) + }; + if method_type.is_none() { + eprintln!("Cannot fetch Candid interface from canister metadata, sending arguments with inferred types."); + } let is_management_canister = canister_id == CanisterId::management_canister(); - - let method_type = maybe_candid_path.and_then(|path| get_candid_type(&path, method_name)); let is_query_method = method_type.as_ref().map(|(_, f)| f.is_query()); let arguments_from_file = opts @@ -263,9 +281,6 @@ pub async fn exec( // Get the argument, get the type, convert the argument to the type and return // an error if any of it doesn't work. let arg_value = blob_from_arguments(arguments, opts.random.as_deref(), arg_type, &method_type)?; - let agent = env.get_agent(); - - fetch_root_key_if_needed(env).await?; // amount has been validated by cycle_amount_validator let cycles = opts.with_cycles.unwrap_or(0); diff --git a/src/dfx/src/commands/canister/delete.rs b/src/dfx/src/commands/canister/delete.rs index af19f9937c..877d316ae6 100644 --- a/src/dfx/src/commands/canister/delete.rs +++ b/src/dfx/src/commands/canister/delete.rs @@ -1,4 +1,3 @@ -use crate::lib::agent::create_agent_environment; use crate::lib::environment::Environment; use crate::lib::error::DfxResult; use crate::lib::ic_attributes::CanisterSettings; @@ -129,8 +128,7 @@ async fn delete_canister( }, CallSender::SelectedId => { let network = env.get_network_descriptor(); - let agent_env = create_agent_environment(env, Some(network.name.clone()))?; - let identity_name = agent_env + let identity_name = env .get_selected_identity() .expect("No selected identity.") .to_string(); @@ -138,7 +136,10 @@ async fn delete_canister( match wallet_canister_id(network, &identity_name)? { Some(canister_id) => WithdrawTarget::Canister { canister_id }, None if CYCLES_LEDGER_ENABLED => { - let Some(my_principal) = env.get_selected_identity_principal() else { bail!("Identity has no principal attached") }; + let Some(my_principal) = env.get_selected_identity_principal() + else { + bail!("Identity has no principal attached") + }; WithdrawTarget::CyclesLedger { to: Account { owner: my_principal, diff --git a/src/dfx/src/commands/canister/deposit_cycles.rs b/src/dfx/src/commands/canister/deposit_cycles.rs index 1db9ed67f2..0ff9bdb06b 100644 --- a/src/dfx/src/commands/canister/deposit_cycles.rs +++ b/src/dfx/src/commands/canister/deposit_cycles.rs @@ -79,11 +79,11 @@ pub async fn exec( // amount has been validated by cycle_amount_validator let cycles = opts.cycles; - let config = env.get_config_or_anyhow()?; - if let Some(canister) = opts.canister.as_deref() { deposit_cycles(env, canister, call_sender, cycles).await } else if opts.all { + let config = env.get_config_or_anyhow()?; + if let Some(canisters) = &config.get_config().canisters { for canister in canisters.keys() { deposit_cycles(env, canister, call_sender, cycles) diff --git a/src/dfx/src/commands/canister/sign.rs b/src/dfx/src/commands/canister/sign.rs index 69515733de..d00d4ecbaf 100644 --- a/src/dfx/src/commands/canister/sign.rs +++ b/src/dfx/src/commands/canister/sign.rs @@ -8,6 +8,7 @@ use crate::util::clap::parsers::file_or_stdin_parser; use crate::util::{arguments_from_file, blob_from_arguments, get_candid_type}; use anyhow::{anyhow, bail, Context}; use candid::Principal; +use candid_parser::utils::CandidSource; use clap::Parser; use dfx_core::identity::CallSender; use ic_agent::AgentError; @@ -86,7 +87,7 @@ pub async fn exec( if let Some(canister_name) = canister_id_store.get_name(callee_canister) { get_local_cid_and_candid_path(env, canister_name, Some(id))? } else { - // TODO fetch candid file from remote canister + // Sign works in offline mode, cannot fetch candid file from remote canister (id, None) } } @@ -96,7 +97,8 @@ pub async fn exec( } }; - let method_type = maybe_candid_path.and_then(|path| get_candid_type(&path, method_name)); + let method_type = + maybe_candid_path.and_then(|path| get_candid_type(CandidSource::File(&path), method_name)); let is_query_method = method_type.as_ref().map(|(_, f)| f.is_query()); let arguments_from_file = opts diff --git a/src/dfx/src/commands/canister/start.rs b/src/dfx/src/commands/canister/start.rs index 672068ec42..529817ca59 100644 --- a/src/dfx/src/commands/canister/start.rs +++ b/src/dfx/src/commands/canister/start.rs @@ -45,12 +45,12 @@ pub async fn exec( opts: CanisterStartOpts, call_sender: &CallSender, ) -> DfxResult { - let config = env.get_config_or_anyhow()?; fetch_root_key_if_needed(env).await?; if let Some(canister) = opts.canister.as_deref() { start_canister(env, canister, call_sender).await } else if opts.all { + let config = env.get_config_or_anyhow()?; if let Some(canisters) = &config.get_config().canisters { for canister in canisters.keys() { start_canister(env, canister, call_sender).await?; diff --git a/src/dfx/src/commands/canister/stop.rs b/src/dfx/src/commands/canister/stop.rs index 898ea5aef3..7f71472908 100644 --- a/src/dfx/src/commands/canister/stop.rs +++ b/src/dfx/src/commands/canister/stop.rs @@ -46,13 +46,12 @@ pub async fn exec( opts: CanisterStopOpts, call_sender: &CallSender, ) -> DfxResult { - let config = env.get_config_or_anyhow()?; - fetch_root_key_if_needed(env).await?; if let Some(canister) = opts.canister.as_deref() { stop_canister(env, canister, call_sender).await } else if opts.all { + let config = env.get_config_or_anyhow()?; if let Some(canisters) = &config.get_config().canisters { for canister in canisters.keys() { stop_canister(env, canister, call_sender).await?; diff --git a/src/dfx/src/commands/canister/uninstall_code.rs b/src/dfx/src/commands/canister/uninstall_code.rs index e7e9838e8f..4b386d7a36 100644 --- a/src/dfx/src/commands/canister/uninstall_code.rs +++ b/src/dfx/src/commands/canister/uninstall_code.rs @@ -47,13 +47,13 @@ pub async fn exec( opts: UninstallCodeOpts, call_sender: &CallSender, ) -> DfxResult { - let config = env.get_config_or_anyhow()?; - fetch_root_key_if_needed(env).await?; if let Some(canister) = opts.canister.as_deref() { uninstall_code(env, canister, call_sender).await } else if opts.all { + let config = env.get_config_or_anyhow()?; + if let Some(canisters) = &config.get_config().canisters { for canister in canisters.keys() { uninstall_code(env, canister, call_sender).await?; diff --git a/src/dfx/src/commands/deps/init.rs b/src/dfx/src/commands/deps/init.rs index 05e0b81172..44350710f6 100644 --- a/src/dfx/src/commands/deps/init.rs +++ b/src/dfx/src/commands/deps/init.rs @@ -5,10 +5,10 @@ use crate::lib::deps::{ }; use crate::lib::environment::Environment; use crate::lib::error::DfxResult; -use crate::util::{check_candid_file, fuzzy_parse_argument}; +use crate::util::fuzzy_parse_argument; use anyhow::{anyhow, bail}; use candid::Principal; -use candid_parser::{types::IDLTypes, typing::ast_to_type}; +use candid_parser::{types::IDLTypes, typing::ast_to_type, utils::CandidSource}; use clap::Parser; use slog::{info, warn, Logger}; @@ -68,7 +68,7 @@ fn set_init( .ok_or_else(|| anyhow!("Failed to find {canister_id} entry in pulled.json"))?; let canister_prompt = get_canister_prompt(canister_id, pulled_canister); let idl_path = get_pulled_service_candid_path(canister_id)?; - let (env, _) = check_candid_file(&idl_path)?; + let (env, _) = CandidSource::File(&idl_path).load()?; let candid_args = pulled_json.get_candid_args(canister_id)?; let candid_args_idl_types: IDLTypes = candid_args.parse()?; let mut types = vec![]; diff --git a/src/dfx/src/commands/new.rs b/src/dfx/src/commands/new.rs index 708adff9b6..98569b85b2 100644 --- a/src/dfx/src/commands/new.rs +++ b/src/dfx/src/commands/new.rs @@ -12,7 +12,6 @@ use dfx_core::config::model::dfinity::CONFIG_FILE_NAME; use dfx_core::json::{load_json_file, save_json_file}; use fn_error_context::context; use indicatif::HumanBytes; -use lazy_static::lazy_static; use semver::Version; use serde_json::Value; use slog::{info, warn, Logger}; @@ -30,15 +29,12 @@ const RELEASE_ROOT: &str = "https://sdk.dfinity.org"; // The dist-tag to use when getting the version from NPM. const AGENT_JS_DEFAULT_INSTALL_DIST_TAG: &str = "latest"; -lazy_static! { // Tested on a phone tethering connection. This should be fine with // little impact to the user, given that "new" is supposedly a // heavy-weight operation. Thus, worst case we are utilizing the user // expectation for the duration to have a more expensive version // check. - static ref CHECK_VERSION_TIMEOUT: Duration = Duration::from_secs(2); - -} +const CHECK_VERSION_TIMEOUT: Duration = Duration::from_secs(2); /// Creates a new project. #[derive(Parser)] @@ -417,7 +413,7 @@ pub fn exec(env: &dyn Environment, opts: NewOpts) -> DfxResult { // It is fine for the following command to timeout or fail. We // drop the error. - let latest_version = get_latest_version(RELEASE_ROOT, Some(*CHECK_VERSION_TIMEOUT)).ok(); + let latest_version = get_latest_version(RELEASE_ROOT, Some(CHECK_VERSION_TIMEOUT)).ok(); if is_upgrade_necessary(latest_version.as_ref(), current_version) { warn_upgrade(log, latest_version.as_ref(), current_version); diff --git a/src/dfx/src/commands/remote/generate_binding.rs b/src/dfx/src/commands/remote/generate_binding.rs index 947b5b852a..45a48b8b20 100644 --- a/src/dfx/src/commands/remote/generate_binding.rs +++ b/src/dfx/src/commands/remote/generate_binding.rs @@ -2,8 +2,8 @@ use crate::lib::agent::create_agent_environment; use crate::lib::environment::Environment; use crate::lib::error::DfxResult; use crate::lib::models::canister::CanisterPool; -use crate::util::check_candid_file; use anyhow::Context; +use candid_parser::utils::CandidSource; use clap::Parser; use slog::info; @@ -70,7 +70,7 @@ pub fn exec(env: &dyn Environment, opts: GenerateBindingOpts) -> DfxResult { continue; } } - let (type_env, did_types) = check_candid_file(&candid)?; + let (type_env, did_types) = CandidSource::File(&candid).load()?; let extension = main.extension().unwrap_or_default(); let bindings = if extension == "mo" { Some(candid_parser::bindings::motoko::compile( diff --git a/src/dfx/src/commands/wallet/upgrade.rs b/src/dfx/src/commands/wallet/upgrade.rs index a0d36b3076..229738cd8a 100644 --- a/src/dfx/src/commands/wallet/upgrade.rs +++ b/src/dfx/src/commands/wallet/upgrade.rs @@ -43,7 +43,15 @@ pub async fn exec(env: &dyn Environment, _opts: UpgradeOpts) -> DfxResult { let agent = env.get_agent(); - install_wallet(env, agent, canister_id, InstallMode::Upgrade).await?; + install_wallet( + env, + agent, + canister_id, + InstallMode::Upgrade { + skip_pre_upgrade: false, + }, + ) + .await?; println!("Upgraded the wallet wasm module."); Ok(()) diff --git a/src/dfx/src/config/cache.rs b/src/dfx/src/config/cache.rs index 7491d8e701..401b8597ae 100644 --- a/src/dfx/src/config/cache.rs +++ b/src/dfx/src/config/cache.rs @@ -130,7 +130,7 @@ pub fn install_version(v: &str, force: bool) -> Result { // Copy our own binary in the cache. let dfx = temp_p.join("dfx"); - #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] dfx_core::fs::write( &dfx, dfx_core::fs::read(¤t_exe).map_err(UnifiedIoError::from)?, diff --git a/src/dfx/src/lib/builders/assets.rs b/src/dfx/src/lib/builders/assets.rs index 701075a4df..eff29745ac 100644 --- a/src/dfx/src/lib/builders/assets.rs +++ b/src/dfx/src/lib/builders/assets.rs @@ -56,6 +56,8 @@ pub struct AssetsBuilder { _cache: Arc, logger: Logger, } +unsafe impl Send for AssetsBuilder {} +unsafe impl Sync for AssetsBuilder {} impl AssetsBuilder { #[context("Failed to create AssetBuilder.")] diff --git a/src/dfx/src/lib/builders/mod.rs b/src/dfx/src/lib/builders/mod.rs index 88b95e9abc..05c6706905 100644 --- a/src/dfx/src/lib/builders/mod.rs +++ b/src/dfx/src/lib/builders/mod.rs @@ -3,9 +3,9 @@ use crate::lib::canister_info::CanisterInfo; use crate::lib::environment::Environment; use crate::lib::error::{BuildError, DfxError, DfxResult}; use crate::lib::models::canister::CanisterPool; -use crate::util::check_candid_file; use anyhow::{anyhow, bail, Context}; use candid::Principal as CanisterId; +use candid_parser::utils::CandidSource; use dfx_core::config::model::dfinity::{Config, Profile}; use dfx_core::network::provider::get_network_context; use dfx_core::util; @@ -150,7 +150,7 @@ pub trait CanisterBuilder { let generated_idl_path = self.generate_idl(pool, info, config)?; - let (env, ty) = check_candid_file(generated_idl_path.as_path())?; + let (env, ty) = CandidSource::File(generated_idl_path.as_path()).load()?; // Typescript if bindings.contains(&"ts".to_string()) { @@ -328,7 +328,7 @@ pub fn run_command(args: Vec, vars: &[Env<'_>], cwd: &Path) -> DfxResult let canonicalized = dfx_core::fs::canonicalize(&cwd.join(command_name)) .or_else(|_| which::which(command_name)) .map_err(|_| anyhow!("Cannot find command or file {command_name}"))?; - let mut cmd = Command::new(&canonicalized); + let mut cmd = Command::new(canonicalized); cmd.args(arguments) .current_dir(cwd) diff --git a/src/dfx/src/lib/builders/motoko.rs b/src/dfx/src/lib/builders/motoko.rs index 3b3f526d38..6934f0a61e 100644 --- a/src/dfx/src/lib/builders/motoko.rs +++ b/src/dfx/src/lib/builders/motoko.rs @@ -26,6 +26,8 @@ pub struct MotokoBuilder { logger: slog::Logger, cache: Arc, } +unsafe impl Send for MotokoBuilder {} +unsafe impl Sync for MotokoBuilder {} impl MotokoBuilder { #[context("Failed to create MotokoBuilder.")] diff --git a/src/dfx/src/lib/error/mod.rs b/src/dfx/src/lib/error/mod.rs index 576c74fa65..90bd8d984f 100644 --- a/src/dfx/src/lib/error/mod.rs +++ b/src/dfx/src/lib/error/mod.rs @@ -4,7 +4,6 @@ pub mod notify_top_up; pub mod project; pub use build::BuildError; -pub use dfx_core::error::extension::ExtensionError; pub use notify_create_canister::NotifyCreateCanisterError; pub use notify_top_up::NotifyTopUpError; pub use project::ProjectError; diff --git a/src/dfx/src/lib/info/mod.rs b/src/dfx/src/lib/info/mod.rs index 67e3d4ea31..04bf28df82 100644 --- a/src/dfx/src/lib/info/mod.rs +++ b/src/dfx/src/lib/info/mod.rs @@ -1,8 +1,5 @@ -use lazy_static::lazy_static; -lazy_static! { - static ref REPLICA_REV_STR: String = env!("DFX_ASSET_REPLICA_REV").to_string(); -} +const REPLICA_REV_STR: &str = env!("DFX_ASSET_REPLICA_REV"); pub fn replica_rev() -> &'static str { - &REPLICA_REV_STR + REPLICA_REV_STR } diff --git a/src/dfx/src/lib/migrate.rs b/src/dfx/src/lib/migrate.rs index 16642be28a..a1bb2085a9 100644 --- a/src/dfx/src/lib/migrate.rs +++ b/src/dfx/src/lib/migrate.rs @@ -65,7 +65,15 @@ async fn migrate_wallet( if !wallet.version_supports_u128_cycles() { if fix { println!("Upgrading wallet... "); - install_wallet(env, agent, *wallet.canister_id_(), InstallMode::Upgrade).await? + install_wallet( + env, + agent, + *wallet.canister_id_(), + InstallMode::Upgrade { + skip_pre_upgrade: false, + }, + ) + .await? } else { println!("The wallet is outdated; run `dfx wallet upgrade`"); } diff --git a/src/dfx/src/lib/models/canister.rs b/src/dfx/src/lib/models/canister.rs index 5f435683d9..9dec60901d 100644 --- a/src/dfx/src/lib/models/canister.rs +++ b/src/dfx/src/lib/models/canister.rs @@ -8,9 +8,10 @@ use crate::lib::error::{BuildError, DfxError, DfxResult}; use crate::lib::metadata::dfx::DfxMetadata; use crate::lib::metadata::names::{CANDID_ARGS, CANDID_SERVICE, DFX}; use crate::lib::wasm::file::{compress_bytes, read_wasm_module}; -use crate::util::{assets, check_candid_file}; +use crate::util::assets; use anyhow::{anyhow, bail, Context}; use candid::Principal as CanisterId; +use candid_parser::utils::CandidSource; use dfx_core::config::model::canister_id_store::CanisterIdStore; use dfx_core::config::model::dfinity::{ CanisterMetadataSection, Config, MetadataVisibility, WasmOptLevel, @@ -41,6 +42,8 @@ pub struct Canister { builder: Arc, output: RefCell>, } +unsafe impl Send for Canister {} +unsafe impl Sync for Canister {} impl Canister { /// Create a new canister. @@ -273,15 +276,15 @@ impl Canister { let IdlBuildOutput::File(build_idl_path) = &build_output.idl; - // 1. Copy the complete IDL file to .dfx/local/canisters/NAME/constructor.did. + // 1. Separate into constructor.did, service.did and init_args + let (constructor_did, service_did, init_args) = separate_candid(build_idl_path)?; + + // 2. Copy the constructor IDL file to .dfx/local/canisters/NAME/constructor.did. let constructor_idl_path = self.info.get_constructor_idl_path(); dfx_core::fs::composite::ensure_parent_dir_exists(&constructor_idl_path)?; - dfx_core::fs::copy(build_idl_path, &constructor_idl_path)?; + dfx_core::fs::write(&constructor_idl_path, constructor_did)?; dfx_core::fs::set_permissions_readwrite(&constructor_idl_path)?; - // 2. Separate into service.did and init_args - let (service_did, init_args) = separate_candid(build_idl_path)?; - // 3. Save service.did into following places in .dfx/local/: // - canisters/NAME/service.did // - IDL_ROOT/CANISTER_ID.did @@ -335,42 +338,61 @@ fn wasm_opt_level_convert(opt_level: WasmOptLevel) -> OptLevel { } } -fn separate_candid(path: &Path) -> DfxResult<(String, String)> { - let (env, actor) = check_candid_file(path)?; +fn separate_candid(path: &Path) -> DfxResult<(String, String, String)> { + use candid::pretty::candid::{compile, pp_args}; + use candid::types::internal::TypeInner; + use candid_parser::{ + pretty_parse, + types::{Dec, IDLProg}, + }; + let did = dfx_core::fs::read_to_string(path)?; + let prog = pretty_parse::(&format!("{}", path.display()), &did)?; + let has_imports = prog + .decs + .iter() + .any(|dec| matches!(dec, Dec::ImportType(_) | Dec::ImportServ(_))); + let (env, actor) = CandidSource::File(path).load()?; let actor = actor.ok_or_else(|| anyhow!("provided candid file contains no main service"))?; - if let candid::types::internal::TypeInner::Class(args, ty) = actor.as_ref() { - use candid_parser::pretty::{ - candid::{compile, pp_ty}, - utils::{concat, enclose}, + let actor = env.trace_type(&actor)?; + let has_init_args = matches!(actor.as_ref(), TypeInner::Class(_, _)); + if has_imports || has_init_args { + let (init_args, serv) = match actor.as_ref() { + TypeInner::Class(args, ty) => (args.clone(), ty.clone()), + TypeInner::Service(_) => (vec![], actor.clone()), + _ => unreachable!(), }; - - let actor = Some(ty.clone()); - let service_did = compile(&env, &actor); - let doc = concat(args.iter().map(pp_ty), ","); - let init_args = enclose("(", doc, ")").pretty(80).to_string(); - Ok((service_did, init_args)) + let init_args = pp_args(&init_args).pretty(80).to_string(); + let service = compile(&env, &Some(serv)); + let constructor = compile(&env, &Some(actor)); + Ok((constructor, service, init_args)) } else { - // The original candid from builder output doesn't contain init_args - // Use it directly to avoid items reordering - let service_did = dfx_core::fs::read_to_string(path)?; - let init_args = String::from("()"); - Ok((service_did, init_args)) + // Keep the original did file to preserve comments + Ok((did.clone(), did, "()".to_string())) } } #[context("{} is not a valid subtype of {}", specified_idl_path.display(), compiled_idl_path.display())] fn check_valid_subtype(compiled_idl_path: &Path, specified_idl_path: &Path) -> DfxResult { - let (mut env, opt_specified) = - check_candid_file(specified_idl_path).context("Checking specified candid file.")?; + use candid::types::subtype::{subtype_with_config, OptReport}; + let (mut env, opt_specified) = CandidSource::File(specified_idl_path) + .load() + .context("Checking specified candid file.")?; let specified_type = opt_specified.expect("Specified did file should contain some service interface"); - let (env2, opt_compiled) = - check_candid_file(compiled_idl_path).context("Checking compiled candid file.")?; + let (env2, opt_compiled) = CandidSource::File(compiled_idl_path) + .load() + .context("Checking compiled candid file.")?; let compiled_type = opt_compiled.expect("Compiled did file should contain some service interface"); let mut gamma = HashSet::new(); let specified_type = env.merge_type(env2, specified_type); - candid::types::subtype::subtype(&mut gamma, &env, &compiled_type, &specified_type)?; + subtype_with_config( + OptReport::Error, + &mut gamma, + &env, + &compiled_type, + &specified_type, + )?; Ok(()) } @@ -810,7 +832,7 @@ fn build_canister_js(canister_id: &CanisterId, canister_info: &CanisterInfo) -> .get_service_idl_path() .with_extension("did.d.ts"); - let (env, ty) = check_candid_file(&canister_info.get_service_idl_path())?; + let (env, ty) = CandidSource::File(&canister_info.get_constructor_idl_path()).load()?; let content = ensure_trailing_newline(candid_parser::bindings::javascript::compile(&env, &ty)); std::fs::write(&output_did_js_path, content).with_context(|| { format!( diff --git a/src/dfx/src/lib/operations/canister/install_canister.rs b/src/dfx/src/lib/operations/canister/install_canister.rs index 3f94596cec..60f1988573 100644 --- a/src/dfx/src/lib/operations/canister/install_canister.rs +++ b/src/dfx/src/lib/operations/canister/install_canister.rs @@ -63,13 +63,15 @@ pub async fn install_canister( ); let mode = mode.unwrap_or_else(|| { if installed_module_hash.is_some() { - InstallMode::Upgrade + InstallMode::Upgrade { + skip_pre_upgrade: false, + } } else { InstallMode::Install } }); if let Some(canister_info) = canister_info { - if !skip_consent && matches!(mode, InstallMode::Reinstall | InstallMode::Upgrade) { + if !skip_consent && matches!(mode, InstallMode::Reinstall | InstallMode::Upgrade { .. }) { let candid = read_module_metadata(agent, canister_id, "candid:service").await; if let Some(candid) = &candid { match check_candid_compatibility(canister_info, candid) { @@ -85,7 +87,8 @@ pub async fn install_canister( } } } - if !skip_consent && canister_info.is_motoko() && matches!(mode, InstallMode::Upgrade) { + if !skip_consent && canister_info.is_motoko() && matches!(mode, InstallMode::Upgrade { .. }) + { let stable_types = read_module_metadata(agent, canister_id, "motoko:stable-types").await; if let Some(stable_types) = &stable_types { @@ -120,7 +123,7 @@ pub async fn install_canister( let new_hash = Sha256::digest(&wasm_module); debug!(log, "New wasm module hash: {}", hex::encode(new_hash)); - if mode == InstallMode::Upgrade + if matches!(mode, InstallMode::Upgrade { .. }) && matches!(&installed_module_hash, Some(old_hash) if old_hash[..] == new_hash[..]) && !upgrade_unchanged { @@ -246,7 +249,8 @@ fn check_candid_compatibility( canister_info: &CanisterInfo, candid: &str, ) -> anyhow::Result> { - use crate::util::check_candid_file; + use candid::types::subtype::{subtype_with_config, OptReport}; + use candid_parser::utils::CandidSource; let candid_path = canister_info.get_constructor_idl_path(); let deployed_path = canister_info .get_constructor_idl_path() @@ -257,16 +261,19 @@ fn check_candid_compatibility( deployed_path.to_string_lossy() ) })?; - let (mut env, opt_new) = - check_candid_file(&candid_path).context("Checking generated did file.")?; + let (mut env, opt_new) = CandidSource::File(&candid_path) + .load() + .context("Checking generated did file.")?; let new_type = opt_new .ok_or_else(|| anyhow!("Generated did file should contain some service interface"))?; - let (env2, opt_old) = check_candid_file(&deployed_path).context("Checking old candid file.")?; + let (env2, opt_old) = CandidSource::File(&deployed_path) + .load() + .context("Checking old candid file.")?; let old_type = opt_old .ok_or_else(|| anyhow!("Deployed did file should contain some service interface"))?; let mut gamma = HashSet::new(); let old_type = env.merge_type(env2, old_type); - let result = candid::types::subtype::subtype(&mut gamma, &env, &new_type, &old_type); + let result = subtype_with_config(OptReport::Error, &mut gamma, &env, &new_type, &old_type); Ok(match result { Ok(_) => None, Err(e) => Some(e.to_string()), @@ -417,7 +424,7 @@ fn run_post_install_task( let canonicalized = dfx_core::fs::canonicalize(&cwd.join(&words[0])) .or_else(|_| which::which(&words[0])) .map_err(|_| anyhow!("Cannot find command or file {}", &words[0]))?; - let mut command = Command::new(&canonicalized); + let mut command = Command::new(canonicalized); command.args(&words[1..]); let vars = get_and_write_environment_variables(canister, &network.name, pool, dependencies, env_file)?; diff --git a/src/dfx/src/lib/operations/canister/mod.rs b/src/dfx/src/lib/operations/canister/mod.rs index 9e01743f42..a5af1e7ce2 100644 --- a/src/dfx/src/lib/operations/canister/mod.rs +++ b/src/dfx/src/lib/operations/canister/mod.rs @@ -12,17 +12,14 @@ use candid::utils::ArgumentDecoder; use candid::CandidType; use candid::Principal as CanisterId; use candid::Principal; -pub use deploy_canisters::deploy_canisters; -pub use deploy_canisters::DeployMode; use dfx_core::canister::build_wallet_canister; -pub use dfx_core::canister::install_canister_wasm; use dfx_core::identity::CallSender; use fn_error_context::context; use ic_utils::interfaces::management_canister::builders::CanisterSettings; use ic_utils::interfaces::management_canister::{MgmtMethod, StatusCallResult}; use ic_utils::interfaces::ManagementCanister; use ic_utils::Argument; -pub use install_canister::{install_canister, install_wallet}; +pub use install_canister::install_wallet; use std::path::PathBuf; pub mod motoko_playground; diff --git a/src/dfx/src/lib/operations/canister/motoko_playground.rs b/src/dfx/src/lib/operations/canister/motoko_playground.rs index 1d6d41db4a..22dd90afe6 100644 --- a/src/dfx/src/lib/operations/canister/motoko_playground.rs +++ b/src/dfx/src/lib/operations/canister/motoko_playground.rs @@ -45,9 +45,36 @@ impl CanisterInfo { pub struct InstallArgs<'a> { pub arg: &'a [u8], pub wasm_module: &'a [u8], - pub mode: InstallMode, + pub mode: PlaygroundInstallMode, pub canister_id: Principal, } + +#[derive(CandidType, Deserialize, Debug)] +pub enum PlaygroundInstallMode { + #[serde(rename = "install")] + Install, + #[serde(rename = "upgrade")] + Upgrade, + #[serde(rename = "reinstall")] + Reinstall, +} + +impl TryFrom for PlaygroundInstallMode { + type Error = anyhow::Error; + fn try_from(m: InstallMode) -> DfxResult { + match m { + InstallMode::Install => Ok(Self::Install), + InstallMode::Reinstall => Ok(Self::Reinstall), + InstallMode::Upgrade { + skip_pre_upgrade: false, + } => Ok(Self::Upgrade), + InstallMode::Upgrade { + skip_pre_upgrade: true, + } => bail!("Cannot skip pre-upgrade on the playground"), + } + } +} + #[derive(CandidType)] struct InstallConfig<'a> { profiling: bool, @@ -167,7 +194,7 @@ pub async fn playground_install_code( let install_arg = InstallArgs { arg, wasm_module, - mode, + mode: mode.try_into()?, canister_id: canister_info.id, }; let install_config = InstallConfig { diff --git a/src/dfx/src/main.rs b/src/dfx/src/main.rs index 712d2df3f3..24543ad355 100644 --- a/src/dfx/src/main.rs +++ b/src/dfx/src/main.rs @@ -193,7 +193,8 @@ fn main() { let command = cli_opts.command; let result = match EnvironmentImpl::new() { Ok(env) => { - maybe_redirect_dfx(env.get_version()).map_or((), |_| unreachable!()); + #[allow(clippy::let_unit_value)] + let _ = maybe_redirect_dfx(env.get_version()).map_or((), |_| unreachable!()); match EnvironmentImpl::new().map(|env| { env.with_logger(log) .with_identity_override(identity) diff --git a/src/dfx/src/util/mod.rs b/src/dfx/src/util/mod.rs index 3eda9ffcca..62afddd5fa 100644 --- a/src/dfx/src/util/mod.rs +++ b/src/dfx/src/util/mod.rs @@ -7,7 +7,7 @@ use bytes::Bytes; use candid::types::{value::IDLValue, Function, Type, TypeEnv, TypeInner}; use candid::IDLArgs; use candid_parser::error::pretty_diagnose; -use candid_parser::typing::pretty_check_file; +use candid_parser::utils::CandidSource; use dfx_core::fs::create_dir_all; use fn_error_context::context; #[cfg(unix)] @@ -112,18 +112,15 @@ pub async fn read_module_metadata( /// Parse IDL file into TypeEnv. This is a best effort function: it will succeed if /// the IDL file can be parsed and type checked in Rust parser, and has an /// actor in the IDL file. If anything fails, it returns None. -pub fn get_candid_type( - idl_path: &std::path::Path, - method_name: &str, -) -> Option<(TypeEnv, Function)> { - let (env, ty) = check_candid_file(idl_path).ok()?; +pub fn get_candid_type(candid: CandidSource, method_name: &str) -> Option<(TypeEnv, Function)> { + let (env, ty) = candid.load().ok()?; let actor = ty?; let method = env.get_method(&actor, method_name).ok()?.clone(); Some((env, method)) } pub fn get_candid_init_type(idl_path: &std::path::Path) -> Option<(TypeEnv, Function)> { - let (env, ty) = check_candid_file(idl_path).ok()?; + let (env, ty) = CandidSource::File(idl_path).load().ok()?; let actor = ty?; let args = match actor.as_ref() { TypeInner::Class(args, _) => args.clone(), @@ -137,16 +134,6 @@ pub fn get_candid_init_type(idl_path: &std::path::Path) -> Option<(TypeEnv, Func Some((env, res)) } -pub fn check_candid_file(idl_path: &std::path::Path) -> DfxResult<(TypeEnv, Option)> { - //context macro does not work for the returned error type - pretty_check_file(idl_path).with_context(|| { - format!( - "Candid file check failed for {}.", - idl_path.to_string_lossy() - ) - }) -} - pub fn arguments_from_file(file_name: &Path) -> DfxResult { if file_name == Path::new("-") { let mut content = String::new(); diff --git a/src/distributed/assetstorage.wasm.gz b/src/distributed/assetstorage.wasm.gz index 08649715e2..2796c34f49 100755 Binary files a/src/distributed/assetstorage.wasm.gz and b/src/distributed/assetstorage.wasm.gz differ diff --git a/src/distributed/ui.wasm b/src/distributed/ui.wasm index 673188b3e5..8d9153ce31 100644 Binary files a/src/distributed/ui.wasm and b/src/distributed/ui.wasm differ