Skip to content

Commit d341ecc

Browse files
authored
Merge branch 'main' into feat/more-doc-usage-details
2 parents 8c4586a + 0c33096 commit d341ecc

File tree

11 files changed

+40
-15
lines changed

11 files changed

+40
-15
lines changed

Earthfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.6.1 AS mdlint-ci
4-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.6.1 AS cspell-ci
5-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/python:v3.6.1 AS python-ci
6-
IMPORT github.com/input-output-hk/catalyst-ci:v3.6.1 AS cat-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.6.6 AS mdlint-ci
4+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.6.6 AS cspell-ci
5+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/python:v3.6.6 AS python-ci
6+
IMPORT github.com/input-output-hk/catalyst-ci:v3.6.0 AS cat-ci
77

88
FROM debian:stable-slim
99

docs/Earthfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.6.1 AS docs-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.6.6 AS docs-ci
44

55
IMPORT .. AS repo
66

docs/src/architecture/08_concepts/signed_doc/cddl/Earthfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cddl:v3.6.1 AS cddl-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cddl:v3.6.6 AS cddl-ci
44

55
check-cddl:
66
FROM cddl-ci+cddl-base

rust/Earthfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.6.1 AS rust-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.6.6 AS rust-ci
44
IMPORT ../ AS repo-ci
55

66
COPY_SRC:

rust/deny.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ version = 2
1919
ignore = [
2020
"RUSTSEC-2025-0067",
2121
"RUSTSEC-2025-0068",
22+
"RUSTSEC-2024-0370",
2223
]
2324

2425
[bans]

rust/signed_doc/src/validator/rules/chain/mod.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
//! `chain` rule type impl.
22
3-
use catalyst_signed_doc_spec::{is_required::IsRequired, metadata::chain::Chain};
3+
use anyhow::ensure;
4+
use catalyst_signed_doc_spec::{
5+
is_required::IsRequired,
6+
metadata::{chain::Chain, collaborators::Collaborators},
7+
};
48

59
use crate::{CatalystSignedDocument, providers::CatalystSignedDocumentProvider};
610

@@ -21,16 +25,24 @@ pub(crate) enum ChainRule {
2125

2226
impl ChainRule {
2327
/// Generating `ChainRule` from specs
24-
pub(crate) fn new(spec: &Chain) -> Self {
28+
pub(crate) fn new(
29+
spec: &Chain,
30+
collaborators_spec: &Collaborators,
31+
) -> anyhow::Result<Self> {
2532
let optional = match spec.required {
2633
IsRequired::Yes => false,
2734
IsRequired::Optional => true,
2835
IsRequired::Excluded => {
29-
return Self::NotSpecified;
36+
return Ok(Self::NotSpecified);
3037
},
3138
};
3239

33-
Self::Specified { optional }
40+
ensure!(
41+
matches!(collaborators_spec.required, IsRequired::Excluded),
42+
"Chained Documents do not support collaborators"
43+
);
44+
45+
Ok(Self::Specified { optional })
3446
}
3547

3648
/// Field validation rule

rust/signed_doc/src/validator/rules/chain/tests.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use catalyst_signed_doc_spec::{is_required::IsRequired, metadata::chain::Chain as ChainSpec};
12
use catalyst_types::uuid::{UuidV4, UuidV7};
23
use test_case::test_case;
34

@@ -48,6 +49,17 @@ async fn test_without_chaining_documents() {
4849
assert!(!rule.check(&doc, &provider).await.unwrap());
4950
}
5051

52+
#[tokio::test]
53+
async fn chain_rule_collaborators_rule_conflict() {
54+
let chain = ChainSpec {
55+
required: IsRequired::Optional,
56+
};
57+
let collaborators = Collaborators {
58+
required: IsRequired::Optional,
59+
};
60+
ChainRule::new(&chain, &collaborators).unwrap_err();
61+
}
62+
5163
#[test_case(
5264
{
5365
let doc_type = UuidV4::new();

rust/signed_doc/src/validator/rules/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl Rules {
129129
content_encoding: ContentEncodingRule::new(&doc_spec.headers.content_encoding)?,
130130
template: TemplateRule::new(all_docs_specs, &doc_spec.metadata.template)?,
131131
parameters: ParametersRule::new(all_docs_specs, &doc_spec.metadata.parameters)?,
132-
chain: ChainRule::new(&doc_spec.metadata.chain),
132+
chain: ChainRule::new(&doc_spec.metadata.chain, &doc_spec.metadata.collaborators)?,
133133
doc_ref: RefRule::new(all_docs_specs, &doc_spec.metadata.doc_ref)?,
134134
reply: ReplyRule::new(all_docs_specs, &doc_spec.metadata.reply)?,
135135
section: SectionRule::NotSpecified,

specs/Earthfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/python:v3.6.1 AS python-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/python:v3.6.6 AS python-ci
44

55
IMPORT ../docs AS docs
66

specs/generators/pages/signed_doc/cddl/Earthfile.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION 0.8
22

3-
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cddl:v3.6.1 AS cddl-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cddl:v3.6.6 AS cddl-ci
44

55
check-cddl:
66
FROM cddl-ci+cddl-base

0 commit comments

Comments
 (0)