From f72c6ec978b6791d83fe5f807a254a8d7e29fbd6 Mon Sep 17 00:00:00 2001 From: Yan Chen Date: Thu, 16 Nov 2023 21:24:19 -0800 Subject: [PATCH 1/6] chore: bump candid to 0.10 --- Cargo.lock | 129 ++++++++++++++++++++++-------------------------- Cargo.toml | 3 +- icx/Cargo.toml | 3 +- icx/src/main.rs | 8 +-- 4 files changed, 66 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 02c91d43..a2ec4e03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -100,6 +100,12 @@ dependencies = [ "backtrace", ] +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + [[package]] name = "arrayvec" version = "0.5.2" @@ -288,9 +294,9 @@ checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -313,39 +319,32 @@ dependencies = [ [[package]] name = "candid" -version = "0.9.5" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "762aa04e3a889d47a1773b74ee3b13438a9bc895954fff79ebf7f308c3744a6c" +checksum = "a2525ab7a58543c132da8c780abe3aa1ba394ddcc1888a4ad2ba4f5100906ebe" dependencies = [ "anyhow", "binread", "byteorder", "candid_derive", - "codespan-reporting", - "crc32fast", - "data-encoding", "hex", - "lalrpop", - "lalrpop-util", + "ic_principal", "leb128", - "logos", "num-bigint 0.4.3", "num-traits", - "num_enum", "paste", "pretty", "serde", "serde_bytes", - "sha2 0.10.7", "stacker", "thiserror", ] [[package]] name = "candid_derive" -version = "0.6.2" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "810b3bd60244f282090652ffc7c30a9d23892e72dfe443e46ee55569044f7dd5" +checksum = "970c220da8aa2fa6f7ef5dbbf3ea5b620a59eb3ac107cfb95ae8c6eebdfb7a08" dependencies = [ "lazy_static", "proc-macro2", @@ -353,6 +352,25 @@ dependencies = [ "syn 2.0.32", ] +[[package]] +name = "candid_parser" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a152b737c1c2681d4ed3359f15016b499f2ddc59aef9fdce0be82f483c11e700" +dependencies = [ + "anyhow", + "candid", + "codespan-reporting", + "convert_case", + "hex", + "lalrpop", + "lalrpop-util", + "logos", + "num-bigint 0.4.3", + "pretty", + "thiserror", +] + [[package]] name = "cc" version = "1.0.83" @@ -451,6 +469,15 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.3" @@ -1146,12 +1173,29 @@ dependencies = [ "sha2 0.9.9", ] +[[package]] +name = "ic_principal" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899a4e8ddada85b91a2fe32b4dc6c0d475ef7bfef3f51cf2aecb26ee4ac4724f" +dependencies = [ + "arbitrary", + "crc32fast", + "data-encoding", + "hex", + "serde", + "serde_bytes", + "sha2 0.10.7", + "thiserror", +] + [[package]] name = "icx" version = "0.30.2" dependencies = [ "anyhow", "candid", + "candid_parser", "clap", "hex", "humantime", @@ -1502,27 +1546,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.32", -] - [[package]] name = "object" version = "0.32.0" @@ -1693,16 +1716,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit", -] - [[package]] name = "proc-macro2" version = "1.0.66" @@ -2492,23 +2505,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "toml_datetime" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" - -[[package]] -name = "toml_edit" -version = "0.19.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" -dependencies = [ - "indexmap 2.0.0", - "toml_datetime", - "winnow", -] - [[package]] name = "tower-service" version = "0.3.2" @@ -2861,15 +2857,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" -[[package]] -name = "winnow" -version = "0.5.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d09770118a7eb1ccaf4a594a221334119a44a814fcb0d31c5b85e83e97227a97" -dependencies = [ - "memchr", -] - [[package]] name = "winreg" version = "0.50.0" diff --git a/Cargo.toml b/Cargo.toml index 623d2ea8..07eceb55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,8 @@ ic-utils = { path = "ic-utils", version = "0.30.2" } ic-transport-types = { path = "ic-transport-types", version = "0.30.2" } ic-certification = "1.2.0" -candid = "0.9.5" +candid = "0.10.0" +candid_parser = "0.1.0" clap = "4.4.3" hex = "0.4.3" leb128 = "0.2.5" diff --git a/icx/Cargo.toml b/icx/Cargo.toml index d0927805..61eb7f6d 100644 --- a/icx/Cargo.toml +++ b/icx/Cargo.toml @@ -20,7 +20,8 @@ path = "src/main.rs" [dependencies] anyhow = { version = "1.0", features = ["backtrace"] } -candid = { workspace = true, features = ["parser"] } +candid = { workspace = true, features = ["value"] } +candid_parser = { workspace = true } clap = { workspace = true, features = ["derive", "cargo", "color"] } hex = { workspace = true } humantime = "2.0.1" diff --git a/icx/src/main.rs b/icx/src/main.rs index ad6c1bdb..6e148d28 100644 --- a/icx/src/main.rs +++ b/icx/src/main.rs @@ -1,10 +1,10 @@ use anyhow::{bail, Context, Result}; use candid::{ - check_prog, types::value::IDLValue, types::{Function, Type, TypeInner}, - CandidType, Decode, Deserialize, IDLArgs, IDLProg, TypeEnv, + CandidType, Decode, Deserialize, IDLArgs, TypeEnv, }; +use candid_parser::{check_prog, parse_idl_args, parse_idl_value, IDLProg}; use clap::{crate_authors, crate_version, Parser, ValueEnum}; use ic_agent::{ agent::{self, signed::SignedUpdate}, @@ -194,7 +194,7 @@ fn blob_from_arguments( } ArgType::Idl => { let arguments = arguments.unwrap_or("()"); - let args = arguments.parse::(); + let args = parse_idl_args(arguments); let typed_args = match method_type { None => args .context("Failed to parse arguments with no method type info")? @@ -210,7 +210,7 @@ fn blob_from_arguments( if &TypeInner::Text == func.args[0].as_ref() && !is_quote { Ok(IDLValue::Text(arguments.to_string())) } else { - arguments.parse::() + parse_idl_value(arguments) } .map(|v| IDLArgs::new(&[v])) } else { From 5eb8cd79f83a66914b678d4ba65d0e26c15dfa01 Mon Sep 17 00:00:00 2001 From: Yan Chen Date: Thu, 16 Nov 2023 21:33:25 -0800 Subject: [PATCH 2/6] fix --- ic-agent/src/agent/agent_test.rs | 4 ++-- ic-utils/src/interfaces/http_request.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ic-agent/src/agent/agent_test.rs b/ic-agent/src/agent/agent_test.rs index dbded453..ade6eaa9 100644 --- a/ic-agent/src/agent/agent_test.rs +++ b/ic-agent/src/agent/agent_test.rs @@ -422,7 +422,7 @@ async fn wrong_subnet_query_certificate() { Some("application/cbor"), ) .await; - let blob = Encode!(&Nat::from(12)).unwrap(); + let blob = Encode!(&Nat::from(12u8)).unwrap(); let response = QueryResponse::Replied { reply: ReplyResponse { arg: blob.clone() }, signatures: vec![NodeSignature { @@ -468,7 +468,7 @@ async fn no_cert() { Some("application/cbor"), ) .await; - let blob = Encode!(&Nat::from(12)).unwrap(); + let blob = Encode!(&Nat::from(12u8)).unwrap(); let response = QueryResponse::Replied { reply: ReplyResponse { arg: blob.clone() }, signatures: vec![], diff --git a/ic-utils/src/interfaces/http_request.rs b/ic-utils/src/interfaces/http_request.rs index b40fa534..8c2cfa7e 100644 --- a/ic-utils/src/interfaces/http_request.rs +++ b/ic-utils/src/interfaces/http_request.rs @@ -594,7 +594,7 @@ mod test { })); assert!(fields.contains(&IDLField { id: Label::Named("index".into()), - val: IDLValue::Nat(42.into()) + val: IDLValue::Nat(42u8.into()) })); assert!(fields.contains(&IDLField { id: Label::Named("sha256".into()), @@ -615,7 +615,7 @@ mod test { token: pre_update_legacy::Token { key: "foo".into(), content_encoding: "bar".into(), - index: 42.into(), + index: 42u8.into(), sha256: None, }, })), @@ -641,7 +641,7 @@ mod test { token: pre_update_legacy::Token { key: "foo".into(), content_encoding: "bar".into(), - index: 42.into(), + index: 42u8.into(), sha256: None, }, })), @@ -661,7 +661,7 @@ mod test { token: Some(pre_update_legacy::Token { key: "foo".into(), content_encoding: "bar".into(), - index: 42.into(), + index: 42u8.into(), sha256: None, }), }) @@ -683,7 +683,7 @@ mod test { })); assert!(fields.contains(&IDLField { id: Label::Named("index".into()), - val: IDLValue::Nat(42.into()) + val: IDLValue::Nat(42u8.into()) })); assert!(fields.contains(&IDLField { id: Label::Named("sha256".into()), From c1adb94a41e2bdf3710c0e1b26382afdf2e9bda3 Mon Sep 17 00:00:00 2001 From: Yan Chen Date: Thu, 16 Nov 2023 21:49:58 -0800 Subject: [PATCH 3/6] fix --- ic-utils/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ic-utils/Cargo.toml b/ic-utils/Cargo.toml index 6ed998b4..475bd5bb 100644 --- a/ic-utils/Cargo.toml +++ b/ic-utils/Cargo.toml @@ -18,7 +18,7 @@ include = ["src", "Cargo.toml", "../LICENSE", "README.md"] [dependencies] async-trait = "0.1.68" -candid = { workspace = true } +candid = { workspace = true, features = ["value"] } ic-agent = { workspace = true, default-features = false } serde = { workspace = true } serde_bytes = { workspace = true } From 9608b5354d154d2bfa6293d5e97258c9301dbe48 Mon Sep 17 00:00:00 2001 From: Yan Chen Date: Fri, 17 Nov 2023 09:09:51 -0800 Subject: [PATCH 4/6] bump version --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a2ec4e03..d5e4a291 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "ic-agent" -version = "0.30.2" +version = "0.30.3" dependencies = [ "backoff", "cached", @@ -1116,7 +1116,7 @@ dependencies = [ [[package]] name = "ic-identity-hsm" -version = "0.30.2" +version = "0.30.3" dependencies = [ "hex", "ic-agent", @@ -1128,7 +1128,7 @@ dependencies = [ [[package]] name = "ic-transport-types" -version = "0.30.2" +version = "0.30.3" dependencies = [ "candid", "hex", @@ -1144,7 +1144,7 @@ dependencies = [ [[package]] name = "ic-utils" -version = "0.30.2" +version = "0.30.3" dependencies = [ "async-trait", "candid", @@ -1191,7 +1191,7 @@ dependencies = [ [[package]] name = "icx" -version = "0.30.2" +version = "0.30.3" dependencies = [ "anyhow", "candid", @@ -1209,7 +1209,7 @@ dependencies = [ [[package]] name = "icx-cert" -version = "0.30.2" +version = "0.30.3" dependencies = [ "anyhow", "base64 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 07eceb55..65a6aae9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ members = [ ] [workspace.package] -version = "0.30.2" +version = "0.30.3" authors = ["DFINITY Stiftung "] edition = "2021" repository = "https://github.com/dfinity/agent-rs" From d36352a152efc8ec328de961c57c21e0904e24d3 Mon Sep 17 00:00:00 2001 From: Yan Chen Date: Fri, 17 Nov 2023 09:12:39 -0800 Subject: [PATCH 5/6] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb15d70..76d5e15a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +* Bump candid to 0.10 + ## [0.30.2] = 20223-11-16 * Fixed a spurious certificate validation error in the five minutes after a node is added to a subnet From 386ef629b23aa5301c46e83f7f0143097f0f10d0 Mon Sep 17 00:00:00 2001 From: Yan Chen Date: Fri, 17 Nov 2023 10:17:32 -0800 Subject: [PATCH 6/6] marking as breaking change --- CHANGELOG.md | 2 +- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76d5e15a..a2a1f480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased -* Bump candid to 0.10 +* Breaking change: Bump candid to 0.10. Downstream libraries need to bump Candid to 0.10 as well. ## [0.30.2] = 20223-11-16 diff --git a/Cargo.lock b/Cargo.lock index d5e4a291..a2ec4e03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "ic-agent" -version = "0.30.3" +version = "0.30.2" dependencies = [ "backoff", "cached", @@ -1116,7 +1116,7 @@ dependencies = [ [[package]] name = "ic-identity-hsm" -version = "0.30.3" +version = "0.30.2" dependencies = [ "hex", "ic-agent", @@ -1128,7 +1128,7 @@ dependencies = [ [[package]] name = "ic-transport-types" -version = "0.30.3" +version = "0.30.2" dependencies = [ "candid", "hex", @@ -1144,7 +1144,7 @@ dependencies = [ [[package]] name = "ic-utils" -version = "0.30.3" +version = "0.30.2" dependencies = [ "async-trait", "candid", @@ -1191,7 +1191,7 @@ dependencies = [ [[package]] name = "icx" -version = "0.30.3" +version = "0.30.2" dependencies = [ "anyhow", "candid", @@ -1209,7 +1209,7 @@ dependencies = [ [[package]] name = "icx-cert" -version = "0.30.3" +version = "0.30.2" dependencies = [ "anyhow", "base64 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 65a6aae9..07eceb55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ members = [ ] [workspace.package] -version = "0.30.3" +version = "0.30.2" authors = ["DFINITY Stiftung "] edition = "2021" repository = "https://github.com/dfinity/agent-rs"