Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release 0.35.0 #557

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,272 changes: 528 additions & 744 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ repository = "https://github.com/dfinity/agent-rs"
# MSRV
# Avoid updating this field unless we use new Rust features
# Sync rust-version in rust-toolchain.toml
rust-version = "1.70.0"
rust-version = "1.75.0"
license = "Apache-2.0"

[workspace.dependencies]
ic-agent = { path = "ic-agent", version = "0.35.0", default-features = false }
ic-utils = { path = "ic-utils", version = "0.35.0" }
ic-transport-types = { path = "ic-transport-types", version = "0.35.0" }

ic-certification = "2.2"
anyhow = "1"
candid = "0.10.1"
candid_parser = "0.1.1"
clap = "4.4.3"
futures-util = "0.3.21"
hex = "0.4.3"
ic-certification = "2.2"
leb128 = "0.2.5"
ring = "0.17.7"
serde = "1.0.162"
Expand Down
36 changes: 19 additions & 17 deletions ic-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,32 @@ include = ["src", "Cargo.toml", "../LICENSE", "README.md"]
[dependencies]
async-lock = "3.3"
backoff = "0.4.0"
cached = { version = "0.46", features = ["ahash"], default-features = false }
candid = { workspace = true }
cached = { version = "0.51", default-features = false, features = ["ahash"] }
candid.workspace = true
ed25519-consensus = { version = "2" }
futures-util = { workspace = true }
hex = { workspace = true }
futures-util.workspace = true
hex.workspace = true
http = "1.0.0"
http-body = "1.0.0"
ic-certification = { workspace = true }
ic-transport-types = { workspace = true }
ic-verify-bls-signature = "0.1"
ic-certification.workspace = true
ic-transport-types.workspace = true
ic-verify-bls-signature = "0.3"
k256 = { version = "0.13.1", features = ["pem"] }
p256 = { version = "0.13.2", features = ["pem"] }
leb128 = { workspace = true }
leb128.workspace = true
pkcs8 = { version = "0.10.2", features = ["std"] }
sec1 = { version = "0.7.2", features = ["pem"] }
rand = "0.8.5"
rangemap = "1.4"
ring = { workspace = true, features = ["std"] }
serde = { workspace = true, features = ["derive"] }
serde_bytes = { workspace = true }
serde_cbor = { workspace = true }
serde_repr = { workspace = true }
sha2 = { workspace = true }
serde_bytes.workspace = true
serde_cbor.workspace = true
serde_repr.workspace = true
sha2.workspace = true
simple_asn1 = "0.6.1"
thiserror = { workspace = true }
time = { workspace = true }
thiserror.workspace = true
time.workspace = true
url = "2.1.0"

[dependencies.hyper]
Expand All @@ -57,7 +57,7 @@ features = ["blocking", "json", "rustls-tls-webpki-roots", "stream"]
optional = true

[dependencies.pem]
version = "2.0.1"
version = "3"
optional = true

