Skip to content

Commit 51bb74c

Browse files
qnikstnc6
authored andcommitted
Add ksy keys
1 parent ebf202e commit 51bb74c

File tree

10 files changed

+312
-63
lines changed

10 files changed

+312
-63
lines changed

scls-cddl/cddl-src/Cardano/SCLS/Common.hs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,15 @@ script_hash =
213213

214214
anchor :: Rule
215215
anchor =
216-
"anchor"
217-
=:= arr
218-
[ "anchor_url" ==> url
219-
, "anchor_data_hash" ==> hash32
220-
]
216+
comment
217+
[str|
218+
| Signed url
219+
|]
220+
$ "anchor"
221+
=:= arr
222+
[ "anchor_url" ==> url
223+
, "anchor_data_hash" ==> VBytes
224+
]
221225

222226
epoch_no :: Rule
223227
epoch_no = "epoch_no" =:= VUInt `sized` (8 :: Word64)

scls-cddl/cddl-src/Cardano/SCLS/Namespace/Blocks.hs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,33 @@
1111
module Cardano.SCLS.Namespace.Blocks where
1212

1313
import Codec.CBOR.Cuddle.Huddle
14+
import Text.Heredoc (str)
15+
import Prelude (($))
1416

1517
record_entry :: Rule
16-
record_entry = "record_entry" =:= VInt
18+
record_entry =
19+
comment
20+
[str| Values for the blocks.
21+
|
22+
| Key definition:
23+
|
24+
| ```
25+
| meta:
26+
| endian: be
27+
|
28+
| seq:
29+
| - id: key
30+
| type: blocks
31+
|
32+
| types:
33+
| block:
34+
| seq:
35+
| - id: keyhash_stakepool
36+
| doc: keyhash of the stake pool
37+
| size: 28
38+
| - id: epoch
39+
| doc: epoch
40+
| type: u8
41+
| ```
42+
|]
43+
$ "record_entry" =:= VInt

scls-cddl/cddl-src/Cardano/SCLS/Namespace/GovCommittee.hs

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,39 @@ import Text.Heredoc (str)
1717
record_entry :: Rule
1818
record_entry =
1919
comment
20-
[str| The key for the entry is epoch number (8 bytes) |]
20+
[str| The key for the namespace
21+
|
22+
| ```
23+
| meta:
24+
| endian: be
25+
|
26+
| seq:
27+
| - id: key
28+
| type: gov_committee
29+
|
30+
| types:
31+
| gov_committee:
32+
| seq:
33+
| - id: epoch
34+
| doc: epoch
35+
| type: u8
36+
| ```
37+
|]
2138
$ "record_entry" =:= committee
2239

2340
committee :: Rule
2441
committee =
25-
"committee"
26-
=:= (mp [0 <+ asKey credential ==> committee_authorization])
42+
comment
43+
[str| Storage of the committee members
44+
|]
45+
$ "committee" =:= (mp [0 <+ asKey credential ==> committee_authorization])
2746

2847
committee_authorization :: Rule
2948
committee_authorization =
30-
"committee_authorization"
31-
=:= arr [0, a credential]
32-
/ arr [1, a (anchor / VNil)]
49+
comment
50+
[str| 0 - hot committee member
51+
| 1 - resignation
52+
|]
53+
$ "committee_authorization"
54+
=:= arr [0, a credential]
55+
/ arr [1, a (anchor / VNil)]

scls-cddl/cddl-src/Cardano/SCLS/Namespace/GovConstitution.hs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,31 @@ record_entry :: Rule
1717
record_entry =
1818
comment
1919
[str| Constinution record entry
20-
| Key is the epoch number (8 bytes)
20+
|
21+
| ```
22+
| meta:
23+
| endian: be
24+
|
25+
| seq:
26+
| - id: key
27+
| type: gov_constitution
28+
|
29+
| gov_constitution:
30+
| seq:
31+
| - id: epoch
32+
| doc: Current epoch.
33+
| type: u8
34+
| ```
2135
|]
2236
$ "record_entry" =:= constitution
2337

