{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

{-# HLINT ignore "Use camelCase" #-}
{-# HLINT ignore "Evaluate" #-}
module Test.Cardano.Ledger.Shelley.CDDL where

import Codec.CBOR.Cuddle.Huddle
import Data.Function (($))
import Data.Word (Word64)
import GHC.Num (Integer)
import Test.Cardano.Ledger.Core.Binary.CDDL

shelley :: Huddle
shelley :: Huddle
shelley = [Rule] -> Huddle
collectFrom [Rule
block, Rule
transaction, Rule
signkeyKES]

block :: Rule
block :: Rule
block =
  Text
"block"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
header
      , Key
"transaction_bodies" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_body]
      , Key
"transaction_witness_sets"
          forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_witness_set]
      , Key
"transaction_metadata_set"
          forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> MapChoice -> MapChoice
mp [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
transaction_index forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
transaction_metadata]
      ]

transaction :: Rule
transaction :: Rule
transaction =
  Text
"transaction"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_body
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_witness_set
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule
transaction_metadata forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)
      ]

transaction_index :: Rule
transaction_index :: Rule
transaction_index = Text
"transaction_index" forall a. IsType0 a => Text -> a -> Rule
=:= Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
2 :: Word64)

header :: Rule
header :: Rule
header =
  Text
"header"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
header_body
      , Key
"body_signature" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
kes_signature
      ]

header_body :: Rule
header_body :: Rule
header_body =
  Text
"header_body"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"block_number" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt
      , Key
"slot" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt
      , Key
"prev_hash" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Rule
hash32 forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)
      , Key
"issuer_vkey" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vkey
      , Key
"vrf_vkey" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vrf_vkey
      , Key
"nonce_vrf" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vrf_cert
      , Key
"leader_vrf" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vrf_cert
      , Key
"block_body_size" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
4 :: Word64))
      , Key
"block_body_hash" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
hash32
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
operational_cert
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
protocol_version
      ]

operational_cert :: Named Group
operational_cert :: Named Group
operational_cert =
  Text
"operational_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp
      [ Key
"hot_vkey" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
kes_vkey
      , Key
"sequence_number" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt
      , Key
"kes_period" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt
      , Key
"sigma" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
signature
      ]

-- TODO Replace with the following once
-- https://github.com/input-output-hk/cuddle/issues/29 is addressed in cuddle.
--
-- next_major_protocol_version :: Rule
-- next_major_protocol_version = "next_major_protocol_version" =:= (10 :: Integer)
next_major_protocol_version :: Integer
next_major_protocol_version :: Integer
next_major_protocol_version = Integer
3

major_protocol_version :: Rule
major_protocol_version :: Rule
major_protocol_version = Text
"major_protocol_version" forall a. IsType0 a => Text -> a -> Rule
=:= (Integer
1 :: Integer) Integer -> Integer -> Ranged
... Integer
next_major_protocol_version

protocol_version :: Named Group
protocol_version :: Named Group
protocol_version = Text
"protocol_version" Text -> Group -> Named Group
=:~ Group -> Group
grp [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
major_protocol_version, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Value Int
VUInt]

transaction_body :: Rule
transaction_body :: Rule
transaction_body =
  Text
"transaction_body"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ Word64 -> Key
idx Word64
0 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
set Rule
transaction_input
      , Word64 -> Key
idx Word64
1 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_output]
      , Word64 -> Key
idx Word64
2 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
      , Word64 -> Key
idx Word64
3 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
4 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
certificate])
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
5 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
withdrawals)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
6 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
update)
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
7 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
metadata_hash)
      ]

transaction_input :: Rule
transaction_input :: Rule
transaction_input =
  Text
"transaction_input"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"transaction_id" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
hash32
      , Key
"index" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt
      ]

transaction_output :: Rule
transaction_output :: Rule
transaction_output =
  Text
"transaction_output"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
address
      , Key
"amount" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
      ]

certificate :: Rule
certificate :: Rule
certificate =
  Text