[target.'cfg(not(target_family = "wasm"))'.dependencies]
Expand All @@ -68,13 +68,15 @@ hyper-util = { version = "0.1.3", features = [
"client-legacy",
"http2",
], optional = true }
hyper-rustls = { version = "0.26.0", features = [
# [email protected]>[email protected]>aws-lc-rs which causes a build failure on Windows.
# And latest [email protected] still uses [email protected], so we stick to 0.26 for now.
hyper-rustls = { version = "0.26", features = [
"webpki-roots",
"http2",
], optional = true }
tokio = { version = "1.24.2", features = ["time"] }
tower = { version = "0.4.13", optional = true }
rustls-webpki = "0.101.4"
rustls-webpki = "0.102"

[target.'cfg(target_family = "wasm")'.dependencies]
getrandom = { version = "0.2", features = ["js"], optional = true }
Expand Down
2 changes: 1 addition & 1 deletion ic-agent/src/agent/http_transport/route_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ mod tests {
fn test_routes_rotation() {
let provider = RoundRobinRouteProvider::new(vec!["https://url1.com", "https://url2.com"])
.expect("failed to create a route provider");
let url_strings = vec![
let url_strings = [
"https://url1.com/api/v2/",
"https://url2.com/api/v2/",
"https://url1.com/api/v2/",
Expand Down
6 changes: 3 additions & 3 deletions ic-identity-hsm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ keywords = ["internet-computer", "agent", "utility", "icp", "dfinity"]
include = ["src", "Cargo.toml", "../LICENSE", "README.md"]

[dependencies]
hex = { workspace = true }
hex.workspace = true
ic-agent = { workspace = true, default-features = false }
pkcs11 = "0.5.0"
sha2 = { workspace = true }
sha2.workspace = true
simple_asn1 = "0.6.0"
thiserror = { workspace = true }
thiserror.workspace = true

[dev-dependencies]
ic-agent = { workspace = true, features = ["reqwest"] }
4 changes: 2 additions & 2 deletions ic-identity-hsm/src/hsm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ fn get_ec_point(

let blocks =
from_der(der_encoded_ec_point.as_slice()).map_err(HardwareIdentityError::ASN1Decode)?;
let block = blocks.get(0).ok_or(HardwareIdentityError::EcPointEmpty)?;
let block = blocks.first().ok_or(HardwareIdentityError::EcPointEmpty)?;
if let OctetString(_size, data) = block {
Ok(data.clone())
} else {
Expand All @@ -302,7 +302,7 @@ fn get_attribute_length(
ctx.get_attribute_value(session_handle, object_handle, &mut attributes)?;

let first = attributes
.get(0)
.first()
.ok_or(HardwareIdentityError::AttributeNotFound(attribute_type))?;
Ok(first.ulValueLen as usize)
}
Expand Down
162 changes: 81 additions & 81 deletions ic-transport-types/src/request_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,87 @@ impl SerializeTupleVariant for TupleVariantSerializer {
}
}

// can't use serde_bytes on by-value arrays
// these impls are effectively #[serde(with = "serde_bytes")]
impl Serialize for RequestId {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
if serializer.is_human_readable() {
let mut text = [0u8; 64];
hex::encode_to_slice(self.0, &mut text).unwrap();
serializer.serialize_str(std::str::from_utf8(&text).unwrap())
} else {
serializer.serialize_bytes(&self.0)
}
}
}

impl<'de> Deserialize<'de> for RequestId {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
if deserializer.is_human_readable() {
deserializer.deserialize_str(RequestIdVisitor)
} else {
deserializer.deserialize_bytes(RequestIdVisitor)
}
}
}

struct RequestIdVisitor;

impl<'de> Visitor<'de> for RequestIdVisitor {
type Value = RequestId;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("a sha256 hash")
}

fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
where
E: de::Error,
{
Ok(RequestId::new(v.try_into().map_err(|_| {
E::custom(format_args!("must be 32 bytes long, was {}", v.len()))
})?))
}

fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
where
A: de::SeqAccess<'de>,
{
let mut arr = Sha256Hash::default();
for (i, byte) in arr.iter_mut().enumerate() {
*byte = seq.next_element()?.ok_or(A::Error::custom(format_args!(
"must be 32 bytes long, was {}",
i - 1
)))?;
}
if seq.next_element::<u8>()?.is_some() {
Err(A::Error::custom("must be 32 bytes long, was more"))
} else {
Ok(RequestId(arr))
}
}

fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
where
E: de::Error,
{
if v.len() != 64 {
return Err(E::custom(format_args!(
"must be 32 bytes long, was {}",
v.len() / 2
)));
}
let mut arr = Sha256Hash::default();
hex::decode_to_slice(v, &mut arr).map_err(E::custom)?;
Ok(RequestId(arr))
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down Expand Up @@ -877,84 +958,3 @@ mod tests {
);
}
}

// can't use serde_bytes on by-value arrays
// these impls are effectively #[serde(with = "serde_bytes")]
impl Serialize for RequestId {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
if serializer.is_human_readable() {
let mut text = [0u8; 64];
hex::encode_to_slice(self.0, &mut text).unwrap();
serializer.serialize_str(std::str::from_utf8(&text).unwrap())
} else {
serializer.serialize_bytes(&self.0)
}
}
}

impl<'de> Deserialize<'de> for RequestId {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
if deserializer.is_human_readable() {
deserializer.deserialize_str(RequestIdVisitor)
} else {
deserializer.deserialize_bytes(RequestIdVisitor)
}
}
}

struct RequestIdVisitor;

impl<'de> Visitor<'de> for RequestIdVisitor {
type Value = RequestId;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("a sha256 hash")
}

fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
where
E: de::Error,
{
Ok(RequestId::new(v.try_into().map_err(|_| {
E::custom(format_args!("must be 32 bytes long, was {}", v.len()))
})?))
}

fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
where
A: de::SeqAccess<'de>,
{
let mut arr = Sha256Hash::default();
for (i, byte) in arr.iter_mut().enumerate() {
*byte = seq.next_element()?.ok_or(A::Error::custom(format_args!(
"must be 32 bytes long, was {}",
i - 1
)))?;
}
if seq.next_element::<u8>()?.is_some() {
Err(A::Error::custom("must be 32 bytes long, was more"))
} else {
Ok(RequestId(arr))
}
}

fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
where
E: de::Error,
{
if v.len() != 64 {
return Err(E::custom(format_args!(
"must be 32 bytes long, was {}",
v.len() / 2
)));
}
let mut arr = Sha256Hash::default();
hex::decode_to_slice(v, &mut arr).map_err(E::custom)?;
Ok(RequestId(arr))
}
}
20 changes: 10 additions & 10 deletions ic-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ include = ["src", "Cargo.toml", "../LICENSE", "README.md"]
[dependencies]
async-trait = "0.1.68"
candid = { workspace = true, features = ["value"] }
futures-util = { workspace = true }
futures-util.workspace = true
ic-agent = { workspace = true, default-features = false }
serde = { workspace = true }
serde_bytes = { workspace = true }
sha2 = { workspace = true }
strum = "0.24"
strum_macros = "0.24"
thiserror = { workspace = true }
time = { workspace = true }
tokio = { workspace = true }
serde.workspace = true
serde_bytes.workspace = true
sha2.workspace = true
strum = "0.26"
strum_macros = "0.26"
thiserror.workspace = true
time.workspace = true
tokio.workspace = true
semver = "1.0.7"
once_cell = "1.10.0"

[dev-dependencies]
ic-agent = { workspace = true, default-features = true }
ring = { workspace = true }
ring.workspace = true
tokio = { workspace = true, features = ["full"] }

[features]
Expand Down
18 changes: 9 additions & 9 deletions icx-cert/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ include = ["src", "Cargo.toml", "../LICENSE", "README.md"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0"
base64 = "0.13"
anyhow.workspace = true
base64 = "0.22"
clap = { workspace = true, features = ["derive", "cargo", "color"] }
hex = { workspace = true }
ic-certification = { workspace = true }
leb128 = "0.2.4"
reqwest = { version = "0.11", default-features = false, features = [
hex.workspace = true
ic-certification.workspace = true
leb128.workspace = true
reqwest = { version = "0.12", default-features = false, features = [
"blocking",
"rustls-tls",
] }
sha2 = { workspace = true }
sha2.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_bytes = { workspace = true }
serde_cbor = { workspace = true }
serde_bytes.workspace = true
serde_cbor.workspace = true
time = { workspace = true, features = ["formatting"] }
Loading