Skip to content

Commit 1b0cbb5

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/cat-sign-doc-validator
2 parents c2a8d7b + c441fb6 commit 1b0cbb5

File tree

11 files changed

+82
-33
lines changed

11 files changed

+82
-33
lines changed

docs/src/architecture/08_concepts/catalyst_docs/comment.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,24 @@ A list of used [Catalyst Signed Document protected header fields](./../signed_do
4343
[Catalyst Signed Document content] must be [Brotli] compressed.
4444

4545
```CDDL
46-
"content-type" => "br"
46+
"content-encoding" => "br"
4747
```
4848

4949
* [`ref`](./../signed_doc/meta.md#ref-document-reference).
50-
Reference to a related [Proposal Document].
51-
* [`template`](./../signed_doc/meta.md#ref-document-reference) must be equal to `0b8424d4-ebfd-46e3-9577-1775a69d290c` value,
52-
[comment template type](#comment-template).
50+
Reference to a related [Proposal Document],
51+
which [`type`](./../signed_doc/spec.md#type) must be equal to
52+
[proposal document `type`][Proposal Document] field value.
5353

54-
```CDDL
55-
"template" => 37(h'0b8424d4ebfd46e395771775a69d290c')
56-
```
54+
* [`template`](./../signed_doc/meta.md#ref-document-reference).
55+
A reference to the comment template document,
56+
which [`type`](./../signed_doc/spec.md#type) must be equal to
57+
[comment template `type`](#comment-template) field value.
5758

5859
* [`reply`](./../signed_doc/meta.md#reply-reply-reference) (optional).
59-
A reference to another comment,
60+
A reference to another comment document,
6061
where the comment is in reply to the referenced comment.
62+
The [`type`](./../signed_doc/spec.md#type) of the replied document
63+
must be equal to comment document `type` field value.
6164
Comments may only reply to a single other comment document.
6265
The referenced `comment` must be for the same proposal [`id`](./../signed_doc/spec.md#id),
6366
but can be for a different proposal [`ver`](./../signed_doc/spec.md#ver).
@@ -100,7 +103,7 @@ A list of used [Catalyst Signed Document protected header fields](./../signed_do
100103
[Catalyst Signed Document content] must be [Brotli] compressed.
101104

102105
```CDDL
103-
"content-type" => "br"
106+
"content-encoding" => "br"
104107
```
105108

106109
#### Content format

docs/src/architecture/08_concepts/catalyst_docs/proposal.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,18 @@ A list of used [Catalyst Signed Document protected header fields](./../signed_do
4747
[Catalyst Signed Document content] must be [Brotli] compressed.
4848

4949
```CDDL
50-
"content-type" => "br"
50+
"content-encoding" => "br"
5151
```
5252

53-
* [`template`](./../signed_doc/meta.md#ref-document-reference) must be equal to `0ce8ab38-9258-4fbc-a62e-7faa6e58318f` value,
54-
[proposal template type](#proposal-template).
53+
* [`template`](./../signed_doc/meta.md#ref-document-reference).
54+
A reference to the proposal template document,
55+
which [`type`](./../signed_doc/spec.md#type) must be equal to
56+
[proposal template `type`](#proposal-template) field value.
5557

56-
```CDDL
57-
"template" => 37(h'0ce8ab3892584fbca62e7faa6e58318f')
58-
```
58+
* [`category_id`](./../signed_doc/meta.md#category_id) (optional).
59+
A reference to the category document,
60+
which [`type`](./../signed_doc/spec.md#type) must be equal to
61+
`48c20109-362a-4d32-9bba-e0a9cf8b45be` value.
5962

6063
#### Content format
6164

@@ -91,7 +94,7 @@ A list of used [Catalyst Signed Document protected header fields](./../signed_do
9194
[Catalyst Signed Document content] must be [Brotli] compressed.
9295

9396
```CDDL
94-
"content-type" => "br"
97+
"content-encoding" => "br"
9598
```
9699

97100
#### Content format

docs/src/architecture/08_concepts/catalyst_docs/review.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,13 @@ A list of used [Catalyst Signed Document protected header fields](./../signed_do
4343
[Catalyst Signed Document content] must be [Brotli] compressed.
4444

4545
```CDDL
46-
"content-type" => "br"
46+
"content-encoding" => "br"
4747
```
4848

49-
* [`template`](./../signed_doc/meta.md#ref-document-reference) must be equal to `ebe5d0bf-5d86-4577-af4d-008fddbe2edc` value,
50-
[review template type](#review-template).
51-
52-
```CDDL
53-
"template" => 37(h'ebe5d0bf5d864577af4d008fddbe2edc')
54-
```
49+
* [`template`](./../signed_doc/meta.md#ref-document-reference).
50+
A reference to the review template document,
51+
which [`type`](./../signed_doc/spec.md#type) must be equal to
52+
[review template `type`](#review-template) field value.
5553

5654
#### Content format
5755

@@ -87,7 +85,7 @@ A list of used [Catalyst Signed Document protected header fields](./../signed_do
8785
[Catalyst Signed Document content] must be [Brotli] compressed.
8886

8987
```CDDL
90-
"content-type" => "br"
88+
"content-encoding" => "br"
9189
```
9290

9391
#### Content format

docs/src/architecture/08_concepts/signed_doc/meta.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,5 @@ e.g. "Development & Infrastructure", "Products & Integrations".
115115

116116
[UUID]: https://www.rfc-editor.org/rfc/rfc9562.html
117117
[CBOR]: https://datatracker.ietf.org/doc/rfc8949/
118+
[JSON]: https://datatracker.ietf.org/doc/html/rfc7159
118119
[JSON Path]: https://datatracker.ietf.org/doc/html/rfc9535

rust/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,3 @@ unchecked_duration_subtraction = "deny"
6161
unreachable = "deny"
6262
missing_docs_in_private_items = "deny"
6363
arithmetic_side_effects = "deny"
64-
65-
# https://github.com/orxfun/orx-pseudo-default/issues/11
66-
[patch.crates-io]
67-
orx-pseudo-default = { git = "https://github.com/orxfun/orx-pseudo-default?rev=1.4.0", tag = "1.4.0" }

rust/cardano-blockchain-types/src/metadata/cip36/key_registration.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ impl Decode<'_, ProblemReport> for Cip36KeyRegistration {
116116
.as_ref()
117117
.map(|addr| !addr.payment().is_script())
118118
.or(None);
119+
cip36_key_registration.payment_addr = shelley_addr;
119120
},
120121
Cip36KeyRegistrationKeys::Nonce => {
121-
cip36_key_registration.nonce = Some(decode_nonce(d)?);
122+
cip36_key_registration.raw_nonce = Some(decode_nonce(d)?);
122123
},
123124
Cip36KeyRegistrationKeys::Purpose => {
124125
cip36_key_registration.purpose = decode_purpose(d)?;

rust/cardano-blockchain-types/src/metadata/cip36/mod.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ impl fmt::Display for Cip36 {
6767

6868
/// CIP-36 Catalyst registration error
6969
#[allow(dead_code, clippy::module_name_repetitions)]
70+
#[derive(Debug)]
7071
pub struct Cip36Error {
7172
/// The decoding error that make the code not able to process.
7273
error: anyhow::Error,
@@ -345,3 +346,32 @@ impl Cip36 {
345346
&self.err_report
346347
}
347348
}
349+
350+
#[cfg(test)]
351+
mod tests {
352+
use crate::{Cip36, MultiEraBlock, Network, Point};
353+
354+
// CIP36 in transaction 1
355+
// <https://preprod.cardanoscan.io/transaction/5c7cf7bff543447fc1e46c2598380fa08b8d882de2191ef5bc80078b71724217?tab=metadata>
356+
fn block_1() -> MultiEraBlock {
357+
let data = hex::decode(include_str!("./test_data/block_1.block")).unwrap();
358+
let previous = Point::fuzzy(0.into());
359+
MultiEraBlock::new(Network::Preprod, data, &previous, 0.into()).unwrap()
360+
}
361+
362+
#[test]
363+
fn new() {
364+
let res = Cip36::new(&block_1(), 1.into(), true).unwrap().unwrap();
365+
assert!(!res.err_report().is_problematic());
366+
assert!(res.is_valid());
367+
assert!(res.network() == Network::Preprod);
368+
assert!(res.raw_nonce() == Some(55_076_993));
369+
assert!(res.nonce() == Some(55_076_993));
370+
}
371+
372+
#[test]
373+
fn from_block() {
374+
let res = Cip36::cip36_from_block(&block_1(), true).unwrap();
375+
assert_eq!(res.len(), 1);
376+
}
377+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
820685828a1a001f49b41a034868a058203b7e53cdf5da9c4231c9530d73cff6330f4ca3f89017735380dcfe00173dccc15820b9de7dfcc40f225fee6647d1807a17119ad682621e0b1b83b766b0600f7adaf75820f597c6a19866c05211a67992d7e5ffe63d7d5cf9e061b776041898ffd713882f825840c8f3964340e140102f671b9365e74ac28f8c1798d864c00c7b0cc389ffbb636aee598e5babd96047f33d16b846120004e0ee37003658061440e9c21b0466dbf558505e463cd8ca93c993b20b3dea6a7ec554c910cb8165fc3007d6d335152f686e3e0fc659eacc0aacae1d845cc516a56bfe31c8e5647b0bfd8a12b7443d34005003a635f4a5167c5966ca4f029f5c4eea041907ed582057ed586261c7b9967221cc2f22b1e532e7934e4930f51712e0b7e614818a95a2845820cc6be19cd87bbce3535b383629e10101118532bb85a48959062161f3feaa0d470619018058406decddfd1c5c01a493af54652aa7d8b518be943952f45cb98c071095e8dcb1d56fb932f9c8d06ce1f6206fedc3487b00acbae60bec07bf65d6930231641782058208005901c0c47c719d8a3088a62ef4b10abe4d94b8ef9fd1c064cec2a7159859b271ee57710c3ee20d2ddc0f816f81290ac71857c59c99a055e3dda42cc86b8350a036230845c22faaba31e77034f6f5328e05fa40275f7dd360a155da356ec75441e2d3e57eb42b3899ba7a926498e0aecf8277ab92b8b3fecc5b1f1993ebde94915507e368ff3963a79df924bfe6ca8a0c48db0dc21d24e9ffc2f07eb5042ef85ecff227c568238fa4070e1d9ff335a19168fe29e8045fe348033b93dbc62675dbdadf9dda4f2725a67d05880a3a7d380087a552efbeba0763cdc3507627da7593f8bae8e2d5f84f7a744239cce2f0f7a49f9fb08f2b02b6b43581377cc5c57e90defade76fdb075ff901ee2ef7c3e7d4357c5eaba9bc757fce5daf4a9dfd648fa85fbf32bba4a1a866e9de8a6781bcbf2f077796a87f5a27ac847004641cc35d93db12f3c4e161bf39a5dcb830672a7e20f1cffab7a346b199423b8fd998f60736682d3692861cb12315e618cc824feec8ab318e8d56c0bad209a7755db3411ea2e1c7f91566a0aeefdfefb222b2c72cf5142bb11659719b4aa1207134a6c962481e967828e7e580d6573d4733c8de41f5256f9a1b20d99773fbd769d219baff2d9573282a600818258200fdf79c438b4b06b54ab55e5c15a81edbe833746e2f143045ebfd050e60b1e12000184825839006e2afcc23973d9613fe552cfd8aee78d1c14cf963d88354247f703faec22783550d560336a5c46ff0db2577797a4a72958eb25baeab9cc801a00174aeb825839006e2afcc23973d9613fe552cfd8aee78d1c14cf963d88354247f703fa434bc8b84be3d2f2565b2cc619df393e8555f615ec97b0b77ff7e0a51a001ab3f0825839006e2afcc23973d9613fe552cfd8aee78d1c14cf963d88354247f703fa826c43601d1480a5c4ca600ef16048eb728a4a186ac607f03059b7891a001ab3f0825839006e2afcc23973d9613fe552cfd8aee78d1c14cf963d88354247f703fab7f1d8e182a285631f984e601ae340093d48b27fc4e81f85a803bbba1a001ab3f0021a00036905031a034884ab048882008200581cec22783550d560336a5c46ff0db2577797a4a72958eb25baeab9cc8083028200581cec22783550d560336a5c46ff0db2577797a4a72958eb25baeab9cc80581cfe662c24cf56fb98626161f76d231ac50ab7b47dd83986a30c1d479682008200581c434bc8b84be3d2f2565b2cc619df393e8555f615ec97b0b77ff7e0a583028200581c434bc8b84be3d2f2565b2cc619df393e8555f615ec97b0b77ff7e0a5581c209c6caf1fdabf53984cdcdce4e8d53f680165f33557a47c54b1dd6a82008200581c826c43601d1480a5c4ca600ef16048eb728a4a186ac607f03059b78983028200581c826c43601d1480a5c4ca600ef16048eb728a4a186ac607f03059b789581c9b4c92eb5cb4c072a0e6670777e1bc8586a202bceebc702e81b1315e82008200581cb7f1d8e182a285631f984e601ae340093d48b27fc4e81f85a803bbba83028200581cb7f1d8e182a285631f984e601ae340093d48b27fc4e81f85a803bbba581c36caf09e7ff5ba0642161b164069e2f3c66af52d4caa6c98e5e1513807582029c1794791d20182de3f94321a60b1442bd93848d6700a229472cd3d1f3b100ea50081825820882c7d125819cf748dff7cec1b6c5f7a3353e43ef5f4d7f7ca2baba91a322c6a000181a200583900afe07feb59dda08fdbac532c0d65e9c302366ebfeac91fa64ac8dabf464fbac58c3cac691bbd379e112318dc41854a5283b34e07905beece011b000000010675244f021a0002b149031a034884a10758201a32391d19ebf3532450b73834c5440ab4487407da4394d0646490eadbb2f9e182a100858258208681815713d89a9380822da80403e10103356960db9b64c7d9c5abdedcc1a6615840996bcfad8a35f9661a5e1ef16f5edd9aa0cf0de2e2c9879faacace907b1082e5d78438b241303fc6f10fbf31b986c5e22cf9b8e1d3ee8756c54901accde39b0682582057487ee3d5eeafc112ca116dc6a5e292377487c042a70202e3da76fe42408304584031105c9226307684b5593815ed62d1c9bab2cc3153fbc04bbc42aa9b6a06df710fc626001ab646ecda7c610a531444e81d998d7b3ebdd5e99ab3d7c31a905d0682582056e748f5da316d9f3f996e37f4f031e450f8d6dd32aad6f0e0490bef8760afc558400186eef2b753fd1c0f151921e521cea43dd71561c69de9f863c2d44e74c479bbb22e823eb722980125fb3e754e785e89867e09f134c2fe0a96956e55bc3b2e0782582083bd5c7717bf75b990866ef694b012550a4f900db841c1e961176556c6b7893b5840d064abdd257950a7f87e2e18cdd719b0ad37c4d364f2ce409d082181b9405cadbbc3016dcc5243c69c0b57351a26d7c73cd4fb45f96279ee9721316932b5d100825820f9f6995231c9627902f39e170e15f606f9c407290fd10af4b09f3c80c262a48458401c21df46d0da54dc8d70a497d348f7d2e2d830ccd858b2424d8bddbf27559d7a7e09473bfb26e9f7a284e052e038de9fdbd59733b6fe0be6ae34c45eb837c30fa10081825820404a7112a430ececff35b0319f16a3345bfb031b895badf3ec2897c4b7296bf85840d1953964ee3abb6c3193443a2dbacaf388047e3b327d52b98ee0b71f48e71d919956648218c5fe0919ae1f209f27501dda8a475e8e26eb2aac7f0cd881460305a200a1191acea165706f6f6c7384a262696478386665363632633234636635366662393836323631363166373664323331616335306162376234376464383339383661333063316434373936667765696768741819a262696478383230396336636166316664616266353339383463646364636534653864353366363830313635663333353537613437633534623164643661667765696768741819a262696478383962346339326562356362346330373261306536363730373737653162633835383661323032626365656263373032653831623133313565667765696768741819a2626964783833366361663039653766663562613036343231363162313634303639653266336336366166353264346361613663393865356531353133386677656967687418190182a219ef64a4015820dda9e5418d0fbac9d624a3a6e259cbc194f5e2eef58b91c2c2c675fbb09a4d5e02582012a5b7212903f01722323d229a08ad91e8b01659aad3284c0aad556cff992f9303583900afe07feb59dda08fdbac532c0d65e9c302366ebfeac91fa64ac8dabf464fbac58c3cac691bbd379e112318dc41854a5283b34e07905beece041a0348688119ef65a10158405fc485d5204599c402becdaf0552f1e7d9c499525939795bddc13355abdbd676cf06b66d2b82cfbe0bbf55aad2cc72bd5f47b72f89bfed513dab9d638c35860b8080

rust/catalyst-types/src/hash_wrapper.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ macro_rules! define_hashes {
3333
}
3434
}
3535

36+
impl std::fmt::Display for $name {
37+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
38+
f.write_str(&format!("0x{}", self.0))
39+
}
40+
}
41+
3642
impl From<$name> for Vec<u8> {
3743
fn from(value: $name) -> Self {
3844
value.0.into()
@@ -124,4 +130,14 @@ mod tests {
124130
let from_vec = H1::try_from(v).unwrap();
125131
assert_eq!(hash, from_vec);
126132
}
133+
134+
// The display implementation is used to get user-friendly representation and must be
135+
// equal to `hex::encode(<underlying bytes>)`.
136+
#[test]
137+
fn display() {
138+
let hash = H1::new(&[1, 2, 3, 4, 5]);
139+
let display = format!("{hash}");
140+
let expected = "0x2a6ad53c3c6986406e1d6c7cfd06b69a";
141+
assert_eq!(expected, display);
142+
}
127143
}

rust/cbork/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ workspace = true
1515
[dependencies]
1616
# Always used a versioned dependency, so that changes to dependent libraries do not cause cascading
1717
# breakage inside the repo.
18-
cbork-cddl-parser = {version = "0.0.3", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "v0.0.3" }
18+
cbork-cddl-parser = { version = "0.0.3", git = "https://github.com/input-output-hk/catalyst-libs.git", rev = "r20250204-00" }
1919
# Only use this for testing - do not change dependency to this in checked in code.
2020
#cbork-cddl-parser = { path = "../cbork-cddl-parser", version = "0.1.0" }
21-
clap = { version = "4.5.19", features = ["derive", "env"] }
21+
clap = { version = "4.5.19", features = ["derive", "env"] }
2222
anyhow = "1.0.89"
2323
console = "0.15.8"
2424

0 commit comments

Comments
 (0)