Skip to content

Commit 4eb8340

Browse files
authored
fix(rust/signed-doc): Minor fixes for catalyst-singed-doc crate (#220)
* fix * wip * try * try * fix * try * wip * fix readme * wip * wip * try new rust cat-ci 1.85 compiler version * wip * fix deny.toml * bump fmmap version * wip * fix * fix * revert using 1.85 * wip * wip * fix
1 parent 0a460cf commit 4eb8340

File tree

10 files changed

+20
-14
lines changed

10 files changed

+20
-14
lines changed

rust/Earthfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ build:
6868
SAVE ARTIFACT target/doc doc
6969
SAVE ARTIFACT target/release/cbork cbork
7070
# Catalyst Signed Documents cli tool
71-
SAVE ARTIFACT target/release/examples/mk_signed_doc mk_signed_doc
71+
SAVE ARTIFACT target/release/mk_signed_doc mk_signed_doc
7272

7373
# build-src-check: Check for any caching issues with the source we are building against.
7474
check-builder-src-cache:

rust/cardano-blockchain-types/src/txn_witness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl TxnWitness {
8181
pub fn check_witness_in_tx(&self, vkey_hash: &VKeyHash, tx_num: TxnIndex) -> bool {
8282
self.0
8383
.get(vkey_hash)
84-
.map_or(false, |entry| entry.1.contains(&tx_num))
84+
.is_some_and(|entry| entry.1.contains(&tx_num))
8585
}
8686

8787
/// Get the actual verifying key from the given public key hash.

rust/cardano-chain-follower/src/chain_sync_live_chains.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,7 @@ impl ProtectedLiveChainBlockList {
394394
// Search backwards for a fork smaller than or equal to the one we know.
395395
while this_block.fork() > fork {
396396
rollback_depth = rollback_depth.saturating_add(1);
397-
entry = match entry.prev() {
398-
Some(entry) => entry,
399-
None => return None,
400-
};
397+
entry = entry.prev()?;
401398

402399
this_block = entry.value().clone();
403400
}

rust/catalyst-types/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ thiserror = "2.0.11"
3030
base64-url = "3.0.0"
3131
uuid = { version = "1.12.0", features = ["v4", "v7", "serde"] }
3232
chrono = "0.4.39"
33-
fmmap = { version = "0.3.3", features = ["sync", "tokio-async"] }
33+
fmmap = { version = "0.4.0", features = ["sync", "tokio"] }
3434
once_cell = "1.20.2"
3535
tracing = "0.1.41"
3636

rust/catalyst-voting/Cargo.toml

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ rand_core = { version = "0.6.4", features = ["getrandom"] }
2222
rand_chacha = "0.3.1"
2323
curve25519-dalek = { version = "4.1.3", features = ["digest", "rand_core"] }
2424
ed25519-dalek = { version = "2.1.1", features = ["rand_core"] }
25+
# Its a transitive dependency which fails to build on higher version with our current compiler 1.83
26+
base64ct = { version = "=1.6.0" }
2527
blake2b_simd = "1.0.2"
2628
rayon = "1.10.0"
2729

@@ -31,3 +33,7 @@ proptest = { version = "1.5.0" }
3133
# Potentially it could be replaced with using `proptest::property_test` attribute macro,
3234
# after this PR will be merged https://github.com/proptest-rs/proptest/pull/523
3335
test-strategy = "0.4.0"
36+
37+
[package.metadata.cargo-machete]
38+
# remove that after fixing issues with latest crates
39+
ignored = ["base64ct"]

rust/signed_doc/Cargo.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ serde_json = "1.0.134"
1818
coset = "0.3.8"
1919
minicbor = { version = "0.25.1", features = ["half"] }
2020
brotli = "7.0.0"
21-
ed25519-dalek = { version = "2.1.1" }
21+
ed25519-dalek = { version = "2.1.1", features = ["rand_core", "pem"] }
2222
hex = "0.4.3"
2323
strum = { version = "0.26.3", features = ["derive"] }
2424
clap = { version = "4.5.23", features = ["derive", "env"] }
@@ -30,4 +30,7 @@ futures = "0.3.31"
3030
base64-url = "3.0.0"
3131
rand = "0.8.5"
3232
tokio = { version = "1.42.0", features = [ "macros" ] }
33-
ed25519-dalek = { version = "2.1.1", features = ["rand_core", "pem"] }
33+
34+
[[bin]]
35+
name = "mk_signed_doc"
36+
path = "bins/mk_signed_doc.rs"

rust/signed_doc/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ openssl genpkey -algorithm=ED25519 -out=private.pem -outpubkey=public.pem
1818
`meta.json` file should follow the [`meta.schema.json`](./meta.schema.json).
1919

2020
```shell
21-
cargo run -p catalyst-signed-doc --example mk_signed_doc build signed_doc/doc.json signed_doc/doc.cose signed_doc/meta.json
21+
cargo run -p catalyst-signed-doc build signed_doc/doc.json signed_doc/doc.cose signed_doc/meta.json
2222
```
2323

2424
### Sign document
2525

2626
`KID` is a valid Catalyst ID URI.
2727

2828
```shell
29-
cargo run -p catalyst-signed-doc --example mk_signed_doc sign signed_doc/doc.cose signed_doc/meta.json <KID>
29+
cargo run -p catalyst-signed-doc sign signed_doc/doc.cose signed_doc/meta.json <KID>
3030
```
3131

3232
### Inspect document
3333

3434
```shell
35-
cargo run -p catalyst-signed-doc --example mk_signed_doc inspect signed_doc/doc.cose
35+
cargo run -p catalyst-signed-doc inspect signed_doc/doc.cose
3636
```

rust/signed_doc/src/validator/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn document_rules_init() -> HashMap<Uuid, Rules> {
4242
.try_into()
4343
.expect("Must be a valid UUID V4"),
4444
},
45-
category: CategoryRule::Specified { optional: false },
45+
category: CategoryRule::Specified { optional: true },
4646
doc_ref: RefRule::NotSpecified,
4747
reply: ReplyRule::NotSpecified,
4848
section: SectionRule::NotSpecified,

rust/signed_doc/src/validator/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ where
1818
} else {
1919
report.functional_validation(
2020
format!("Cannot retrieve a document {doc_ref}").as_str(),
21-
"Validation data provider could not return a corresponding {doc_name}.",
21+
"Validation data provider could not return a corresponding document.",
2222
);
2323
Ok(false)
2424
}

0 commit comments

Comments
 (0)