2438
constitution :: Rule
2539
constitution =
26-
"constitution"
27-
=:= arr
28-
[ a anchor
29-
, a (script_hash / VNil)
30-
]
40+
comment
41+
[str| address of the constition
42+
|]
43+
$ "constitution"
44+
=:= arr
45+
[ a anchor
46+
, a (script_hash / VNil)
47+
]

scls-cddl/cddl-src/Cardano/SCLS/Namespace/GovPParams.hs

Lines changed: 81 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{-# LANGUAGE TypeApplications #-}
66
{-# LANGUAGE NoImplicitPrelude #-}
77
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
8+
89
{-# HLINT ignore "Use camelCase" #-}
910

1011
module Cardano.SCLS.Namespace.GovPParams where
@@ -18,13 +19,44 @@ import Prelude (Integer, ($))
1819
record_entry :: Rule
1920
record_entry =
2021
comment
21-
[str| The key for the entry is one of the following:
22-
| prev / curr / fut1 / fut0
23-
| fut0 stands for possible future
24-
| fut1 stands for definite future
25-
|
26-
| fut0 + no pparams is not represented, key should be omitted in that case
27-
|]
22+
[str| Specification for parameters
23+
|
24+
| ```
25+
| meta:
26+
| endian: be
27+
|
28+
| seq:
29+
| - id: key
30+
| type: gov_pparams
31+
|
32+
| types:
33+
| gov_pparams:
34+
| seq:
35+
| - id: value
36+
| type: strz
37+
| size: 4
38+
| encoding: ASCII
39+
| - id: valiant
40+
| size: 0
41+
| type:
42+
| switch-on: value
43+
| cases:
44+
| '"prev"': kprev
45+
| '"curr"': kcurr
46+
| '"fut0"': kfut0
47+
| '"fut1"': kfut1
48+
| kprev:
49+
| doc: previous values
50+
| kcurr:
51+
| doc: current values
52+
| kfut0:
53+
| doc: possible future
54+
| kfut1:
55+
| doc: definitive future
56+
| ```
57+
|
58+
| fut0 with missig parameters should be omitted.
59+
|]
2860
$ "record_entry" =:= gov_pparams_out
2961

3062
gov_pparams_out :: Rule
@@ -125,27 +157,48 @@ ex_units = "ex_units" =:= arr ["mem" ==> VUInt, "steps" ==> VUInt]
125157

126158
pool_voting_thresholds :: Rule
127159
pool_voting_thresholds =
128-
"pool_voting_thresholds"
129-
=:= arr
130-
[ a unit_interval -- motion no confidence
131-
, a unit_interval -- committee normal
132-
, a unit_interval -- committee no confidence
133-
, a unit_interval -- hard fork initiation
134-
, a unit_interval -- security relevant parameter voting threshold
135-
]
160+
comment
161+
[str|
162+
| 0 - motion no confidence
163+
| 1 - committee normal
164+
| 2 - committee no confidence
165+
| 3 - hard fork initiation
166+
| 4 - security relevant parameter voting threshold
167+
|]
168+
$ "pool_voting_thresholds"
169+
=:= arr
170+
[ a unit_interval -- motion no confidence
171+
, a unit_interval -- committee normal
172+
, a unit_interval -- committee no confidence
173+
, a unit_interval -- hard fork initiation
174+
, a unit_interval -- security relevant parameter voting threshold
175+
]
136176

137177
drep_voting_thresholds :: Rule
138178
drep_voting_thresholds =
139-
"drep_voting_thresholds"
140-
=:= arr
141-
[ a unit_interval -- motion no confidence
142-
, a unit_interval -- committee normal
143-
, a unit_interval -- committee no confidence
144-
, a unit_interval -- update constitution
145-
, a unit_interval -- hard fork initiation
146-
, a unit_interval -- PP network group
147-
, a unit_interval -- PP economic group
148-
, a unit_interval -- PP technical group
149-
, a unit_interval -- PP governance group
150-
, a unit_interval -- treasury withdrawal
151-
]
179+
comment
180+
[str|
181+
| 0 - motion no confidence
182+
| 1 - committee normal
183+
| 2 - committee no confidence
184+
| 3 - update constitution
185+
| 4 - hard fork initiation
186+
| 5 - PP network group
187+
| 6 - PP economic group
188+
| 7 - PP technical group
189+
| 8 - PP governance group
190+
| 9 - treasury withdrawal
191+
|]
192+
$ "drep_voting_thresholds"
193+
=:= arr
194+
[ a unit_interval -- motion no confidence
195+
, a unit_interval -- committee normal
196+
, a unit_interval -- committee no confidence
197+
, a unit_interval -- update constitution
198+
, a unit_interval -- hard fork initiation
199+
, a unit_interval -- PP network group
200+
, a unit_interval -- PP economic group
201+
, a unit_interval -- PP technical group
202+
, a unit_interval -- PP governance group
203+
, a unit_interval -- treasury withdrawal
204+
]

scls-cddl/cddl-src/Cardano/SCLS/Namespace/GovProposals.hs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,31 @@ import Text.Heredoc (str)
2121
record_entry :: Rule
2222
record_entry =
2323
comment
24-
[str| The key for the entry is a gov_action_id (34 bytes: 32 bytes for transaction_id + 2 bytes for gov_action_index) |]
24+
[str| Size of the key
25+
|
26+
| ```
27+
| meta:
28+
| endian: be
29+
|
30+
| seq:
31+
| - id: key
32+
| type: gov_proposals
33+
|
34+
| gov_proposals:
35+
| seq:
36+
| - id: tx_addr
37+
| doc: transaction
38+
| type: bytes
39+
| size: 28
40+
| - id: tx_idx
41+
| doc: index inside transaction
42+
| type: u4
43+
| - id: gov_action_idx
44+
| doc: governance action index
45+
| type: u2
46+
| ```
47+
|
48+
|]
2549
$ "record_entry" =:= proposal
2650

2751
committee_cold_credential :: Rule

scls-cddl/cddl-src/Cardano/SCLS/Namespace/PoolStake.hs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,24 @@ record_entry :: Rule
1818
record_entry =
1919
comment
2020
[str| The key for the entry is one of the following:
21-
| (keyhash28)
22-
|]
21+
|
22+
| ```
23+
| meta:
24+
| endian: be
25+
|
26+
| seq:
27+
| - id: key
28+
| type: pool_stake
29+
|
30+
| types:
31+
| pool_stake:
32+
| seq:
33+
| - id: keyhash
34+
| doc: stake pool keyhash
35+
| size: 28
36+
| ```
37+
|
38+
|]
2339
$ "record_entry" =:= individual_pool_stake
2440

2541
individual_pool_stake :: Rule

scls-cddl/cddl-src/Cardano/SCLS/Namespace/Pots.hs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,28 @@ import Text.Heredoc (str)
1717

1818
-- | Top-level entry for pots namespace
1919
record_entry :: Rule
20-
record_entry = "record_entry" =:= pots_table
20+
record_entry =
21+
comment
22+
[str| The key for the entry is one of the following:
23+
|
24+
| ```
25+
| meta:
26+
| endian: be
27+
|
28+
| seq:
29+
| - id: key
30+
| type: pots
31+
|
32+
| types:
33+
| pots:
34+
| seq:
35+
| - id: epoch
36+
| doc: current epoch
37+
| size: 8
38+
| ```
39+
|
40+
|]
41+
$ "record_entry" =:= pots_table
2142

2243
-- | Table mapping pot names to coin values
2344
pots_table :: Rule

0 commit comments

Comments
 (0)