"certificate"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
stake_registration]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
stake_deregistration]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
stake_delegation]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
pool_registration]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
pool_retirement]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
genesis_key_delegation]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
move_instantaneous_rewards_cert]

stake_registration :: Named Group
stake_registration :: Named Group
stake_registration =
  forall a. Text -> Named a -> Named a
comment Text
"This will be deprecated in a future era" forall a b. (a -> b) -> a -> b
$
    Text
"stake_registration" Text -> Group -> Named Group
=:~ Group -> Group
grp [Type0
0, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
stake_credential]

stake_deregistration :: Named Group
stake_deregistration :: Named Group
stake_deregistration =
  forall a. Text -> Named a -> Named a
comment Text
"This will be deprecated in a future era" forall a b. (a -> b) -> a -> b
$
    Text
"stake_deregistration" Text -> Group -> Named Group
=:~ Group -> Group
grp [Type0
1, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
stake_credential]

stake_delegation :: Named Group
stake_delegation :: Named Group
stake_delegation =
  Text
"stake_delegation"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Type0
2, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
stake_credential, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
pool_keyhash]

-- POOL
pool_registration :: Named Group
pool_registration :: Named Group
pool_registration = Text
"pool_registration" Text -> Group -> Named Group
=:~ Group -> Group
grp [Type0
3, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
pool_params]

pool_retirement :: Named Group
pool_retirement :: Named Group
pool_retirement = Text
"pool_retirement" Text -> Group -> Named Group
=:~ Group -> Group
grp [Type0
4, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
pool_keyhash, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
epoch]

genesis_key_delegation :: Named Group
genesis_key_delegation :: Named Group
genesis_key_delegation =
  Text
"genesis_key_delegation"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Type0
5, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
genesishash, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
genesis_delegate_hash, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
vrf_keyhash]

move_instantaneous_rewards_cert :: Named Group
move_instantaneous_rewards_cert :: Named Group
move_instantaneous_rewards_cert =
  Text
"move_instantaneous_rewards_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Type0
6, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
move_instantaneous_reward]

move_instantaneous_reward :: Rule
move_instantaneous_reward :: Rule
move_instantaneous_reward =
  Text
"move_instantaneous_reward"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Integer -> Literal
int Integer
0 forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Integer -> Literal
int Integer
1), forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a forall a b. (a -> b) -> a -> b
$ MapChoice -> MapChoice
mp [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
stake_credential forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin]]

stake_credential :: Rule
stake_credential :: Rule
stake_credential =
  Text
"stake_credential"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ArrayEntry
0, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
addr_keyhash]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
1, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
scripthash]

pool_params :: Named Group
pool_params :: Named Group
pool_params =
  Text
"pool_params"
    Text -> Group -> Named Group
=:~ Group -> Group
grp
      [ Key
"operator" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
pool_keyhash
      , Key
"vrf_keyhash" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vrf_keyhash
      , Key
"pledge" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
      , Key
"cost" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
      , Key
"margin" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
unit_interval
      , Key
"reward_account" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
reward_account
      , Key
"pool_owners" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall t0. IsType0 t0 => t0 -> GRuleCall
set Rule
addr_keyhash
      , Key
"relays" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
relay]
      , Key
"pool_metadata" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Rule
pool_metadata forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)
      ]

port :: Rule
port :: Rule
port = Text
"port" forall a. IsType0 a => Text -> a -> Rule
=:= Value Int
VUInt Value Int -> Word64 -> Constrained
`le` Word64
65535

ipv4 :: Rule
ipv4 :: Rule
ipv4 = Text
"ipv4" forall a. IsType0 a => Text -> a -> Rule
=:= Value ByteString
VBytes forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
4 :: Word64)

ipv6 :: Rule
ipv6 :: Rule
ipv6 = Text
"ipv6" forall a. IsType0 a => Text -> a -> Rule
=:= Value ByteString
VBytes forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
16 :: Word64)

dns_name :: Rule
dns_name :: Rule
dns_name = Text
"dns_name" forall a. IsType0 a => Text -> a -> Rule
=:= Value Text
VText forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
0 :: Word64, Word64
64 :: Word64)

