Skip to content

Commit f65e84f

Browse files
authored
feat(docs): Update voting docs, add cddl validation (#79)
* fix gen_vote_tx structure * add cose import * cleanup Earthfiles, add cddl-check target * update jorm spec * wip * add cddl validation * add cddl validation for immutable_ledger specs * fix spelling * add missing blueprint.cue files * fix * fix immutable ledger cddl definitions * wip * wip * wip * fix * fix CI * fix cat-ci version
1 parent fdbd960 commit f65e84f

File tree

18 files changed

+246
-170
lines changed

18 files changed

+246
-170
lines changed

.config/dictionaries/project.dic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ cardano
2727
carryforward
2828
CBOR
2929
cbork
30+
cddlc
3031
cdylib
3132
CEST
3233
chacha

docs/src/architecture/08_concepts/catalyst_voting/.pages

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ title: Catalyst Voting
22
arrange:
33
- crypto.md
44
- gen_vote_tx.md
5-
- jorm.md
6-
- cat_v2.md
5+
- v1.md
6+
- v2.md

docs/src/architecture/08_concepts/catalyst_voting/cat_v2.md

Lines changed: 0 additions & 71 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
VERSION 0.8
2+
3+
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cddl:v3.2.23 AS cddl-ci
4+
5+
check-cddl:
6+
FROM cddl-ci+cddl-base
7+
8+
WORKDIR /cddl
9+
10+
COPY ./gen_vote_tx.cddl \
11+
./vote_tx_v2_public.cddl \
12+
./vote_tx_v2_private.cddl \
13+
./gen_vote_tx_cose_payload.cddl \
14+
.
15+
16+
RUN cddlc -2 gen_vote_tx_cose_payload.cddl
17+
RUN cddlc -2 gen_vote_tx.cddl
18+
RUN cddlc -2 vote_tx_v2_public.cddl
19+
RUN cddlc -2 vote_tx_v2_private.cddl
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version: "1.0.0"
2+
project: name: "docs-catalyst-voting-cddl"
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
gen-vote-tx = [
2-
tx-body,
1+
gen-vote-tx<choice-t, proof-t, prop-id-t> = [
2+
tx-body<choice-t, proof-t, prop-id-t>,
33
signature
44
]
55

6-
tx-body = [
6+
tx-body<choice-t, proof-t, prop-id-t> = [
77
vote-type
88
event,
9-
votes,
9+
votes<choice-t, proof-t, prop-id-t>,
1010
voters-data,
1111
]
1212

1313
vote-type = UUID ; e.g. Public or Private vote
1414
event = { * event-key => any }
1515
event-key = int / text
1616

17-
votes = [+ vote]
18-
vote = [
19-
choices,
20-
proof \ null,
21-
prop-id \ null,
17+
votes<choice-t, proof-t, prop-id-t> = [+ vote<choice-t, proof-t, prop-id-t>]
18+
vote<choice-t, proof-t, prop-id-t> = [
19+
choices<choice-t>,
20+
proof<proof-t>,
21+
prop-id<prop-id-t>,
2222
]
23-
choices = [+ choice]
24-
choice = encoded-cbor
25-
proof = encoded-cbor
26-
prop-id = encoded-cbor
23+
choices<choice-t> = [+ choice<choice-t>]
24+
choice<choice-t> = #6.24(bytes .cbor choice-t) ; encoded-cbor
25+
proof<proof-t> = #6.24(bytes .cbor proof-t) ; encoded-cbor
26+
prop-id<prop-id-t> = #6.24(bytes .cbor prop-id-t) ; encoded-cbor
2727

2828
voters-data = encoded-cbor
2929

3030
UUID = #6.37(bytes) ; UUID type
31-
signature = #6.98(COSE_Sign) ; COSE signature
31+
signature = #6.98(cose.COSE_Sign) ; COSE signature
32+
33+
;# import rfc9052 as cose
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
cose-payload = blake2b-256
2-
blake2b-256 = #6.32782(bytes .size 32) ; Blake2b-256 hash bytes
2+
blake2b-256 = #6.32782(bytes .size 32) ; Blake2b-256 hash bytes

docs/src/architecture/08_concepts/catalyst_voting/cddl/vote_tx_v2.cddl

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
vote-tx-v2 = gen-vote-tx<choice-data, proof-data, proposal>
2+
3+
choice-data = ciphertext
4+
ciphertext = [group-element, group-element]
5+
6+
proposal = UUID
7+
8+
proof-data = zk-proof
9+
10+
zk-proof = [[+ (announcement, ~ciphertext, r-response)], scalar]
11+
12+
announcement = (group-element, group-element, group-element)
13+
r-response = (scalar, scalar, scalar)
14+
15+
scalar = bytes .size 32
16+
group-element = bytes .size 32
17+
18+
;# include gen_vote_tx
19+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
vote-tx-v2-public = gen-vote-tx<choice-data, proof-data, proposal>
2+
3+
choice-data = uint
4+
proof-data = undefined
5+
proposal = UUID
6+
7+
;# include gen_vote_tx
8+

0 commit comments

Comments
 (0)