diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 91edd4a9ed..3281077db8 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -1,3 +1,17 @@ += 0.7.6 + +== icx-proxy + +The streaming callback mechanism now requires the following record structure for the token: + type StreamingCallbackToken = record { + key: text; + content_encoding: text; + index: nat; + sha256: opt blob; + }; + +Previously, the token could be a record with any set of fields. + = 0.7.1 == DFX diff --git a/Cargo.lock b/Cargo.lock index 253c6ab427..bf9eea5a4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -405,9 +405,9 @@ checksum = "81cddc5f91628367664cc7c69714ff08deee8a3efc54623011c772544d7b2767" [[package]] name = "arbitrary" -version = "0.4.7" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db55d72333851e17d572bec876e390cd3b11eb1ef53ae821dd9f3b653d2b4569" +checksum = "237430fd6ed3740afe94eefcc278ae21e050285be882804e0d6e8695f0c94691" [[package]] name = "arrayref" @@ -537,6 +537,28 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6736e2428df2ca2848d846c43e88745121a6654696e349ce0054a420815a7409" +[[package]] +name = "binread" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a883c66db6f3c86b19210ceed1b2b18de64b617c92cb0f0bc90b8c05f18dba87" +dependencies = [ + "binread_derive", + "lazy_static", +] + +[[package]] +name = "binread_derive" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c575d9a28eb4c2d61747b23d50271c6699b941448c35a738af35267f90b3d4d2" +dependencies = [ + "either", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "bit-set" version = "0.5.2" @@ -669,11 +691,13 @@ dependencies = [ [[package]] name = "candid" -version = "0.6.20" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87374c2fe85d0195e32eed34e1bc20e8783ee755cc2c5ba7b113a1920dd75d2f" +checksum = "b4ce6a365c345f4f690d22ae6cfe468e8865fa2720923af20da9384f0f698534" dependencies = [ + "anyhow", "arbitrary", + "binread", "byteorder", "candid_derive", "codespan-reporting", @@ -684,7 +708,7 @@ dependencies = [ "lalrpop-util", "leb128", "logos", - "num-bigint 0.3.2", + "num-bigint 0.4.0", "num-traits", "num_enum", "paste", @@ -698,9 +722,9 @@ dependencies = [ [[package]] name = "candid_derive" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d7232a5dd836d83ae9ffd79061b42d729afab6f11bfaba7dc2a82575b686ae2" +checksum = "2e02c03c4d547674a3f3f3109538fb49871fbe636216daa019f06a62faca9061" dependencies = [ "lazy_static", "proc-macro2", @@ -794,9 +818,9 @@ dependencies = [ [[package]] name = "codespan-reporting" -version = "0.9.5" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0762455306b1ed42bc651ef6a2197aabda5e1d4a43c34d5eab5c1a3634e81d" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" dependencies = [ "termcolor", "unicode-width", @@ -1176,7 +1200,6 @@ dependencies = [ "pest_consume", "pest_generator", "quote", - "reqwest 0.11.2", "serde", "serde_cbor", "sha2", @@ -1907,17 +1930,17 @@ dependencies = [ [[package]] name = "ic-agent" -version = "0.5.1" -source = "git+https://github.com/dfinity/agent-rs.git?rev=de2e774e4afb39dd06db00d390ec2dbbc5a51597#de2e774e4afb39dd06db00d390ec2dbbc5a51597" +version = "0.5.2" +source = "git+https://github.com/dfinity/agent-rs.git?rev=c6543eb3a2a9df0c706092de75f8888331ae81b1#c6543eb3a2a9df0c706092de75f8888331ae81b1" dependencies = [ "async-trait", "base32", "base64 0.12.3", "byteorder", + "candid", "garcon", "hex", "http", - "ic-types", "leb128", "mime", "openssl", @@ -1938,11 +1961,10 @@ dependencies = [ [[package]] name = "ic-identity-hsm" version = "0.3.2" -source = "git+https://github.com/dfinity/agent-rs.git?rev=de2e774e4afb39dd06db00d390ec2dbbc5a51597#de2e774e4afb39dd06db00d390ec2dbbc5a51597" +source = "git+https://github.com/dfinity/agent-rs.git?rev=c6543eb3a2a9df0c706092de75f8888331ae81b1#c6543eb3a2a9df0c706092de75f8888331ae81b1" dependencies = [ "hex", "ic-agent", - "ic-types", "num-bigint 0.3.2", "openssl", "pkcs11", @@ -1952,8 +1974,9 @@ dependencies = [ [[package]] name = "ic-types" -version = "0.1.4" -source = "git+https://github.com/dfinity/agent-rs.git?rev=de2e774e4afb39dd06db00d390ec2dbbc5a51597#de2e774e4afb39dd06db00d390ec2dbbc5a51597" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f0b1f1517d697f67a8b5ad558ef6b9372ed1fc5ab669a519d7fa1837e8f88a" dependencies = [ "base32", "crc32fast", @@ -1966,14 +1989,13 @@ dependencies = [ [[package]] name = "ic-utils" -version = "0.3.2" -source = "git+https://github.com/dfinity/agent-rs.git?rev=de2e774e4afb39dd06db00d390ec2dbbc5a51597#de2e774e4afb39dd06db00d390ec2dbbc5a51597" +version = "0.3.3" +source = "git+https://github.com/dfinity/agent-rs.git?rev=c6543eb3a2a9df0c706092de75f8888331ae81b1#c6543eb3a2a9df0c706092de75f8888331ae81b1" dependencies = [ "async-trait", "candid", "garcon", "ic-agent", - "ic-types", "serde", "serde_bytes", "strum", @@ -2535,6 +2557,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0d047c1062aa51e256408c560894e5251f08925980e53cf1aa5bd00eec6512" +dependencies = [ + "autocfg 1.0.1", + "num-integer", + "num-traits", +] + [[package]] name = "num-integer" version = "0.1.44" @@ -3730,12 +3763,12 @@ dependencies = [ [[package]] name = "simple_asn1" -version = "0.5.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8d597fce66eb0f19dd129b9956e4054cba21aeaf97d4116595027b670fac50" +checksum = "8eb4ea60fb301dc81dfc113df680571045d375ab7345d171c5dc7d7e13107a80" dependencies = [ "chrono", - "num-bigint 0.3.2", + "num-bigint 0.4.0", "num-traits", "thiserror", ] diff --git a/Cargo.toml b/Cargo.toml index d8cd880104..124a32d079 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,19 +6,14 @@ members = [ [patch.crates-io.ic-agent] version = "0.5.1" git = "https://github.com/dfinity/agent-rs.git" -rev = "de2e774e4afb39dd06db00d390ec2dbbc5a51597" +rev = "c6543eb3a2a9df0c706092de75f8888331ae81b1" [patch.crates-io.ic-identity-hsm] version = "0.3.2" git = "https://github.com/dfinity/agent-rs.git" -rev = "de2e774e4afb39dd06db00d390ec2dbbc5a51597" - -[patch.crates-io.ic-types] -version = "0.1.4" -git = "https://github.com/dfinity/agent-rs.git" -rev = "de2e774e4afb39dd06db00d390ec2dbbc5a51597" +rev = "c6543eb3a2a9df0c706092de75f8888331ae81b1" [patch.crates-io.ic-utils] version = "0.3.2" git = "https://github.com/dfinity/agent-rs.git" -rev = "de2e774e4afb39dd06db00d390ec2dbbc5a51597" +rev = "c6543eb3a2a9df0c706092de75f8888331ae81b1" diff --git a/e2e/tests-dfx/assetscanister.bash b/e2e/tests-dfx/assetscanister.bash index c8dd008fd1..bbe6dfd945 100644 --- a/e2e/tests-dfx/assetscanister.bash +++ b/e2e/tests-dfx/assetscanister.bash @@ -173,14 +173,14 @@ teardown() { assert_command dfx canister --no-wallet call --query e2e_project_assets get '(record{key="/text-with-newlines.txt";accept_encodings=vec{"identity"}})' - assert_command dfx canister --no-wallet call --query e2e_project_assets get_chunk '(record{key="/text-with-newlines.txt";content_encoding="identity";index=0;sha256=vec { 243; 191; 114; 177; 83; 18; 144; 121; 131; 38; 109; 183; 89; 244; 120; 136; 53; 187; 14; 74; 8; 112; 86; 100; 115; 8; 179; 155; 69; 78; 95; 160; }})' + assert_command dfx canister --no-wallet call --query e2e_project_assets get_chunk '(record{key="/text-with-newlines.txt";content_encoding="identity";index=0;sha256=opt vec { 243; 191; 114; 177; 83; 18; 144; 121; 131; 38; 109; 183; 89; 244; 120; 136; 53; 187; 14; 74; 8; 112; 86; 100; 115; 8; 179; 155; 69; 78; 95; 160; }})' assert_command dfx canister --no-wallet call --query e2e_project_assets get_chunk '(record{key="/text-with-newlines.txt";content_encoding="identity";index=0})' - assert_command_fail dfx canister --no-wallet call --query e2e_project_assets get_chunk '(record{key="/text-with-newlines.txt";content_encoding="identity";index=0;sha256=vec { 88; 87; 86; }})' + assert_command_fail dfx canister --no-wallet call --query e2e_project_assets get_chunk '(record{key="/text-with-newlines.txt";content_encoding="identity";index=0;sha256=opt vec { 88; 87; 86; }})' assert_match 'sha256 mismatch' - assert_command dfx canister --no-wallet call --query e2e_project_assets http_request_streaming_callback '(record{key="/text-with-newlines.txt";content_encoding="identity";index=0;sha256=vec { 243; 191; 114; 177; 83; 18; 144; 121; 131; 38; 109; 183; 89; 244; 120; 136; 53; 187; 14; 74; 8; 112; 86; 100; 115; 8; 179; 155; 69; 78; 95; 160; }})' + assert_command dfx canister --no-wallet call --query e2e_project_assets http_request_streaming_callback '(record{key="/text-with-newlines.txt";content_encoding="identity";index=0;sha256=opt vec { 243; 191; 114; 177; 83; 18; 144; 121; 131; 38; 109; 183; 89; 244; 120; 136; 53; 187; 14; 74; 8; 112; 86; 100; 115; 8; 179; 155; 69; 78; 95; 160; }})' assert_command dfx canister --no-wallet call --query e2e_project_assets http_request_streaming_callback '(record{key="/text-with-newlines.txt";content_encoding="identity";index=0})' - assert_command_fail dfx canister --no-wallet call --query e2e_project_assets http_request_streaming_callback '(record{key="/text-with-newlines.txt";content_encoding="identity";index=0;sha256=vec { 88; 87; 86; }})' + assert_command_fail dfx canister --no-wallet call --query e2e_project_assets http_request_streaming_callback '(record{key="/text-with-newlines.txt";content_encoding="identity";index=0;sha256=opt vec { 88; 87; 86; }})' assert_match 'sha256 mismatch' } @@ -197,7 +197,7 @@ teardown() { assert_eq '(blob "\b8\01 \80\0aw12 \00xy\0aKL\0b\0ajk")' assert_command dfx canister call --query e2e_project_assets retrieve '("/text-with-newlines.txt")' --output idl - assert_eq '(blob "cherries\0ait'\''s cherry season\0aCHERRIES")' + assert_eq '(blob "cherries\0ait\27s cherry season\0aCHERRIES")' assert_command dfx canister call --update e2e_project_assets store '(record{key="AA"; content_type="text/plain"; content_encoding="identity"; content=blob "hello, world!"})' assert_eq '()' diff --git a/e2e/tests-dfx/basic-project.bash b/e2e/tests-dfx/basic-project.bash index 26d2200c6d..d8e104e06c 100644 --- a/e2e/tests-dfx/basic-project.bash +++ b/e2e/tests-dfx/basic-project.bash @@ -56,17 +56,17 @@ teardown() { dfx canister install hello assert_command dfx canister call hello read - assert_eq "(0)" + assert_eq "(0 : nat)" assert_command dfx canister call hello inc assert_eq "()" assert_command dfx canister call hello read - assert_eq "(1)" + assert_eq "(1 : nat)" dfx canister call hello inc assert_command dfx canister call hello read - assert_eq "(2)" + assert_eq "(2 : nat)" assert_command dfx canister call hello read --output raw assert_eq "4449444c00017d02" @@ -77,7 +77,7 @@ teardown() { dfx canister call hello inc assert_command dfx canister call --query hello read - assert_eq "(3)" + assert_eq "(3 : nat)" assert_command dfx canister call hello inc --async assert_command dfx canister request-status "$stdout" "$(dfx canister id hello)" @@ -90,7 +90,7 @@ teardown() { # Call with user Identity as Sender assert_command dfx canister --no-wallet call hello read --async assert_command dfx canister request-status "$stdout" "$(dfx canister id hello)" - assert_eq "(1_337)" + assert_eq "(1_337 : nat)" # Call using the wallet's call forwarding assert_command dfx canister --wallet="$(dfx identity get-wallet)" call hello read --async @@ -107,7 +107,7 @@ teardown() { dfx canister install --all assert_command dfx canister call hello inc '(42,false,"testzZ",vec{1;2;3},opt record{head=42; tail=opt record{head=+43; tail=null}}, variant { cons=record{ 42; variant { cons=record{43; variant { nil }} } } })' --output idl - assert_eq "(43, true, \"uftu{[\", vec { 2; 3; 4;}, opt record { head = 43; tail = opt record { head = 44; tail = null;};}, variant { cons = record { 43; variant { cons = record { 44; variant { nil };} };} })" + assert_eq "(43 : int, true, \"uftu{[\", vec { 2 : nat; 3 : nat; 4 : nat;}, opt record { head = 43 : int; tail = opt record { head = 44 : int; tail = null;};}, variant { cons = record { 43 : int; variant { cons = record { 44 : int; variant { nil };} };} })" } @test "build + install + call -- matrix_multiply_mo" { @@ -118,5 +118,5 @@ teardown() { dfx canister install --all assert_command dfx canister call hello multiply '(vec{vec{1;2};vec{3;4};vec{5;6}},vec{vec{1;2;3};vec{4;5;6}})' - assert_eq "(vec { vec { 9; 12; 15 }; vec { 19; 26; 33 }; vec { 29; 40; 51 } })" + assert_eq "( vec { vec { 9 : int; 12 : int; 15 : int }; vec { 19 : int; 26 : int; 33 : int }; vec { 29 : int; 40 : int; 51 : int }; }, )" } diff --git a/e2e/tests-dfx/build_granular.bash b/e2e/tests-dfx/build_granular.bash index b4372b39aa..4af8aa501c 100644 --- a/e2e/tests-dfx/build_granular.bash +++ b/e2e/tests-dfx/build_granular.bash @@ -69,7 +69,7 @@ teardown() { assert_eq '(blob "\b8\01 \80\0aw12 \00xy\0aKL\0b\0ajk")' assert_command dfx canister call --query e2e_project_assets retrieve '("/text-with-newlines.txt")' --output idl - assert_eq '(blob "cherries\0ait'\''s cherry season\0aCHERRIES")' + assert_eq '(blob "cherries\0ait\27s cherry season\0aCHERRIES")' } @test "cyclic dependencies are detected" { diff --git a/nix/sources.json b/nix/sources.json index 832eb70ceb..86f01ab114 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -15,7 +15,7 @@ "agent-rs": { "branch": "main", "repo": "https://github.com/dfinity/agent-rs", - "rev": "de2e774e4afb39dd06db00d390ec2dbbc5a51597", + "rev": "c6543eb3a2a9df0c706092de75f8888331ae81b1", "type": "git" }, "bats-support": { diff --git a/src/dfx/Cargo.toml b/src/dfx/Cargo.toml index cc85d126e6..088618783c 100644 --- a/src/dfx/Cargo.toml +++ b/src/dfx/Cargo.toml @@ -22,7 +22,7 @@ actix-web = { version = "3.0.2", features = [ "default", "openssl", "rustls" ] } anyhow = "1.0.34" atty = "0.2.13" base64 = "0.11.0" -candid = { version = "0.6.20", features = [ "random" ] } +candid = { version = "0.7.1", features = [ "random" ] } chrono = "0.4.9" clap = "3.0.0-beta.2" console = "0.7.7" @@ -36,6 +36,7 @@ futures = "0.3.5" futures-intrusive = "0.4.0" garcon = { version = "0.2", features = ["async"] } hex = {version = "0.4.2", features = ["serde"] } +ic-types = "0.2.0" indicatif = "0.13.0" lazy-init = "0.5.0" lazy_static = "1.4.0" @@ -78,23 +79,18 @@ webpki-roots = "0.21.0" [dependencies.ic-agent] version = "0.5.1" git = "https://github.com/dfinity/agent-rs.git" -rev = "de2e774e4afb39dd06db00d390ec2dbbc5a51597" +rev = "c6543eb3a2a9df0c706092de75f8888331ae81b1" features = ["reqwest"] [dependencies.ic-identity-hsm] version = "0.3.2" git = "https://github.com/dfinity/agent-rs.git" -rev = "de2e774e4afb39dd06db00d390ec2dbbc5a51597" - -[dependencies.ic-types] -version = "0.1.4" -git = "https://github.com/dfinity/agent-rs.git" -rev = "de2e774e4afb39dd06db00d390ec2dbbc5a51597" +rev = "c6543eb3a2a9df0c706092de75f8888331ae81b1" [dependencies.ic-utils] version = "0.3.2" git = "https://github.com/dfinity/agent-rs.git" -rev = "de2e774e4afb39dd06db00d390ec2dbbc5a51597" +rev = "c6543eb3a2a9df0c706092de75f8888331ae81b1" [dev-dependencies] env_logger = "0.6" diff --git a/src/dfx/src/commands/wallet/mod.rs b/src/dfx/src/commands/wallet/mod.rs index aee79f910d..bf2adb3280 100644 --- a/src/dfx/src/commands/wallet/mod.rs +++ b/src/dfx/src/commands/wallet/mod.rs @@ -6,7 +6,7 @@ use crate::lib::root_key::fetch_root_key_if_needed; use crate::lib::waiter::waiter_with_timeout; use crate::util::expiry_duration; -use candid::de::ArgumentDecoder; +use candid::utils::ArgumentDecoder; use candid::CandidType; use clap::Clap; use ic_utils::call::SyncCall; diff --git a/src/dfx/src/lib/operations/canister/mod.rs b/src/dfx/src/lib/operations/canister/mod.rs index 5ca7e29753..7e1a62d1ff 100644 --- a/src/dfx/src/lib/operations/canister/mod.rs +++ b/src/dfx/src/lib/operations/canister/mod.rs @@ -15,7 +15,7 @@ use crate::lib::identity::Identity; use crate::lib::waiter::waiter_with_timeout; use anyhow::anyhow; -use candid::de::ArgumentDecoder; +use candid::utils::ArgumentDecoder; use candid::CandidType; use ic_types::principal::Principal as CanisterId; use ic_types::Principal;