single_host_addr :: Named Group
single_host_addr :: Named Group
single_host_addr =
  Text
"single_host_addr"
    Text -> Group -> Named Group
=:~ Group -> Group
grp
      [ Type0
0
      , Rule
port forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , Rule
ipv4 forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , Rule
ipv6 forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      ]

single_host_name :: Named Group
single_host_name :: Named Group
single_host_name =
  Text
"single_host_name"
    Text -> Group -> Named Group
=:~ Group -> Group
grp
      [ Type0
1
      , Rule
port forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
dns_name -- An A or AAAA DNS record
      ]

multi_host_name :: Named Group
multi_host_name :: Named Group
multi_host_name =
  Text
"multi_host_name"
    Text -> Group -> Named Group
=:~ Group -> Group
grp
      [ Type0
2
      , forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
dns_name -- A SRV DNS record
      ]

relay :: Rule
relay :: Rule
relay =
  Text
"relay"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
single_host_addr]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
single_host_name]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
multi_host_name]

pool_metadata :: Rule
pool_metadata :: Rule
pool_metadata = Text
"pool_metadata" forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
url, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
metadata_hash]

url :: Rule
url :: Rule
url = Text
"url" forall a. IsType0 a => Text -> a -> Rule
=:= Value Text
VText forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
0 :: Word64, Word64
64 :: Word64)

withdrawals :: Rule
withdrawals :: Rule
withdrawals = Text
"withdrawals" forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
reward_account forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin]

update :: Rule
update :: Rule
update = Text
"update" forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
proposed_protocol_parameter_updates, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
epoch]

proposed_protocol_parameter_updates :: Rule
proposed_protocol_parameter_updates :: Rule
proposed_protocol_parameter_updates =
  Text
"proposed_protocol_parameter_updates"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
genesishash forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
protocol_param_update]

protocol_param_update :: Rule
protocol_param_update :: Rule
protocol_param_update =
  Text
"protocol_param_update"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
0 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt) -- minfee A
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
1 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt) -- minfee B
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
2 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt) -- max block body size
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
3 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt) -- max transaction size
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
4 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value Int
VUInt forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
2 :: Word64))) -- max block header size
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
5 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin) -- key deposit
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
6 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin) -- pool deposit
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
7 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
epoch) -- maximum epoch
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
8 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt) -- n_opt: desired number of stake pools
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
9 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
nonnegative_interval) -- pool pledge influence
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
10 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
unit_interval) -- expansion rate
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
11 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
unit_interval) -- treasury growth rate
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
12 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
unit_interval) -- decentralisation constant
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
13 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
nonce) -- extra entropy
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
14 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
protocol_version]) -- protocol version
      , forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
15 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin) -- min utxo value
      ]

transaction_witness_set :: Rule
transaction_witness_set :: Rule
transaction_witness_set =
  Text
"transaction_witness_set"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
0 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
vkeywitness]
      , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
1 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
multisig_script]
      , forall a. CanQuantify a => a -> a
opt forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
2 forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
bootstrap_witness]
      ]

transaction_metadatum :: Rule
transaction_metadatum :: Rule
transaction_metadatum =
  Text
"transaction_metadatum"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> Seal Map
smp [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
transaction_metadatum forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
transaction_metadatum]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> Seal (Choice ArrayChoice)
sarr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
transaction_metadatum]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Int
VInt
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ (Value ByteString
VBytes forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
0 :: Word64, Word64
64 :: Word64))
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ (Value Text
VText forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
0 :: Word64, Word64
64 :: Word64))

transaction_metadatum_label :: Rule
transaction_metadatum_label :: Rule
transaction_metadatum_label = Text
"transaction_metadatum_label" forall a. IsType0 a => Text -> a -> Rule
=:= Value Int
VUInt

transaction_metadata :: Rule
transaction_metadata :: Rule
transaction_metadata =
  Text
"transaction_metadata"
    forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ Word64
0
          forall a. CanQuantify a => Word64 -> a -> a
