From ad87925e8f7f544a54f1501e4031f5762c6d9af8 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Sun, 6 Oct 2024 08:35:01 +0700 Subject: [PATCH 1/7] fix(general): Bump Versions --- Earthfile | 4 +-- docs/Earthfile | 2 +- .../rust/overhead_benchmark/Cargo.toml | 12 ++++---- rust/Earthfile | 2 +- rust/c509-certificate/Cargo.toml | 22 +++++++------- rust/c509-certificate/Earthfile | 2 +- rust/cardano-chain-follower/Cargo.toml | 29 ++++++++++--------- rust/catalyst-voting/Cargo.toml | 6 ++-- rust/cbork-abnf-parser/Cargo.toml | 8 ++--- rust/cbork-cddl-parser/Cargo.toml | 6 ++-- rust/cbork/Cargo.toml | 6 ++-- rust/cbork/Earthfile | 2 +- rust/hermes-ipfs/Cargo.toml | 12 ++++---- rust/hermes-ipfs/src/lib.rs | 6 ++-- 14 files changed, 60 insertions(+), 59 deletions(-) diff --git a/Earthfile b/Earthfile index 30f00065c51..a224708f320 100644 --- a/Earthfile +++ b/Earthfile @@ -1,7 +1,7 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.13 AS mdlint-ci -IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.13 AS cspell-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.15 AS mdlint-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.15 AS cspell-ci FROM debian:stable-slim diff --git a/docs/Earthfile b/docs/Earthfile index 09766872cf2..b20624efbfe 100644 --- a/docs/Earthfile +++ b/docs/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.2.13 AS docs-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.2.15 AS docs-ci IMPORT .. AS repo diff --git a/integration_tests/rust/overhead_benchmark/Cargo.toml b/integration_tests/rust/overhead_benchmark/Cargo.toml index fbdb4d2b49c..8d40e4766bf 100644 --- a/integration_tests/rust/overhead_benchmark/Cargo.toml +++ b/integration_tests/rust/overhead_benchmark/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "overhead_benchmark" -version = "0.1.0" +version = "0.1.1" edition.workspace = true [lints] @@ -9,8 +9,8 @@ workspace = true [dependencies] cardano-chain-follower = { path = "../.." } -anyhow = "1.0.82" -clap = { version = "4.5.4", features = ["derive", "help", "usage", "std"], default-features = false } -pallas-traverse = "0.30.1" -pallas-hardano = "0.30.1" -tokio = { version = "1.37.0", features = ["macros", "sync", "rt-multi-thread", "rt", "net"] } +anyhow = "1.0.89" +clap = { version = "4.5.19", features = ["derive", "help", "usage", "std"], default-features = false } +pallas-traverse = "0.30.2" +pallas-hardano = "0.30.2" +tokio = { version = "1.40.0", features = ["macros", "sync", "rt-multi-thread", "rt", "net"] } diff --git a/rust/Earthfile b/rust/Earthfile index a76ec1ff234..ca6ed4f5022 100644 --- a/rust/Earthfile +++ b/rust/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.13 AS rust-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.15 AS rust-ci COPY_SRC: FUNCTION diff --git a/rust/c509-certificate/Cargo.toml b/rust/c509-certificate/Cargo.toml index 38dbba9e4a7..ba001324f3e 100644 --- a/rust/c509-certificate/Cargo.toml +++ b/rust/c509-certificate/Cargo.toml @@ -2,7 +2,7 @@ name = "c509-certificate" description = "C509 certificate implementation" keywords = ["cardano", "catalyst", "c509 certificate", "certificate", "x509"] -version = "0.0.2" +version = "0.0.3" authors = [ "Arissara Chotivichit " ] @@ -21,26 +21,26 @@ workspace = true minicbor = { version = "0.25.1", features = ["std"] } hex = "0.4.3" oid = "0.2.1" -oid-registry = "0.7.0" -asn1-rs = "0.6.0" -anyhow = "1.0.86" +oid-registry = "0.7.1" +asn1-rs = "0.6.2" +anyhow = "1.0.89" bimap = "0.6.3" -once_cell = "1.19.0" +once_cell = "1.20.2" strum = "0.26.3" -strum_macros = "0.26.3" -regex = "1.10.5" +strum_macros = "0.26.4" +regex = "1.11.0" ed25519-dalek = { version = "2.1.1", features = ["pem"] } -thiserror = "1.0.56" +thiserror = "1.0.64" serde = { version = "1.0.204", features = ["derive"] } -wasm-bindgen = "0.2.92" +wasm-bindgen = "0.2.93" serde-wasm-bindgen = "0.6.5" [package.metadata.cargo-machete] ignored = ["strum"] [dev-dependencies] -clap = { version = "4.5.9", features = ["derive"] } -serde_json = "1.0.120" +clap = { version = "4.5.19", features = ["derive"] } +serde_json = "1.0.128" rand = "0.8.5" chrono = "0.4.38" diff --git a/rust/c509-certificate/Earthfile b/rust/c509-certificate/Earthfile index 80af451c187..198a9379521 100644 --- a/rust/c509-certificate/Earthfile +++ b/rust/c509-certificate/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.13 AS rust-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.15 AS rust-ci IMPORT .. AS rust-local IMPORT ../.. AS repo diff --git a/rust/cardano-chain-follower/Cargo.toml b/rust/cardano-chain-follower/Cargo.toml index 508524fd465..e63542ad5d5 100644 --- a/rust/cardano-chain-follower/Cargo.toml +++ b/rust/cardano-chain-follower/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cardano-chain-follower" -version = "0.0.2" +version = "0.0.3" edition.workspace = true authors.workspace = true homepage.workspace = true @@ -16,14 +16,15 @@ pallas-hardano = { version = "0.30.1", git = "https://github.com/input-output-hk pallas-crypto = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" } # cspell: words licence -mithril-client = { version = "0.8.16", git = "https://github.com/input-output-hk/catalyst-mithril.git", branch = "fix/lgpl-licence", default-features = false, features = [ +#mithril-client = { version = "0.8.16", git = "https://github.com/input-output-hk/catalyst-mithril.git", branch = "fix/lgpl-licence", default-features = false, features = [ +mithril-client = { version = "0.8.18", default-features = false, features = [ "full", "num-integer-backend", ] } c509-certificate = { version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "v0.0.1" } -thiserror = "1.0.56" +thiserror = "1.0.64" tokio = { version = "1.40.0", features = [ "macros", "rt", @@ -32,13 +33,13 @@ tokio = { version = "1.40.0", features = [ ] } tracing = "0.1.40" tracing-log = "0.2.0" -dashmap = "6.0.1" -url = "2.5.0" -anyhow = "1.0.86" +dashmap = "6.1.0" +url = "2.5.2" +anyhow = "1.0.89" chrono = "0.4.38" -async-trait = "0.1.82" +async-trait = "0.1.83" dirs = "5.0.1" -futures = "0.3.30" +futures = "0.3.31" humantime = "2.1.0" crossbeam-skiplist = "0.1.3" crossbeam-channel = "0.5.13" @@ -47,26 +48,26 @@ strum = "0.26.3" ouroboros = "0.18.4" hex = "0.4.3" rayon = "1.10.0" -serde = "1.0.209" +serde = "1.0.210" serde_json = "1.0.128" mimalloc = { version = "0.1.43", optional = true } memx = "0.1.32" fmmap = { version = "0.3.3", features = ["sync", "tokio-async"] } -minicbor = { version = "0.24.4", features = ["alloc", "derive", "half"] } -brotli = "6.0.0" +minicbor = { version = "0.25.1", features = ["alloc", "derive", "half"] } +brotli = "7.0.0" zstd = "0.13.2" x509-cert = "0.2.5" ed25519-dalek = "2.1.1" blake2b_simd = "1.0.2" num-traits = "0.2.19" logcall = "0.1.9" -tar = "0.4.41" +tar = "0.4.42" ureq = { version = "2.10.1", features = ["native-certs"] } http = "1.1.0" hickory-resolver = { version = "0.24.1", features = ["dns-over-rustls"] } moka = { version = "0.12.8", features = ["sync"] } der-parser = "9.0.0" -regex = "1.10.6" +regex = "1.11.0" bech32 = "0.11.0" [dev-dependencies] @@ -75,7 +76,7 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } test-log = { version = "0.2.16", default-features = false, features = [ "trace", ] } -clap = "4.5.17" +clap = "4.5.19" # Note, these features are for support of features exposed by dependencies. [features] diff --git a/rust/catalyst-voting/Cargo.toml b/rust/catalyst-voting/Cargo.toml index e26728cea5f..866437d4e2b 100644 --- a/rust/catalyst-voting/Cargo.toml +++ b/rust/catalyst-voting/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "catalyst-voting" -version = "0.1.0" +version = "0.0.1" edition.workspace = true authors.workspace = true homepage.workspace = true @@ -11,9 +11,9 @@ license.workspace = true workspace = true [dependencies] -thiserror = "1.0.56" +thiserror = "1.0.64" rand_core = "0.6.4" -curve25519-dalek = { version = "4.0", features = ["digest"] } +curve25519-dalek = { version = "4.1.3", features = ["digest"] } blake2b_simd = "1.0.2" [dev-dependencies] diff --git a/rust/cbork-abnf-parser/Cargo.toml b/rust/cbork-abnf-parser/Cargo.toml index 6d438b813e0..9b28425d644 100644 --- a/rust/cbork-abnf-parser/Cargo.toml +++ b/rust/cbork-abnf-parser/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "cbork-abnf-parser" -version = "0.0.1" +version = "0.0.2" edition.workspace = true license.workspace = true authors.workspace = true @@ -16,6 +16,6 @@ workspace = true [dependencies] derive_more = {version = "1.0.0", features = ["from"] } -pest = { version = "2.7.2", features = ["std", "pretty-print", "memchr", "const_prec_climber"] } -pest_derive = { version = "2.7.2", features = ["grammar-extras"] } -thiserror = "1.0.56" +pest = { version = "2.7.13", features = ["std", "pretty-print", "memchr", "const_prec_climber"] } +pest_derive = { version = "2.7.13", features = ["grammar-extras"] } +thiserror = "1.0.64" diff --git a/rust/cbork-cddl-parser/Cargo.toml b/rust/cbork-cddl-parser/Cargo.toml index fad6435f322..bd55ec14e87 100644 --- a/rust/cbork-cddl-parser/Cargo.toml +++ b/rust/cbork-cddl-parser/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "cbork-cddl-parser" -version = "0.0.1" +version = "0.0.2" edition.workspace = true license.workspace = true authors.workspace = true @@ -17,5 +17,5 @@ workspace = true [dependencies] derive_more = {version = "1.0.0", features = ["from","display"] } pest = { version = "2.7.2", features = ["std", "pretty-print", "memchr", "const_prec_climber"] } -pest_derive = { version = "2.7.2", features = ["grammar-extras"] } -thiserror = "1.0.56" +pest_derive = { version = "2.7.13", features = ["grammar-extras"] } +thiserror = "1.0.64" diff --git a/rust/cbork/Cargo.toml b/rust/cbork/Cargo.toml index 9827d5a6c0d..e1ffe51d3e9 100644 --- a/rust/cbork/Cargo.toml +++ b/rust/cbork/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cbork" -version = "0.0.1" +version = "0.0.2" edition.workspace = true license.workspace = true authors.workspace = true @@ -18,7 +18,7 @@ workspace = true cbork-cddl-parser = {version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "v0.0.1" } # Only use this for testing - do not change dependency to this in checked in code. #cbork-cddl-parser = { path = "../cbork-cddl-parser", version = "0.1.0" } -clap = { version = "4.5.3", features = ["derive", "env"] } -anyhow = "1.0.71" +clap = { version = "4.5.19", features = ["derive", "env"] } +anyhow = "1.0.89" console = "0.15.8" diff --git a/rust/cbork/Earthfile b/rust/cbork/Earthfile index bc0dd2c19d2..ed2e6473f0f 100644 --- a/rust/cbork/Earthfile +++ b/rust/cbork/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.13 AS rust-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.15 AS rust-ci IMPORT .. AS rust-local diff --git a/rust/hermes-ipfs/Cargo.toml b/rust/hermes-ipfs/Cargo.toml index 141da4adbc9..9ca3935d67e 100644 --- a/rust/hermes-ipfs/Cargo.toml +++ b/rust/hermes-ipfs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hermes-ipfs" -version = "0.0.1" +version = "0.0.2" edition.workspace = true license.workspace = true authors.workspace = true @@ -11,17 +11,17 @@ repository.workspace = true workspace = true [dependencies] -anyhow = "1.0.71" +anyhow = "1.0.89" derive_more = {version = "1.0.0", features = ["from","into","display"] } libipld = "0.16.0" -rust-ipfs = "0.11.21" -tokio = "1.36.0" +rust-ipfs = "0.12.1" +tokio = "1.40.0" [dev-dependencies] # Dependencies used by examples -clap = { version = "4.5.3", features = ["derive"] } +clap = { version = "4.5.19", features = ["derive"] } dirs = "5.0.1" lipsum = "0.9.1" rand = "0.8.5" -rustyline-async = "0.4.2" +rustyline-async = "0.4.3" tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } diff --git a/rust/hermes-ipfs/src/lib.rs b/rust/hermes-ipfs/src/lib.rs index 6b2b41e781b..9915a3f440b 100644 --- a/rust/hermes-ipfs/src/lib.rs +++ b/rust/hermes-ipfs/src/lib.rs @@ -30,7 +30,7 @@ pub use rust_ipfs::StorageType; /// Stream for `PubSub` Topic Subscriptions. pub use rust_ipfs::SubscriptionStream; /// Builder type for IPFS Node configuration. -use rust_ipfs::UninitializedIpfsNoop; +use rust_ipfs::UninitializedIpfsDefault as UninitializedIpfs; use rust_ipfs::{ dag::ResolveError, libp2p::gossipsub::{Message as PubsubMessage, MessageId as PubsubMessageId}, @@ -43,13 +43,13 @@ use rust_ipfs::{ pub struct MessageId(pub PubsubMessageId); /// Builder type for IPFS Node configuration. -pub struct IpfsBuilder(UninitializedIpfsNoop); +pub struct IpfsBuilder(UninitializedIpfs); impl IpfsBuilder { #[must_use] /// Create a new` IpfsBuilder`. pub fn new() -> Self { - Self(UninitializedIpfsNoop::new()) + Self(UninitializedIpfs::new()) } #[must_use] From 339121d24064132be015b1257366800b73c72ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Rosales?= Date: Sun, 6 Oct 2024 17:20:18 -0700 Subject: [PATCH 2/7] fix(rust/hermes-ipfs): update to work with latest rust-ipfs version --- rust/hermes-ipfs/Cargo.toml | 2 +- rust/hermes-ipfs/src/lib.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rust/hermes-ipfs/Cargo.toml b/rust/hermes-ipfs/Cargo.toml index 9ca3935d67e..ddb7a1612b8 100644 --- a/rust/hermes-ipfs/Cargo.toml +++ b/rust/hermes-ipfs/Cargo.toml @@ -13,7 +13,7 @@ workspace = true [dependencies] anyhow = "1.0.89" derive_more = {version = "1.0.0", features = ["from","into","display"] } -libipld = "0.16.0" +ipld-core = { version = "0.4.1", features = ["serde"]} rust-ipfs = "0.12.1" tokio = "1.40.0" diff --git a/rust/hermes-ipfs/src/lib.rs b/rust/hermes-ipfs/src/lib.rs index 9915a3f440b..8ff7bad6a1a 100644 --- a/rust/hermes-ipfs/src/lib.rs +++ b/rust/hermes-ipfs/src/lib.rs @@ -6,9 +6,9 @@ use std::str::FromStr; use derive_more::{Display, From, Into}; /// IPFS Content Identifier. -pub use libipld::Cid; +pub use ipld_core::cid::Cid; /// IPLD -pub use libipld::Ipld; +pub use ipld_core::ipld::Ipld; /// `rust_ipfs` re-export. pub use rust_ipfs; /// libp2p re-exports. @@ -181,7 +181,7 @@ impl HermesIpfs { /// /// Returns an error if pinning fails. pub async fn insert_pin(&self, cid: &Cid) -> anyhow::Result<()> { - self.node.insert_pin(cid).await + self.node.insert_pin(cid.clone()).await } /// Checks whether a given block is pinned. @@ -271,7 +271,7 @@ impl HermesIpfs { /// /// Returns error if unable to add peer. pub async fn add_peer(&self, peer_id: PeerId, addr: Multiaddr) -> anyhow::Result<()> { - self.node.add_peer(peer_id, addr).await + self.node.add_peer((peer_id, addr)).await } /// List of local listening addresses From 428d2b58490c3241820f95c425a0a53bc26fc2b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Rosales?= Date: Sun, 6 Oct 2024 18:16:00 -0700 Subject: [PATCH 3/7] fix(rust/cardano-chain-follower): bump c509-certificate version --- rust/cardano-chain-follower/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/cardano-chain-follower/Cargo.toml b/rust/cardano-chain-follower/Cargo.toml index e63542ad5d5..4f7cf5730a0 100644 --- a/rust/cardano-chain-follower/Cargo.toml +++ b/rust/cardano-chain-follower/Cargo.toml @@ -22,7 +22,7 @@ mithril-client = { version = "0.8.18", default-features = false, features = [ "num-integer-backend", ] } -c509-certificate = { version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "v0.0.1" } +c509-certificate = { version = "0.0.3", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "v0.0.3" } thiserror = "1.0.64" tokio = { version = "1.40.0", features = [ From c0e5b96d845d799a7f217424d631ee0c6919c2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Rosales?= Date: Sun, 6 Oct 2024 18:21:05 -0700 Subject: [PATCH 4/7] fix(rust/cardano-chain-follower): remove unused clone --- rust/hermes-ipfs/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/hermes-ipfs/src/lib.rs b/rust/hermes-ipfs/src/lib.rs index 8ff7bad6a1a..09ccda894ea 100644 --- a/rust/hermes-ipfs/src/lib.rs +++ b/rust/hermes-ipfs/src/lib.rs @@ -181,7 +181,7 @@ impl HermesIpfs { /// /// Returns an error if pinning fails. pub async fn insert_pin(&self, cid: &Cid) -> anyhow::Result<()> { - self.node.insert_pin(cid.clone()).await + self.node.insert_pin(cid).await } /// Checks whether a given block is pinned. From 9c878f090fb2cd6a10236fea6702b980a5a7ff30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Rosales?= Date: Sun, 6 Oct 2024 20:34:01 -0600 Subject: [PATCH 5/7] fix(rust/cardano-chain-follower): Update RBAC 509 API (#50) * fix(rust/cardano-chain-follower): make KeyLocalRef fields public * feat(rust/cardano-chain-follower): make extract_cip19_hash public * fix(rust/cardano-chain-follower): code format --- rust/cardano-chain-follower/src/metadata/cip509/mod.rs | 2 +- .../src/metadata/cip509/rbac/role_data.rs | 6 +++--- rust/cardano-chain-follower/src/metadata/cip509/utils.rs | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/rust/cardano-chain-follower/src/metadata/cip509/mod.rs b/rust/cardano-chain-follower/src/metadata/cip509/mod.rs index 493aebdb3a6..b518654e1db 100644 --- a/rust/cardano-chain-follower/src/metadata/cip509/mod.rs +++ b/rust/cardano-chain-follower/src/metadata/cip509/mod.rs @@ -5,10 +5,10 @@ // cspell: words pkix pub mod rbac; +pub mod utils; pub mod x509_chunks; mod decode_helper; -mod utils; use std::sync::Arc; diff --git a/rust/cardano-chain-follower/src/metadata/cip509/rbac/role_data.rs b/rust/cardano-chain-follower/src/metadata/cip509/rbac/role_data.rs index b56f16f0f32..21733a9532a 100644 --- a/rust/cardano-chain-follower/src/metadata/cip509/rbac/role_data.rs +++ b/rust/cardano-chain-follower/src/metadata/cip509/rbac/role_data.rs @@ -112,15 +112,15 @@ impl Decode<'_, ()> for KeyReference { #[derive(Debug, PartialEq, Clone)] pub struct KeyLocalRef { /// Local reference. - local_ref: LocalRefInt, + pub local_ref: LocalRefInt, /// Key offset. - key_offset: u64, + pub key_offset: u64, } /// Enum of local reference with its associated unsigned integer value. #[derive(FromRepr, Debug, PartialEq, Clone)] #[repr(u8)] -enum LocalRefInt { +pub enum LocalRefInt { /// x509 certificates. X509Certs = Cip509RbacMetadataInt::X509Certs as u8, // 10 /// c509 certificates. diff --git a/rust/cardano-chain-follower/src/metadata/cip509/utils.rs b/rust/cardano-chain-follower/src/metadata/cip509/utils.rs index 0f4d55adfd0..47cb0c434f2 100644 --- a/rust/cardano-chain-follower/src/metadata/cip509/utils.rs +++ b/rust/cardano-chain-follower/src/metadata/cip509/utils.rs @@ -7,7 +7,8 @@ use crate::witness::TxWitness; /// Example input: `web+cardano://addr/` /// /// URI = scheme ":" ["//" authority] path ["?" query] ["#" fragment] -pub(crate) fn extract_cip19_hash(uri: &str, prefix: Option<&str>) -> Option> { +#[must_use] +pub fn extract_cip19_hash(uri: &str, prefix: Option<&str>) -> Option> { // Regex pattern to match the expected URI format let r = Regex::new("^.+://addr/(.+)$").ok()?; From c3746678c6bb2fa52f32c9400d098b041d4fa12e Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 7 Oct 2024 10:24:42 +0700 Subject: [PATCH 6/7] fix(rust): Bump all rust crates, and fix chain-follower -> c509 usage --- rust/c509-certificate/Cargo.toml | 2 +- .../src/extensions/extension/data.rs | 27 +++++++++++++++++-- .../src/extensions/extension/mod.rs | 4 +-- rust/c509-certificate/src/lib.rs | 3 +++ rust/cardano-chain-follower/Cargo.toml | 3 +-- .../src/metadata/cip509/mod.rs | 23 +++++++--------- rust/cbork-abnf-parser/Cargo.toml | 2 +- rust/cbork-cddl-parser/Cargo.toml | 4 +-- rust/cbork/Cargo.toml | 4 +-- rust/hermes-ipfs/Cargo.toml | 2 +- 10 files changed, 48 insertions(+), 26 deletions(-) diff --git a/rust/c509-certificate/Cargo.toml b/rust/c509-certificate/Cargo.toml index ba001324f3e..0174b0c58d6 100644 --- a/rust/c509-certificate/Cargo.toml +++ b/rust/c509-certificate/Cargo.toml @@ -31,7 +31,7 @@ strum_macros = "0.26.4" regex = "1.11.0" ed25519-dalek = { version = "2.1.1", features = ["pem"] } thiserror = "1.0.64" -serde = { version = "1.0.204", features = ["derive"] } +serde = { version = "1.0.210", features = ["derive"] } wasm-bindgen = "0.2.93" serde-wasm-bindgen = "0.6.5" diff --git a/rust/c509-certificate/src/extensions/extension/data.rs b/rust/c509-certificate/src/extensions/extension/data.rs index 09980dd4448..9edc3a94d6f 100644 --- a/rust/c509-certificate/src/extensions/extension/data.rs +++ b/rust/c509-certificate/src/extensions/extension/data.rs @@ -20,10 +20,22 @@ type ExtensionDataTuple = (i16, Oid<'static>, ExtensionValueType, &'static str); /// Create a type alias for `ExtensionValueType` type Evt = ExtensionValueType; +/// Enum of all C509 Extension Types +pub enum C509ExtensionType { + /// Subject Key Identifier + SubjectKeyIdentifier = 1, + /// Key Usage + KeyUsage = 2, + /// Subject Alternative Name + SubjectAlternativeName = 3, +} + /// `Extension` data table +/// TODO, complete the ENUM above, and use it instead of raw integers here. +/// Name might be able to come from the enum comments, which would reduce redundancy. #[rustfmt::skip] const EXTENSION_DATA: [ExtensionDataTuple; 25] = [ - // Int | OID | Type | Name + // Int | OID | Type | Name ( 1, oid!(2.5.29 .14), Evt::Bytes, "Subject Key Identifier"), ( 2, oid!(2.5.29 .15), Evt::Int, "Key Usage"), ( 3, oid!(2.5.29 .17), Evt::AlternativeName, "Subject Alternative Name"), @@ -33,7 +45,7 @@ const EXTENSION_DATA: [ExtensionDataTuple; 25] = [ ( 7, oid!(2.5.29 .35), Evt::Unsupported, "Authority Key Identifier"), ( 8, oid!(2.5.29 .37), Evt::Unsupported, "Extended Key Usage"), ( 9, oid!(1.3.6 .1 .5 .5 .7 .1 .1), Evt::Unsupported, "Authority Information Access"), - (10, oid!(1.3.6 .1 .4 .1 .11129 .2 .4 .2), Evt::Unsupported, "Signed Certificate Timestamp List"), + (10, oid!(1.3.6 .1 .4 .1 .11129 .2 .4 .2), Evt::Unsupported, "Signed Certificate Timestamp List"), (24, oid!(2.5.29 .9), Evt::Unsupported, "Subject Directory Attributes"), (25, oid!(2.5.29 .18), Evt::AlternativeName, "Issuer Alternative Name"), (26, oid!(2.5.29 .30), Evt::Unsupported, "Name Constraints"), @@ -51,6 +63,17 @@ const EXTENSION_DATA: [ExtensionDataTuple; 25] = [ (38, oid!(1.3.6 .1 .5 .5 .7 .48 .1 .5), Evt::Unsupported, "OCSP No Check"), ]; +impl C509ExtensionType { + /// Get the OID for an Extension Type + #[must_use] + #[allow(clippy::missing_panics_doc)] // Can't really panic unless there is a bug. + pub fn oid(self) -> Oid<'static> { + let ext: i16 = self as i16; + #[allow(clippy::expect_used)] // Can't really panic. + get_oid_from_int(ext).expect("Invalid Extension Type") + } +} + /// A struct of data that contains lookup tables for `Extension`. pub(crate) struct ExtensionData { /// A table of integer to OID, provide a bidirectional lookup. diff --git a/rust/c509-certificate/src/extensions/extension/mod.rs b/rust/c509-certificate/src/extensions/extension/mod.rs index 8fc4ea21cfc..1d7c2b7c76a 100644 --- a/rust/c509-certificate/src/extensions/extension/mod.rs +++ b/rust/c509-certificate/src/extensions/extension/mod.rs @@ -1,6 +1,6 @@ //! C509 Extension use to construct an Extensions message field for C509 Certificate. -mod data; +pub mod data; use std::{fmt::Debug, str::FromStr}; use asn1_rs::Oid; @@ -55,7 +55,7 @@ impl Extension { /// Get the registered OID of the `Extension`. #[must_use] - pub(crate) fn registered_oid(&self) -> &C509oidRegistered { + pub fn registered_oid(&self) -> &C509oidRegistered { &self.registered_oid } } diff --git a/rust/c509-certificate/src/lib.rs b/rust/c509-certificate/src/lib.rs index b60c0cade77..5003ab74d31 100644 --- a/rust/c509-certificate/src/lib.rs +++ b/rust/c509-certificate/src/lib.rs @@ -46,6 +46,9 @@ use c509::C509; use cert_tbs::TbsCert; use minicbor::{Decode, Encode}; use signing::{PrivateKey, PublicKey}; + +pub use crate::extensions::extension::data::C509ExtensionType; + pub mod algorithm_identifier; pub mod attributes; pub mod big_uint; diff --git a/rust/cardano-chain-follower/Cargo.toml b/rust/cardano-chain-follower/Cargo.toml index 4f7cf5730a0..2de3972ac61 100644 --- a/rust/cardano-chain-follower/Cargo.toml +++ b/rust/cardano-chain-follower/Cargo.toml @@ -16,13 +16,12 @@ pallas-hardano = { version = "0.30.1", git = "https://github.com/input-output-hk pallas-crypto = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" } # cspell: words licence -#mithril-client = { version = "0.8.16", git = "https://github.com/input-output-hk/catalyst-mithril.git", branch = "fix/lgpl-licence", default-features = false, features = [ mithril-client = { version = "0.8.18", default-features = false, features = [ "full", "num-integer-backend", ] } -c509-certificate = { version = "0.0.3", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "v0.0.3" } +c509-certificate = { version = "0.0.3", git = "https://github.com/input-output-hk/catalyst-libs.git" , tag = "v0.0.3" } thiserror = "1.0.64" tokio = { version = "1.40.0", features = [ diff --git a/rust/cardano-chain-follower/src/metadata/cip509/mod.rs b/rust/cardano-chain-follower/src/metadata/cip509/mod.rs index b518654e1db..f699cde1326 100644 --- a/rust/cardano-chain-follower/src/metadata/cip509/mod.rs +++ b/rust/cardano-chain-follower/src/metadata/cip509/mod.rs @@ -12,9 +12,9 @@ mod decode_helper; use std::sync::Arc; -use c509_certificate::general_names::general_name::GeneralNameValue; +use c509_certificate::{general_names::general_name::GeneralNameValue, C509ExtensionType}; use decode_helper::{decode_bytes, decode_helper, decode_map_len}; -use der_parser::{asn1_rs::oid, der::parse_der_sequence, Oid}; +use der_parser::der::parse_der_sequence; use minicbor::{ decode::{self}, Decode, Decoder, @@ -51,9 +51,6 @@ pub const LABEL: u64 = 509; /// uniform resource identifier (URI) in the subject alternative name extension. pub(crate) const URI: u8 = 134; -/// Subject Alternative Name OID -pub(crate) const SUBJECT_ALT_NAME_OID: Oid = oid!(2.5.29 .17); - /// CIP509 metadatum. #[derive(Debug, PartialEq, Clone, Default)] pub struct Cip509 { @@ -642,17 +639,17 @@ impl Cip509 { ); }, C509Cert::C509Certificate(c509) => { - for exts in c509.get_tbs_cert().get_extensions().get_inner() { - if exts.get_registered_oid().get_c509_oid().get_oid() - == SUBJECT_ALT_NAME_OID + for exts in c509.tbs_cert().extensions().extensions() { + if *exts.registered_oid().c509_oid().oid() + == C509ExtensionType::SubjectAlternativeName.oid() { - match exts.get_value() { + match exts.value() { c509_certificate::extensions::extension::ExtensionValue::AlternativeName(alt_name) => { - match alt_name.get_inner() { + match alt_name.general_name() { c509_certificate::extensions::alt_name::GeneralNamesOrText::GeneralNames(gn) => { - for name in gn.get_inner() { - if name.get_gn_type() == &c509_certificate::general_names::general_name::GeneralNameTypeRegistry::UniformResourceIdentifier { - match name.get_gn_value() { + for name in gn.general_names() { + if name.gn_type() == &c509_certificate::general_names::general_name::GeneralNameTypeRegistry::UniformResourceIdentifier { + match name.gn_value() { GeneralNameValue::Text(s) => { if let Some(h) = extract_cip19_hash(s, Some("stake")) { pk_addrs.push(h); diff --git a/rust/cbork-abnf-parser/Cargo.toml b/rust/cbork-abnf-parser/Cargo.toml index 9b28425d644..debe86fa6e2 100644 --- a/rust/cbork-abnf-parser/Cargo.toml +++ b/rust/cbork-abnf-parser/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "cbork-abnf-parser" -version = "0.0.2" +version = "0.0.3" edition.workspace = true license.workspace = true authors.workspace = true diff --git a/rust/cbork-cddl-parser/Cargo.toml b/rust/cbork-cddl-parser/Cargo.toml index bd55ec14e87..b2c7e307aae 100644 --- a/rust/cbork-cddl-parser/Cargo.toml +++ b/rust/cbork-cddl-parser/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "cbork-cddl-parser" -version = "0.0.2" +version = "0.0.3" edition.workspace = true license.workspace = true authors.workspace = true @@ -16,6 +16,6 @@ workspace = true [dependencies] derive_more = {version = "1.0.0", features = ["from","display"] } -pest = { version = "2.7.2", features = ["std", "pretty-print", "memchr", "const_prec_climber"] } +pest = { version = "2.7.13", features = ["std", "pretty-print", "memchr", "const_prec_climber"] } pest_derive = { version = "2.7.13", features = ["grammar-extras"] } thiserror = "1.0.64" diff --git a/rust/cbork/Cargo.toml b/rust/cbork/Cargo.toml index e1ffe51d3e9..e5af55aecce 100644 --- a/rust/cbork/Cargo.toml +++ b/rust/cbork/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cbork" -version = "0.0.2" +version = "0.0.3" edition.workspace = true license.workspace = true authors.workspace = true @@ -15,7 +15,7 @@ workspace = true [dependencies] # Always used a versioned dependency, so that changes to dependent libraries do not cause cascading # breakage inside the repo. -cbork-cddl-parser = {version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "v0.0.1" } +cbork-cddl-parser = {version = "0.0.3", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "v0.0.3" } # Only use this for testing - do not change dependency to this in checked in code. #cbork-cddl-parser = { path = "../cbork-cddl-parser", version = "0.1.0" } clap = { version = "4.5.19", features = ["derive", "env"] } diff --git a/rust/hermes-ipfs/Cargo.toml b/rust/hermes-ipfs/Cargo.toml index ddb7a1612b8..9fba93ecba2 100644 --- a/rust/hermes-ipfs/Cargo.toml +++ b/rust/hermes-ipfs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hermes-ipfs" -version = "0.0.2" +version = "0.0.3" edition.workspace = true license.workspace = true authors.workspace = true From d420558f8371efc782f84fbbca343ac7d92be991 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 7 Oct 2024 10:27:34 +0700 Subject: [PATCH 7/7] fix(rust): sync standard config --- rust/Earthfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rust/Earthfile b/rust/Earthfile index ca6ed4f5022..2ba01a634c6 100644 --- a/rust/Earthfile +++ b/rust/Earthfile @@ -15,15 +15,16 @@ COPY_SRC: hermes-ipfs \ . +# builder : Set up our target toolchains, and copy our files. +builder: + DO rust-ci+SETUP + # sync-cfg: Synchronize local config with CI version. # Must be run by the developer manually. sync-cfg: + FROM +builder DO rust-ci+SYNC_STD_CFG -# builder : Set up our target toolchains, and copy our files. -builder: - DO rust-ci+SETUP - builder-src: FROM +builder