Skip to content
Draft
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
6 changes: 6 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ source-repository-package
--sha256: sha256-DQHX7V1Ci/n7UVKotqGpBLKyiNHkttTu+tvuQqn/e/k=
tag: d4b12a415712666e139a19cdc4584423a5397c5f

source-repository-package
type: git
location: https://github.com/input-output-hk/cuddle.git
--sha256: sha256-XplTfcHBwZprhR3NXKgUNGb7kGGbFG4ogn4BVJxtz0s=
tag: 29b8db51bb132e403a91e7ac622184e047b8fede

-- NOTE: If you would like to update the above,
-- see CONTRIBUTING.md#to-update-the-referenced-agda-ledger-spec
index-state:
Expand Down
10 changes: 7 additions & 3 deletions eras/allegra/impl/cddl-files/allegra.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ protocol_param_update =

nonnegative_interval = #6.30([uint, positive_int])

positive_int = 1 .. maxWord64
positive_int = 1 .. max_word64

maxWord64 = 18446744073709551615
max_word64 = 18446744073709551615

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

Expand Down Expand Up @@ -305,7 +305,11 @@ script_any = (2, [* native_script])

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

int64 = -9223372036854775808 .. 9223372036854775807
int64 = min_int64 .. max_int64

min_int64 = -9223372036854775808

max_int64 = 9223372036854775807

invalid_before = (4, uint)

Expand Down
20 changes: 12 additions & 8 deletions eras/allegra/impl/testlib/Test/Cardano/Ledger/Allegra/CDDL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,23 @@

module Test.Cardano.Ledger.Allegra.CDDL (
module Test.Cardano.Ledger.Shelley.CDDL,
module Test.Cardano.Ledger.Allegra.CDDL,
allegraCDDL,
transaction_witness_set,
auxiliary_data,
metadata,
auxiliary_scripts,
script_pubkey,
script_all,
script_any,
invalid_before,
invalid_hereafter,
) where

import Cardano.Ledger.Allegra (AllegraEra)
import Cardano.Ledger.Core (Era)
import Codec.CBOR.Cuddle.Huddle
import Data.Function (($))
import Test.Cardano.Ledger.Shelley.CDDL hiding (
block,
transaction,
transaction_body,
transaction_witness_set,
)
import Test.Cardano.Ledger.Shelley.CDDL
import Text.Heredoc

