Skip to content

Commit bf625f9

Browse files
committed
fix gen_vote_tx structure
1 parent fdbd960 commit bf625f9

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

Earthfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,17 @@ repo-docs:
4141
COPY --dir *.md LICENSE-APACHE LICENSE-MIT .
4242

4343
SAVE ARTIFACT /repo repo
44+
45+
cddlc:
46+
FROM ruby:3.3.0-alpine
47+
48+
WORKDIR /cddl
49+
50+
RUN gem install cddlc
51+
52+
COPY ./docs/src/architecture/08_concepts/catalyst_voting/cddl/gen_vote_tx.cddl .
53+
COPY ./docs/src/architecture/08_concepts/catalyst_voting/cddl/vote_tx_v2.cddl .
54+
55+
RUN cddlc -u2tcddl vote_tx_v2.cddl
56+
57+

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ event = { * event-key => any }
1515
event-key = int / text
1616

1717
votes = [+ vote]
18-
vote = [
19-
choices,
20-
proof \ null,
21-
prop-id \ null,
18+
vote<choice-t, proof-t, prop-id-t> = [
19+
choices<choice-t>,
20+
proof<proof-t> / null,
21+
prop-id<prop-id-t> / null,
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

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
vote-tx-v2 = gen-vote-tx
2-
3-
choice = #6.24(bstr(choice-data))
4-
proof = #6.24(bstr(proof-data))
5-
prop-id = #6.24(bstr(proposal))
1+
vote-tx-v2 = gen-vote-tx<choice-data, proof-data, proposal>
62

73
choice-data = public-choice / private-choice
84

@@ -16,10 +12,9 @@ proposal = UUID
1612

1713
proof-data = zk-proof
1814

19-
zk-proof = [[+ (announcement, ciphertext, r-response)], scalar]
15+
zk-proof = [[+ (announcement, ~ciphertext, r-response)], scalar]
2016

2117
announcement = (group-element, group-element, group-element)
22-
ciphertext = (group-element, group-element)
2318
r-response = (scalar, scalar, scalar)
2419

2520
scalar = bytes .size 32

0 commit comments

Comments
 (0)