Skip to content

Commit badd547

Browse files
committed
CDDL: Replace huddle-cddl with generate-cddl
1 parent ea7ed2c commit badd547

File tree

8 files changed

+202
-284
lines changed

8 files changed

+202
-284
lines changed

eras/allegra/impl/cddl-files/allegra.cddl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ pool_keyhash = hash28
166166

167167
pool_registration_cert = (3, pool_params)
168168

169+
; Pool parameters for stake pool registration
169170
pool_params =
170171
( operator : pool_keyhash
171172
, vrf_keyhash : vrf_keyhash
@@ -292,8 +293,6 @@ transaction_witness_set =
292293
vkeywitness = [vkey, signature]
293294

294295
; Allegra introduces timelock support for native scripts.
295-
; This is the 6-variant native script format used by
296-
; Allegra, Mary, Alonzo, Babbage, and Conway.
297296
;
298297
; Timelock validity intervals are half-open intervals [a, b).
299298
; script_invalid_before: specifies the left (included) endpoint a.

eras/alonzo/impl/cddl-files/alonzo.cddl

Lines changed: 39 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,17 @@
55
; the same
66
; 2) every transaction_index must be strictly smaller than the length of
77
; transaction_bodies
8-
; NEW:
9-
; invalid_transactions
108
block =
119
[ header
1210
, transaction_bodies : [* transaction_body]
1311
, transaction_witness_sets : [* transaction_witness_set]
1412
, auxiliary_data_set : {* transaction_index => auxiliary_data}
15-
, invalid_transactions : [* transaction_index]
13+
, invalid_transactions : [* transaction_index] ; new
1614
]
1715

1816

1917
header = [header_body, body_signature : kes_signature]
2018

21-
; block_body_size: merkle triple root
2219
header_body =
2320
[ block_number : block_number
2421
, slot : slot
@@ -28,7 +25,7 @@ header_body =
2825
, nonce_vrf : vrf_cert
2926
, leader_vrf : vrf_cert
3027
, block_body_size : uint
31-
, block_body_hash : hash32
28+
, block_body_hash : hash32 ; merkle triple root
3229
, operational_cert
3330
, protocol_version
3431
]
@@ -67,30 +64,21 @@ major_protocol_version = 0 .. 7
6764

6865
kes_signature = bytes .size 448
6966

70-
; 2: fee
71-
; 3: time to live
72-
; 8: validity interval start
73-
; 13: collateral
74-
; NEW:
75-
; 11: script_data_hash
76-
; 13: set transaction_input
77-
; 14: required_signers
78-
; 15: network_id
7967
transaction_body =
8068
{ 0 : set<transaction_input>
8169
, 1 : [* transaction_output]
82-
, 2 : coin
83-
, ? 3 : slot
70+
, 2 : coin ; fee
71+
, ? 3 : slot ; time to live
8472
, ? 4 : [* certificate]
8573
, ? 5 : withdrawals
8674
, ? 6 : update
8775
, ? 7 : auxiliary_data_hash
88-
, ? 8 : slot
76+
, ? 8 : slot ; validity interval start
8977
, ? 9 : mint
90-
, ? 11 : script_data_hash
91-
, ? 13 : set<transaction_input>
92-
, ? 14 : required_signers
93-
, ? 15 : network_id
78+
, ? 11 : script_data_hash ; new
79+
, ? 13 : set<transaction_input> ; collateral
80+
, ? 14 : required_signers ; new
81+
, ? 15 : network_id ; new
9482
}
9583

9684

@@ -100,8 +88,6 @@ transaction_input = [id : transaction_id, index : uint .size 2]
10088

10189
transaction_id = hash32
10290

103-
; NEW:
104-
; datum_hash: $hash32
10591
transaction_output = [address, amount : value, ? datum_hash : hash32]
10692

10793
; address = bytes
@@ -198,6 +184,7 @@ pool_keyhash = hash28
198184

199185
pool_registration_cert = (3, pool_params)
200186