<+ forall r. IsType0 r => r -> Key
asKey Rule
transaction_metadatum_label
          forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
transaction_metadatum
      ]

vkeywitness :: Rule
vkeywitness :: Rule
vkeywitness = Text
"vkeywitness" forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
vkey, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
signature]

bootstrap_witness :: Rule
bootstrap_witness :: Rule
bootstrap_witness =
  Text
"bootstrap_witness"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"public_key" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vkey
      , Key
"signature" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
signature
      , Key
"chain_code" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> (Value ByteString
VBytes forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
32 :: Word64))
      , Key
"attributes" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value ByteString
VBytes
      ]

multisig_script :: Rule
multisig_script :: Rule
multisig_script =
  Text
"multisig_script"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
multisig_pubkey]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
multisig_all]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
multisig_any]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Named Group
multisig_n_of_k]

multisig_pubkey :: Named Group
multisig_pubkey :: Named Group
multisig_pubkey = Text
"multisig_pubkey" Text -> Group -> Named Group
=:~ Group -> Group
grp [Type0
0, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
addr_keyhash]

multisig_all :: Named Group
multisig_all :: Named Group
multisig_all = Text
"multisig_all" Text -> Group -> Named Group
=:~ Group -> Group
grp [Type0
1, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
multisig_script])]

multisig_any :: Named Group
multisig_any :: Named Group
multisig_any = Text
"multisig_any" Text -> Group -> Named Group
=:~ Group -> Group
grp [Type0
2, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
multisig_script])]

multisig_n_of_k :: Named Group
multisig_n_of_k :: Named Group
multisig_n_of_k =
  Text
"multisig_n_of_k"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Type0
3, Key
"n" forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
multisig_script])]

epoch :: Rule
epoch :: Rule
epoch = Text
"epoch" forall a. IsType0 a => Text -> a -> Rule
=:= Value Int
VUInt

genesis_delegate_hash :: Rule
genesis_delegate_hash :: Rule
genesis_delegate_hash = Text
"genesis_delegate_hash" forall a. IsType0 a => Text -> a -> Rule
=:= Rule
hash28

genesishash :: Rule
genesishash :: Rule
genesishash = Text
"genesishash" forall a. IsType0 a => Text -> a -> Rule
=:= Rule
hash28

scripthash :: Rule
scripthash :: Rule
scripthash = Text
"scripthash" forall a. IsType0 a => Text -> a -> Rule
=:= Rule
hash28

metadata_hash :: Rule
metadata_hash :: Rule
metadata_hash = Text
"metadata_hash" forall a. IsType0 a => Text -> a -> Rule
=:= Rule
hash32

nonce :: Rule
nonce :: Rule
nonce =
  Text
"nonce"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [ArrayEntry
0]
    forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [ArrayEntry
1, forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Value ByteString
VBytes forall a s. (IsSizeable a, IsSize s) => Value a -> s -> Constrained
`sized` (Word64
32 :: Word64))]

--------------------------------------------------------------------------------
-- Shelley does not support some of the tagged core datastructured that we rely
-- on in future eras. In order to have the "correct" common specification in
-- core, we override them here
--------------------------------------------------------------------------------
set :: IsType0 t0 => t0 -> GRuleCall
set :: forall t0. IsType0 t0 => t0 -> GRuleCall
set = forall t0. IsType0 t0 => (GRef -> Rule) -> t0 -> GRuleCall
binding forall a b. (a -> b) -> a -> b
$ \GRef
x -> Text
"set" forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Word64
0 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a GRef
x]

nonempty_set :: IsType0 t0 => t0 -> GRuleCall
nonempty_set :: forall t0. IsType0 t0 => t0 -> GRuleCall
nonempty_set = forall t0. IsType0 t0 => (GRef -> Rule) -> t0 -> GRuleCall
binding forall a b. (a -> b) -> a -> b
$ \GRef
x ->
  Text
"nonempty_set"
    forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Word64
1 forall a. CanQuantify a => Word64 -> a -> a
<+ forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a GRef
x]