• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

input-output-hk / catalyst-libs / 16646523141

31 Jul 2025 10:28AM UTC coverage: 67.341% (+3.8%) from 63.544%
16646523141

push

github

web-flow
feat(rust/signed-doc): Implement new Catalyst Signed Doc (#338)

* chore: add new line to open pr

Signed-off-by: bkioshn <bkioshn@gmail.com>

* chore: revert

Signed-off-by: bkioshn <bkioshn@gmail.com>

* feat(rust/signed-doc): add new type `DocType` (#339)

* feat(signed-doc): add new type DocType

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): add conversion policy

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): doc type

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): doc type error

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): seperate test

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): format

Signed-off-by: bkioshn <bkioshn@gmail.com>

---------

Signed-off-by: bkioshn <bkioshn@gmail.com>

* feat(rust/signed-doc): Add initial decoding tests for the Catalyst Signed Documents (#349)

* wip

* wip

* fix fmt

* fix spelling

* fix clippy

* fix(rust/signed-doc): Apply new `DocType` (#347)

* feat(signed-doc): add new type DocType

Signed-off-by: bkioshn <bkioshn@gmail.com>

* wip: apply doctype

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): add more function to DocType

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): map old doctype to new doctype

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): add eq to uuidv4

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): fix validator

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): minor fixes

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(catalyst-types): add hash to uuidv4

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): decoding test

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): doctype

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(signed-doc): minor fixes

Signed-off-by: bkioshn <bkioshn@gmail.com>

* chore(sign-doc): fix comment

Signed-off-by: bkioshn <bkioshn@gmail.com>

* fix(catalyst-types): add froms... (continued)

2453 of 2675 new or added lines in 38 files covered. (91.7%)

19 existing lines in 7 files now uncovered.

11312 of 16798 relevant lines covered (67.34%)

2525.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.78
/rust/signed_doc/src/metadata/collaborators.rs
1
//! Catalyst Signed Document `collaborators` field type definition.
2

3
use std::{ops::Deref, str::FromStr};
4

5
use catalyst_types::catalyst_id::CatalystId;
6
use cbork_utils::{array::Array, decode_context::DecodeCtx};
7

8
/// 'collaborators' field type definition, which is a JSON path string
9
#[derive(Clone, Debug, PartialEq)]
10
pub struct Collaborators(Vec<CatalystId>);
11

12
impl Deref for Collaborators {
13
    type Target = Vec<CatalystId>;
14

NEW
15
    fn deref(&self) -> &Self::Target {
×
NEW
16
        &self.0
×
NEW
17
    }
×
18
}
19

20
impl minicbor::Encode<()> for Collaborators {
21
    fn encode<W: minicbor::encode::Write>(
2✔
22
        &self, e: &mut minicbor::Encoder<W>, _ctx: &mut (),
2✔
23
    ) -> Result<(), minicbor::encode::Error<W::Error>> {
2✔
24
        if !self.0.is_empty() {
2✔
25
            e.array(
2✔
26
                self.0
2✔
27
                    .len()
2✔
28
                    .try_into()
2✔
29
                    .map_err(minicbor::encode::Error::message)?,
2✔
NEW
30
            )?;
×
31
            for c in &self.0 {
6✔
32
                e.bytes(&c.to_string().into_bytes())?;
4✔
33
            }
NEW
34
        }
×
35
        Ok(())
2✔
36
    }
2✔
37
}
38

39
impl minicbor::Decode<'_, ()> for Collaborators {
40
    fn decode(
5✔
41
        d: &mut minicbor::Decoder<'_>, _ctx: &mut (),
5✔
42
    ) -> Result<Self, minicbor::decode::Error> {
5✔
43
        Array::decode(d, &mut DecodeCtx::Deterministic)?
5✔
44
            .iter()
5✔
45
            .map(|item| minicbor::Decoder::new(item).bytes())
9✔
46
            .collect::<Result<Vec<_>, _>>()?
5✔
47
            .into_iter()
4✔
48
            .map(CatalystId::try_from)
4✔
49
            .collect::<Result<_, _>>()
4✔
50
            .map(Self)
4✔
51
            .map_err(minicbor::decode::Error::custom)
4✔
52
    }
5✔
53
}
54

55
impl<'de> serde::Deserialize<'de> for Collaborators {
56
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2✔
57
    where D: serde::Deserializer<'de> {
2✔
58
        Vec::<String>::deserialize(deserializer)?
2✔
59
            .into_iter()
2✔
60
            .map(|id| CatalystId::from_str(&id))
4✔
61
            .collect::<Result<_, _>>()
2✔
62
            .map(Self)
2✔
63
            .map_err(serde::de::Error::custom)
2✔
64
    }
2✔
65
}
66

67
impl serde::Serialize for Collaborators {
NEW
68
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
×
NEW
69
    where S: serde::Serializer {
×
NEW
70
        let iter = self.0.iter().map(ToString::to_string);
×
NEW
71
        serializer.collect_seq(iter)
×
NEW
72
    }
×
73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc