Skip to content

Commit

Permalink
chore!: bump candid (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyan-dfinity committed Nov 17, 2023
1 parent ed0862a commit b7ae339
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 85 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

* Breaking change: Bump candid to 0.10. Downstream libraries need to bump Candid to 0.10 as well.

## [0.30.2] = 20223-11-16

* Fixed a spurious certificate validation error in the five minutes after a node is added to a subnet
Expand Down
129 changes: 58 additions & 71 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions ic-agent/src/agent/agent_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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![],
Expand Down
2 changes: 1 addition & 1 deletion ic-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
10 changes: 5 additions & 5 deletions ic-utils/src/interfaces/http_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand All @@ -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,
},
})),
Expand All @@ -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,
},
})),
Expand All @@ -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,
}),
})
Expand All @@ -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()),
Expand Down
3 changes: 2 additions & 1 deletion icx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions icx/src/main.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand Down Expand Up @@ -194,7 +194,7 @@ fn blob_from_arguments(
}
ArgType::Idl => {
let arguments = arguments.unwrap_or("()");
let args = arguments.parse::<IDLArgs>();
let args = parse_idl_args(arguments);
let typed_args = match method_type {
None => args
.context("Failed to parse arguments with no method type info")?
Expand All @@ -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::<IDLValue>()
parse_idl_value(arguments)
}
.map(|v| IDLArgs::new(&[v]))
} else {
Expand Down

0 comments on commit b7ae339

Please sign in to comment.