Skip to content

Commit ecb9fc8

Browse files
authored
Merge pull request #5073 from IntersectMBO/js/cddl-fixes
CDDL fixes
2 parents f975500 + 0220798 commit ecb9fc8

File tree

11 files changed

+49
-33
lines changed

11 files changed

+49
-33
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ transaction_body =
5555
{ 0 : set<transaction_input>
5656
, 1 : [* transaction_output]
5757
, 2 : coin
58-
, 3 : uint
58+
, ? 3 : uint
5959
, ? 4 : [* certificate]
6060
, ? 5 : withdrawals
6161
, ? 6 : update
@@ -66,7 +66,9 @@ transaction_body =
6666

6767
set<a0> = [* a0]
6868

69-
transaction_input = [transaction_id : hash32, index : uint .size 2]
69+
transaction_input = [id : transaction_id, index : uint .size 2]
70+
71+
transaction_id = hash32
7072

7173
transaction_output = [address, amount : coin]
7274

@@ -208,12 +210,10 @@ dns_name = text .size (0 .. 64)
208210
; dns_name: An SRV DNS record
209211
multi_host_name = (2, dns_name)
210212

211-
pool_metadata = [url, metadata_hash]
213+
pool_metadata = [url, bytes]
212214

213215
url = text .size (0 .. 64)
214216

215-
metadata_hash = hash32
216-
217217
pool_retirement = (4, pool_keyhash, epoch)
218218

219219
epoch = uint
@@ -272,6 +272,8 @@ maxWord64 = 18446744073709551615
272272

273273
nonce = [0// 1, bytes .size 32]
274274

275+
metadata_hash = hash32
276+
275277
transaction_witness_set =
276278
{? 0 : [* vkeywitness], ? 1 : [* native_script], ? 2 : [* bootstrap_witness]}
277279

eras/allegra/impl/testlib/Test/Cardano/Ledger/Allegra/CDDL.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ transaction_body =
8787
[ idx 0 ==> set transaction_input
8888
, idx 1 ==> arr [0 <+ a transaction_output]
8989
, idx 2 ==> coin
90-
, idx 3 ==> VUInt
90+
, opt (idx 3 ==> VUInt)
9191
, opt (idx 4 ==> arr [0 <+ a certificate])
9292
, opt (idx 5 ==> withdrawals)
9393
, opt (idx 6 ==> update)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ transaction_body =
8888

8989
set<a0> = [* a0]
9090

91-
transaction_input = [transaction_id : hash32, index : uint .size 2]
91+
transaction_input = [id : transaction_id, index : uint .size 2]
92+
93+
transaction_id = hash32
9294

9395
; NEW:
9496
; datum_hash: $hash32
@@ -240,12 +242,10 @@ dns_name = text .size (0 .. 64)
240242
; dns_name: An SRV DNS record
241243
multi_host_name = (2, dns_name)
242244

243-
pool_metadata = [url, metadata_hash]
245+
pool_metadata = [url, bytes]
244246

245247
url = text .size (0 .. 64)
246248

247-
metadata_hash = hash32
248-
249249
pool_retirement = (4, pool_keyhash, epoch)
250250

251251
epoch = uint

eras/babbage/impl/cddl-files/babbage.cddl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ transaction_body =
8989

9090
set<a0> = [* a0]
9191

92-
transaction_input = [transaction_id : hash32, index : uint .size 2]
92+
transaction_input = [id : transaction_id, index : uint .size 2]
93+
94+
transaction_id = hash32
9395

9496
; Both of the Alonzo and Babbage style TxOut formats are equally valid
9597
; and can be used interchangeably.
@@ -329,12 +331,10 @@ dns_name = text .size (0 .. 64)
329331
; dns_name: An SRV DNS record
330332
multi_host_name = (2, dns_name)
331333

332-
pool_metadata = [url, metadata_hash]
334+
pool_metadata = [url, bytes]
333335

334336
url = text .size (0 .. 64)
335337

336-
metadata_hash = hash32
337-
338338
pool_retirement = (4, pool_keyhash, epoch)
339339

340340
epoch = uint

eras/byron/ledger/impl/cddl-spec/byron.cddl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ blake2b-256 = bytes .size 32
2525
txid = blake2b-256
2626
blockid = blake2b-256
2727
updid = blake2b-256
28+
certificateid = blake2b-256
29+
voteid = blake2b-256
2830
hash = blake2b-256
2931

3032
blake2b-224 = bytes .size 28
@@ -48,8 +50,9 @@ attributes = {* any => any}
4850
addrdistr = [1] / [0, stakeholderid]
4951

5052
addrtype = &("PubKey" : 0, "Script" : 1, "Redeem" : 2) / (u64 .gt 2)
51-
addrattr = { ? 0 : addrdistr
52-
, ? 1 : bytes}
53+
addrattr = { ? 1 : bytes
54+
, ? 2 : bytes
55+
}
5356
address = [ #6.24(bytes .cbor ([addressid, addrattr, addrtype])), u64 ]
5457

5558
; Transactions
@@ -146,7 +149,7 @@ updata = [ hash, hash, hash, hash ]
146149
upprop = [ "blockVersion" : bver
147150
, "blockVersionMod" : bvermod
148151
, "softwareVersion" : [ text, u32 ]
149-
, "data" : #6.258([text, updata])
152+
, "data" : { * text => updata }
150153
, "attributes" : attributes
151154
, "from" : pubkey
152155
, "signature" : signature

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ transaction_body =
153153

154154
set<a0> = #6.258([* a0])/ [* a0]
155155

156-
transaction_input = [transaction_id : hash32, index : uint .size 2]
156+
transaction_input = [transaction_id : transaction_id, index : uint .size 2]
157+
158+
transaction_id = hash32
157159

158160
; Both of the Alonzo and Babbage style TxOut formats are equally valid
159161
; and can be used interchangeably
@@ -518,7 +520,8 @@ voter =
518520
]
519521

520522

521-
gov_action_id = [transaction_id : hash32, gov_action_index : uint .size 2]
523+
gov_action_id =
524+
[transaction_id : transaction_id, gov_action_index : uint .size 2]
522525

523526
voting_procedure = [vote, anchor/ nil]
524527

eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/CDDL.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ gov_action_id :: Rule
308308
gov_action_id =
309309
"gov_action_id"
310310
=:= arr
311-
[ "transaction_id" ==> hash32
311+
[ "transaction_id" ==> transaction_id
312312
, "gov_action_index" ==> (VUInt `sized` (2 :: Word64))
313313
]
314314

@@ -319,7 +319,7 @@ transaction_input :: Rule
319319
transaction_input =
320320
"transaction_input"
321321
=:= arr
322-
[ "transaction_id" ==> hash32
322+
[ "transaction_id" ==> transaction_id
323323
, "index" ==> (VUInt `sized` (2 :: Word64))
324324
]
325325

eras/mary/impl/cddl-files/mary.cddl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ transaction_body =
5454
{ 0 : set<transaction_input>
5555
, 1 : [* transaction_output]
5656
, 2 : coin
57-
, 3 : uint
57+
, ? 3 : uint
5858
, ? 4 : [* certificate]
5959
, ? 5 : withdrawals
6060
, ? 6 : update
@@ -66,7 +66,9 @@ transaction_body =
6666

6767
set<a0> = [* a0]
6868

69-
transaction_input = [transaction_id : hash32, index : uint .size 2]
69+
transaction_input = [id : transaction_id, index : uint .size 2]
70+
71+
transaction_id = hash32
7072

7173
transaction_output = [address, amount : value]
7274

@@ -216,12 +218,10 @@ dns_name = text .size (0 .. 64)
216218
; dns_name: An SRV DNS record
217219
multi_host_name = (2, dns_name)
218220

219-
pool_metadata = [url, metadata_hash]
221+
pool_metadata = [url, bytes]
220222

221223
url = text .size (0 .. 64)
222224

223-
metadata_hash = hash32
224-
225225
pool_retirement = (4, pool_keyhash, epoch)
226226

227227
epoch = uint
@@ -280,6 +280,8 @@ maxWord64 = 18446744073709551615
280280

281281
nonce = [0// 1, bytes .size 32]
282282

283+
metadata_hash = hash32
284+
283285
mint = multiasset<int64>
284286

285287
int64 = -9223372036854775808 .. 9223372036854775807

eras/mary/impl/testlib/Test/Cardano/Ledger/Mary/CDDL.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ transaction_body =
4949
[ idx 0 ==> set transaction_input
5050
, idx 1 ==> arr [0 <+ a transaction_output]
5151
, idx 2 ==> coin
52-
, idx 3 ==> VUInt
52+
, opt (idx 3 ==> VUInt)
5353
, opt (idx 4 ==> arr [0 <+ a certificate])
5454
, opt (idx 5 ==> withdrawals)
5555
, opt (idx 6 ==> update)

eras/shelley/impl/cddl-files/shelley.cddl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ transaction_body =
6464

6565
set<a0> = [* a0]
6666

67-
transaction_input = [transaction_id : hash32, index : uint .size 2]
67+
transaction_input = [id : transaction_id, index : uint .size 2]
68+
69+
transaction_id = hash32
6870

6971
transaction_output = [address, amount : coin]
7072

@@ -206,12 +208,10 @@ dns_name = text .size (0 .. 64)
206208
; dns_name: An SRV DNS record
207209
multi_host_name = (2, dns_name)
208210

209-
pool_metadata = [url, metadata_hash]
211+
pool_metadata = [url, bytes]
210212

211213
url = text .size (0 .. 64)
212214

213-
metadata_hash = hash32
214-
215215
pool_retirement = (4, pool_keyhash, epoch)
216216

217217
epoch = uint
@@ -270,6 +270,8 @@ maxWord64 = 18446744073709551615
270270

271271
nonce = [0// 1, bytes .size 32]
272272

273+
metadata_hash = hash32
274+
273275
transaction_witness_set =
274276
{ ? 0 : [* vkeywitness]
275277
, ? 1 : [* multisig_script]

0 commit comments

Comments
 (0)