Skip to content

Commit 21f8bb3

Browse files
committed
Merge branch 'main' into wip/document-schemas
2 parents bf256dd + 5f31d75 commit 21f8bb3

File tree

24 files changed

+236
-92
lines changed

24 files changed

+236
-92
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
@@ -122,4 +122,5 @@ e.g. "Development & Infrastructure", "Products & Integrations".
122122

123123
[UUID]: https://www.rfc-editor.org/rfc/rfc9562.html
124124
[CBOR]: https://datatracker.ietf.org/doc/rfc8949/
125+
[JSON]: https://datatracker.ietf.org/doc/html/rfc7159
125126
[JSON Path]: https://datatracker.ietf.org/doc/html/rfc9535

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.2.28 AS rust-ci
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.37 AS rust-ci
44

55
COPY_SRC:
66
FUNCTION

rust/cardano-blockchain-types/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ workspace = true
2020
[dependencies]
2121
pallas = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" }
2222
# pallas-hardano = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" }
23-
cbork-utils = { version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "r20250128-01" }
24-
catalyst-types = { version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "r20250128-01" }
23+
cbork-utils = { version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "r20250212-00" }
24+
catalyst-types = { version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "r20250212-00" }
2525

2626
ouroboros = "0.18.4"
2727
tracing = "0.1.41"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ define_hashes!(
99
/// A transaction hash - Blake2b-256 hash of a transaction.
1010
(TransactionHash, Blake2b256Hash),
1111
/// A public key hash - raw Blake2b-224 hash of an Ed25519 public key (has no discriminator, just the hash).
12-
(PubKeyHash, Blake2b224Hash)
12+
(PubKeyHash, Blake2b224Hash),
1313
);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ mod network;
1010
mod point;
1111
mod slot;
1212
mod txn_index;
13+
mod txn_output_offset;
1314
mod txn_witness;
1415

1516
pub use auxdata::{
@@ -29,4 +30,5 @@ pub use network::Network;
2930
pub use point::Point;
3031
pub use slot::Slot;
3132
pub use txn_index::TxnIndex;
33+
pub use txn_output_offset::TxnOutputOffset;
3234
pub use txn_witness::{TxnWitness, VKeyHash};

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+
}

0 commit comments

Comments
 (0)