1
1
; This file was auto-generated from huddle. Please do not modify it directly!
2
- ;Pseudo-rule introduced by Cuddle to collect root elements
3
- huddle_root_defs = [block, transaction]
4
2
5
3
block =
6
4
[ header
@@ -10,5 +8,332 @@ block =
10
8
]
11
9
12
10
11
+ header = [header_body, body_signature: kes_signature]
12
+
13
+ header_body =
14
+ [ block_number: uint
15
+ , slot : uint
16
+ , prev_hash : hash32/ nil
17
+ , issuer_vkey : vkey
18
+ , vrf_vkey : vrf_vkey
19
+ , nonce_vrf : vrf_cert
20
+ , leader_vrf : vrf_cert
21
+ , block_body_size: uint .size 4
22
+ , block_body_hash: hash32
23
+ , operational_cert
24
+ , protocol_version
25
+ ]
26
+
27
+
28
+ hash32 = bytes .size 32
29
+
30
+ vkey = bytes .size 32
31
+
32
+ vrf_vkey = bytes .size 32
33
+
34
+ vrf_cert = [bytes, bytes .size 80]
35
+
36
+ operational_cert =
37
+ ( hot_vkey: kes_vkey
38
+ , sequence_number: uint
39
+ , kes_period : uint
40
+ , sigma : signature
41
+ )
42
+
43
+ kes_vkey = bytes .size 32
44
+
45
+ signature = bytes .size 64
46
+
47
+ protocol_version = (major_protocol_version, uint)
48
+
49
+ major_protocol_version = 1 .. 3
50
+
51
+ kes_signature = bytes .size 448
52
+
53
+ ;Allegra transaction body adds the validity interval start at index 8
54
+ transaction_body =
55
+ { 0: set<transaction_input>
56
+ , 1: [*transaction_output]
57
+ , 2: coin
58
+ , 3: uint
59
+ , ?4: [*certificate]
60
+ , ?5: withdrawals
61
+ , ?6: update
62
+ , ?7: metadata_hash
63
+ , ?8: uint
64
+ }
65
+
66
+
67
+ set<a0> = [*a0]
68
+
69
+ transaction_input = [transaction_id: hash32, index: uint .size 2]
70
+
71
+ transaction_output = [address, amount: coin]
72
+
73
+ ;address = bytes
74
+ ;
75
+ ;address format:
76
+ ; [ 8 bit header | payload ];
77
+ ;
78
+ ;shelley payment addresses:
79
+ ; bit 7: 0
80
+ ; bit 6: base/other
81
+ ; bit 5: pointer/enterprise [for base: stake cred is keyhash/scripthash]
82
+ ; bit 4: payment cred is keyhash/scripthash
83
+ ; bits 3-0: network id
84
+ ;
85
+ ;reward addresses:
86
+ ; bits 7-5: 111
87
+ ; bit 4: credential is keyhash/scripthash
88
+ ; bits 3-0: network id
89
+ ;
90
+ ;byron addresses:
91
+ ; bits 7-4: 1000
92
+ ;
93
+ ; 0000: base address: keyhash28,keyhash28
94
+ ; 0001: base address: scripthash28,keyhash28
95
+ ; 0010: base address: keyhash28,scripthash28
96
+ ; 0011: base address: scripthash28,scripthash28
97
+ ; 0100: pointer address: keyhash28, 3 variable length uint
98
+ ; 0101: pointer address: scripthash28, 3 variable length uint
99
+ ; 0110: enterprise address: keyhash28
100
+ ; 0111: enterprise address: scripthash28
101
+ ; 1000: byron address
102
+ ; 1110: reward account: keyhash28
103
+ ; 1111: reward account: scripthash28
104
+ ;1001-1101: future formats
105
+ address =
106
+ h'001000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000'
107
+ / h'102000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000'
108
+ / h'203000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000'
109
+ / h'304000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000'
110
+ / h'405000000000000000000000000000000000000000000000000000000087680203'
111
+ / h'506000000000000000000000000000000000000000000000000000000087680203'
112
+ / h'6070000000000000000000000000000000000000000000000000000000'
113
+ / h'7080000000000000000000000000000000000000000000000000000000'
114
+
115
+ coin = uint
116
+
117
+ certificate =
118
+ [ stake_registration
119
+ // stake_deregistration
120
+ // stake_delegation
121
+ // pool_registration
122
+ // pool_retirement
123
+ // genesis_key_delegation
124
+ // move_instantaneous_rewards_cert
125
+ ]
126
+
127
+
128
+ ;This will be deprecated in a future era
129
+ stake_registration = (0, stake_credential)
130
+
131
+ stake_credential = credential
132
+
133
+ credential = [0, addr_keyhash// 1, script_hash]
134
+
135
+ addr_keyhash = hash28
136
+
137
+ hash28 = bytes .size 28
138
+
139
+ ;To compute a script hash, note that you must prepend
140
+ ;a tag to the bytes of the script before hashing.
141
+ ;The tag is determined by the language.
142
+ ;The tags in the Conway era are:
143
+ ; "\x00" for multisig scripts
144
+ ; "\x01" for Plutus V1 scripts
145
+ ; "\x02" for Plutus V2 scripts
146
+ ; "\x03" for Plutus V3 scripts
147
+ script_hash = hash28
148
+
149
+ ;This will be deprecated in a future era
150
+ stake_deregistration = (1, stake_credential)
151
+
152
+ stake_delegation = (2, stake_credential, pool_keyhash)
153
+
154
+ pool_keyhash = hash28
155
+
156
+ pool_registration = (3, pool_params)
157
+
158
+ pool_params =
159
+ ( operator: pool_keyhash
160
+ , vrf_keyhash : vrf_keyhash
161
+ , pledge : coin
162
+ , cost : coin
163
+ , margin : unit_interval
164
+ , reward_account: reward_account
165
+ , pool_owners : set<addr_keyhash>
166
+ , relays : [*relay]
167
+ , pool_metadata : pool_metadata/ nil
168
+ )
169
+
170
+ vrf_keyhash = hash32
171
+
172
+ ;The real unit_interval is: #6.30([uint, uint])
173
+ ;
174
+ ;A unit interval is a number in the range between 0 and 1, which
175
+ ;means there are two extra constraints:
176
+ ; 1. numerator <= denominator
177
+ ; 2. denominator > 0
178
+ ;
179
+ ;The relation between numerator and denominator can be
180
+ ;expressed in CDDL, but we have a limitation currently
181
+ ;(see: https://github.com/input-output-hk/cuddle/issues/30)
182
+ ;which poses a problem for testing. We need to be able to
183
+ ;generate random valid data for testing implementation of
184
+ ;our encoders/decoders. Which means we cannot use the actual
185
+ ;definition here and we hard code the value to 1/2
186
+ unit_interval = #6.30([1, 2])
187
+
188
+ ;reward_account = bytes
189
+ reward_account =
190
+ h'E090000000000000000000000000000000000000000000000000000000'
191
+ / h'F0A0000000000000000000000000000000000000000000000000000000'
192
+
193
+ relay = [single_host_addr// single_host_name// multi_host_name]
194
+
195
+ single_host_addr = (0, port/ nil, ipv4/ nil, ipv6/ nil)
196
+
197
+ port = uint .le 65535
198
+
199
+ ipv4 = bytes .size 4
200
+
201
+ ipv6 = bytes .size 16
202
+
203
+ ;dns_name: An A or AAAA DNS record
204
+ single_host_name = (1, port/ nil, dns_name)
205
+
206
+ dns_name = text .size (0 .. 64)
207
+
208
+ ;dns_name: An SRV DNS record
209
+ multi_host_name = (2, dns_name)
210
+
211
+ pool_metadata = [url, metadata_hash]
212
+
213
+ url = text .size (0 .. 64)
214
+
215
+ metadata_hash = hash32
216
+
217
+ pool_retirement = (4, pool_keyhash, epoch)
218
+
219
+ epoch = uint
220
+
221
+ genesis_key_delegation = (5, genesis_hash, genesis_delegate_hash, vrf_keyhash)
222
+
223
+ genesis_hash = hash28
224
+
225
+ genesis_delegate_hash = hash28
226
+
227
+ move_instantaneous_rewards_cert = (6, move_instantaneous_reward)
228
+
229
+ ;The first field determines where the funds are drawn from.
230
+ ; 0 denotes the reserves,
231
+ ; 1 denotes the treasury.
232
+ ;If the second field is a map, funds are moved to stake credentials.
233
+ ;Otherwise, the funds are given to the other accounting pot.
234
+ ;NOTE:
235
+ ; This has been safely backported to Shelley from Alonzo.
236
+ move_instantaneous_reward = [0/ 1, {*stake_credential: delta_coin}/ coin]
237
+
238
+ ;This too has been introduced in Shelley as a backport from Alonzo.
239
+ delta_coin = int
240
+
241
+ withdrawals = {*reward_account: coin}
242
+
243
+ update = [proposed_protocol_parameter_updates, epoch]
244
+
245
+ proposed_protocol_parameter_updates = {*genesis_hash: protocol_param_update}
246
+
247
+ protocol_param_update =
248
+ { ?0: uint ;minfee A
249
+ , ?1 : uint ;minfee B
250
+ , ?2 : uint ;max block body size
251
+ , ?3 : uint ;max transaction size
252
+ , ?4 : uint .size 2 ;max block header size
253
+ , ?5 : coin ;key deposit
254
+ , ?6 : coin ;pool deposit
255
+ , ?7 : epoch ;maximum epoch
256
+ , ?8 : uint .size 2 ;n_opt: desired number of stake pools
257
+ , ?9 : nonnegative_interval ;pool pledge influence
258
+ , ?10: unit_interval ;expansion rate
259
+ , ?11: unit_interval ;treasury growth rate
260
+ , ?12: unit_interval ;decentralization constant
261
+ , ?13: nonce ;extra entropy
262
+ , ?14: [protocol_version] ;protocol version
263
+ , ?15: coin ;min utxo value
264
+ }
265
+
266
+
267
+ nonnegative_interval = #6.30([uint, positive_int])
268
+
269
+ positive_int = 1 .. maxWord64
270
+
271
+ maxWord64 = 18446744073709551615
272
+
273
+ nonce = [0// 1, bytes .size 32]
274
+
275
+ transaction_witness_set =
276
+ {?0: [*vkeywitness], ?1: [*native_script], ?2: [*bootstrap_witness]}
277
+
278
+ vkeywitness = [vkey, signature]
279
+
280
+ ;Timelock validity intervals are half-open intervals [a, b).
281
+ ;
282
+ ; invalid_before:
283
+ ; specifies the left (included) endpoint a.
284
+ ;
285
+ ; invalid_hereafter:
286
+ ; specifies the right (excluded) endpoint b.
287
+ native_script =
288
+ [ script_pubkey
289
+ // script_all
290
+ // script_any
291
+ // script_n_of_k
292
+ // invalid_before
293
+ // invalid_hereafter
294
+ ]
295
+
296
+
297
+ script_pubkey = (0, addr_keyhash)
298
+
299
+ script_all = (1, [*native_script])
300
+
301
+ script_any = (2, [*native_script])
302
+
303
+ script_n_of_k = (3, n: int64, [*native_script])
304
+
305
+ int64 = -9223372036854775808 .. 9223372036854775807
306
+
307
+ invalid_before = (4, uint)
308
+
309
+ invalid_hereafter = (5, uint)
310
+
311
+ bootstrap_witness =
312
+ [ public_key: vkey
313
+ , signature : signature
314
+ , chain_code: bytes .size 32
315
+ , attributes: bytes
316
+ ]
317
+
318
+
319
+ transaction_index = uint .size 2
320
+
321
+ auxiliary_data =
322
+ metadata
323
+ / [transaction_metadata: metadata, auxiliary_scripts: auxiliary_scripts]
324
+
325
+ metadata = {*transaction_metadatum_label: transaction_metadatum}
326
+
327
+ transaction_metadatum_label = uint
328
+
329
+ transaction_metadatum =
330
+ {*transaction_metadatum: transaction_metadatum}
331
+ / [*transaction_metadatum]
332
+ / int
333
+ / bytes .size (0 .. 64)
334
+ / text .size (0 .. 64)
335
+
336
+ auxiliary_scripts = [*native_script]
337
+
13
338
transaction = [transaction_body, transaction_witness_set, auxiliary_data/ nil]
14
339
0 commit comments