Skip to content

Commit 9ecddb1

Browse files
committed
CDDL: Consolidate slot and block_number fields
1 parent 537ebff commit 9ecddb1

File tree

21 files changed

+115
-77
lines changed

21 files changed

+115
-77
lines changed

eras/allegra/impl/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
### `testlib`
88

9+
* Use named CDDL `slot` rule for timelock validity intervals
910
* Add `impSatisfyMNativeScripts`
1011
* Add `impSatisfySignature`
1112

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ block =
1111
header = [header_body, body_signature : kes_signature]
1212

1313
header_body =
14-
[ block_number : uint
15-
, slot : uint
14+
[ block_number : block_number
15+
, slot : slot
1616
, prev_hash : hash32/ nil
1717
, issuer_vkey : vkey
1818
, vrf_vkey : vrf_vkey
@@ -25,6 +25,10 @@ header_body =
2525
]
2626

2727

28+
block_number = uint
29+
30+
slot = uint
31+
2832
hash32 = bytes .size 32
2933

3034
vkey = bytes .size 32
@@ -55,12 +59,12 @@ transaction_body =
5559
{ 0 : set<transaction_input>
5660
, 1 : [* transaction_output]
5761
, 2 : coin
58-
, ? 3 : uint
62+
, ? 3 : slot
5963
, ? 4 : [* certificate]
6064
, ? 5 : withdrawals
6165
, ? 6 : update
6266
, ? 7 : metadata_hash
63-
, ? 8 : uint
67+
, ? 8 : slot
6468
}
6569

6670

@@ -311,9 +315,9 @@ min_int64 = -9223372036854775808
311315

312316
max_int64 = 9223372036854775807
313317

314-
invalid_before = (4, uint)
318+
invalid_before = (4, slot)
315319

316-
invalid_hereafter = (5, uint)
320+
invalid_hereafter = (5, slot)
317321

318322
bootstrap_witness =
319323
[ public_key : vkey

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ script_n_of_k :: Named Group
7070
script_n_of_k = "script_n_of_k" =:~ grp [3, "n" ==> int64, a (arr [0 <+ a native_script])]
7171

7272
invalid_before :: Named Group
73-
invalid_before = "invalid_before" =:~ grp [4, a VUInt]
73+
invalid_before = "invalid_before" =:~ grp [4, a slot]
7474

7575
invalid_hereafter :: Named Group
76-
invalid_hereafter = "invalid_hereafter" =:~ grp [5, a VUInt]
76+
invalid_hereafter = "invalid_hereafter" =:~ grp [5, a slot]
7777

7878
metadata :: Rule
7979
metadata = "metadata" =:= mp [0 <+ asKey transaction_metadatum_label ==> transaction_metadatum]
@@ -100,12 +100,12 @@ transaction_body =
100100
[ idx 0 ==> untagged_set transaction_input
101101
, idx 1 ==> arr [0 <+ a transaction_output]
102102
, idx 2 ==> coin
103-
, opt (idx 3 ==> VUInt)
103+
, opt (idx 3 ==> slot)
104104
, opt (idx 4 ==> arr [0 <+ a certificate])
105105
, opt (idx 5 ==> withdrawals)
106106
, opt (idx 6 ==> update @era)
107107
, opt (idx 7 ==> metadata_hash)
108-
, opt (idx 8 ==> VUInt)
108+
, opt (idx 8 ==> slot)
109109
]
110110

111111
block :: forall era. Era era => Rule

eras/alonzo/impl/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### `testlib`
1010

11+
* Use named CDDL `slot` and `block_number` rules in header
1112
* Add `NativeScript` parameter to `exampleTx`
1213

1314
## 1.14.0.0

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ header = [header_body, body_signature : kes_signature]
2020

2121
; block_body_size: merkle triple root
2222
header_body =
23-
[ block_number : uint
24-
, slot : uint
23+
[ block_number : block_number
24+
, slot : slot
2525
, prev_hash : hash32/ nil
2626
, issuer_vkey : vkey
2727
, vrf_vkey : vrf_vkey
@@ -34,6 +34,10 @@ header_body =
3434
]
3535

3636

37+
block_number = uint
38+
39+
slot = uint
40+
3741
hash32 = bytes .size 32
3842

3943
vkey = bytes .size 32
@@ -72,12 +76,12 @@ transaction_body =
7276
{ 0 : set<transaction_input>
7377
, 1 : [* transaction_output]
7478
, 2 : coin
75-
, ? 3 : uint
79+
, ? 3 : slot
7680
, ? 4 : [* certificate]
7781
, ? 5 : withdrawals
7882
, ? 6 : update
7983
, ? 7 : auxiliary_data_hash
80-
, ? 8 : uint
84+
, ? 8 : slot
8185
, ? 9 : mint
8286
, ? 11 : script_data_hash
8387
, ? 13 : set<transaction_input>
@@ -470,9 +474,9 @@ script_any = (2, [* native_script])
470474

471475
script_n_of_k = (3, n : uint, [* native_script])
472476

473-
invalid_before = (4, uint)
477+
invalid_before = (4, slot)
474478

475-
invalid_hereafter = (5, uint)
479+
invalid_hereafter = (5, slot)
476480

477481
bootstrap_witness =
478482
[ public_key : vkey

eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/CDDL.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ transaction_body =
9696
[ idx 0 ==> untagged_set transaction_input
9797
, idx 1 ==> arr [0 <+ a transaction_output]
9898
, idx 2 ==> coin
99-
, opt (idx 3 ==> VUInt)
99+
, opt (idx 3 ==> slot)
100100
, opt (idx 4 ==> arr [0 <+ a certificate])
101101
, opt (idx 5 ==> withdrawals)
102102
, opt (idx 6 ==> update)
103103
, opt (idx 7 ==> auxiliary_data_hash)
104-
, opt (idx 8 ==> VUInt)
104+
, opt (idx 8 ==> slot)
105105
, opt (idx 9 ==> mint)
106106
, opt (idx 11 ==> script_data_hash)
107107
, opt (idx 13 ==> untagged_set transaction_input)
@@ -390,8 +390,8 @@ header_body =
390390
|]
391391
$ "header_body"
392392
=:= arr
393-
[ "block_number" ==> VUInt
394-
, "slot" ==> VUInt
393+
[ "block_number" ==> block_number
394+
, "slot" ==> slot
395395
, "prev_hash" ==> (hash32 / VNil)
396396
, "issuer_vkey" ==> vkey
397397
, "vrf_vkey" ==> vrf_vkey

eras/babbage/impl/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
### `testlib`
88

9+
* Use named CDDL `slot` and `block_number` rules in header
910
* Add `BabbageEraImp`
1011
* Removed `babbageEraSpecificSpec`
1112

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ header = [header_body, body_signature : kes_signature]
1919
; block_body_size: merkle triple root
2020
; vrf_result: NEW, replaces nonce_vrf and leader_vrf
2121
header_body =
22-
[ block_number : uint
23-
, slot : uint
22+
[ block_number : block_number
23+
, slot : slot
2424
, prev_hash : hash32/ nil
2525
, issuer_vkey : vkey
2626
, vrf_vkey : vrf_vkey
@@ -32,6 +32,10 @@ header_body =
3232
]
3333

3434

35+
block_number = uint
36+
37+
slot = uint
38+
3539
hash32 = bytes .size 32
3640

3741
vkey = bytes .size 32
@@ -70,12 +74,12 @@ transaction_body =
7074
{ 0 : set<transaction_input>
7175
, 1 : [* transaction_output]
7276
, 2 : coin
73-
, ? 3 : uint
77+
, ? 3 : slot
7478
, ? 4 : [* certificate]
7579
, ? 5 : withdrawals
7680
, ? 6 : update
7781
, ? 7 : auxiliary_data_hash
78-
, ? 8 : uint
82+
, ? 8 : slot
7983
, ? 9 : mint
8084
, ? 11 : script_data_hash
8185
, ? 13 : set<transaction_input>
@@ -243,9 +247,9 @@ script_any = (2, [* native_script])
243247

244248
script_n_of_k = (3, n : uint, [* native_script])
245249

246-
invalid_before = (4, uint)
250+
invalid_before = (4, slot)
247251

248-
invalid_hereafter = (5, uint)
252+
invalid_hereafter = (5, slot)
249253

250254
plutus_v1_script = bytes
251255

eras/babbage/impl/testlib/Test/Cardano/Ledger/Babbage/CDDL.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ header_body =
7474
|]
7575
$ "header_body"
7676
=:= arr
77-
[ "block_number" ==> VUInt
78-
, "slot" ==> VUInt
77+
[ "block_number" ==> block_number
78+
, "slot" ==> slot
7979
, "prev_hash" ==> (hash32 / VNil)
8080
, "issuer_vkey" ==> vkey
8181
, "vrf_vkey" ==> vrf_vkey
@@ -116,12 +116,12 @@ transaction_body =
116116
[ idx 0 ==> untagged_set transaction_input
117117
, idx 1 ==> arr [0 <+ a transaction_output]
118118
, idx 2 ==> coin
119-
, opt (idx 3 ==> VUInt)
119+
, opt (idx 3 ==> slot)
120120
, opt (idx 4 ==> arr [0 <+ a certificate])
121121
, opt (idx 5 ==> withdrawals)
122122
, opt (idx 6 ==> update)
123123
, opt (idx 7 ==> auxiliary_data_hash)
124-
, opt (idx 8 ==> VUInt)
124+
, opt (idx 8 ==> slot)
125125
, opt (idx 9 ==> mint)
126126
, opt (idx 11 ==> script_data_hash)
127127
, opt (idx 13 ==> untagged_set transaction_input)

eras/conway/impl/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
### `testlib`
1212

1313
* Rename `epoch_no` to `epoch` for consistency
14+
* Rename `slot_no` to `slot` and `block_no` to `block_number` for consistency
1415
* Removed `regDelegToDRep`
1516
* Removed `registerRewardAccountWithDeposit`
1617
* Removed `registerPoolWithDeposit`

0 commit comments

Comments
 (0)