187+
; Pool parameters for stake pool registration
201188
pool_params =
202189
( operator : pool_keyhash
203190
, vrf_keyhash : vrf_keyhash
@@ -285,55 +272,31 @@ update = [proposed_protocol_parameter_updates, epoch]
285272

286273
proposed_protocol_parameter_updates = {* genesis_hash => protocol_param_update}
287274

288-
; 0: minfee A
289-
; 1: minfee B
290-
; 2: max block body size
291-
; 3: max transaction size
292-
; 4: max block header size
293-
; 5: key deposit
294-
; 6: pool deposit
295-
; 7: maximum epoch
296-
; 8: n_opt: desired number of stake pools
297-
; 9: pool pledge influence
298-
; 10: expansion rate
299-
; 11: treasury growth rate
300-
; 12: d. decentralization constant
301-
; 13: extra entropy
302-
; 14: protocol version
303-
; 16: min pool cost ; NEW
304-
; 17: ada per utxo byte ; NEW
305-
; 18: cost models for script languages ; NEW
306-
; 19: execution costs ; NEW
307-
; 20: max tx ex units ; NEW
308-
; 21: max block ex units ; NEW
309-
; 22: max value size ; NEW
310-
; 23: collateral percentage ; NEW
311-
; 24: max collateral inputs ; NEW
312275
protocol_param_update =
313-
{ ? 0 : uint
314-
, ? 1 : uint
315-
, ? 2 : uint .size 4
316-
, ? 3 : uint .size 4
317-
, ? 4 : uint .size 2
318-
, ? 5 : coin
319-
, ? 6 : coin
320-
, ? 7 : epoch_interval
321-
, ? 8 : uint .size 2
322-
, ? 9 : nonnegative_interval
323-
, ? 10 : unit_interval
324-
, ? 11 : unit_interval
325-
, ? 12 : unit_interval
326-
, ? 13 : nonce
327-
, ? 14 : [protocol_version]
328-
, ? 16 : coin
329-
, ? 17 : coin
330-
, ? 18 : cost_models
331-
, ? 19 : ex_unit_prices
332-
, ? 20 : ex_units
333-
, ? 21 : ex_units
334-
, ? 22 : uint
335-
, ? 23 : uint
336-
, ? 24 : uint
276+
{ ? 0 : uint ; minfee A
277+
, ? 1 : uint ; minfee B
278+
, ? 2 : uint .size 4 ; max block body size
279+
, ? 3 : uint .size 4 ; max transaction size
280+
, ? 4 : uint .size 2 ; max block header size
281+
, ? 5 : coin ; key deposit
282+
, ? 6 : coin ; pool deposit
283+
, ? 7 : epoch_interval ; maximum epoch
284+
, ? 8 : uint .size 2 ; n_opt: desired number of stake pools
285+
, ? 9 : nonnegative_interval ; pool pledge influence
286+
, ? 10 : unit_interval ; expansion rate
287+
, ? 11 : unit_interval ; treasury growth rate
288+
, ? 12 : unit_interval ; decentralization constant
289+
, ? 13 : nonce ; extra entropy
290+
, ? 14 : [protocol_version] ; protocol version
291+
, ? 16 : coin ; min pool cost
292+
, ? 17 : coin ; ada per utxo byte
293+
, ? 18 : cost_models ; cost models for script languages
294+
, ? 19 : ex_unit_prices ; execution costs
295+
, ? 20 : ex_units ; max tx ex units
296+
, ? 21 : ex_units ; max block ex units
297+
, ? 22 : uint ; max value size
298+
, ? 23 : uint ; collateral percentage
299+
, ? 24 : uint ; max collateral inputs
337300
}
338301

339302

@@ -429,36 +392,26 @@ mint = multiasset<int64>
429392
; [ 80 | datums | A0 ]
430393
;
431394
; corresponding to a CBOR empty list and an empty map (our
432-
; apologies).,
433-
;
434-
; NEW:
435-
; script_data_hash
395+
; apologies).
436396
script_data_hash = hash32
437397

438398
required_signers = set<addr_keyhash>
439399

440400
network_id = 0/ 1
441401

442-
;
443-
; NEW:
444-
; 3: [* plutus_v1_script ]
445-
; 4: [* plutus_data ]
446-
; 5: redeemers
447402
transaction_witness_set =
448403
{ ? 0 : [* vkeywitness]
449404
, ? 1 : [* native_script]
450405
, ? 2 : [* bootstrap_witness]
451-
, ? 3 : [* plutus_v1_script]
452-
, ? 4 : [* plutus_data]
453-
, ? 5 : redeemers
406+
, ? 3 : [* plutus_v1_script] ; new
407+
, ? 4 : [* plutus_data] ; new
408+
, ? 5 : redeemers ; new
454409
}
455410

456411

457412
vkeywitness = [vkey, signature]
458413

459414
; Allegra introduces timelock support for native scripts.
460-
; This is the 6-variant native script format used by
461-
; Allegra, Mary, Alonzo, Babbage, and Conway.
462415
;
463416
; Timelock validity intervals are half-open intervals [a, b).
464417
; script_invalid_before: specifies the left (included) endpoint a.
@@ -513,7 +466,6 @@ distinct_bytes =
513466
/ bytes .size 30
514467
/ bytes .size 32
515468

516-
; NEW
517469
plutus_data =
518470
constr<plutus_data
519471
>
@@ -553,15 +505,14 @@ big_nint = #6.3(bounded_bytes)
553505

554506
redeemers = [* redeemer]
555507

556-
; NEW
557508
redeemer =
558509
[tag : redeemer_tag, index : uint, data : plutus_data, ex_units : ex_units]
559510

560511
; 0: spend
561512
; 1: mint
562513
; 2: cert
563514
; 3: reward
564-
redeemer_tag = 0/ 1/ 2/ 3
515+
redeemer_tag = 0 .. 3
565516

566517
transaction_index = uint .size 2
567518

0 commit comments

Comments
 (0)