diff --git a/CHANGELOG.md b/CHANGELOG.md index cb2fccf6..2533fe9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 2026-03-18 + +### Candid 0.10.26 + +* Bug fixes: + + Fix decoding failure when a trailing argument is a primitive vector + ## 2026-03-16 ### Candid 0.10.25 diff --git a/Cargo.lock b/Cargo.lock index 47cac772..8eb17f36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -209,13 +209,13 @@ dependencies = [ [[package]] name = "candid" -version = "0.10.25" +version = "0.10.26" dependencies = [ "anyhow", "bincode", "binread", "byteorder", - "candid_derive 0.10.25", + "candid_derive 0.10.26", "candid_parser 0.3.0", "hex", "ic_principal 0.1.2", @@ -247,7 +247,7 @@ dependencies = [ [[package]] name = "candid_derive" -version = "0.10.25" +version = "0.10.26" dependencies = [ "lazy_static", "proc-macro2 1.0.86", @@ -280,7 +280,7 @@ version = "0.3.0" dependencies = [ "anyhow", "arbitrary", - "candid 0.10.25", + "candid 0.10.26", "codespan-reporting", "console", "convert_case", diff --git a/rust/bench/Cargo.lock b/rust/bench/Cargo.lock index 0700075b..ef54d1e2 100644 --- a/rust/bench/Cargo.lock +++ b/rust/bench/Cargo.lock @@ -156,7 +156,7 @@ dependencies = [ [[package]] name = "candid" -version = "0.10.25" +version = "0.10.26" dependencies = [ "anyhow", "binread", @@ -177,7 +177,7 @@ dependencies = [ [[package]] name = "candid_derive" -version = "0.10.25" +version = "0.10.26" dependencies = [ "lazy_static", "proc-macro2", diff --git a/rust/candid/Cargo.toml b/rust/candid/Cargo.toml index 222b0409..5655ede0 100644 --- a/rust/candid/Cargo.toml +++ b/rust/candid/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "candid" # sync with the version in `candid_derive/Cargo.toml` -version = "0.10.25" +version = "0.10.26" edition = "2021" rust-version.workspace = true authors = ["DFINITY Team"] @@ -16,7 +16,7 @@ keywords = ["internet-computer", "idl", "candid", "dfinity"] include = ["src", "Cargo.toml", "LICENSE", "README.md"] [dependencies] -candid_derive = { path = "../candid_derive", version = "=0.10.25" } +candid_derive = { path = "../candid_derive", version = "=0.10.26" } ic_principal = { path = "../ic_principal", version = "0.1.0" } binread = { version = "2.2", features = ["debug_template"] } byteorder = "1.5.0" diff --git a/rust/candid/src/de.rs b/rust/candid/src/de.rs index 710c757b..341d9ae9 100644 --- a/rust/candid/src/de.rs +++ b/rust/candid/src/de.rs @@ -1241,14 +1241,12 @@ impl<'de> de::SeqAccess<'de> for Compound<'_, 'de> { return Ok(None); } *len -= 1; - if exact_primitive.is_some() { - seed.deserialize(&mut *self.de).map(Some) - } else { + self.de.expect_type = expect.clone(); + self.de.wire_type = wire.clone(); + if exact_primitive.is_none() { self.de.add_cost(3)?; - self.de.expect_type = expect.clone(); - self.de.wire_type = wire.clone(); - seed.deserialize(&mut *self.de).map(Some) } + seed.deserialize(&mut *self.de).map(Some) } Style::Struct { ref expect, diff --git a/rust/candid/tests/compatibility_vectors.rs b/rust/candid/tests/compatibility_vectors.rs index f33254fd..b76e9904 100644 --- a/rust/candid/tests/compatibility_vectors.rs +++ b/rust/candid/tests/compatibility_vectors.rs @@ -76,3 +76,12 @@ fn bulk_encode_primitive_vectors_round_trip() { let empty: Vec = vec![]; assert_eq!(Decode!(&Encode!(&empty).unwrap(), Vec).unwrap(), empty); } + +#[test] +fn primitive_vector_is_extra_args() { + let extra = vec![1i16, 2, 3]; + let bytes = Encode!(&123u8, &extra).unwrap(); + + let decoded_values = Decode!(&bytes, u8).unwrap(); + assert_eq!(decoded_values, 123); +} diff --git a/rust/candid_derive/Cargo.toml b/rust/candid_derive/Cargo.toml index 473dc729..9aee2aa3 100644 --- a/rust/candid_derive/Cargo.toml +++ b/rust/candid_derive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "candid_derive" # sync with the version in `candid/Cargo.toml` -version = "0.10.25" +version = "0.10.26" edition = "2021" rust-version.workspace = true authors = ["DFINITY Team"]