Skip to content

Commit 730df0c

Browse files
committed
Update conway.cddl with new comments
1 parent 885a510 commit 730df0c

File tree

1 file changed

+58
-27
lines changed

1 file changed

+58
-27
lines changed

eras/conway/impl/cddl-files/conway.cddl

Lines changed: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,38 @@ $vrf_vkey = bytes .size 32
2626
addr_keyhash = $hash28
2727

2828
; address = bytes
29-
; reward_account = bytes
3029
;
31-
; address format:
32-
; [ 8 bit header | payload ];
30+
; address format:
31+
; [ 8 bit header | payload ];
3332
;
34-
; shelley payment addresses:
35-
; bit 7: 0
36-
; bit 6: base/other
37-
; bit 5: pointer/enterprise [for base: stake cred is keyhash/scripthash]
38-
; bit 4: payment cred is keyhash/scripthash
39-
; bits 3-0: network id
33+
; shelley payment addresses:
34+
; bit 7: 0
35+
; bit 6: base/other
36+
; bit 5: pointer/enterprise [for base: stake cred is keyhash/scripthash]
37+
; bit 4: payment cred is keyhash/scripthash
38+
; bits 3-0: network id
4039
;
41-
; reward addresses:
42-
; bits 7-5: 111
43-
; bit 4: credential is keyhash/scripthash
44-
; bits 3-0: network id
40+
; reward addresses:
41+
; bits 7-5: 111
42+
; bit 4: credential is keyhash/scripthash
43+
; bits 3-0: network id
4544
;
46-
; byron addresses:
47-
; bits 7-4: 1000
45+
; byron addresses:
46+
; bits 7-4: 1000
47+
;
48+
; 0000: base address: keyhash28,keyhash28
49+
; 0001: base address: scripthash28,keyhash28
50+
; 0010: base address: keyhash28,scripthash28
51+
; 0011: base address: scripthash28,scripthash28
52+
; 0100: pointer address: keyhash28, 3 variable length uint
53+
; 0101: pointer address: scripthash28, 3 variable length uint
54+
; 0110: enterprise address: keyhash28
55+
; 0111: enterprise address: scripthash28
56+
; 1000: byron address
57+
; 1110: reward account: keyhash28
58+
; 1111: reward account: scripthash28
59+
; 1001-1101: future formats
4860
;
49-
; 0000: base address: keyhash28,keyhash28
50-
; 0001: base address: scripthash28,keyhash28
51-
; 0010: base address: keyhash28,scripthash28
52-
; 0011: base address: scripthash28,scripthash28
53-
; 0100: pointer address: keyhash28, 3 variable length uint
54-
; 0101: pointer address: scripthash28, 3 variable length uint
55-
; 0110: enterprise address: keyhash28
56-
; 0111: enterprise address: scripthash28
57-
; 1000: byron address
58-
; 1110: reward account: keyhash28
59-
; 1111: reward account: scripthash28
60-
; 1001 - 1101: future formats
6161
address = h'001000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000'
6262
/ h'102000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000'
6363
/ h'203000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000'
@@ -106,6 +106,17 @@ bootstrap_witness = [public_key : $vkey
106106
, chain_code : bytes .size 32
107107
, attributes : bytes]
108108

109+
; The real bounded_bytes does not have this limit. it instead has
110+
; a different limit which cannot be expressed in CDDL.
111+
;
112+
; The limit is as follows:
113+
; - bytes with a definite-length encoding are limited to size 0..64
114+
; - for bytes with an indefinite-length CBOR encoding, each chunk is
115+
; limited to size 0..64
116+
; ( reminder: in CBOR, the indefinite-length encoding of
117+
; bytestrings consists of a token #2.31 followed by a sequence
118+
; of definite-length encoded bytestrings and a stop code )
119+
;
109120
bounded_bytes = bytes .size (0 .. 64)
110121

111122
certificate = [stake_registration
@@ -151,6 +162,9 @@ datum_hash = $hash32
151162

152163
datum_option = [0, $hash32 // 1, data]
153164

165+
; A type for distinct values.
166+
; The type parameter must support .size, for example: bytes or uint
167+
;
154168
distinct_VBytes = bytes .size 8
155169
/ bytes .size 16
156170
/ bytes .size 20
@@ -348,6 +362,8 @@ relay = [single_host_addr // single_host_name // multi_host_name]
348362

349363
required_signers = nonempty_set<addr_keyhash>
350364

365+
; reward_account = bytes
366+
;
351367
reward_account = h'E090000000000000000000000000000000000000000000000000000000'
352368
/ h'F0A0000000000000000000000000000000000000000000000000000000'
353369

@@ -495,6 +511,21 @@ transaction_witness_set = {? 0 : nonempty_set<vkeywitness>
495511
, ? 6 : nonempty_set<plutus_v2_script>
496512
, ? 7 : nonempty_set<plutus_v3_script>}
497513

514+
; The real unit_interval is: #6.30([uint, uint])
515+
;
516+
; A unit interval is a number in the range between 0 and 1, which
517+
; means there are two extra constraints:
518+
; 1. numerator <= denominator
519+
; 2. denominator > 0
520+
;
521+
; The relation between numerator and denominator can be
522+
; expressed in CDDL, but we have a limitation currently
523+
; (see: https://github.com/input-output-hk/cuddle/issues/30)
524+
; which poses a problem for testing. We need to be able to
525+
; generate random valid data for testing implementation of
526+
; our encoders/decoders. Which means we cannot use the actual
527+
; definition here and we hard code the value to 1/2
528+
;
498529
unit_interval = #6.30([1, 2])
499530

500531
url = text .size (0 .. 128)

0 commit comments

Comments
 (0)