allegraCDDL :: Huddle
Expand Down Expand Up @@ -93,7 +97,7 @@ transaction_body =
|]
$ "transaction_body"
=:= mp
[ idx 0 ==> set transaction_input
[ idx 0 ==> untagged_set transaction_input
, idx 1 ==> arr [0 <+ a transaction_output]
, idx 2 ==> coin
, opt (idx 3 ==> VUInt)
Expand Down
12 changes: 8 additions & 4 deletions eras/alonzo/impl/cddl-files/alonzo.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ protocol_param_update =

nonnegative_interval = #6.30([uint, positive_int])

positive_int = 1 .. maxWord64
positive_int = 1 .. max_word64

maxWord64 = 18446744073709551615
max_word64 = 18446744073709551615

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

Expand All @@ -349,7 +349,11 @@ language = 0
; See Plutus' `ParamName` for parameter ordering
cost_model = [166*166 int64]

int64 = -9223372036854775808 .. 9223372036854775807
int64 = min_int64 .. max_int64

min_int64 = -9223372036854775808

max_int64 = 9223372036854775807

ex_unit_prices = [mem_price : positive_interval, step_price : positive_interval]

Expand Down Expand Up @@ -558,5 +562,5 @@ auxiliary_scripts = [* native_script]
transaction =
[transaction_body, transaction_witness_set, bool, auxiliary_data/ nil]

signkeyKES = bytes .size 64
signkey_kes = bytes .size 64

38 changes: 15 additions & 23 deletions eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/CDDL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@

module Test.Cardano.Ledger.Alonzo.CDDL (
module Test.Cardano.Ledger.Mary.CDDL,
module Test.Cardano.Ledger.Alonzo.CDDL,
alonzoCDDL,
certificates,
auxiliary_data_hash,
required_signers,
network_id,
native_script,
redeemers,
constr,
ex_unit_prices,
ex_units,
positive_interval,
) where

import Cardano.Ledger.Alonzo (AlonzoEra)
Expand All @@ -19,21 +29,9 @@ import Data.Function (($))
import Data.Word (Word64)
import Test.Cardano.Ledger.Mary.CDDL hiding (
auxiliary_data,
block,
header,
header_body,
mint,
native_script,
proposed_protocol_parameter_updates,
protocol_param_update,
protocol_version,
script_n_of_k,
transaction,
transaction_body,
transaction_output,
transaction_witness_set,
update,
value,
)
import Text.Heredoc

Expand All @@ -44,7 +42,7 @@ alonzoCDDL =
, HIRule transaction
, HIRule kes_signature
, HIRule language
, HIRule signkeyKES
, HIRule signkey_kes
]

block :: Rule
Expand Down Expand Up @@ -95,7 +93,7 @@ transaction_body =
|]
$ "transaction_body"
=:= mp
[ idx 0 ==> set transaction_input
[ idx 0 ==> untagged_set transaction_input
, idx 1 ==> arr [0 <+ a transaction_output]
, idx 2 ==> coin
, opt (idx 3 ==> VUInt)
Expand All @@ -106,13 +104,13 @@ transaction_body =
, opt (idx 8 ==> VUInt)
, opt (idx 9 ==> mint)
, opt (idx 11 ==> script_data_hash)
, opt (idx 13 ==> set transaction_input)
, opt (idx 13 ==> untagged_set transaction_input)
, opt (idx 14 ==> required_signers)
, opt (idx 15 ==> network_id)
]

required_signers :: Rule
required_signers = "required_signers" =:= set addr_keyhash
required_signers = "required_signers" =:= untagged_set addr_keyhash

transaction_output :: Rule
transaction_output =
Expand Down Expand Up @@ -435,9 +433,3 @@ network_id = "network_id" =:= int 0 / int 1

auxiliary_data_hash :: Rule
auxiliary_data_hash = "auxiliary_data_hash" =:= hash32

mint :: Rule
mint = "mint" =:= multiasset int64

value :: Rule
value = "value" =:= coin / sarr [a coin, a (multiasset VUInt)]
12 changes: 8 additions & 4 deletions eras/babbage/impl/cddl-files/babbage.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,19 @@ protocol_param_update =

nonnegative_interval = #6.30([uint, positive_int])

positive_int = 1 .. maxWord64
positive_int = 1 .. max_word64

maxWord64 = 18446744073709551615
max_word64 = 18446744073709551615

; 0: Plutus v1
; 1: Plutus v2
cost_models = {? 0 : [166*166 int64], ? 1 : [175*175 int64]}

int64 = -9223372036854775808 .. 9223372036854775807
int64 = min_int64 .. max_int64

min_int64 = -9223372036854775808

max_int64 = 9223372036854775807

ex_unit_prices = [mem_price : positive_interval, step_price : positive_interval]

Expand Down Expand Up @@ -578,5 +582,5 @@ transaction =
; 1: Plutus v2
language = 0/ 1

signkeyKES = bytes .size 64
signkey_kes = bytes .size 64

31 changes: 8 additions & 23 deletions eras/babbage/impl/testlib/Test/Cardano/Ledger/Babbage/CDDL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,17 @@

module Test.Cardano.Ledger.Babbage.CDDL (
module Test.Cardano.Ledger.Alonzo.CDDL,
module Test.Cardano.Ledger.Babbage.CDDL,
babbageCDDL,
operational_cert,
babbage_transaction_output,
plutus_data,
) where

import Cardano.Ledger.Babbage (BabbageEra)
import Codec.CBOR.Cuddle.Huddle
import Data.Word (Word64)
import Test.Cardano.Ledger.Alonzo.CDDL hiding (
auxiliary_data,
block,
cost_models,
header,
header_body,
language,
operational_cert,
plutus_data,
plutus_script,
proposed_protocol_parameter_updates,
protocol_param_update,
protocol_version,
script_data_hash,
script_n_of_k,
transaction,
transaction_body,
transaction_output,
transaction_witness_set,
update,
)
import Text.Heredoc
import Prelude hiding ((/))
Expand All @@ -47,7 +32,7 @@ babbageCDDL =
, HIRule transaction
, HIRule kes_signature
, HIRule language
, HIRule signkeyKES
, HIRule signkey_kes
]

