Skip to content

Commit

Permalink
fix(general): Bump Versions (#49)
Browse files Browse the repository at this point in the history
* fix(general): Bump Versions

* fix(rust/hermes-ipfs): update to work with latest rust-ipfs version

* fix(rust/cardano-chain-follower): bump c509-certificate version

* fix(rust/cardano-chain-follower): remove unused clone

* 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

* fix(rust): Bump all rust crates, and fix chain-follower -> c509 usage

* fix(rust): sync standard config

---------

Co-authored-by: Joaquín Rosales <[email protected]>
  • Loading branch information
stevenj and saibatizoku authored Oct 7, 2024
1 parent da61ae4 commit 1409266
Show file tree
Hide file tree
Showing 20 changed files with 117 additions and 92 deletions.
4 changes: 2 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/Earthfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
12 changes: 6 additions & 6 deletions integration_tests/rust/overhead_benchmark/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "overhead_benchmark"
version = "0.1.0"
version = "0.1.1"
edition.workspace = true

[lints]
Expand All @@ -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"] }
11 changes: 6 additions & 5 deletions rust/Earthfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down
22 changes: 11 additions & 11 deletions rust/c509-certificate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
serde = { version = "1.0.204", features = ["derive"] }
wasm-bindgen = "0.2.92"
thiserror = "1.0.64"
serde = { version = "1.0.210", features = ["derive"] }
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"

Expand Down
2 changes: 1 addition & 1 deletion rust/c509-certificate/Earthfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 25 additions & 2 deletions rust/c509-certificate/src/extensions/extension/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"),
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions rust/c509-certificate/src/extensions/extension/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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
}
}
Expand Down
3 changes: 3 additions & 0 deletions rust/c509-certificate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
30 changes: 15 additions & 15 deletions rust/cardano-chain-follower/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,14 +16,14 @@ 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.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.56"
thiserror = "1.0.64"
tokio = { version = "1.40.0", features = [
"macros",
"rt",
Expand All @@ -32,13 +32,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"
Expand All @@ -47,26 +47,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]
Expand All @@ -75,7 +75,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]
Expand Down
25 changes: 11 additions & 14 deletions rust/cardano-chain-follower/src/metadata/cip509/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
// cspell: words pkix

pub mod rbac;
pub mod utils;
pub mod x509_chunks;

mod decode_helper;
mod utils;

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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion rust/cardano-chain-follower/src/metadata/cip509/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use crate::witness::TxWitness;
/// Example input: `web+cardano://addr/<cip-19 address string>`
/// <https://github.com/cardano-foundation/CIPs/tree/6bae5165dde5d803778efa5e93bd408f3317ca03/CPS-0016>
/// URI = scheme ":" ["//" authority] path ["?" query] ["#" fragment]
pub(crate) fn extract_cip19_hash(uri: &str, prefix: Option<&str>) -> Option<Vec<u8>> {
#[must_use]
pub fn extract_cip19_hash(uri: &str, prefix: Option<&str>) -> Option<Vec<u8>> {
// Regex pattern to match the expected URI format
let r = Regex::new("^.+://addr/(.+)$").ok()?;

Expand Down
6 changes: 3 additions & 3 deletions rust/catalyst-voting/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]
Expand Down
Loading

0 comments on commit 1409266

Please sign in to comment.