Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eras/allegra/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

### `testlib`

* Use fixed-sized `uint .size 8` for `slot` in CDDL for timelock validity intervals
* Add `impSatisfyMNativeScripts`
* Add `impSatisfySignature`

Expand Down
30 changes: 18 additions & 12 deletions eras/allegra/impl/cddl-files/allegra.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ block =
header = [header_body, body_signature : kes_signature]

header_body =
[ block_number : uint
, slot : uint
[ block_number : block_number
, slot : slot
, prev_hash : hash32/ nil
, issuer_vkey : vkey
, vrf_vkey : vrf_vkey
Expand All @@ -25,6 +25,10 @@ header_body =
]


block_number = uint .size 8

slot = uint .size 8

hash32 = bytes .size 32

vkey = bytes .size 32
Expand All @@ -34,10 +38,10 @@ vrf_vkey = bytes .size 32
vrf_cert = [bytes, bytes .size 80]

operational_cert =
( hot_vkey : kes_vkey
, sequence_number : uint
, kes_period : uint
, sigma : signature
( hot_vkey : kes_vkey
, sequence_number : uint .size 8
, kes_period : uint
, sigma : signature
)

kes_vkey = bytes .size 32
Expand All @@ -55,12 +59,12 @@ transaction_body =
{ 0 : set<transaction_input>
, 1 : [* transaction_output]
, 2 : coin
, ? 3 : uint
, ? 3 : slot
, ? 4 : [* certificate]
, ? 5 : withdrawals
, ? 6 : update
, ? 7 : metadata_hash
, ? 8 : uint
, ? 8 : slot
}


Expand Down Expand Up @@ -216,7 +220,7 @@ url = text .size (0 .. 64)

pool_retirement = (4, pool_keyhash, epoch)

epoch = uint
epoch = uint .size 8

genesis_key_delegation = (5, genesis_hash, genesis_delegate_hash, vrf_keyhash)

Expand Down Expand Up @@ -252,7 +256,7 @@ protocol_param_update =
, ? 4 : uint .size 2 ; max block header size
, ? 5 : coin ; key deposit
, ? 6 : coin ; pool deposit
, ? 7 : epoch ; maximum epoch
, ? 7 : epoch_interval ; maximum epoch
, ? 8 : uint .size 2 ; n_opt: desired number of stake pools
, ? 9 : nonnegative_interval ; pool pledge influence
, ? 10 : unit_interval ; expansion rate
Expand All @@ -265,6 +269,8 @@ protocol_param_update =
}


epoch_interval = uint .size 4

nonnegative_interval = #6.30([uint, positive_int])

positive_int = 1 .. max_word64
Expand Down Expand Up @@ -311,9 +317,9 @@ min_int64 = -9223372036854775808

max_int64 = 9223372036854775807

invalid_before = (4, uint)
invalid_before = (4, slot)

invalid_hereafter = (5, uint)
invalid_hereafter = (5, slot)

bootstrap_witness =
[ public_key : vkey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ script_n_of_k :: Named Group
script_n_of_k = "script_n_of_k" =:~ grp [3, "n" ==> int64, a (arr [0 <+ a native_script])]

invalid_before :: Named Group
invalid_before = "invalid_before" =:~ grp [4, a VUInt]
invalid_before = "invalid_before" =:~ grp [4, a slot]

invalid_hereafter :: Named Group
invalid_hereafter = "invalid_hereafter" =:~ grp [5, a VUInt]
invalid_hereafter = "invalid_hereafter" =:~ grp [5, a slot]

metadata :: Rule
metadata = "metadata" =:= mp [0 <+ asKey transaction_metadatum_label ==> transaction_metadatum]
Expand All @@ -100,12 +100,12 @@ transaction_body =
[ idx 0 ==> untagged_set transaction_input
, idx 1 ==> arr [0 <+ a transaction_output]
, idx 2 ==> coin
, opt (idx 3 ==> VUInt)
, opt (idx 3 ==> slot)
, opt (idx 4 ==> arr [0 <+ a certificate])
, opt (idx 5 ==> withdrawals)
, opt (idx 6 ==> update @era)
, opt (idx 7 ==> metadata_hash)
, opt (idx 8 ==> VUInt)
, opt (idx 8 ==> slot)
]

block :: forall era. Era era => Rule
Expand Down
2 changes: 2 additions & 0 deletions eras/alonzo/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

### `testlib`

* Use fixed-sized `uint .size 8` for `slot` and `block_number` in CDDL for header
* Remove CDDL `protocol_version` redefinition
* Add `NativeScript` parameter to `exampleTx`

## 1.14.0.0
Expand Down
30 changes: 18 additions & 12 deletions eras/alonzo/impl/cddl-files/alonzo.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ header = [header_body, body_signature : kes_signature]

; block_body_size: merkle triple root
header_body =
[ block_number : uint
, slot : uint
[ block_number : block_number
, slot : slot
, prev_hash : hash32/ nil
, issuer_vkey : vkey
, vrf_vkey : vrf_vkey
Expand All @@ -34,6 +34,10 @@ header_body =
]


block_number = uint .size 8

slot = uint .size 8

hash32 = bytes .size 32

vkey = bytes .size 32
Expand All @@ -43,10 +47,10 @@ vrf_vkey = bytes .size 32
vrf_cert = [bytes, bytes .size 80]

operational_cert =
( hot_vkey : kes_vkey
, sequence_number : uint
, kes_period : uint
, sigma : signature
( hot_vkey : kes_vkey
, sequence_number : uint .size 8
, kes_period : uint
, sigma : signature
)

kes_vkey = bytes .size 32
Expand All @@ -72,12 +76,12 @@ transaction_body =
{ 0 : set<transaction_input>
, 1 : [* transaction_output]
, 2 : coin
, ? 3 : uint
, ? 3 : slot
, ? 4 : [* certificate]
, ? 5 : withdrawals
, ? 6 : update
, ? 7 : auxiliary_data_hash
, ? 8 : uint
, ? 8 : slot
, ? 9 : mint
, ? 11 : script_data_hash
, ? 13 : set<transaction_input>
Expand Down Expand Up @@ -248,7 +252,7 @@ url = text .size (0 .. 64)

pool_retirement = (4, pool_keyhash, epoch)

epoch = uint
epoch = uint .size 8

genesis_key_delegation = (5, genesis_hash, genesis_delegate_hash, vrf_keyhash)

Expand Down Expand Up @@ -308,7 +312,7 @@ protocol_param_update =
, ? 4 : uint .size 2
, ? 5 : coin
, ? 6 : coin
, ? 7 : epoch
, ? 7 : epoch_interval
, ? 8 : uint .size 2
, ? 9 : nonnegative_interval
, ? 10 : unit_interval
Expand All @@ -328,6 +332,8 @@ protocol_param_update =
}


epoch_interval = uint .size 4

nonnegative_interval = #6.30([uint, positive_int])

positive_int = 1 .. max_word64
Expand Down Expand Up @@ -470,9 +476,9 @@ script_any = (2, [* native_script])

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

invalid_before = (4, uint)
invalid_before = (4, slot)

invalid_hereafter = (5, uint)
invalid_hereafter = (5, slot)

bootstrap_witness =
[ public_key : vkey
Expand Down
17 changes: 7 additions & 10 deletions eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/CDDL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ transaction =
, a (auxiliary_data / VNil)
]

protocol_version :: Named Group
protocol_version = "protocol_version" =:~ grp [a $ major_protocol_version @AlonzoEra, a VUInt]

transaction_body :: Rule
transaction_body =
comment
Expand All @@ -96,12 +93,12 @@ transaction_body =
[ idx 0 ==> untagged_set transaction_input
, idx 1 ==> arr [0 <+ a transaction_output]
, idx 2 ==> coin
, opt (idx 3 ==> VUInt)
, opt (idx 3 ==> slot)
, opt (idx 4 ==> arr [0 <+ a certificate])
, opt (idx 5 ==> withdrawals)
, opt (idx 6 ==> update)
, opt (idx 7 ==> auxiliary_data_hash)
, opt (idx 8 ==> VUInt)
, opt (idx 8 ==> slot)
, opt (idx 9 ==> mint)
, opt (idx 11 ==> script_data_hash)
, opt (idx 13 ==> untagged_set transaction_input)
Expand Down Expand Up @@ -224,14 +221,14 @@ protocol_param_update =
, opt (idx 4 ==> (VUInt `sized` (2 :: Word64)))
, opt (idx 5 ==> coin)
, opt (idx 6 ==> coin)
, opt (idx 7 ==> epoch)
, opt (idx 7 ==> epoch_interval)
, opt (idx 8 ==> VUInt `sized` (2 :: Word64))
, opt (idx 9 ==> nonnegative_interval)
, opt (idx 10 ==> unit_interval)
, opt (idx 11 ==> unit_interval)
, opt (idx 12 ==> unit_interval)
, opt (idx 13 ==> nonce)
, opt (idx 14 ==> arr [a protocol_version])
, opt (idx 14 ==> arr [a (protocol_version @AlonzoEra)])
, opt (idx 16 ==> coin)
, opt (idx 17 ==> coin)
, opt (idx 18 ==> cost_models)
Expand Down Expand Up @@ -390,8 +387,8 @@ header_body =
|]
$ "header_body"
=:= arr
[ "block_number" ==> VUInt
, "slot" ==> VUInt
[ "block_number" ==> block_number
, "slot" ==> slot
, "prev_hash" ==> (hash32 / VNil)
, "issuer_vkey" ==> vkey
, "vrf_vkey" ==> vrf_vkey
Expand All @@ -400,7 +397,7 @@ header_body =
, "block_body_size" ==> VUInt
, "block_body_hash" ==> hash32
, a operational_cert
, a protocol_version
, a (protocol_version @AlonzoEra)
]

native_script :: Rule
Expand Down
2 changes: 2 additions & 0 deletions eras/babbage/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

### `testlib`

* Hide Shelley CDDL `protocol_version` and re-export a new one for Babbage
* Use fixed-sized `uint .size 8` for `slot` and `block_number` in CDDL for header
* Add `BabbageEraImp`
* Removed `babbageEraSpecificSpec`

Expand Down
22 changes: 14 additions & 8 deletions eras/babbage/impl/cddl-files/babbage.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ header = [header_body, body_signature : kes_signature]
; block_body_size: merkle triple root
; vrf_result: NEW, replaces nonce_vrf and leader_vrf
header_body =
[ block_number : uint
, slot : uint
[ block_number : block_number
, slot : slot
, prev_hash : hash32/ nil
, issuer_vkey : vkey
, vrf_vkey : vrf_vkey
Expand All @@ -32,6 +32,10 @@ header_body =
]


block_number = uint .size 8

slot = uint .size 8

hash32 = bytes .size 32

vkey = bytes .size 32
Expand Down Expand Up @@ -70,12 +74,12 @@ transaction_body =
{ 0 : set<transaction_input>
, 1 : [* transaction_output]
, 2 : coin
, ? 3 : uint
, ? 3 : slot
, ? 4 : [* certificate]
, ? 5 : withdrawals
, ? 6 : update
, ? 7 : auxiliary_data_hash
, ? 8 : uint
, ? 8 : slot
, ? 9 : mint
, ? 11 : script_data_hash
, ? 13 : set<transaction_input>
Expand Down Expand Up @@ -243,9 +247,9 @@ script_any = (2, [* native_script])

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

invalid_before = (4, uint)
invalid_before = (4, slot)

invalid_hereafter = (5, uint)
invalid_hereafter = (5, slot)

plutus_v1_script = bytes

Expand Down Expand Up @@ -337,7 +341,7 @@ url = text .size (0 .. 64)

pool_retirement = (4, pool_keyhash, epoch)

epoch = uint
epoch = uint .size 8

genesis_key_delegation = (5, genesis_hash, genesis_delegate_hash, vrf_keyhash)

Expand Down Expand Up @@ -395,7 +399,7 @@ protocol_param_update =
, ? 4 : uint .size 2
, ? 5 : coin
, ? 6 : coin
, ? 7 : epoch
, ? 7 : epoch_interval
, ? 8 : uint .size 2
, ? 9 : nonnegative_interval
, ? 10 : unit_interval
Expand All @@ -413,6 +417,8 @@ protocol_param_update =
}


epoch_interval = uint .size 4

nonnegative_interval = #6.30([uint, positive_int])

positive_int = 1 .. max_word64
Expand Down
Loading