block :: Rule
Expand Down Expand Up @@ -128,7 +113,7 @@ transaction_body =
|]
$ "transaction_body"
=:= mp
[ idx 0 ==> set transaction_input
[ idx 0 ==> untagged_set transaction_input
, idx 1 ==> arr [0 <+ a transaction_output]
, idx 2 ==> coin
, opt (idx 3 ==> VUInt)
Expand All @@ -139,12 +124,12 @@ transaction_body =
, opt (idx 8 ==> VUInt)
, opt (idx 9 ==> mint)
, opt (idx 11 ==> script_data_hash)
, opt (idx 13 ==> set transaction_input)
, opt (idx 13 ==> untagged_set transaction_input)
, opt (idx 14 ==> required_signers)
, opt (idx 15 ==> network_id)
, opt (idx 16 ==> transaction_output)
, opt (idx 17 ==> coin)
, opt (idx 18 ==> set transaction_input)
, opt (idx 18 ==> untagged_set transaction_input)
]

-- TODO: Allow for adding to the comments of a Rule in order to not have to
Expand Down
30 changes: 17 additions & 13 deletions eras/conway/impl/cddl-files/conway.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ language = 0/ 1/ 2

potential_languages = 0 .. 255

signkeyKES = bytes .size 64
signkey_kes = bytes .size 64

certificate =
[ stake_registration
Expand Down Expand Up @@ -228,9 +228,9 @@ hash28 = bytes .size 28

asset_name = bytes .size (0 .. 32)

positive_coin = 1 .. maxWord64
positive_coin = 1 .. max_word64

maxWord64 = 18446744073709551615
max_word64 = 18446744073709551615

; NEW starting with babbage
; datum_option
Expand Down Expand Up @@ -309,7 +309,11 @@ script_any = (2, [* native_script])

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

int64 = -9223372036854775808 .. 9223372036854775807
int64 = min_int64 .. max_int64

min_int64 = -9223372036854775808

max_int64 = 9223372036854775807

invalid_before = (4, slot_no)

Expand All @@ -321,21 +325,21 @@ invalid_hereafter = (5, slot_no)
; around for tests in order to avoid generating duplicates, since
; the cddl tool we use for roundtrip testing doesn't generate
; distinct collections.
plutus_v1_script = distinct_VBytes
plutus_v1_script = distinct_bytes

; A type for distinct values.
; The type parameter must support .size, for example: bytes or uint
distinct_VBytes =
distinct_bytes =
bytes .size 8
/ bytes .size 16
/ bytes .size 20
/ bytes .size 24
/ bytes .size 30
/ bytes .size 32

plutus_v2_script = distinct_VBytes
plutus_v2_script = distinct_bytes

plutus_v3_script = distinct_VBytes
plutus_v3_script = distinct_bytes

certificates = nonempty_oset<certificate>

Expand Down Expand Up @@ -425,13 +429,13 @@ withdrawals = {+ reward_account => coin}

auxiliary_data_hash = hash32

mint = {+ policy_id => {+ asset_name => nonZeroInt64}}
mint = {+ policy_id => {+ asset_name => nonzero_int64}}

nonZeroInt64 = negInt64/ posInt64
nonzero_int64 = negative_int64/ positive_int64

negInt64 = -9223372036854775808 .. -1
negative_int64 = min_int64 .. -1

posInt64 = 1 .. 9223372036854775807
positive_int64 = 1 .. max_int64

; This is a hash of data which may affect evaluation of a script.
; This data consists of:
Expand Down Expand Up @@ -586,7 +590,7 @@ epoch_interval = uint .size 4

nonnegative_interval = #6.30([uint, positive_int])

positive_int = 1 .. maxWord64
positive_int = 1 .. max_word64

; The format for cost_models is flexible enough to allow adding
; Plutus built-ins and language versions in the future.
Expand Down
Loading
Loading