Skip to content

Commit f8760f0

Browse files
authored
Merge branch 'main' into chore/update-ci-versions
2 parents 9f761c2 + 41c1446 commit f8760f0

File tree

90 files changed

+3025
-5179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+3025
-5179
lines changed

.config/dictionaries/project.dic

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ coverallsapp
4949
cpus
5050
crontabs
5151
crontagged
52+
csprng
5253
cstring
5354
dalek
5455
dashmap
@@ -122,6 +123,7 @@ jorm
122123
jormungandr
123124
Jörmungandr
124125
jsonschema
126+
kiduri
125127
lcov
126128
Leay
127129
Leshiy
@@ -141,6 +143,7 @@ maindbname
141143
mapref
142144
mdlint
143145
mdns
146+
MEMMAP
144147
memx
145148
Metadatum
146149
mgrybyk
@@ -209,6 +212,8 @@ reqwest
209212
retriggering
210213
ristretto
211214
rlib
215+
rngs
216+
rsplit
212217
rulelist
213218
RULENAME
214219
runable
@@ -235,6 +240,7 @@ smac
235240
stevenj
236241
stringzilla
237242
subsec
243+
subnetwork
238244
symlinkat
239245
syscall
240246
tacho
@@ -262,8 +268,11 @@ unlinkat
262268
upnp
263269
ureq
264270
userid
271+
userinfo
265272
utimensat
266273
UTXO
274+
uuidv4
275+
uuidv7
267276
vitss
268277
Vkey
269278
vkeywitness
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
title: RBAC KID (Key Identifier) URI
2+
arrange:
3+
- kiduri.md
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
---
2+
Title: RBAC Key Identifier URI Specification
3+
Category: Catalyst
4+
Status: Proposed
5+
Authors:
6+
- Steven Johnson <[email protected]>
7+
Implementors:
8+
- Catalyst Fund 14
9+
Discussions: []
10+
Created: 2025-01-05
11+
License: CC-BY-4.0
12+
---
13+
14+
* [Abstract](#abstract)
15+
* [Motivation: why is this CIP necessary?](#motivation-why-is-this-cip-necessary)
16+
* [Specification](#specification)
17+
* [URI](#uri)
18+
* [`scheme`](#scheme)
19+
* [`authority`](#authority)
20+
* [`authority` - `host`](#authority---host)
21+
* [List of defined hosts](#list-of-defined-hosts)
22+
* [`authority` - `userinfo`](#authority---userinfo)
23+
* [Lists of defined subnetwork `userinfo` values](#lists-of-defined-subnetwork-userinfo-values)
24+
* [Cardano](#cardano)
25+
* [`path`](#path)
26+
* [Reference Implementation](#reference-implementation)
27+
* [Test Vectors](#test-vectors)
28+
* [Rationale: how does this CIP achieve its goals?](#rationale-how-does-this-cip-achieve-its-goals)
29+
* [Path to Active](#path-to-active)
30+
* [Acceptance Criteria](#acceptance-criteria)
31+
* [Implementation Plan](#implementation-plan)
32+
* [Copyright](#copyright)
33+
34+
## Abstract
35+
36+
Definition of a [URI] which allows for RBAC keys used for different purposes to be easily and
37+
unambiguously identified.
38+
39+
## Motivation: why is this CIP necessary?
40+
41+
There is a need to identify which Key from a RBAC registration was used to sign data.
42+
RBAC defines a universal keychain of different keys that can be used for different purposes.
43+
They can be used not only for Signatures, but also Encryption.
44+
45+
Therefore, there needs to be an unambiguous and easy to lookup identifier to signify which key was
46+
used for a particular purpose.
47+
48+
This document defines a [URI] scheme to unambiguously define a particular key with reference to a
49+
particular RBAC keychain.
50+
51+
## Specification
52+
53+
### URI
54+
55+
The RBAC Kid is formatted using a [Universal Resource Identifier].
56+
Refer to [RFC3986] for the specification of the URI format.
57+
58+
### `scheme`
59+
60+
The [scheme](https://datatracker.ietf.org/doc/html/rfc3986#section-3.1) **MUST** be `kid.catalyst-rbac`;
61+
62+
### `authority`
63+
64+
The [authority](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2) references the blockchain or network
65+
the key was registered within.
66+
67+
It is perfectly valid for a Kid to reference a different network than the place where the Key is used.
68+
For example, a `cardano` KID can be used to post documents to `IPFS`.
69+
Its purpose is to define WHERE the key was registered, and nothing more.
70+
71+
The Authority will consist of a `host` and optional `userinfo`.
72+
73+
#### `authority` - `host`
74+
75+
The [host](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2)
76+
refers to the network type where the RBAC registration was made.
77+
It **IS NOT** resolvable with **DNS**, and **IS NOT** a public host name.
78+
It is used as a decentralized network identifier.
79+
The consumer of the `KID` must be able to resolve these host names.
80+
81+
##### List of defined hosts
82+
83+
| `host` | Description |
84+
| --- | --- |
85+
| `cardano` | Cardano Blockchain |
86+
| `midnight` | Midnight Blockchain |
87+
| `ethereum` | Ethereum Blockchain |
88+
| `cosmos` | Cosmos Blockchain |
89+
90+
#### `authority` - `userinfo`
91+
92+
The [userinfo](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1)
93+
is used to distinguish a subnetwork from the primary main network.
94+
The absence of `userinfo` is used to indicate the primary main network.
95+
96+
##### Lists of defined subnetwork `userinfo` values
97+
98+
###### Cardano
99+
100+
| `userinfo` | Description |
101+
| --- | --- |
102+
| `preprod` | Cardano Pre-Production Network |
103+
| `preview` | Cardano Preview Network |
104+
| 0x<hex_number> | Cardano network identified by this magic number in hex |
105+
106+
### `path`
107+
108+
The [path](https://datatracker.ietf.org/doc/html/rfc3986#section-3.3) defines the actual key within the registration.
109+
Keys are defined relative to the very first Role0 Key registered in any RBAC registration.
110+
111+
The overall `path` specification is: `<initial role0 key>/<role>/<rotation>#encrypt`
112+
113+
* `<initial role 0 key>` - This is the very first role 0 key used to post the registration to the network.
114+
* It is the [Base64 URL] encoded binary data of the role 0 public key.
115+
* This does not change, even if the Initial Role 0 key is revoked.
116+
* This allows for an unambiguous identifier for the RBAC keychain.
117+
* It is not necessarily the key being identified.
118+
* `<role>` - This is the Role number being used.
119+
* It is a positive number, starting at 0, and no greater than 65535.
120+
* `<rotation>` - This is the rotation of the defined role key being identified.
121+
* It starts at 0 for the first published key for the role, and increments by one for each subsequent published rotation.
122+
* This number refers to the published sequence of keys for the role in the RBAC registration keychain,
123+
not the index used in the key derivation.
124+
* It is positive and no greater than 65535.
125+
* `#encrypt` - [Fragment](https://datatracker.ietf.org/doc/html/rfc3986#section-3.5)
126+
disambiguates Encryption Public Keys from signing public keys.
127+
* Roles can have 1 active public signing key, and 1 active public encryption key.
128+
* By default, the URL is referencing the signing public key.
129+
* If a public encryption key is being identified, then the fragment `#encrypt` is appended to the [Universal Resource Identifier].
130+
131+
## Reference Implementation
132+
133+
The first implementation will be Catalyst Voices.
134+
135+
## Test Vectors
136+
137+
* `kid.catalyst-rbac://cardano/<key>/0/0`
138+
* A Signing key registered on the Cardano Main network.
139+
* Role 0 - Rotation 0.
140+
In this example, it is exactly the same as the `<key>`.
141+
* `kid.catalyst-rbac://preprod@cardano/<key>/7/3`
142+
* A Signing key registered on the Cardano pre-production network.
143+
* Role 7 - Rotation 3.
144+
The Key for Role 7, and its third published rotation
145+
(i.e., the fourth key published, the first is the initial key, plus 3 rotations following it).
146+
* `kid.catalyst-rbac://preprod@cardano/<key>/2/0#encrypt`
147+
* A Public Encryption key registered on the Cardano pre-production network.
148+
* Role 2 - Rotation 0.
149+
The initially published Public Encryption Key for Role 2.
150+
* `kid.catalyst-rbac://midnight/<key>/0/1`
151+
* A Signing key registered on the Midnight Blockchain Main network
152+
* Role 0 - Rotation 1.
153+
In this example, it is NOT the same as the `<key>`, as it identifies the first rotation after `<key>`.
154+
* `kid.catalyst-rbac://midnight/<key>/2/1#encrypt`
155+
* A public encryption key registered on the Midnight Blockchain Main network.
156+
* Role 2 - Rotation 1.
157+
158+
## Rationale: how does this CIP achieve its goals?
159+
160+
By creating a [URI] to identify keys,
161+
we allow the unambiguous and flexible identification of any RBAC Key that was used for any purpose.
162+
163+
## Path to Active
164+
165+
### Acceptance Criteria
166+
167+
Working Implementation before Fund 14.
168+
169+
### Implementation Plan
170+
171+
Fund 14 project catalyst will deploy this scheme for Key Identification.
172+
173+
## Copyright
174+
175+
This document is licensed under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/legalcode).
176+
177+
[URI]: https://datatracker.ietf.org/doc/html/rfc3986
178+
[Universal Resource Identifier]: https://datatracker.ietf.org/doc/html/rfc3986
179+
[RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986
180+
[Base64 URL]: https://datatracker.ietf.org/doc/html/rfc4648#section-5

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ There can, and probably will, exist multiple versions of the same document.
107107

108108
The `ver` is a [UUID] v7.
109109

110-
The initial `ver` assigned the first time a Catalyst Signed Document is published will be identical to the [`id`](#id).
110+
The initial `ver` assigned the first time a Catalyst Signed Document is published **MUST** be identical to the [`id`](#id).
111111
Subsequent versions will retain the same [`id`](#id) and will create a new `ver`,
112112
following best practice for creating a new [UUID] v7.
113113

rust/Earthfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ build:
5858
--args1="--libs=c509-certificate --libs=cardano-blockchain-types --libs=cardano-chain-follower --libs=hermes-ipfs" \
5959
--args2="--libs=cbork-cddl-parser --libs=cbork-abnf-parser --libs=cbork-utils --libs=catalyst-types" \
6060
--args3="--libs=catalyst-voting --libs=immutable-ledger --libs=vote-tx-v1 --libs=vote-tx-v2" \
61-
--args4="--bins=cbork/cbork --libs=rbac-registration --libs=signed_doc" \
61+
--args4="--bins=cbork/cbork --libs=rbac-registration --libs=catalyst-signed-doc" \
6262
--args5="--cov_report=$HOME/build/coverage-report.info" \
6363
--output="release/[^\./]+" \
6464
--junit="cat-libs.junit-report.xml" \

rust/cardano-blockchain-types/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ workspace = true
1919

2020
[dependencies]
2121
pallas = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" }
22-
pallas-crypto = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" }
2322
# pallas-hardano = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" }
2423
cbork-utils = { version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "v0.0.11" }
2524
catalyst-types = { version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "r20250108-00" }

rust/cardano-blockchain-types/src/auxdata/metadatum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
33
use std::sync::Arc;
44

5+
use catalyst_types::conversion::from_saturating;
56
use dashmap::DashMap;
67
use minicbor::Decode;
78

89
use super::{metadatum_label::MetadatumLabel, metadatum_value::MetadatumValue};
9-
use crate::conversion::from_saturating;
1010

1111
/// Transaction Metadata
1212
/// See: <https://github.com/IntersectMBO/cardano-ledger/blob/78b32d585fd4a0340fb2b184959fb0d46f32c8d2/eras/conway/impl/cddl-files/conway.cddl#L519>

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

Lines changed: 0 additions & 55 deletions
This file was deleted.

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

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,40 @@
66
//!
77
//! Note: This fork terminology is different from fork in blockchain.
88
9-
use crate::conversion::from_saturating;
9+
use std::fmt;
10+
11+
use catalyst_types::conversion::from_saturating;
1012

1113
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd)]
1214
/// Counter that is incremented every time there is a roll-back in live-chain.
1315
pub struct Fork(u64);
1416

1517
impl Fork {
18+
/// Fork for data that read from the blockchain during a backfill on initial sync
19+
pub const BACKFILL: Self = Self(1);
20+
/// Fork count for the first live block.
21+
pub const FIRST_LIVE: Self = Self(2);
22+
/// Fork for immutable data. This indicates that there is no roll-back.
23+
pub const IMMUTABLE: Self = Self(0);
24+
25+
/// Is the fork for immutable data.
26+
#[must_use]
27+
pub fn is_immutable(&self) -> bool {
28+
self == &Self::IMMUTABLE
29+
}
30+
31+
/// Is the fork for backfill data.
32+
#[must_use]
33+
pub fn is_backfill(&self) -> bool {
34+
self == &Self::BACKFILL
35+
}
36+
37+
/// Is the fork for live data.
38+
#[must_use]
39+
pub fn is_live(&self) -> bool {
40+
self >= &Self::FIRST_LIVE
41+
}
42+
1643
/// Convert an `<T>` to `Fork` (saturate if out of range).
1744
pub fn from_saturating<
1845
T: Copy
@@ -38,6 +65,17 @@ impl Fork {
3865
}
3966
}
4067

68+
impl fmt::Display for Fork {
69+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
70+
match self.0 {
71+
0 => write!(f, "IMMUTABLE"),
72+
1 => write!(f, "BACKFILL"),
73+
// For live forks: 2 maps to LIVE:1, 3 maps to LIVE:2 etc.
74+
2..=u64::MAX => write!(f, "LIVE:{}", self.0 - 1),
75+
}
76+
}
77+
}
78+
4179
impl From<u64> for Fork {
4280
fn from(value: u64) -> Self {
4381
Self(value)

0 commit comments

Comments
 (0)