File tree Expand file tree Collapse file tree 6 files changed +55
-17
lines changed Expand file tree Collapse file tree 6 files changed +55
-17
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ module Cardano.SCLS.CDDL (
66) where
77
88import Cardano.SCLS.Namespace.Blocks qualified as Blocks
9+ import Cardano.SCLS.Namespace.GovCommittee qualified as GovCommittee
910import Cardano.SCLS.Namespace.GovConstitution qualified as GovConstitution
1011import Cardano.SCLS.Namespace.GovPParams qualified as GovPParams
1112import Cardano.SCLS.Namespace.PoolStake qualified as PoolStake
@@ -34,6 +35,7 @@ namespaces =
3435 , (" pots/v0" , NamespaceInfo (collectFromInit [HIRule Pots. record_entry]) 8 ) -- Key is epoch number
3536 , (" pool_stake/v0" , NamespaceInfo (collectFromInit [HIRule PoolStake. record_entry]) 28 ) -- 28 bytes for key
3637 , (" snapshots/v0" , NamespaceInfo (collectFromInit [HIRule Snapshots. record_entry]) 30 )
38+ , (" gov/committee/v0" , NamespaceInfo (collectFromInit [HIRule GovCommittee. record_entry]) 8 )
3739 , (" gov/constitution/v0" , NamespaceInfo (collectFromInit [HIRule GovConstitution. record_entry]) 8 )
3840 , (" gov/pparams/v0" , NamespaceInfo (collectFromInit [HIRule GovPParams. record_entry]) 4 )
3941 ]
Original file line number Diff line number Diff line change @@ -188,6 +188,15 @@ positive_int = "positive_int" =:= (1 :: Integer) ... maxWord64
188188maxWord64 :: Integer
189189maxWord64 = 18446744073709551615
190190
191+ credential :: Rule
192+ credential =
193+ " credential"
194+ =:= arr [0 , a addr_keyhash]
195+ / arr [1 , a script_hash]
196+
197+ addr_keyhash :: Rule
198+ addr_keyhash = " addr_keyhash" =:= hash28
199+
191200script_hash :: Rule
192201script_hash =
193202 comment
@@ -201,3 +210,14 @@ script_hash =
201210 | - "\x03" for Plutus V3 scripts
202211 |]
203212 $ " script_hash" =:= hash28
213+
214+ anchor :: Rule
215+ anchor =
216+ " anchor"
217+ =:= arr
218+ [ " anchor_url" ==> url
219+ , " anchor_data_hash" ==> hash32
220+ ]
221+
222+ epoch_no :: Rule
223+ epoch_no = " epoch_no" =:= VUInt `sized` (8 :: Word64 )
Original file line number Diff line number Diff line change 1+ {-# LANGUAGE ImportQualifiedPost #-}
2+ {-# LANGUAGE OverloadedLists #-}
3+ {-# LANGUAGE OverloadedStrings #-}
4+ {-# LANGUAGE QuasiQuotes #-}
5+ {-# LANGUAGE TypeApplications #-}
6+ {-# LANGUAGE NoImplicitPrelude #-}
7+ {-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
8+
9+ {-# HLINT ignore "Use camelCase" #-}
10+ module Cardano.SCLS.Namespace.GovCommittee where
11+
12+ import Cardano.SCLS.Common
13+ import Codec.CBOR.Cuddle.Huddle
14+ import Data.Function (($) )
15+ import Text.Heredoc (str )
16+
17+ record_entry :: Rule
18+ record_entry =
19+ comment
20+ [str | The key for the entry is epoch number (8 bytes) |]
21+ $ " record_entry" =:= committee
22+
23+ committee :: Rule
24+ committee =
25+ " committee"
26+ =:= (mp [0 <+ asKey credential ==> committee_authorization])
27+
28+ committee_authorization :: Rule
29+ committee_authorization =
30+ " committee_authorization"
31+ =:= arr [0 , a credential]
32+ / arr [1 , a (anchor / VNil )]
Original file line number Diff line number Diff line change @@ -21,14 +21,6 @@ record_entry =
2121 |]
2222 $ " record_entry" =:= constitution
2323
24- anchor :: Rule
25- anchor =
26- " anchor"
27- =:= arr
28- [ " anchor_url" ==> url
29- , " anchor_data_hash" ==> hash32
30- ]
31-
3224constitution :: Rule
3325constitution =
3426 " constitution"
Original file line number Diff line number Diff line change @@ -38,15 +38,6 @@ record_key =
3838pool_keyhash :: Rule
3939pool_keyhash = " pool_keyhash" =:= hash28
4040
41- addr_keyhash :: Rule
42- addr_keyhash = " addr_keyhash" =:= hash28
43-
44- credential :: Rule
45- credential =
46- " credential"
47- =:= arr [0 , a addr_keyhash]
48- / arr [1 , a script_hash]
49-
5041snapshot_out :: Rule
5142snapshot_out =
5243 comment
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ library
2929 other-modules :
3030 Cardano.SCLS.Common
3131 Cardano.SCLS.Namespace.Blocks
32+ Cardano.SCLS.Namespace.GovCommittee
3233 Cardano.SCLS.Namespace.GovConstitution
3334 Cardano.SCLS.Namespace.GovPParams
3435 Cardano.SCLS.Namespace.PoolStake
You can’t perform that action at this time.
0 commit comments