{-# LANGUAGE GADTs #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeApplications #-}
module Gen.Bcc.Api.Typed
( genAddressCole
, genAddressSophie
, genCertificate
, genMaybeOptimumNonce
, genOptimumNonce
, genProtocolParameters
, genValueNestedRep
, genValueNestedBundle
, genColeKeyWitness
, genTxId
, genTxIn
, genTxOut
, genUTxO
, genScript
, genSimpleScript
, genZerepochScript
, genScriptInAnyLang
, genScriptInEra
, genScriptHash
, genScriptData
, genOperationalCertificate
, genOperationalCertificateIssueCounter
, genSophieWitness
, genSigningKey
, genStakeAddress
, genTx
, genTxBody
, genValue
, genValueDefault
, genVerificationKey
, genVerificationKeyHash
, genUpdateProposal
, genProtocolParametersUpdate
, genScriptDataSupportedInAurumEra
, genTxOutDatumHash
, genTxOutValue
, genValueForTxOut
, genValueForMinting
, genRational
) where
import Bcc.Api hiding (txIns)
import qualified Bcc.Api as Api
import Bcc.Api.Cole (KeyWitness (ColeKeyWitness), Entropic (Entropic),
WitnessNetworkIdOrColeAddress (..))
import Bcc.Api.Sophie (Hash (ScriptDataHash), KESPeriod (KESPeriod),
OperationalCertificateIssueCounter (OperationalCertificateIssueCounter),
ZerepochScript (ZerepochScriptSerialised), ProtocolParameters (ProtocolParameters),
StakeCredential (StakeCredentialByKey), StakePoolKey)
import Bcc.Prelude
import Control.Monad.Fail (fail)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Short as SBS
import Data.Coerce
import Data.String
import qualified Bcc.Binary as CBOR
import qualified Bcc.Crypto.Hash as Crypto
import qualified Bcc.Crypto.Seed as Crypto
import qualified Zerepoch.V1.Ledger.Api as Zerepoch
import qualified Sophie.Spec.Ledger.TxBody as Ledger (EraIndependentTxBody)
import Hedgehog (Gen, Range)
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
import qualified Bcc.Crypto.Hash.Class as CRYPTO
import Bcc.Ledger.SafeHash (unsafeMakeSafeHash)
import Gen.Bcc.Api.Metadata (genTxMetadata)
import Test.Bcc.Chain.UTxO.Gen (genVKWitness)
import Test.Bcc.Crypto.Gen (genProtocolMagicId)
genAddressCole :: Gen (Address ColeAddr)
genAddressCole :: Gen (Address ColeAddr)
genAddressCole = NetworkId -> VerificationKey ColeKey -> Address ColeAddr
makeColeAddress (NetworkId -> VerificationKey ColeKey -> Address ColeAddr)
-> GenT Identity NetworkId
-> GenT Identity (VerificationKey ColeKey -> Address ColeAddr)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity NetworkId
genNetworkId
GenT Identity (VerificationKey ColeKey -> Address ColeAddr)
-> GenT Identity (VerificationKey ColeKey)
-> Gen (Address ColeAddr)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AsType ColeKey -> GenT Identity (VerificationKey ColeKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (VerificationKey keyrole)
genVerificationKey AsType ColeKey
AsColeKey
genAddressSophie :: Gen (Address SophieAddr)
genAddressSophie :: Gen (Address SophieAddr)
genAddressSophie = NetworkId
-> PaymentCredential -> StakeAddressReference -> Address SophieAddr
makeSophieAddress (NetworkId
-> PaymentCredential
-> StakeAddressReference
-> Address SophieAddr)
-> GenT Identity NetworkId
-> GenT
Identity
(PaymentCredential -> StakeAddressReference -> Address SophieAddr)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity NetworkId
genNetworkId
GenT
Identity
(PaymentCredential -> StakeAddressReference -> Address SophieAddr)
-> GenT Identity PaymentCredential
-> GenT Identity (StakeAddressReference -> Address SophieAddr)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity PaymentCredential
genPaymentCredential
GenT Identity (StakeAddressReference -> Address SophieAddr)
-> GenT Identity StakeAddressReference -> Gen (Address SophieAddr)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity StakeAddressReference
genStakeAddressReference
genAddressInEra :: BccEra era -> Gen (AddressInEra era)
genAddressInEra :: BccEra era -> Gen (AddressInEra era)
genAddressInEra BccEra era
era =
case BccEra era -> BccEraStyle era
forall era. BccEra era -> BccEraStyle era
bccEraStyle BccEra era
era of
BccEraStyle era
LegacyColeEra ->
Address ColeAddr -> AddressInEra era
forall era. Address ColeAddr -> AddressInEra era
coleAddressInEra (Address ColeAddr -> AddressInEra era)
-> Gen (Address ColeAddr) -> Gen (AddressInEra era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (Address ColeAddr)
genAddressCole
SophieBasedEra SophieBasedEra era
_ ->
[Gen (AddressInEra era)] -> Gen (AddressInEra era)
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ Address ColeAddr -> AddressInEra era
forall era. Address ColeAddr -> AddressInEra era
coleAddressInEra (Address ColeAddr -> AddressInEra era)
-> Gen (Address ColeAddr) -> Gen (AddressInEra era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (Address ColeAddr)
genAddressCole
, Address SophieAddr -> AddressInEra era
forall era.
IsSophieBasedEra era =>
Address SophieAddr -> AddressInEra era
sophieAddressInEra (Address SophieAddr -> AddressInEra era)
-> Gen (Address SophieAddr) -> Gen (AddressInEra era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (Address SophieAddr)
genAddressSophie
]
genKESPeriod :: Gen KESPeriod
genKESPeriod :: Gen KESPeriod
genKESPeriod = Word -> KESPeriod
KESPeriod (Word -> KESPeriod) -> GenT Identity Word -> Gen KESPeriod
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Word -> GenT Identity Word
forall (m :: * -> *). MonadGen m => Range Word -> m Word
Gen.word Range Word
forall a. (Bounded a, Num a) => Range a
Range.constantBounded
genEntropic :: Gen Entropic
genEntropic :: Gen Entropic
genEntropic = Integer -> Entropic
Entropic (Integer -> Entropic) -> GenT Identity Integer -> Gen Entropic
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Integer -> GenT Identity Integer
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Integer -> Integer -> Range Integer
forall a. Integral a => a -> a -> Range a
Range.linear Integer
0 Integer
5000)
genScript :: ScriptLanguage lang -> Gen (Script lang)
genScript :: ScriptLanguage lang -> Gen (Script lang)
genScript (SimpleScriptLanguage SimpleScriptVersion lang
lang) =
SimpleScriptVersion lang -> SimpleScript lang -> Script lang
forall lang.
SimpleScriptVersion lang -> SimpleScript lang -> Script lang
SimpleScript SimpleScriptVersion lang
lang (SimpleScript lang -> Script lang)
-> GenT Identity (SimpleScript lang) -> Gen (Script lang)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> SimpleScriptVersion lang -> GenT Identity (SimpleScript lang)
forall lang. SimpleScriptVersion lang -> Gen (SimpleScript lang)
genSimpleScript SimpleScriptVersion lang
lang
genScript (ZerepochScriptLanguage ZerepochScriptVersion lang
lang) =
ZerepochScriptVersion lang -> ZerepochScript lang -> Script lang
forall lang.
ZerepochScriptVersion lang -> ZerepochScript lang -> Script lang
ZerepochScript ZerepochScriptVersion lang
lang (ZerepochScript lang -> Script lang)
-> GenT Identity (ZerepochScript lang) -> Gen (Script lang)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ZerepochScriptVersion lang -> GenT Identity (ZerepochScript lang)
forall lang.
ZerepochScriptVersion lang -> Gen (ZerepochScript lang)
genZerepochScript ZerepochScriptVersion lang
lang
genSimpleScript :: SimpleScriptVersion lang -> Gen (SimpleScript lang)
genSimpleScript :: SimpleScriptVersion lang -> Gen (SimpleScript lang)
genSimpleScript SimpleScriptVersion lang
lang =
Gen (SimpleScript lang)
genTerm
where
genTerm :: Gen (SimpleScript lang)
genTerm = ([Gen (SimpleScript lang)] -> Gen (SimpleScript lang))
-> [Gen (SimpleScript lang)]
-> [Gen (SimpleScript lang)]
-> Gen (SimpleScript lang)
forall (m :: * -> *) a.
MonadGen m =>
([m a] -> m a) -> [m a] -> [m a] -> m a
Gen.recursive [Gen (SimpleScript lang)] -> Gen (SimpleScript lang)
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice [Gen (SimpleScript lang)]
nonRecursive [Gen (SimpleScript lang)]
recursive
nonRecursive :: [Gen (SimpleScript lang)]
nonRecursive =
(Hash PaymentKey -> SimpleScript lang
forall lang. Hash PaymentKey -> SimpleScript lang
RequireSignature (Hash PaymentKey -> SimpleScript lang)
-> (VerificationKey PaymentKey -> Hash PaymentKey)
-> VerificationKey PaymentKey
-> SimpleScript lang
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. VerificationKey PaymentKey -> Hash PaymentKey
forall keyrole.
Key keyrole =>
VerificationKey keyrole -> Hash keyrole
verificationKeyHash (VerificationKey PaymentKey -> SimpleScript lang)
-> GenT Identity (VerificationKey PaymentKey)
-> Gen (SimpleScript lang)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
AsType PaymentKey -> GenT Identity (VerificationKey PaymentKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (VerificationKey keyrole)
genVerificationKey AsType PaymentKey
AsPaymentKey)
Gen (SimpleScript lang)
-> [Gen (SimpleScript lang)] -> [Gen (SimpleScript lang)]
forall a. a -> [a] -> [a]
: [ TimeLocksSupported lang -> SlotNo -> SimpleScript lang
forall lang. TimeLocksSupported lang -> SlotNo -> SimpleScript lang
RequireTimeBefore TimeLocksSupported lang
supported (SlotNo -> SimpleScript lang)
-> GenT Identity SlotNo -> Gen (SimpleScript lang)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity SlotNo
genSlotNo
| TimeLocksSupported lang
supported <- Maybe (TimeLocksSupported lang) -> [TimeLocksSupported lang]
forall a. Maybe a -> [a]
maybeToList (SimpleScriptVersion lang -> Maybe (TimeLocksSupported lang)
forall lang.
SimpleScriptVersion lang -> Maybe (TimeLocksSupported lang)
timeLocksSupported SimpleScriptVersion lang
lang) ]
[Gen (SimpleScript lang)]
-> [Gen (SimpleScript lang)] -> [Gen (SimpleScript lang)]
forall a. [a] -> [a] -> [a]
++ [ TimeLocksSupported lang -> SlotNo -> SimpleScript lang
forall lang. TimeLocksSupported lang -> SlotNo -> SimpleScript lang
RequireTimeAfter TimeLocksSupported lang
supported (SlotNo -> SimpleScript lang)
-> GenT Identity SlotNo -> Gen (SimpleScript lang)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity SlotNo
genSlotNo
| TimeLocksSupported lang
supported <- Maybe (TimeLocksSupported lang) -> [TimeLocksSupported lang]
forall a. Maybe a -> [a]
maybeToList (SimpleScriptVersion lang -> Maybe (TimeLocksSupported lang)
forall lang.
SimpleScriptVersion lang -> Maybe (TimeLocksSupported lang)
timeLocksSupported SimpleScriptVersion lang
lang) ]
recursive :: [Gen (SimpleScript lang)]
recursive =
[ [SimpleScript lang] -> SimpleScript lang
forall lang. [SimpleScript lang] -> SimpleScript lang
RequireAllOf ([SimpleScript lang] -> SimpleScript lang)
-> GenT Identity [SimpleScript lang] -> Gen (SimpleScript lang)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int
-> Gen (SimpleScript lang) -> GenT Identity [SimpleScript lang]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
10) Gen (SimpleScript lang)
genTerm
, [SimpleScript lang] -> SimpleScript lang
forall lang. [SimpleScript lang] -> SimpleScript lang
RequireAnyOf ([SimpleScript lang] -> SimpleScript lang)
-> GenT Identity [SimpleScript lang] -> Gen (SimpleScript lang)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int
-> Gen (SimpleScript lang) -> GenT Identity [SimpleScript lang]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
10) Gen (SimpleScript lang)
genTerm
, do [SimpleScript lang]
ts <- Range Int
-> Gen (SimpleScript lang) -> GenT Identity [SimpleScript lang]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
10) Gen (SimpleScript lang)
genTerm
Int
m <- Range Int -> GenT Identity Int
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
0 ([SimpleScript lang] -> Int
forall a. HasLength a => a -> Int
length [SimpleScript lang]
ts))
SimpleScript lang -> Gen (SimpleScript lang)
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> [SimpleScript lang] -> SimpleScript lang
forall lang. Int -> [SimpleScript lang] -> SimpleScript lang
RequireMOf Int
m [SimpleScript lang]
ts)
]
genZerepochScript :: ZerepochScriptVersion lang -> Gen (ZerepochScript lang)
genZerepochScript :: ZerepochScriptVersion lang -> Gen (ZerepochScript lang)
genZerepochScript ZerepochScriptVersion lang
_ =
ShortByteString -> ZerepochScript lang
forall lang. ShortByteString -> ZerepochScript lang
ZerepochScriptSerialised (ShortByteString -> ZerepochScript lang)
-> (ByteString -> ShortByteString)
-> ByteString
-> ZerepochScript lang
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> ShortByteString
SBS.toShort (ByteString -> ZerepochScript lang)
-> GenT Identity ByteString -> Gen (ZerepochScript lang)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int -> GenT Identity ByteString
forall (m :: * -> *). MonadGen m => Range Int -> m ByteString
Gen.bytes (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
32)
genScriptData :: Gen ScriptData
genScriptData :: Gen ScriptData
genScriptData =
([Gen ScriptData] -> Gen ScriptData)
-> [Gen ScriptData] -> [Gen ScriptData] -> Gen ScriptData
forall (m :: * -> *) a.
MonadGen m =>
([m a] -> m a) -> [m a] -> [m a] -> m a
Gen.recursive
[Gen ScriptData] -> Gen ScriptData
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ Integer -> ScriptData
ScriptDataNumber (Integer -> ScriptData) -> GenT Identity Integer -> Gen ScriptData
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity Integer
genInteger
, ByteString -> ScriptData
ScriptDataBytes (ByteString -> ScriptData)
-> GenT Identity ByteString -> Gen ScriptData
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity ByteString
genByteString
]
[ Integer -> [ScriptData] -> ScriptData
ScriptDataConstructor (Integer -> [ScriptData] -> ScriptData)
-> GenT Identity Integer
-> GenT Identity ([ScriptData] -> ScriptData)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity Integer
genInteger
GenT Identity ([ScriptData] -> ScriptData)
-> GenT Identity [ScriptData] -> Gen ScriptData
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity [ScriptData]
genScriptDataList
, [ScriptData] -> ScriptData
ScriptDataList ([ScriptData] -> ScriptData)
-> GenT Identity [ScriptData] -> Gen ScriptData
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity [ScriptData]
genScriptDataList
, [(ScriptData, ScriptData)] -> ScriptData
ScriptDataMap ([(ScriptData, ScriptData)] -> ScriptData)
-> GenT Identity [(ScriptData, ScriptData)] -> Gen ScriptData
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity [(ScriptData, ScriptData)]
genScriptDataMap
]
where
genInteger :: Gen Integer
genInteger :: GenT Identity Integer
genInteger = Range Integer -> GenT Identity Integer
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral
(Integer -> Integer -> Range Integer
forall a. Integral a => a -> a -> Range a
Range.linear
Integer
0
(Word64 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word64
forall a. Bounded a => a
maxBound :: Word64) :: Integer))
genByteString :: Gen ByteString
genByteString :: GenT Identity ByteString
genByteString = [Word8] -> ByteString
BS.pack ([Word8] -> ByteString)
-> GenT Identity [Word8] -> GenT Identity ByteString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int -> GenT Identity Word8 -> GenT Identity [Word8]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
64)
(Range Word8 -> GenT Identity Word8
forall (m :: * -> *). MonadGen m => Range Word8 -> m Word8
Gen.word8 Range Word8
forall a. (Bounded a, Num a) => Range a
Range.constantBounded)
genScriptDataList :: Gen [ScriptData]
genScriptDataList :: GenT Identity [ScriptData]
genScriptDataList =
(Size -> GenT Identity [ScriptData]) -> GenT Identity [ScriptData]
forall (m :: * -> *) a. MonadGen m => (Size -> m a) -> m a
Gen.sized ((Size -> GenT Identity [ScriptData])
-> GenT Identity [ScriptData])
-> (Size -> GenT Identity [ScriptData])
-> GenT Identity [ScriptData]
forall a b. (a -> b) -> a -> b
$ \Size
sz ->
Range Int -> Gen ScriptData -> GenT Identity [ScriptData]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 (Size -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Size
sz)) Gen ScriptData
genScriptData
genScriptDataMap :: Gen [(ScriptData, ScriptData)]
genScriptDataMap :: GenT Identity [(ScriptData, ScriptData)]
genScriptDataMap =
(Size -> GenT Identity [(ScriptData, ScriptData)])
-> GenT Identity [(ScriptData, ScriptData)]
forall (m :: * -> *) a. MonadGen m => (Size -> m a) -> m a
Gen.sized ((Size -> GenT Identity [(ScriptData, ScriptData)])
-> GenT Identity [(ScriptData, ScriptData)])
-> (Size -> GenT Identity [(ScriptData, ScriptData)])
-> GenT Identity [(ScriptData, ScriptData)]
forall a b. (a -> b) -> a -> b
$ \Size
sz ->
Range Int
-> GenT Identity (ScriptData, ScriptData)
-> GenT Identity [(ScriptData, ScriptData)]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 (Size -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Size
sz)) (GenT Identity (ScriptData, ScriptData)
-> GenT Identity [(ScriptData, ScriptData)])
-> GenT Identity (ScriptData, ScriptData)
-> GenT Identity [(ScriptData, ScriptData)]
forall a b. (a -> b) -> a -> b
$
(,) (ScriptData -> ScriptData -> (ScriptData, ScriptData))
-> Gen ScriptData
-> GenT Identity (ScriptData -> (ScriptData, ScriptData))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen ScriptData
genScriptData GenT Identity (ScriptData -> (ScriptData, ScriptData))
-> Gen ScriptData -> GenT Identity (ScriptData, ScriptData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen ScriptData
genScriptData
genScriptInAnyLang :: Gen ScriptInAnyLang
genScriptInAnyLang :: Gen ScriptInAnyLang
genScriptInAnyLang =
[Gen ScriptInAnyLang] -> Gen ScriptInAnyLang
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ ScriptLanguage lang -> Script lang -> ScriptInAnyLang
forall lang. ScriptLanguage lang -> Script lang -> ScriptInAnyLang
ScriptInAnyLang ScriptLanguage lang
lang (Script lang -> ScriptInAnyLang)
-> GenT Identity (Script lang) -> Gen ScriptInAnyLang
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ScriptLanguage lang -> GenT Identity (Script lang)
forall lang. ScriptLanguage lang -> Gen (Script lang)
genScript ScriptLanguage lang
lang
| AnyScriptLanguage ScriptLanguage lang
lang <- [AnyScriptLanguage
forall a. Bounded a => a
minBound..AnyScriptLanguage
forall a. Bounded a => a
maxBound] ]
genScriptInEra :: BccEra era -> Gen (ScriptInEra era)
genScriptInEra :: BccEra era -> Gen (ScriptInEra era)
genScriptInEra BccEra era
era =
[Gen (ScriptInEra era)] -> Gen (ScriptInEra era)
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ ScriptLanguageInEra lang era -> Script lang -> ScriptInEra era
forall lang era.
ScriptLanguageInEra lang era -> Script lang -> ScriptInEra era
ScriptInEra ScriptLanguageInEra lang era
langInEra (Script lang -> ScriptInEra era)
-> GenT Identity (Script lang) -> Gen (ScriptInEra era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ScriptLanguage lang -> GenT Identity (Script lang)
forall lang. ScriptLanguage lang -> Gen (Script lang)
genScript ScriptLanguage lang
lang
| AnyScriptLanguage ScriptLanguage lang
lang <- [AnyScriptLanguage
forall a. Bounded a => a
minBound..AnyScriptLanguage
forall a. Bounded a => a
maxBound]
, Just ScriptLanguageInEra lang era
langInEra <- [BccEra era
-> ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era)
forall era lang.
BccEra era
-> ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era)
scriptLanguageSupportedInEra BccEra era
era ScriptLanguage lang
lang] ]
genScriptHash :: Gen ScriptHash
genScriptHash :: Gen ScriptHash
genScriptHash = do
ScriptInAnyLang ScriptLanguage lang
_ Script lang
script <- Gen ScriptInAnyLang
genScriptInAnyLang
ScriptHash -> Gen ScriptHash
forall (m :: * -> *) a. Monad m => a -> m a
return (Script lang -> ScriptHash
forall lang. Script lang -> ScriptHash
hashScript Script lang
script)
genAssetName :: Gen AssetName
genAssetName :: Gen AssetName
genAssetName =
[(Int, Gen AssetName)] -> Gen AssetName
forall (m :: * -> *) a. MonadGen m => [(Int, m a)] -> m a
Gen.frequency
[ (Int
9, [AssetName] -> Gen AssetName
forall (m :: * -> *) a. MonadGen m => [a] -> m a
Gen.element [AssetName
"", AssetName
"a", AssetName
"b", AssetName
"c"])
, (Int
1, ByteString -> AssetName
AssetName (ByteString -> AssetName)
-> GenT Identity ByteString -> Gen AssetName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int -> GenT Identity Char -> GenT Identity ByteString
forall (m :: * -> *).
MonadGen m =>
Range Int -> m Char -> m ByteString
Gen.utf8 (Int -> Range Int
forall a. a -> Range a
Range.singleton Int
32) GenT Identity Char
forall (m :: * -> *). MonadGen m => m Char
Gen.alphaNum)
, (Int
1, ByteString -> AssetName
AssetName (ByteString -> AssetName)
-> GenT Identity ByteString -> Gen AssetName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int -> GenT Identity Char -> GenT Identity ByteString
forall (m :: * -> *).
MonadGen m =>
Range Int -> m Char -> m ByteString
Gen.utf8 (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
1 Int
31) GenT Identity Char
forall (m :: * -> *). MonadGen m => m Char
Gen.alphaNum)
]
genPolicyId :: Gen PolicyId
genPolicyId :: Gen PolicyId
genPolicyId =
[(Int, Gen PolicyId)] -> Gen PolicyId
forall (m :: * -> *) a. MonadGen m => [(Int, m a)] -> m a
Gen.frequency
[ (Int
9, [PolicyId] -> Gen PolicyId
forall (m :: * -> *) a. MonadGen m => [a] -> m a
Gen.element [ String -> PolicyId
forall a. IsString a => String -> a
fromString (Char
x Char -> String -> String
forall a. a -> [a] -> [a]
: Int -> Char -> String
forall a. Int -> a -> [a]
replicate Int
55 Char
'0') | Char
x <- [Char
'a'..Char
'c'] ])
, (Int
1, ScriptHash -> PolicyId
PolicyId (ScriptHash -> PolicyId) -> Gen ScriptHash -> Gen PolicyId
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen ScriptHash
genScriptHash)
]
genAssetId :: Gen AssetId
genAssetId :: Gen AssetId
genAssetId = [Gen AssetId] -> Gen AssetId
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice [ PolicyId -> AssetName -> AssetId
AssetId (PolicyId -> AssetName -> AssetId)
-> Gen PolicyId -> GenT Identity (AssetName -> AssetId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen PolicyId
genPolicyId GenT Identity (AssetName -> AssetId)
-> Gen AssetName -> Gen AssetId
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen AssetName
genAssetName
, AssetId -> Gen AssetId
forall (m :: * -> *) a. Monad m => a -> m a
return AssetId
BccAssetId
]
genQuantity :: Range Integer -> Gen Quantity
genQuantity :: Range Integer -> Gen Quantity
genQuantity Range Integer
range = Integer -> Quantity
forall a. Num a => Integer -> a
fromInteger (Integer -> Quantity) -> GenT Identity Integer -> Gen Quantity
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Integer -> GenT Identity Integer
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral Range Integer
range
genSignedQuantity :: Gen Quantity
genSignedQuantity :: Gen Quantity
genSignedQuantity = Range Integer -> Gen Quantity
genQuantity (Integer -> Integer -> Integer -> Range Integer
forall a. a -> a -> a -> Range a
Range.constantFrom Integer
0 (-Integer
2) Integer
2)
genUnsignedQuantity :: Gen Quantity
genUnsignedQuantity :: Gen Quantity
genUnsignedQuantity = Range Integer -> Gen Quantity
genQuantity (Integer -> Integer -> Range Integer
forall a. a -> a -> Range a
Range.constant Integer
0 Integer
2)
genValue :: Gen AssetId -> Gen Quantity -> Gen Value
genValue :: Gen AssetId -> Gen Quantity -> Gen Value
genValue Gen AssetId
genAId Gen Quantity
genQuant =
[(AssetId, Quantity)] -> Value
valueFromList ([(AssetId, Quantity)] -> Value)
-> GenT Identity [(AssetId, Quantity)] -> Gen Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
Range Int
-> GenT Identity (AssetId, Quantity)
-> GenT Identity [(AssetId, Quantity)]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
0 Int
10)
((,) (AssetId -> Quantity -> (AssetId, Quantity))
-> Gen AssetId -> GenT Identity (Quantity -> (AssetId, Quantity))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen AssetId
genAId GenT Identity (Quantity -> (AssetId, Quantity))
-> Gen Quantity -> GenT Identity (AssetId, Quantity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Quantity
genQuant)
genValueDefault :: Gen Value
genValueDefault :: Gen Value
genValueDefault = Gen AssetId -> Gen Quantity -> Gen Value
genValue Gen AssetId
genAssetId Gen Quantity
genSignedQuantity
genValueForMinting :: Gen Value
genValueForMinting :: Gen Value
genValueForMinting = Gen AssetId -> Gen Quantity -> Gen Value
genValue Gen AssetId
genAssetIdNoBcc Gen Quantity
genSignedQuantity
where
genAssetIdNoBcc :: Gen AssetId
genAssetIdNoBcc :: Gen AssetId
genAssetIdNoBcc = PolicyId -> AssetName -> AssetId
AssetId (PolicyId -> AssetName -> AssetId)
-> Gen PolicyId -> GenT Identity (AssetName -> AssetId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen PolicyId
genPolicyId GenT Identity (AssetName -> AssetId)
-> Gen AssetName -> Gen AssetId
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen AssetName
genAssetName
genValueForTxOut :: Gen Value
genValueForTxOut :: Gen Value
genValueForTxOut = Gen AssetId -> Gen Quantity -> Gen Value
genValue Gen AssetId
genAssetId Gen Quantity
genUnsignedQuantity
genValueNestedRep :: Gen ValueNestedRep
genValueNestedRep :: Gen ValueNestedRep
genValueNestedRep =
[ValueNestedBundle] -> ValueNestedRep
ValueNestedRep ([ValueNestedBundle] -> ValueNestedRep)
-> GenT Identity [ValueNestedBundle] -> Gen ValueNestedRep
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int
-> GenT Identity ValueNestedBundle
-> GenT Identity [ValueNestedBundle]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
0 Int
5) GenT Identity ValueNestedBundle
genValueNestedBundle
genValueNestedBundle :: Gen ValueNestedBundle
genValueNestedBundle :: GenT Identity ValueNestedBundle
genValueNestedBundle =
[GenT Identity ValueNestedBundle]
-> GenT Identity ValueNestedBundle
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ Quantity -> ValueNestedBundle
ValueNestedBundleBcc (Quantity -> ValueNestedBundle)
-> Gen Quantity -> GenT Identity ValueNestedBundle
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Quantity
genSignedQuantity
, PolicyId -> Map AssetName Quantity -> ValueNestedBundle
ValueNestedBundle (PolicyId -> Map AssetName Quantity -> ValueNestedBundle)
-> Gen PolicyId
-> GenT Identity (Map AssetName Quantity -> ValueNestedBundle)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen PolicyId
genPolicyId
GenT Identity (Map AssetName Quantity -> ValueNestedBundle)
-> GenT Identity (Map AssetName Quantity)
-> GenT Identity ValueNestedBundle
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Range Int
-> GenT Identity (AssetName, Quantity)
-> GenT Identity (Map AssetName Quantity)
forall (m :: * -> *) k v.
(MonadGen m, Ord k) =>
Range Int -> m (k, v) -> m (Map k v)
Gen.map (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
0 Int
5)
((,) (AssetName -> Quantity -> (AssetName, Quantity))
-> Gen AssetName
-> GenT Identity (Quantity -> (AssetName, Quantity))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen AssetName
genAssetName GenT Identity (Quantity -> (AssetName, Quantity))
-> Gen Quantity -> GenT Identity (AssetName, Quantity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Quantity
genSignedQuantity)
]
genNetworkId :: Gen NetworkId
genNetworkId :: GenT Identity NetworkId
genNetworkId =
[GenT Identity NetworkId] -> GenT Identity NetworkId
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ NetworkId -> GenT Identity NetworkId
forall (f :: * -> *) a. Applicative f => a -> f a
pure NetworkId
Mainnet
, NetworkMagic -> NetworkId
Testnet (NetworkMagic -> NetworkId)
-> GenT Identity NetworkMagic -> GenT Identity NetworkId
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity NetworkMagic
genNetworkMagic
]
genNetworkMagic :: Gen NetworkMagic
genNetworkMagic :: GenT Identity NetworkMagic
genNetworkMagic = Word32 -> NetworkMagic
NetworkMagic (Word32 -> NetworkMagic)
-> GenT Identity Word32 -> GenT Identity NetworkMagic
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Word32 -> GenT Identity Word32
forall (m :: * -> *). MonadGen m => Range Word32 -> m Word32
Gen.word32 Range Word32
forall a. (Bounded a, Num a) => Range a
Range.constantBounded
genOperationalCertificate :: Gen OperationalCertificate
genOperationalCertificate :: Gen OperationalCertificate
genOperationalCertificate = (OperationalCertificate, OperationalCertificateIssueCounter)
-> OperationalCertificate
forall a b. (a, b) -> a
fst ((OperationalCertificate, OperationalCertificateIssueCounter)
-> OperationalCertificate)
-> GenT
Identity
(OperationalCertificate, OperationalCertificateIssueCounter)
-> Gen OperationalCertificate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT
Identity
(OperationalCertificate, OperationalCertificateIssueCounter)
genOperationalCertificateWithCounter
genOperationalCertificateIssueCounter :: Gen OperationalCertificateIssueCounter
genOperationalCertificateIssueCounter :: Gen OperationalCertificateIssueCounter
genOperationalCertificateIssueCounter = (OperationalCertificate, OperationalCertificateIssueCounter)
-> OperationalCertificateIssueCounter
forall a b. (a, b) -> b
snd ((OperationalCertificate, OperationalCertificateIssueCounter)
-> OperationalCertificateIssueCounter)
-> GenT
Identity
(OperationalCertificate, OperationalCertificateIssueCounter)
-> Gen OperationalCertificateIssueCounter
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT
Identity
(OperationalCertificate, OperationalCertificateIssueCounter)
genOperationalCertificateWithCounter
genOperationalCertificateWithCounter :: Gen (OperationalCertificate, OperationalCertificateIssueCounter)
genOperationalCertificateWithCounter :: GenT
Identity
(OperationalCertificate, OperationalCertificateIssueCounter)
genOperationalCertificateWithCounter = do
VerificationKey KesKey
kesVKey <- AsType KesKey -> Gen (VerificationKey KesKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (VerificationKey keyrole)
genVerificationKey AsType KesKey
AsKesKey
Either
(SigningKey StakePoolKey) (SigningKey GenesisDelegateExtendedKey)
stkPoolOrGenDelExtSign <- GenT Identity (SigningKey StakePoolKey)
-> GenT Identity (SigningKey GenesisDelegateExtendedKey)
-> GenT
Identity
(Either
(SigningKey StakePoolKey) (SigningKey GenesisDelegateExtendedKey))
forall (m :: * -> *) a b.
MonadGen m =>
m a -> m b -> m (Either a b)
Gen.either (AsType StakePoolKey -> GenT Identity (SigningKey StakePoolKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType StakePoolKey
AsStakePoolKey) (AsType GenesisDelegateExtendedKey
-> GenT Identity (SigningKey GenesisDelegateExtendedKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType GenesisDelegateExtendedKey
AsGenesisDelegateExtendedKey)
KESPeriod
kesP <- Gen KESPeriod
genKESPeriod
Word64
c <- Range Word64 -> GenT Identity Word64
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Range Word64 -> GenT Identity Word64)
-> Range Word64 -> GenT Identity Word64
forall a b. (a -> b) -> a -> b
$ Word64 -> Word64 -> Range Word64
forall a. Integral a => a -> a -> Range a
Range.linear Word64
0 Word64
1000
let stakePoolVer :: VerificationKey StakePoolKey
stakePoolVer = (SigningKey StakePoolKey -> VerificationKey StakePoolKey)
-> (SigningKey GenesisDelegateExtendedKey
-> VerificationKey StakePoolKey)
-> Either
(SigningKey StakePoolKey) (SigningKey GenesisDelegateExtendedKey)
-> VerificationKey StakePoolKey
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either SigningKey StakePoolKey -> VerificationKey StakePoolKey
forall keyrole.
Key keyrole =>
SigningKey keyrole -> VerificationKey keyrole
getVerificationKey (VerificationKey GenesisDelegateExtendedKey
-> VerificationKey StakePoolKey
convert (VerificationKey GenesisDelegateExtendedKey
-> VerificationKey StakePoolKey)
-> (SigningKey GenesisDelegateExtendedKey
-> VerificationKey GenesisDelegateExtendedKey)
-> SigningKey GenesisDelegateExtendedKey
-> VerificationKey StakePoolKey
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. SigningKey GenesisDelegateExtendedKey
-> VerificationKey GenesisDelegateExtendedKey
forall keyrole.
Key keyrole =>
SigningKey keyrole -> VerificationKey keyrole
getVerificationKey) Either
(SigningKey StakePoolKey) (SigningKey GenesisDelegateExtendedKey)
stkPoolOrGenDelExtSign
iCounter :: OperationalCertificateIssueCounter
iCounter = Word64
-> VerificationKey StakePoolKey
-> OperationalCertificateIssueCounter
OperationalCertificateIssueCounter Word64
c VerificationKey StakePoolKey
stakePoolVer
case VerificationKey KesKey
-> Either
(SigningKey StakePoolKey) (SigningKey GenesisDelegateExtendedKey)
-> KESPeriod
-> OperationalCertificateIssueCounter
-> Either
OperationalCertIssueError
(OperationalCertificate, OperationalCertificateIssueCounter)
issueOperationalCertificate VerificationKey KesKey
kesVKey Either
(SigningKey StakePoolKey) (SigningKey GenesisDelegateExtendedKey)
stkPoolOrGenDelExtSign KESPeriod
kesP OperationalCertificateIssueCounter
iCounter of
Left OperationalCertIssueError
err -> String
-> GenT
Identity
(OperationalCertificate, OperationalCertificateIssueCounter)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String
-> GenT
Identity
(OperationalCertificate, OperationalCertificateIssueCounter))
-> String
-> GenT
Identity
(OperationalCertificate, OperationalCertificateIssueCounter)
forall a b. (a -> b) -> a -> b
$ OperationalCertIssueError -> String
forall e. Error e => e -> String
displayError OperationalCertIssueError
err
Right (OperationalCertificate, OperationalCertificateIssueCounter)
pair -> (OperationalCertificate, OperationalCertificateIssueCounter)
-> GenT
Identity
(OperationalCertificate, OperationalCertificateIssueCounter)
forall (m :: * -> *) a. Monad m => a -> m a
return (OperationalCertificate, OperationalCertificateIssueCounter)
pair
where
convert :: VerificationKey GenesisDelegateExtendedKey
-> VerificationKey StakePoolKey
convert :: VerificationKey GenesisDelegateExtendedKey
-> VerificationKey StakePoolKey
convert = (VerificationKey GenesisDelegateKey -> VerificationKey StakePoolKey
forall keyroleA keyroleB.
CastVerificationKeyRole keyroleA keyroleB =>
VerificationKey keyroleA -> VerificationKey keyroleB
castVerificationKey :: VerificationKey GenesisDelegateKey
-> VerificationKey StakePoolKey)
(VerificationKey GenesisDelegateKey
-> VerificationKey StakePoolKey)
-> (VerificationKey GenesisDelegateExtendedKey
-> VerificationKey GenesisDelegateKey)
-> VerificationKey GenesisDelegateExtendedKey
-> VerificationKey StakePoolKey
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (VerificationKey GenesisDelegateExtendedKey
-> VerificationKey GenesisDelegateKey
forall keyroleA keyroleB.
CastVerificationKeyRole keyroleA keyroleB =>
VerificationKey keyroleA -> VerificationKey keyroleB
castVerificationKey :: VerificationKey GenesisDelegateExtendedKey
-> VerificationKey GenesisDelegateKey)
genPaymentCredential :: Gen PaymentCredential
genPaymentCredential :: GenT Identity PaymentCredential
genPaymentCredential = do
VerificationKey PaymentKey
vKey <- AsType PaymentKey -> GenT Identity (VerificationKey PaymentKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (VerificationKey keyrole)
genVerificationKey AsType PaymentKey
AsPaymentKey
PaymentCredential -> GenT Identity PaymentCredential
forall (m :: * -> *) a. Monad m => a -> m a
return (PaymentCredential -> GenT Identity PaymentCredential)
-> (Hash PaymentKey -> PaymentCredential)
-> Hash PaymentKey
-> GenT Identity PaymentCredential
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Hash PaymentKey -> PaymentCredential
PaymentCredentialByKey (Hash PaymentKey -> GenT Identity PaymentCredential)
-> Hash PaymentKey -> GenT Identity PaymentCredential
forall a b. (a -> b) -> a -> b
$ VerificationKey PaymentKey -> Hash PaymentKey
forall keyrole.
Key keyrole =>
VerificationKey keyrole -> Hash keyrole
verificationKeyHash VerificationKey PaymentKey
vKey
genSigningKey :: Key keyrole => AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey :: AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType keyrole
roletoken = do
Seed
seed <- Int -> Gen Seed
genSeed (Word -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
seedSize)
let sk :: SigningKey keyrole
sk = AsType keyrole -> Seed -> SigningKey keyrole
forall keyrole.
Key keyrole =>
AsType keyrole -> Seed -> SigningKey keyrole
deterministicSigningKey AsType keyrole
roletoken Seed
seed
SigningKey keyrole -> Gen (SigningKey keyrole)
forall (m :: * -> *) a. Monad m => a -> m a
return SigningKey keyrole
sk
where
seedSize :: Word
seedSize :: Word
seedSize = AsType keyrole -> Word
forall keyrole. Key keyrole => AsType keyrole -> Word
deterministicSigningKeySeedSize AsType keyrole
roletoken
genStakeAddress :: Gen StakeAddress
genStakeAddress :: Gen StakeAddress
genStakeAddress = NetworkId -> StakeCredential -> StakeAddress
makeStakeAddress (NetworkId -> StakeCredential -> StakeAddress)
-> GenT Identity NetworkId
-> GenT Identity (StakeCredential -> StakeAddress)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity NetworkId
genNetworkId GenT Identity (StakeCredential -> StakeAddress)
-> GenT Identity StakeCredential -> Gen StakeAddress
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity StakeCredential
genStakeCredential
genStakeAddressReference :: Gen StakeAddressReference
genStakeAddressReference :: GenT Identity StakeAddressReference
genStakeAddressReference =
[GenT Identity StakeAddressReference]
-> GenT Identity StakeAddressReference
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ StakeCredential -> StakeAddressReference
StakeAddressByValue (StakeCredential -> StakeAddressReference)
-> GenT Identity StakeCredential
-> GenT Identity StakeAddressReference
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity StakeCredential
genStakeCredential
, StakeAddressReference -> GenT Identity StakeAddressReference
forall (m :: * -> *) a. Monad m => a -> m a
return StakeAddressReference
NoStakeAddress
]
genStakeCredential :: Gen StakeCredential
genStakeCredential :: GenT Identity StakeCredential
genStakeCredential = do
VerificationKey StakeKey
vKey <- AsType StakeKey -> Gen (VerificationKey StakeKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (VerificationKey keyrole)
genVerificationKey AsType StakeKey
AsStakeKey
StakeCredential -> GenT Identity StakeCredential
forall (m :: * -> *) a. Monad m => a -> m a
return (StakeCredential -> GenT Identity StakeCredential)
-> (Hash StakeKey -> StakeCredential)
-> Hash StakeKey
-> GenT Identity StakeCredential
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Hash StakeKey -> StakeCredential
StakeCredentialByKey (Hash StakeKey -> GenT Identity StakeCredential)
-> Hash StakeKey -> GenT Identity StakeCredential
forall a b. (a -> b) -> a -> b
$ VerificationKey StakeKey -> Hash StakeKey
forall keyrole.
Key keyrole =>
VerificationKey keyrole -> Hash keyrole
verificationKeyHash VerificationKey StakeKey
vKey
genSophieHash :: Gen (Crypto.Hash Crypto.Blake2b_256 Ledger.EraIndependentTxBody)
genSophieHash :: Gen (Hash Blake2b_256 EraIndependentTxBody)
genSophieHash = Hash Blake2b_256 EraIndependentTxBody
-> Gen (Hash Blake2b_256 EraIndependentTxBody)
forall (m :: * -> *) a. Monad m => a -> m a
return (Hash Blake2b_256 EraIndependentTxBody
-> Gen (Hash Blake2b_256 EraIndependentTxBody))
-> (Hash Blake2b_256 () -> Hash Blake2b_256 EraIndependentTxBody)
-> Hash Blake2b_256 ()
-> Gen (Hash Blake2b_256 EraIndependentTxBody)
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Hash Blake2b_256 () -> Hash Blake2b_256 EraIndependentTxBody
forall h a b. Hash h a -> Hash h b
Crypto.castHash (Hash Blake2b_256 ()
-> Gen (Hash Blake2b_256 EraIndependentTxBody))
-> Hash Blake2b_256 ()
-> Gen (Hash Blake2b_256 EraIndependentTxBody)
forall a b. (a -> b) -> a -> b
$ (() -> ByteString) -> () -> Hash Blake2b_256 ()
forall h a. HashAlgorithm h => (a -> ByteString) -> a -> Hash h a
Crypto.hashWith () -> ByteString
forall a. ToCBOR a => a -> ByteString
CBOR.serialize' ()
genSlotNo :: Gen SlotNo
genSlotNo :: GenT Identity SlotNo
genSlotNo = Word64 -> SlotNo
SlotNo (Word64 -> SlotNo) -> GenT Identity Word64 -> GenT Identity SlotNo
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Word64 -> GenT Identity Word64
forall (m :: * -> *). MonadGen m => Range Word64 -> m Word64
Gen.word64 Range Word64
forall a. (Bounded a, Num a) => Range a
Range.constantBounded
genTxIn :: Gen TxIn
genTxIn :: Gen TxIn
genTxIn = TxId -> TxIx -> TxIn
TxIn (TxId -> TxIx -> TxIn)
-> GenT Identity TxId -> GenT Identity (TxIx -> TxIn)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity TxId
genTxId GenT Identity (TxIx -> TxIn) -> GenT Identity TxIx -> Gen TxIn
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity TxIx
genTxIndex
genTxId :: Gen TxId
genTxId :: GenT Identity TxId
genTxId = Hash StandardCrypto EraIndependentTxBody -> TxId
Hash Blake2b_256 EraIndependentTxBody -> TxId
TxId (Hash Blake2b_256 EraIndependentTxBody -> TxId)
-> Gen (Hash Blake2b_256 EraIndependentTxBody)
-> GenT Identity TxId
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (Hash Blake2b_256 EraIndependentTxBody)
genSophieHash
genTxIndex :: Gen TxIx
genTxIndex :: GenT Identity TxIx
genTxIndex = Word -> TxIx
TxIx (Word -> TxIx) -> GenT Identity Word -> GenT Identity TxIx
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Word -> GenT Identity Word
forall (m :: * -> *). MonadGen m => Range Word -> m Word
Gen.word Range Word
forall a. (Bounded a, Num a) => Range a
Range.constantBounded
genTxOutValue :: BccEra era -> Gen (TxOutValue era)
genTxOutValue :: BccEra era -> Gen (TxOutValue era)
genTxOutValue BccEra era
era =
case BccEra era
-> Either
(OnlyBccSupportedInEra era) (MultiAssetSupportedInEra era)
forall era.
BccEra era
-> Either
(OnlyBccSupportedInEra era) (MultiAssetSupportedInEra era)
multiAssetSupportedInEra BccEra era
era of
Left OnlyBccSupportedInEra era
bccOnlyInEra -> OnlyBccSupportedInEra era -> Entropic -> TxOutValue era
forall era. OnlyBccSupportedInEra era -> Entropic -> TxOutValue era
TxOutBccOnly OnlyBccSupportedInEra era
bccOnlyInEra (Entropic -> TxOutValue era)
-> Gen Entropic -> Gen (TxOutValue era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Entropic
genEntropic
Right MultiAssetSupportedInEra era
multiAssetInEra -> MultiAssetSupportedInEra era -> Value -> TxOutValue era
forall era. MultiAssetSupportedInEra era -> Value -> TxOutValue era
TxOutValue MultiAssetSupportedInEra era
multiAssetInEra (Value -> TxOutValue era) -> Gen Value -> Gen (TxOutValue era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Value
genValueForTxOut
genTxOut :: BccEra era -> Gen (TxOut era)
genTxOut :: BccEra era -> Gen (TxOut era)
genTxOut BccEra era
era =
AddressInEra era
-> TxOutValue era -> TxOutDatumHash era -> TxOut era
forall era.
AddressInEra era
-> TxOutValue era -> TxOutDatumHash era -> TxOut era
TxOut (AddressInEra era
-> TxOutValue era -> TxOutDatumHash era -> TxOut era)
-> GenT Identity (AddressInEra era)
-> GenT
Identity (TxOutValue era -> TxOutDatumHash era -> TxOut era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BccEra era -> GenT Identity (AddressInEra era)
forall era. BccEra era -> Gen (AddressInEra era)
genAddressInEra BccEra era
era
GenT Identity (TxOutValue era -> TxOutDatumHash era -> TxOut era)
-> GenT Identity (TxOutValue era)
-> GenT Identity (TxOutDatumHash era -> TxOut era)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BccEra era -> GenT Identity (TxOutValue era)
forall era. BccEra era -> Gen (TxOutValue era)
genTxOutValue BccEra era
era
GenT Identity (TxOutDatumHash era -> TxOut era)
-> GenT Identity (TxOutDatumHash era) -> Gen (TxOut era)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BccEra era -> GenT Identity (TxOutDatumHash era)
forall era. BccEra era -> Gen (TxOutDatumHash era)
genTxOutDatumHash BccEra era
era
genUTxO :: BccEra era -> Gen (UTxO era)
genUTxO :: BccEra era -> Gen (UTxO era)
genUTxO BccEra era
era =
Map TxIn (TxOut era) -> UTxO era
forall era. Map TxIn (TxOut era) -> UTxO era
UTxO (Map TxIn (TxOut era) -> UTxO era)
-> GenT Identity (Map TxIn (TxOut era)) -> Gen (UTxO era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int
-> GenT Identity (TxIn, TxOut era)
-> GenT Identity (Map TxIn (TxOut era))
forall (m :: * -> *) k v.
(MonadGen m, Ord k) =>
Range Int -> m (k, v) -> m (Map k v)
Gen.map (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
0 Int
5) ((,) (TxIn -> TxOut era -> (TxIn, TxOut era))
-> Gen TxIn -> GenT Identity (TxOut era -> (TxIn, TxOut era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen TxIn
genTxIn GenT Identity (TxOut era -> (TxIn, TxOut era))
-> GenT Identity (TxOut era) -> GenT Identity (TxIn, TxOut era)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BccEra era -> GenT Identity (TxOut era)
forall era. BccEra era -> Gen (TxOut era)
genTxOut BccEra era
era)
genTtl :: Gen SlotNo
genTtl :: GenT Identity SlotNo
genTtl = GenT Identity SlotNo
genSlotNo
genTxValidityLowerBound :: BccEra era -> Gen (TxValidityLowerBound era)
genTxValidityLowerBound :: BccEra era -> Gen (TxValidityLowerBound era)
genTxValidityLowerBound BccEra era
era =
case BccEra era -> Maybe (ValidityLowerBoundSupportedInEra era)
forall era.
BccEra era -> Maybe (ValidityLowerBoundSupportedInEra era)
validityLowerBoundSupportedInEra BccEra era
era of
Maybe (ValidityLowerBoundSupportedInEra era)
Nothing -> TxValidityLowerBound era -> Gen (TxValidityLowerBound era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxValidityLowerBound era
forall era. TxValidityLowerBound era
TxValidityNoLowerBound
Just ValidityLowerBoundSupportedInEra era
supported -> ValidityLowerBoundSupportedInEra era
-> SlotNo -> TxValidityLowerBound era
forall era.
ValidityLowerBoundSupportedInEra era
-> SlotNo -> TxValidityLowerBound era
TxValidityLowerBound ValidityLowerBoundSupportedInEra era
supported (SlotNo -> TxValidityLowerBound era)
-> GenT Identity SlotNo -> Gen (TxValidityLowerBound era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity SlotNo
genTtl
genTxValidityUpperBound :: BccEra era -> Gen (TxValidityUpperBound era)
genTxValidityUpperBound :: BccEra era -> Gen (TxValidityUpperBound era)
genTxValidityUpperBound BccEra era
era =
case (BccEra era -> Maybe (ValidityUpperBoundSupportedInEra era)
forall era.
BccEra era -> Maybe (ValidityUpperBoundSupportedInEra era)
validityUpperBoundSupportedInEra BccEra era
era,
BccEra era -> Maybe (ValidityNoUpperBoundSupportedInEra era)
forall era.
BccEra era -> Maybe (ValidityNoUpperBoundSupportedInEra era)
validityNoUpperBoundSupportedInEra BccEra era
era) of
(Just ValidityUpperBoundSupportedInEra era
supported, Maybe (ValidityNoUpperBoundSupportedInEra era)
_) ->
ValidityUpperBoundSupportedInEra era
-> SlotNo -> TxValidityUpperBound era
forall era.
ValidityUpperBoundSupportedInEra era
-> SlotNo -> TxValidityUpperBound era
TxValidityUpperBound ValidityUpperBoundSupportedInEra era
supported (SlotNo -> TxValidityUpperBound era)
-> GenT Identity SlotNo -> Gen (TxValidityUpperBound era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity SlotNo
genTtl
(Maybe (ValidityUpperBoundSupportedInEra era)
Nothing, Just ValidityNoUpperBoundSupportedInEra era
supported) ->
TxValidityUpperBound era -> Gen (TxValidityUpperBound era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ValidityNoUpperBoundSupportedInEra era -> TxValidityUpperBound era
forall era.
ValidityNoUpperBoundSupportedInEra era -> TxValidityUpperBound era
TxValidityNoUpperBound ValidityNoUpperBoundSupportedInEra era
supported)
(Maybe (ValidityUpperBoundSupportedInEra era)
Nothing, Maybe (ValidityNoUpperBoundSupportedInEra era)
Nothing) ->
Text -> Gen (TxValidityUpperBound era)
forall a. HasCallStack => Text -> a
panic Text
"genTxValidityUpperBound: unexpected era support combination"
genTxValidityRange
:: BccEra era
-> Gen (TxValidityLowerBound era, TxValidityUpperBound era)
genTxValidityRange :: BccEra era
-> Gen (TxValidityLowerBound era, TxValidityUpperBound era)
genTxValidityRange BccEra era
era =
(,)
(TxValidityLowerBound era
-> TxValidityUpperBound era
-> (TxValidityLowerBound era, TxValidityUpperBound era))
-> GenT Identity (TxValidityLowerBound era)
-> GenT
Identity
(TxValidityUpperBound era
-> (TxValidityLowerBound era, TxValidityUpperBound era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BccEra era -> GenT Identity (TxValidityLowerBound era)
forall era. BccEra era -> Gen (TxValidityLowerBound era)
genTxValidityLowerBound BccEra era
era
GenT
Identity
(TxValidityUpperBound era
-> (TxValidityLowerBound era, TxValidityUpperBound era))
-> GenT Identity (TxValidityUpperBound era)
-> Gen (TxValidityLowerBound era, TxValidityUpperBound era)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BccEra era -> GenT Identity (TxValidityUpperBound era)
forall era. BccEra era -> Gen (TxValidityUpperBound era)
genTxValidityUpperBound BccEra era
era
genTxMetadataInEra :: BccEra era -> Gen (TxMetadataInEra era)
genTxMetadataInEra :: BccEra era -> Gen (TxMetadataInEra era)
genTxMetadataInEra BccEra era
era =
case BccEra era -> Maybe (TxMetadataSupportedInEra era)
forall era. BccEra era -> Maybe (TxMetadataSupportedInEra era)
txMetadataSupportedInEra BccEra era
era of
Maybe (TxMetadataSupportedInEra era)
Nothing -> TxMetadataInEra era -> Gen (TxMetadataInEra era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxMetadataInEra era
forall era. TxMetadataInEra era
TxMetadataNone
Just TxMetadataSupportedInEra era
supported ->
[Gen (TxMetadataInEra era)] -> Gen (TxMetadataInEra era)
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ TxMetadataInEra era -> Gen (TxMetadataInEra era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxMetadataInEra era
forall era. TxMetadataInEra era
TxMetadataNone
, TxMetadataSupportedInEra era -> TxMetadata -> TxMetadataInEra era
forall era.
TxMetadataSupportedInEra era -> TxMetadata -> TxMetadataInEra era
TxMetadataInEra TxMetadataSupportedInEra era
supported (TxMetadata -> TxMetadataInEra era)
-> GenT Identity TxMetadata -> Gen (TxMetadataInEra era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity TxMetadata
genTxMetadata
]
genTxAuxScripts :: BccEra era -> Gen (TxAuxScripts era)
genTxAuxScripts :: BccEra era -> Gen (TxAuxScripts era)
genTxAuxScripts BccEra era
era =
case BccEra era -> Maybe (AuxScriptsSupportedInEra era)
forall era. BccEra era -> Maybe (AuxScriptsSupportedInEra era)
auxScriptsSupportedInEra BccEra era
era of
Maybe (AuxScriptsSupportedInEra era)
Nothing -> TxAuxScripts era -> Gen (TxAuxScripts era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxAuxScripts era
forall era. TxAuxScripts era
TxAuxScriptsNone
Just AuxScriptsSupportedInEra era
supported ->
AuxScriptsSupportedInEra era
-> [ScriptInEra era] -> TxAuxScripts era
forall era.
AuxScriptsSupportedInEra era
-> [ScriptInEra era] -> TxAuxScripts era
TxAuxScripts AuxScriptsSupportedInEra era
supported ([ScriptInEra era] -> TxAuxScripts era)
-> GenT Identity [ScriptInEra era] -> Gen (TxAuxScripts era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
Range Int
-> GenT Identity (ScriptInEra era)
-> GenT Identity [ScriptInEra era]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
3)
(BccEra era -> GenT Identity (ScriptInEra era)
forall era. BccEra era -> Gen (ScriptInEra era)
genScriptInEra BccEra era
era)
genTxWithdrawals :: BccEra era -> Gen (TxWithdrawals BuildTx era)
genTxWithdrawals :: BccEra era -> Gen (TxWithdrawals BuildTx era)
genTxWithdrawals BccEra era
era =
case BccEra era -> Maybe (WithdrawalsSupportedInEra era)
forall era. BccEra era -> Maybe (WithdrawalsSupportedInEra era)
withdrawalsSupportedInEra BccEra era
era of
Maybe (WithdrawalsSupportedInEra era)
Nothing -> TxWithdrawals BuildTx era -> Gen (TxWithdrawals BuildTx era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxWithdrawals BuildTx era
forall build era. TxWithdrawals build era
TxWithdrawalsNone
Just WithdrawalsSupportedInEra era
supported ->
[Gen (TxWithdrawals BuildTx era)]
-> Gen (TxWithdrawals BuildTx era)
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ TxWithdrawals BuildTx era -> Gen (TxWithdrawals BuildTx era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxWithdrawals BuildTx era
forall build era. TxWithdrawals build era
TxWithdrawalsNone
, TxWithdrawals BuildTx era -> Gen (TxWithdrawals BuildTx era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (WithdrawalsSupportedInEra era
-> [(StakeAddress, Entropic,
BuildTxWith BuildTx (Witness WitCtxStake era))]
-> TxWithdrawals BuildTx era
forall era build.
WithdrawalsSupportedInEra era
-> [(StakeAddress, Entropic,
BuildTxWith build (Witness WitCtxStake era))]
-> TxWithdrawals build era
TxWithdrawals WithdrawalsSupportedInEra era
supported [(StakeAddress, Entropic,
BuildTxWith BuildTx (Witness WitCtxStake era))]
forall a. Monoid a => a
mempty)
]
genTxCertificates :: BccEra era -> Gen (TxCertificates BuildTx era)
genTxCertificates :: BccEra era -> Gen (TxCertificates BuildTx era)
genTxCertificates BccEra era
era =
case BccEra era -> Maybe (CertificatesSupportedInEra era)
forall era. BccEra era -> Maybe (CertificatesSupportedInEra era)
certificatesSupportedInEra BccEra era
era of
Maybe (CertificatesSupportedInEra era)
Nothing -> TxCertificates BuildTx era -> Gen (TxCertificates BuildTx era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxCertificates BuildTx era
forall build era. TxCertificates build era
TxCertificatesNone
Just CertificatesSupportedInEra era
supported -> do
[Certificate]
certs <- Range Int
-> GenT Identity Certificate -> GenT Identity [Certificate]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
0 Int
3) GenT Identity Certificate
genCertificate
[Gen (TxCertificates BuildTx era)]
-> Gen (TxCertificates BuildTx era)
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ TxCertificates BuildTx era -> Gen (TxCertificates BuildTx era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxCertificates BuildTx era
forall build era. TxCertificates build era
TxCertificatesNone
, TxCertificates BuildTx era -> Gen (TxCertificates BuildTx era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (CertificatesSupportedInEra era
-> [Certificate]
-> BuildTxWith
BuildTx (Map StakeCredential (Witness WitCtxStake era))
-> TxCertificates BuildTx era
forall era build.
CertificatesSupportedInEra era
-> [Certificate]
-> BuildTxWith
build (Map StakeCredential (Witness WitCtxStake era))
-> TxCertificates build era
TxCertificates CertificatesSupportedInEra era
supported [Certificate]
certs (BuildTxWith
BuildTx (Map StakeCredential (Witness WitCtxStake era))
-> TxCertificates BuildTx era)
-> BuildTxWith
BuildTx (Map StakeCredential (Witness WitCtxStake era))
-> TxCertificates BuildTx era
forall a b. (a -> b) -> a -> b
$ Map StakeCredential (Witness WitCtxStake era)
-> BuildTxWith
BuildTx (Map StakeCredential (Witness WitCtxStake era))
forall a. a -> BuildTxWith BuildTx a
BuildTxWith Map StakeCredential (Witness WitCtxStake era)
forall a. Monoid a => a
mempty)
]
genCertificate :: Gen Certificate
genCertificate :: GenT Identity Certificate
genCertificate =
[GenT Identity Certificate] -> GenT Identity Certificate
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ StakeCredential -> Certificate
StakeAddressRegistrationCertificate (StakeCredential -> Certificate)
-> GenT Identity StakeCredential -> GenT Identity Certificate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity StakeCredential
genStakeCredential
, StakeCredential -> Certificate
StakeAddressDeregistrationCertificate (StakeCredential -> Certificate)
-> GenT Identity StakeCredential -> GenT Identity Certificate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity StakeCredential
genStakeCredential
]
genTxUpdateProposal :: BccEra era -> Gen (TxUpdateProposal era)
genTxUpdateProposal :: BccEra era -> Gen (TxUpdateProposal era)
genTxUpdateProposal BccEra era
era =
case BccEra era -> Maybe (UpdateProposalSupportedInEra era)
forall era. BccEra era -> Maybe (UpdateProposalSupportedInEra era)
updateProposalSupportedInEra BccEra era
era of
Maybe (UpdateProposalSupportedInEra era)
Nothing -> TxUpdateProposal era -> Gen (TxUpdateProposal era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxUpdateProposal era
forall era. TxUpdateProposal era
TxUpdateProposalNone
Just UpdateProposalSupportedInEra era
supported ->
[Gen (TxUpdateProposal era)] -> Gen (TxUpdateProposal era)
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ TxUpdateProposal era -> Gen (TxUpdateProposal era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxUpdateProposal era
forall era. TxUpdateProposal era
TxUpdateProposalNone
, UpdateProposalSupportedInEra era
-> UpdateProposal -> TxUpdateProposal era
forall era.
UpdateProposalSupportedInEra era
-> UpdateProposal -> TxUpdateProposal era
TxUpdateProposal UpdateProposalSupportedInEra era
supported (UpdateProposal -> TxUpdateProposal era)
-> GenT Identity UpdateProposal -> Gen (TxUpdateProposal era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity UpdateProposal
genUpdateProposal
]
genTxMintValue :: BccEra era -> Gen (TxMintValue BuildTx era)
genTxMintValue :: BccEra era -> Gen (TxMintValue BuildTx era)
genTxMintValue BccEra era
era =
case BccEra era
-> Either
(OnlyBccSupportedInEra era) (MultiAssetSupportedInEra era)
forall era.
BccEra era
-> Either
(OnlyBccSupportedInEra era) (MultiAssetSupportedInEra era)
multiAssetSupportedInEra BccEra era
era of
Left OnlyBccSupportedInEra era
_ -> TxMintValue BuildTx era -> Gen (TxMintValue BuildTx era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxMintValue BuildTx era
forall build era. TxMintValue build era
TxMintNone
Right MultiAssetSupportedInEra era
supported ->
[Gen (TxMintValue BuildTx era)] -> Gen (TxMintValue BuildTx era)
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ TxMintValue BuildTx era -> Gen (TxMintValue BuildTx era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxMintValue BuildTx era
forall build era. TxMintValue build era
TxMintNone
, MultiAssetSupportedInEra era
-> Value
-> BuildTxWith
BuildTx (Map PolicyId (ScriptWitness WitCtxMint era))
-> TxMintValue BuildTx era
forall era build.
MultiAssetSupportedInEra era
-> Value
-> BuildTxWith build (Map PolicyId (ScriptWitness WitCtxMint era))
-> TxMintValue build era
TxMintValue MultiAssetSupportedInEra era
supported (Value
-> BuildTxWith
BuildTx (Map PolicyId (ScriptWitness WitCtxMint era))
-> TxMintValue BuildTx era)
-> Gen Value
-> GenT
Identity
(BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint era))
-> TxMintValue BuildTx era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Value
genValueForMinting GenT
Identity
(BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint era))
-> TxMintValue BuildTx era)
-> GenT
Identity
(BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint era)))
-> Gen (TxMintValue BuildTx era)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint era))
-> GenT
Identity
(BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint era)))
forall (m :: * -> *) a. Monad m => a -> m a
return (Map PolicyId (ScriptWitness WitCtxMint era)
-> BuildTxWith
BuildTx (Map PolicyId (ScriptWitness WitCtxMint era))
forall a. a -> BuildTxWith BuildTx a
BuildTxWith Map PolicyId (ScriptWitness WitCtxMint era)
forall a. Monoid a => a
mempty)
]
genTxBodyContent :: BccEra era -> Gen (TxBodyContent BuildTx era)
genTxBodyContent :: BccEra era -> Gen (TxBodyContent BuildTx era)
genTxBodyContent BccEra era
era = do
[(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn era))]
txIns <- (TxIn -> (TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn era)))
-> [TxIn] -> [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn era))]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
map (, Witness WitCtxTxIn era
-> BuildTxWith BuildTx (Witness WitCtxTxIn era)
forall a. a -> BuildTxWith BuildTx a
BuildTxWith (KeyWitnessInCtx WitCtxTxIn -> Witness WitCtxTxIn era
forall witctx era. KeyWitnessInCtx witctx -> Witness witctx era
KeyWitness KeyWitnessInCtx WitCtxTxIn
KeyWitnessForSpending)) ([TxIn] -> [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn era))])
-> GenT Identity [TxIn]
-> GenT
Identity [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn era))]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int -> Gen TxIn -> GenT Identity [TxIn]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
1 Int
10) Gen TxIn
genTxIn
TxInsCollateral era
txInsCollateral <- BccEra era -> Gen (TxInsCollateral era)
forall era. BccEra era -> Gen (TxInsCollateral era)
genTxInsCollateral BccEra era
era
[TxOut era]
txOuts <- Range Int -> GenT Identity (TxOut era) -> GenT Identity [TxOut era]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
1 Int
10) (BccEra era -> GenT Identity (TxOut era)
forall era. BccEra era -> Gen (TxOut era)
genTxOut BccEra era
era)
TxFee era
txFee <- BccEra era -> Gen (TxFee era)
forall era. BccEra era -> Gen (TxFee era)
genTxFee BccEra era
era
(TxValidityLowerBound era, TxValidityUpperBound era)
txValidityRange <- BccEra era
-> Gen (TxValidityLowerBound era, TxValidityUpperBound era)
forall era.
BccEra era
-> Gen (TxValidityLowerBound era, TxValidityUpperBound era)
genTxValidityRange BccEra era
era
TxMetadataInEra era
txMetadata <- BccEra era -> Gen (TxMetadataInEra era)
forall era. BccEra era -> Gen (TxMetadataInEra era)
genTxMetadataInEra BccEra era
era
TxAuxScripts era
txAuxScripts <- BccEra era -> Gen (TxAuxScripts era)
forall era. BccEra era -> Gen (TxAuxScripts era)
genTxAuxScripts BccEra era
era
let txExtraScriptData :: BuildTxWith BuildTx (TxExtraScriptData era)
txExtraScriptData = TxExtraScriptData era
-> BuildTxWith BuildTx (TxExtraScriptData era)
forall a. a -> BuildTxWith BuildTx a
BuildTxWith TxExtraScriptData era
forall era. TxExtraScriptData era
TxExtraScriptDataNone
let txExtraKeyWits :: TxExtraKeyWitnesses era
txExtraKeyWits = TxExtraKeyWitnesses era
forall era. TxExtraKeyWitnesses era
TxExtraKeyWitnessesNone
BuildTxWith BuildTx (Maybe ProtocolParameters)
txProtocolParams <- Maybe ProtocolParameters
-> BuildTxWith BuildTx (Maybe ProtocolParameters)
forall a. a -> BuildTxWith BuildTx a
BuildTxWith (Maybe ProtocolParameters
-> BuildTxWith BuildTx (Maybe ProtocolParameters))
-> GenT Identity (Maybe ProtocolParameters)
-> GenT Identity (BuildTxWith BuildTx (Maybe ProtocolParameters))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity ProtocolParameters
-> GenT Identity (Maybe ProtocolParameters)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe GenT Identity ProtocolParameters
genProtocolParameters
TxWithdrawals BuildTx era
txWithdrawals <- BccEra era -> Gen (TxWithdrawals BuildTx era)
forall era. BccEra era -> Gen (TxWithdrawals BuildTx era)
genTxWithdrawals BccEra era
era
TxCertificates BuildTx era
txCertificates <- BccEra era -> Gen (TxCertificates BuildTx era)
forall era. BccEra era -> Gen (TxCertificates BuildTx era)
genTxCertificates BccEra era
era
TxUpdateProposal era
txUpdateProposal <- BccEra era -> Gen (TxUpdateProposal era)
forall era. BccEra era -> Gen (TxUpdateProposal era)
genTxUpdateProposal BccEra era
era
TxMintValue BuildTx era
txMintValue <- BccEra era -> Gen (TxMintValue BuildTx era)
forall era. BccEra era -> Gen (TxMintValue BuildTx era)
genTxMintValue BccEra era
era
TxScriptValidity era
txScriptValidity <- BccEra era -> Gen (TxScriptValidity era)
forall era. BccEra era -> Gen (TxScriptValidity era)
genTxScriptValidity BccEra era
era
TxBodyContent BuildTx era -> Gen (TxBodyContent BuildTx era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxBodyContent BuildTx era -> Gen (TxBodyContent BuildTx era))
-> TxBodyContent BuildTx era -> Gen (TxBodyContent BuildTx era)
forall a b. (a -> b) -> a -> b
$ TxBodyContent :: forall build era.
TxIns build era
-> TxInsCollateral era
-> [TxOut era]
-> TxFee era
-> (TxValidityLowerBound era, TxValidityUpperBound era)
-> TxMetadataInEra era
-> TxAuxScripts era
-> BuildTxWith build (TxExtraScriptData era)
-> TxExtraKeyWitnesses era
-> BuildTxWith build (Maybe ProtocolParameters)
-> TxWithdrawals build era
-> TxCertificates build era
-> TxUpdateProposal era
-> TxMintValue build era
-> TxScriptValidity era
-> TxBodyContent build era
TxBodyContent
{ [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn era))]
txIns :: [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn era))]
txIns :: [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn era))]
Api.txIns
, TxInsCollateral era
txInsCollateral :: TxInsCollateral era
txInsCollateral :: TxInsCollateral era
Api.txInsCollateral
, [TxOut era]
txOuts :: [TxOut era]
txOuts :: [TxOut era]
Api.txOuts
, TxFee era
txFee :: TxFee era
txFee :: TxFee era
Api.txFee
, (TxValidityLowerBound era, TxValidityUpperBound era)
txValidityRange :: (TxValidityLowerBound era, TxValidityUpperBound era)
txValidityRange :: (TxValidityLowerBound era, TxValidityUpperBound era)
Api.txValidityRange
, TxMetadataInEra era
txMetadata :: TxMetadataInEra era
txMetadata :: TxMetadataInEra era
Api.txMetadata
, TxAuxScripts era
txAuxScripts :: TxAuxScripts era
txAuxScripts :: TxAuxScripts era
Api.txAuxScripts
, BuildTxWith BuildTx (TxExtraScriptData era)
forall era. BuildTxWith BuildTx (TxExtraScriptData era)
txExtraScriptData :: BuildTxWith BuildTx (TxExtraScriptData era)
txExtraScriptData :: forall era. BuildTxWith BuildTx (TxExtraScriptData era)
Api.txExtraScriptData
, TxExtraKeyWitnesses era
forall era. TxExtraKeyWitnesses era
txExtraKeyWits :: TxExtraKeyWitnesses era
txExtraKeyWits :: forall era. TxExtraKeyWitnesses era
Api.txExtraKeyWits
, BuildTxWith BuildTx (Maybe ProtocolParameters)
txProtocolParams :: BuildTxWith BuildTx (Maybe ProtocolParameters)
txProtocolParams :: BuildTxWith BuildTx (Maybe ProtocolParameters)
Api.txProtocolParams
, TxWithdrawals BuildTx era
txWithdrawals :: TxWithdrawals BuildTx era
txWithdrawals :: TxWithdrawals BuildTx era
Api.txWithdrawals
, TxCertificates BuildTx era
txCertificates :: TxCertificates BuildTx era
txCertificates :: TxCertificates BuildTx era
Api.txCertificates
, TxUpdateProposal era
txUpdateProposal :: TxUpdateProposal era
txUpdateProposal :: TxUpdateProposal era
Api.txUpdateProposal
, TxMintValue BuildTx era
txMintValue :: TxMintValue BuildTx era
txMintValue :: TxMintValue BuildTx era
Api.txMintValue
, TxScriptValidity era
txScriptValidity :: TxScriptValidity era
txScriptValidity :: TxScriptValidity era
Api.txScriptValidity
}
genTxInsCollateral :: BccEra era -> Gen (TxInsCollateral era)
genTxInsCollateral :: BccEra era -> Gen (TxInsCollateral era)
genTxInsCollateral BccEra era
era =
case BccEra era -> Maybe (CollateralSupportedInEra era)
forall era. BccEra era -> Maybe (CollateralSupportedInEra era)
collateralSupportedInEra BccEra era
era of
Maybe (CollateralSupportedInEra era)
Nothing -> TxInsCollateral era -> Gen (TxInsCollateral era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxInsCollateral era
forall era. TxInsCollateral era
TxInsCollateralNone
Just CollateralSupportedInEra era
supported -> [Gen (TxInsCollateral era)] -> Gen (TxInsCollateral era)
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ TxInsCollateral era -> Gen (TxInsCollateral era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxInsCollateral era
forall era. TxInsCollateral era
TxInsCollateralNone
, CollateralSupportedInEra era -> [TxIn] -> TxInsCollateral era
forall era.
CollateralSupportedInEra era -> [TxIn] -> TxInsCollateral era
TxInsCollateral CollateralSupportedInEra era
supported ([TxIn] -> TxInsCollateral era)
-> GenT Identity [TxIn] -> Gen (TxInsCollateral era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int -> Gen TxIn -> GenT Identity [TxIn]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
10) Gen TxIn
genTxIn
]
genTxFee :: BccEra era -> Gen (TxFee era)
genTxFee :: BccEra era -> Gen (TxFee era)
genTxFee BccEra era
era =
case BccEra era
-> Either (TxFeesImplicitInEra era) (TxFeesExplicitInEra era)
forall era.
BccEra era
-> Either (TxFeesImplicitInEra era) (TxFeesExplicitInEra era)
txFeesExplicitInEra BccEra era
era of
Left TxFeesImplicitInEra era
supported -> TxFee era -> Gen (TxFee era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxFeesImplicitInEra era -> TxFee era
forall era. TxFeesImplicitInEra era -> TxFee era
TxFeeImplicit TxFeesImplicitInEra era
supported)
Right TxFeesExplicitInEra era
supported -> TxFeesExplicitInEra era -> Entropic -> TxFee era
forall era. TxFeesExplicitInEra era -> Entropic -> TxFee era
TxFeeExplicit TxFeesExplicitInEra era
supported (Entropic -> TxFee era) -> Gen Entropic -> Gen (TxFee era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Entropic
genEntropic
genTxBody :: IsBccEra era => BccEra era -> Gen (TxBody era)
genTxBody :: BccEra era -> Gen (TxBody era)
genTxBody BccEra era
era = do
Either TxBodyError (TxBody era)
res <- TxBodyContent BuildTx era -> Either TxBodyError (TxBody era)
forall era.
IsBccEra era =>
TxBodyContent BuildTx era -> Either TxBodyError (TxBody era)
makeTransactionBody (TxBodyContent BuildTx era -> Either TxBodyError (TxBody era))
-> GenT Identity (TxBodyContent BuildTx era)
-> GenT Identity (Either TxBodyError (TxBody era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BccEra era -> GenT Identity (TxBodyContent BuildTx era)
forall era. BccEra era -> Gen (TxBodyContent BuildTx era)
genTxBodyContent BccEra era
era
case Either TxBodyError (TxBody era)
res of
Left TxBodyError
err -> String -> Gen (TxBody era)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (TxBodyError -> String
forall e. Error e => e -> String
displayError TxBodyError
err)
Right TxBody era
txBody -> TxBody era -> Gen (TxBody era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxBody era
txBody
genTxScriptValidity :: BccEra era -> Gen (TxScriptValidity era)
genTxScriptValidity :: BccEra era -> Gen (TxScriptValidity era)
genTxScriptValidity BccEra era
era = case BccEra era -> Maybe (TxScriptValiditySupportedInEra era)
forall era.
BccEra era -> Maybe (TxScriptValiditySupportedInEra era)
txScriptValiditySupportedInBccEra BccEra era
era of
Maybe (TxScriptValiditySupportedInEra era)
Nothing -> TxScriptValidity era -> Gen (TxScriptValidity era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxScriptValidity era
forall era. TxScriptValidity era
TxScriptValidityNone
Just TxScriptValiditySupportedInEra era
witness -> TxScriptValiditySupportedInEra era
-> ScriptValidity -> TxScriptValidity era
forall era.
TxScriptValiditySupportedInEra era
-> ScriptValidity -> TxScriptValidity era
TxScriptValidity TxScriptValiditySupportedInEra era
witness (ScriptValidity -> TxScriptValidity era)
-> GenT Identity ScriptValidity -> Gen (TxScriptValidity era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity ScriptValidity
genScriptValidity
genScriptValidity :: Gen ScriptValidity
genScriptValidity :: GenT Identity ScriptValidity
genScriptValidity = [ScriptValidity] -> GenT Identity ScriptValidity
forall (m :: * -> *) a. MonadGen m => [a] -> m a
Gen.element [ScriptValidity
ScriptInvalid, ScriptValidity
ScriptValid]
genTx :: forall era. IsBccEra era => BccEra era -> Gen (Tx era)
genTx :: BccEra era -> Gen (Tx era)
genTx BccEra era
era =
[KeyWitness era] -> TxBody era -> Tx era
forall era. [KeyWitness era] -> TxBody era -> Tx era
makeSignedTransaction
([KeyWitness era] -> TxBody era -> Tx era)
-> GenT Identity [KeyWitness era]
-> GenT Identity (TxBody era -> Tx era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BccEra era -> GenT Identity [KeyWitness era]
forall era. BccEra era -> Gen [KeyWitness era]
genWitnesses BccEra era
era
GenT Identity (TxBody era -> Tx era)
-> GenT Identity (TxBody era) -> Gen (Tx era)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BccEra era -> GenT Identity (TxBody era)
forall era. IsBccEra era => BccEra era -> Gen (TxBody era)
genTxBody BccEra era
era
genWitnesses :: BccEra era -> Gen [KeyWitness era]
genWitnesses :: BccEra era -> Gen [KeyWitness era]
genWitnesses BccEra era
era =
case BccEra era -> BccEraStyle era
forall era. BccEra era -> BccEraStyle era
bccEraStyle BccEra era
era of
BccEraStyle era
LegacyColeEra -> Range Int
-> GenT Identity (KeyWitness ColeEra)
-> GenT Identity [KeyWitness ColeEra]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
1 Int
10) GenT Identity (KeyWitness ColeEra)
genColeKeyWitness
SophieBasedEra SophieBasedEra era
_ -> do
[KeyWitness era]
bsWits <- Range Int -> GenT Identity (KeyWitness era) -> Gen [KeyWitness era]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
0 Int
10)
(BccEra era -> GenT Identity (KeyWitness era)
forall era.
IsSophieBasedEra era =>
BccEra era -> Gen (KeyWitness era)
genSophieBootstrapWitness BccEra era
era)
[KeyWitness era]
keyWits <- Range Int -> GenT Identity (KeyWitness era) -> Gen [KeyWitness era]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
0 Int
10)
(BccEra era -> GenT Identity (KeyWitness era)
forall era.
IsSophieBasedEra era =>
BccEra era -> Gen (KeyWitness era)
genSophieKeyWitness BccEra era
era)
[KeyWitness era] -> Gen [KeyWitness era]
forall (m :: * -> *) a. Monad m => a -> m a
return ([KeyWitness era] -> Gen [KeyWitness era])
-> [KeyWitness era] -> Gen [KeyWitness era]
forall a b. (a -> b) -> a -> b
$ [KeyWitness era]
bsWits [KeyWitness era] -> [KeyWitness era] -> [KeyWitness era]
forall a. [a] -> [a] -> [a]
++ [KeyWitness era]
keyWits
genVerificationKey :: Key keyrole => AsType keyrole -> Gen (VerificationKey keyrole)
genVerificationKey :: AsType keyrole -> Gen (VerificationKey keyrole)
genVerificationKey AsType keyrole
roletoken = SigningKey keyrole -> VerificationKey keyrole
forall keyrole.
Key keyrole =>
SigningKey keyrole -> VerificationKey keyrole
getVerificationKey (SigningKey keyrole -> VerificationKey keyrole)
-> GenT Identity (SigningKey keyrole)
-> Gen (VerificationKey keyrole)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType keyrole -> GenT Identity (SigningKey keyrole)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType keyrole
roletoken
genVerificationKeyHash :: Key keyrole => AsType keyrole -> Gen (Hash keyrole)
genVerificationKeyHash :: AsType keyrole -> Gen (Hash keyrole)
genVerificationKeyHash AsType keyrole
roletoken =
VerificationKey keyrole -> Hash keyrole
forall keyrole.
Key keyrole =>
VerificationKey keyrole -> Hash keyrole
verificationKeyHash (VerificationKey keyrole -> Hash keyrole)
-> GenT Identity (VerificationKey keyrole) -> Gen (Hash keyrole)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType keyrole -> GenT Identity (VerificationKey keyrole)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (VerificationKey keyrole)
genVerificationKey AsType keyrole
roletoken
genColeKeyWitness :: Gen (KeyWitness ColeEra)
genColeKeyWitness :: GenT Identity (KeyWitness ColeEra)
genColeKeyWitness = do
ProtocolMagicId
pmId <- Gen ProtocolMagicId
genProtocolMagicId
TxInWitness
txinWitness <- ProtocolMagicId -> Gen TxInWitness
genVKWitness ProtocolMagicId
pmId
KeyWitness ColeEra -> GenT Identity (KeyWitness ColeEra)
forall (m :: * -> *) a. Monad m => a -> m a
return (KeyWitness ColeEra -> GenT Identity (KeyWitness ColeEra))
-> KeyWitness ColeEra -> GenT Identity (KeyWitness ColeEra)
forall a b. (a -> b) -> a -> b
$ TxInWitness -> KeyWitness ColeEra
ColeKeyWitness TxInWitness
txinWitness
genWitnessNetworkIdOrColeAddress :: Gen WitnessNetworkIdOrColeAddress
genWitnessNetworkIdOrColeAddress :: Gen WitnessNetworkIdOrColeAddress
genWitnessNetworkIdOrColeAddress =
[Gen WitnessNetworkIdOrColeAddress]
-> Gen WitnessNetworkIdOrColeAddress
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ NetworkId -> WitnessNetworkIdOrColeAddress
WitnessNetworkId (NetworkId -> WitnessNetworkIdOrColeAddress)
-> GenT Identity NetworkId -> Gen WitnessNetworkIdOrColeAddress
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity NetworkId
genNetworkId
, Address ColeAddr -> WitnessNetworkIdOrColeAddress
WitnessColeAddress (Address ColeAddr -> WitnessNetworkIdOrColeAddress)
-> Gen (Address ColeAddr) -> Gen WitnessNetworkIdOrColeAddress
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (Address ColeAddr)
genAddressCole
]
genSophieBootstrapWitness
:: IsSophieBasedEra era
=> BccEra era
-> Gen (KeyWitness era)
genSophieBootstrapWitness :: BccEra era -> Gen (KeyWitness era)
genSophieBootstrapWitness BccEra era
era =
WitnessNetworkIdOrColeAddress
-> TxBody era -> SigningKey ColeKey -> KeyWitness era
forall era.
IsSophieBasedEra era =>
WitnessNetworkIdOrColeAddress
-> TxBody era -> SigningKey ColeKey -> KeyWitness era
makeSophieBootstrapWitness
(WitnessNetworkIdOrColeAddress
-> TxBody era -> SigningKey ColeKey -> KeyWitness era)
-> Gen WitnessNetworkIdOrColeAddress
-> GenT
Identity (TxBody era -> SigningKey ColeKey -> KeyWitness era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen WitnessNetworkIdOrColeAddress
genWitnessNetworkIdOrColeAddress
GenT Identity (TxBody era -> SigningKey ColeKey -> KeyWitness era)
-> GenT Identity (TxBody era)
-> GenT Identity (SigningKey ColeKey -> KeyWitness era)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BccEra era -> GenT Identity (TxBody era)
forall era. IsBccEra era => BccEra era -> Gen (TxBody era)
genTxBody BccEra era
era
GenT Identity (SigningKey ColeKey -> KeyWitness era)
-> GenT Identity (SigningKey ColeKey) -> Gen (KeyWitness era)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AsType ColeKey -> GenT Identity (SigningKey ColeKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType ColeKey
AsColeKey
genSophieKeyWitness
:: IsSophieBasedEra era
=> BccEra era
-> Gen (KeyWitness era)
genSophieKeyWitness :: BccEra era -> Gen (KeyWitness era)
genSophieKeyWitness BccEra era
era =
TxBody era -> SophieWitnessSigningKey -> KeyWitness era
forall era.
IsSophieBasedEra era =>
TxBody era -> SophieWitnessSigningKey -> KeyWitness era
makeSophieKeyWitness
(TxBody era -> SophieWitnessSigningKey -> KeyWitness era)
-> GenT Identity (TxBody era)
-> GenT Identity (SophieWitnessSigningKey -> KeyWitness era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BccEra era -> GenT Identity (TxBody era)
forall era. IsBccEra era => BccEra era -> Gen (TxBody era)
genTxBody BccEra era
era
GenT Identity (SophieWitnessSigningKey -> KeyWitness era)
-> GenT Identity SophieWitnessSigningKey -> Gen (KeyWitness era)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity SophieWitnessSigningKey
genSophieWitnessSigningKey
genSophieWitness
:: IsSophieBasedEra era
=> BccEra era
-> Gen (KeyWitness era)
genSophieWitness :: BccEra era -> Gen (KeyWitness era)
genSophieWitness BccEra era
era =
[Gen (KeyWitness era)] -> Gen (KeyWitness era)
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ BccEra era -> Gen (KeyWitness era)
forall era.
IsSophieBasedEra era =>
BccEra era -> Gen (KeyWitness era)
genSophieKeyWitness BccEra era
era
, BccEra era -> Gen (KeyWitness era)
forall era.
IsSophieBasedEra era =>
BccEra era -> Gen (KeyWitness era)
genSophieBootstrapWitness BccEra era
era
]
genSophieWitnessSigningKey :: Gen SophieWitnessSigningKey
genSophieWitnessSigningKey :: GenT Identity SophieWitnessSigningKey
genSophieWitnessSigningKey =
[GenT Identity SophieWitnessSigningKey]
-> GenT Identity SophieWitnessSigningKey
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice [ SigningKey PaymentKey -> SophieWitnessSigningKey
WitnessPaymentKey (SigningKey PaymentKey -> SophieWitnessSigningKey)
-> GenT Identity (SigningKey PaymentKey)
-> GenT Identity SophieWitnessSigningKey
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType PaymentKey -> GenT Identity (SigningKey PaymentKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType PaymentKey
AsPaymentKey
, SigningKey PaymentExtendedKey -> SophieWitnessSigningKey
WitnessPaymentExtendedKey (SigningKey PaymentExtendedKey -> SophieWitnessSigningKey)
-> GenT Identity (SigningKey PaymentExtendedKey)
-> GenT Identity SophieWitnessSigningKey
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType PaymentExtendedKey
-> GenT Identity (SigningKey PaymentExtendedKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType PaymentExtendedKey
AsPaymentExtendedKey
, SigningKey StakeKey -> SophieWitnessSigningKey
WitnessStakeKey (SigningKey StakeKey -> SophieWitnessSigningKey)
-> GenT Identity (SigningKey StakeKey)
-> GenT Identity SophieWitnessSigningKey
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType StakeKey -> GenT Identity (SigningKey StakeKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType StakeKey
AsStakeKey
, SigningKey StakePoolKey -> SophieWitnessSigningKey
WitnessStakePoolKey (SigningKey StakePoolKey -> SophieWitnessSigningKey)
-> GenT Identity (SigningKey StakePoolKey)
-> GenT Identity SophieWitnessSigningKey
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType StakePoolKey -> GenT Identity (SigningKey StakePoolKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType StakePoolKey
AsStakePoolKey
, SigningKey GenesisDelegateKey -> SophieWitnessSigningKey
WitnessGenesisDelegateKey (SigningKey GenesisDelegateKey -> SophieWitnessSigningKey)
-> GenT Identity (SigningKey GenesisDelegateKey)
-> GenT Identity SophieWitnessSigningKey
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType GenesisDelegateKey
-> GenT Identity (SigningKey GenesisDelegateKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType GenesisDelegateKey
AsGenesisDelegateKey
, SigningKey VestedDelegateKey -> SophieWitnessSigningKey
WitnessVestedDelegateKey (SigningKey VestedDelegateKey -> SophieWitnessSigningKey)
-> GenT Identity (SigningKey VestedDelegateKey)
-> GenT Identity SophieWitnessSigningKey
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType VestedDelegateKey
-> GenT Identity (SigningKey VestedDelegateKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType VestedDelegateKey
AsVestedDelegateKey
, SigningKey GenesisUTxOKey -> SophieWitnessSigningKey
WitnessGenesisUTxOKey (SigningKey GenesisUTxOKey -> SophieWitnessSigningKey)
-> GenT Identity (SigningKey GenesisUTxOKey)
-> GenT Identity SophieWitnessSigningKey
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType GenesisUTxOKey -> GenT Identity (SigningKey GenesisUTxOKey)
forall keyrole.
Key keyrole =>
AsType keyrole -> Gen (SigningKey keyrole)
genSigningKey AsType GenesisUTxOKey
AsGenesisUTxOKey
]
genSeed :: Int -> Gen Crypto.Seed
genSeed :: Int -> Gen Seed
genSeed Int
n = ByteString -> Seed
Crypto.mkSeedFromBytes (ByteString -> Seed) -> GenT Identity ByteString -> Gen Seed
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int -> GenT Identity ByteString
forall (m :: * -> *). MonadGen m => Range Int -> m ByteString
Gen.bytes (Int -> Range Int
forall a. a -> Range a
Range.singleton Int
n)
genNat :: Gen Natural
genNat :: Gen Natural
genNat = Range Natural -> Gen Natural
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Natural -> Natural -> Range Natural
forall a. Integral a => a -> a -> Range a
Range.linear Natural
0 Natural
10)
genRational :: Gen Rational
genRational :: Gen Rational
genRational =
(\Word64
d -> Ratio Word64 -> Rational
ratioToRational (Word64
1 Word64 -> Word64 -> Ratio Word64
forall a. Integral a => a -> a -> Ratio a
% Word64
d)) (Word64 -> Rational) -> GenT Identity Word64 -> Gen Rational
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity Word64
genDenominator
where
genDenominator :: Gen Word64
genDenominator :: GenT Identity Word64
genDenominator = Range Word64 -> GenT Identity Word64
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Word64 -> Word64 -> Range Word64
forall a. Integral a => a -> a -> Range a
Range.linear Word64
1 Word64
forall a. Bounded a => a
maxBound)
ratioToRational :: Ratio Word64 -> Rational
ratioToRational :: Ratio Word64 -> Rational
ratioToRational = Ratio Word64 -> Rational
forall a. Real a => a -> Rational
toRational
genRationalInt64 :: Gen Rational
genRationalInt64 :: Gen Rational
genRationalInt64 =
(\Int64
d -> Ratio Int64 -> Rational
ratioToRational (Int64
1 Int64 -> Int64 -> Ratio Int64
forall a. Integral a => a -> a -> Ratio a
% Int64
d)) (Int64 -> Rational) -> GenT Identity Int64 -> Gen Rational
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity Int64
genDenominator
where
genDenominator :: Gen Int64
genDenominator :: GenT Identity Int64
genDenominator = Range Int64 -> GenT Identity Int64
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Int64 -> Int64 -> Range Int64
forall a. Integral a => a -> a -> Range a
Range.linear Int64
1 Int64
forall a. Bounded a => a
maxBound)
ratioToRational :: Ratio Int64 -> Rational
ratioToRational :: Ratio Int64 -> Rational
ratioToRational = Ratio Int64 -> Rational
forall a. Real a => a -> Rational
toRational
genEpochNo :: Gen EpochNo
genEpochNo :: Gen EpochNo
genEpochNo = Word64 -> EpochNo
EpochNo (Word64 -> EpochNo) -> GenT Identity Word64 -> Gen EpochNo
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Word64 -> GenT Identity Word64
forall (m :: * -> *). MonadGen m => Range Word64 -> m Word64
Gen.word64 (Word64 -> Word64 -> Range Word64
forall a. Integral a => a -> a -> Range a
Range.linear Word64
0 Word64
10)
genOptimumNonce :: Gen OptimumNonce
genOptimumNonce :: Gen OptimumNonce
genOptimumNonce = ByteString -> OptimumNonce
makeOptimumNonce (ByteString -> OptimumNonce)
-> GenT Identity ByteString -> Gen OptimumNonce
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int -> GenT Identity ByteString
forall (m :: * -> *). MonadGen m => Range Int -> m ByteString
Gen.bytes (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
32)
genMaybeOptimumNonce :: Gen (Maybe OptimumNonce)
genMaybeOptimumNonce :: Gen (Maybe OptimumNonce)
genMaybeOptimumNonce = Gen OptimumNonce -> Gen (Maybe OptimumNonce)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen OptimumNonce
genOptimumNonce
genProtocolParameters :: Gen ProtocolParameters
genProtocolParameters :: GenT Identity ProtocolParameters
genProtocolParameters =
(Natural, Natural)
-> Rational
-> Maybe OptimumNonce
-> Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters
ProtocolParameters
((Natural, Natural)
-> Rational
-> Maybe OptimumNonce
-> Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> GenT Identity (Natural, Natural)
-> GenT
Identity
(Rational
-> Maybe OptimumNonce
-> Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((,) (Natural -> Natural -> (Natural, Natural))
-> Gen Natural -> GenT Identity (Natural -> (Natural, Natural))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Natural
genNat GenT Identity (Natural -> (Natural, Natural))
-> Gen Natural -> GenT Identity (Natural, Natural)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural
genNat)
GenT
Identity
(Rational
-> Maybe OptimumNonce
-> Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Rational
-> GenT
Identity
(Maybe OptimumNonce
-> Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Rational
genRational
GenT
Identity
(Maybe OptimumNonce
-> Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen (Maybe OptimumNonce)
-> GenT
Identity
(Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen (Maybe OptimumNonce)
genMaybeOptimumNonce
GenT
Identity
(Natural
-> Natural
-> Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Natural
-> GenT
Identity
(Natural
-> Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural
genNat
GenT
Identity
(Natural
-> Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Natural
-> GenT
Identity
(Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural
genNat
GenT
Identity
(Natural
-> Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Natural
-> GenT
Identity
(Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural
genNat
GenT
Identity
(Natural
-> Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Natural
-> GenT
Identity
(Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural
genNat
GenT
Identity
(Natural
-> Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Natural
-> GenT
Identity
(Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural
genNat
GenT
Identity
(Maybe Entropic
-> Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> GenT Identity (Maybe Entropic)
-> GenT
Identity
(Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Entropic -> GenT Identity (Maybe Entropic)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Entropic
genEntropic
GenT
Identity
(Entropic
-> Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Entropic
-> GenT
Identity
(Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Entropic
genEntropic
GenT
Identity
(Entropic
-> Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Entropic
-> GenT
Identity
(Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Entropic
genEntropic
GenT
Identity
(Entropic
-> EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Entropic
-> GenT
Identity
(EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Entropic
genEntropic
GenT
Identity
(EpochNo
-> Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen EpochNo
-> GenT
Identity
(Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen EpochNo
genEpochNo
GenT
Identity
(Natural
-> Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Natural
-> GenT
Identity
(Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural
genNat
GenT
Identity
(Rational
-> Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Rational
-> GenT
Identity
(Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Rational
genRationalInt64
GenT
Identity
(Rational
-> Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Rational
-> GenT
Identity
(Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Rational
genRational
GenT
Identity
(Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> Gen Rational
-> GenT
Identity
(Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Rational
genRational
GenT
Identity
(Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> GenT Identity (Maybe Entropic)
-> GenT
Identity
(Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Entropic -> GenT Identity (Maybe Entropic)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Entropic
genEntropic
GenT
Identity
(Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> GenT Identity (Map AnyZerepochScriptVersion CostModel)
-> GenT
Identity
(Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity (Map AnyZerepochScriptVersion CostModel)
genCostModels
GenT
Identity
(Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> GenT Identity (Maybe ExecutionUnitPrices)
-> GenT
Identity
(Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity ExecutionUnitPrices
-> GenT Identity (Maybe ExecutionUnitPrices)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe GenT Identity ExecutionUnitPrices
genExecutionUnitPrices
GenT
Identity
(Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> GenT Identity (Maybe ExecutionUnits)
-> GenT
Identity
(Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity ExecutionUnits
-> GenT Identity (Maybe ExecutionUnits)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe GenT Identity ExecutionUnits
genExecutionUnits
GenT
Identity
(Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParameters)
-> GenT Identity (Maybe ExecutionUnits)
-> GenT
Identity
(Maybe Natural
-> Maybe Natural -> Maybe Natural -> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity ExecutionUnits
-> GenT Identity (Maybe ExecutionUnits)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe GenT Identity ExecutionUnits
genExecutionUnits
GenT
Identity
(Maybe Natural
-> Maybe Natural -> Maybe Natural -> ProtocolParameters)
-> GenT Identity (Maybe Natural)
-> GenT
Identity (Maybe Natural -> Maybe Natural -> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
GenT
Identity (Maybe Natural -> Maybe Natural -> ProtocolParameters)
-> GenT Identity (Maybe Natural)
-> GenT Identity (Maybe Natural -> ProtocolParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
GenT Identity (Maybe Natural -> ProtocolParameters)
-> GenT Identity (Maybe Natural)
-> GenT Identity ProtocolParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
genProtocolParametersUpdate :: Gen ProtocolParametersUpdate
genProtocolParametersUpdate :: Gen ProtocolParametersUpdate
genProtocolParametersUpdate =
Maybe (Natural, Natural)
-> Maybe Rational
-> Maybe (Maybe OptimumNonce)
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate
ProtocolParametersUpdate
(Maybe (Natural, Natural)
-> Maybe Rational
-> Maybe (Maybe OptimumNonce)
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe (Natural, Natural))
-> GenT
Identity
(Maybe Rational
-> Maybe (Maybe OptimumNonce)
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity (Natural, Natural)
-> GenT Identity (Maybe (Natural, Natural))
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe ((,) (Natural -> Natural -> (Natural, Natural))
-> Gen Natural -> GenT Identity (Natural -> (Natural, Natural))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Natural
genNat GenT Identity (Natural -> (Natural, Natural))
-> Gen Natural -> GenT Identity (Natural, Natural)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural
genNat)
GenT
Identity
(Maybe Rational
-> Maybe (Maybe OptimumNonce)
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Rational)
-> GenT
Identity
(Maybe (Maybe OptimumNonce)
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Rational -> GenT Identity (Maybe Rational)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Rational
genRational
GenT
Identity
(Maybe (Maybe OptimumNonce)
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe (Maybe OptimumNonce))
-> GenT
Identity
(Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen (Maybe OptimumNonce)
-> GenT Identity (Maybe (Maybe OptimumNonce))
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen (Maybe OptimumNonce)
genMaybeOptimumNonce
GenT
Identity
(Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Natural)
-> GenT
Identity
(Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
GenT
Identity
(Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Natural)
-> GenT
Identity
(Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
GenT
Identity
(Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Natural)
-> GenT
Identity
(Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
GenT
Identity
(Maybe Natural
-> Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Natural)
-> GenT
Identity
(Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
GenT
Identity
(Maybe Natural
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Natural)
-> GenT
Identity
(Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
GenT
Identity
(Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Entropic)
-> GenT
Identity
(Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Entropic -> GenT Identity (Maybe Entropic)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Entropic
genEntropic
GenT
Identity
(Maybe Entropic
-> Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Entropic)
-> GenT
Identity
(Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Entropic -> GenT Identity (Maybe Entropic)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Entropic
genEntropic
GenT
Identity
(Maybe Entropic
-> Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Entropic)
-> GenT
Identity
(Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Entropic -> GenT Identity (Maybe Entropic)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Entropic
genEntropic
GenT
Identity
(Maybe Entropic
-> Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Entropic)
-> GenT
Identity
(Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Entropic -> GenT Identity (Maybe Entropic)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Entropic
genEntropic
GenT
Identity
(Maybe EpochNo
-> Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe EpochNo)
-> GenT
Identity
(Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen EpochNo -> GenT Identity (Maybe EpochNo)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen EpochNo
genEpochNo
GenT
Identity
(Maybe Natural
-> Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Natural)
-> GenT
Identity
(Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
GenT
Identity
(Maybe Rational
-> Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Rational)
-> GenT
Identity
(Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Rational -> GenT Identity (Maybe Rational)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Rational
genRationalInt64
GenT
Identity
(Maybe Rational
-> Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Rational)
-> GenT
Identity
(Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Rational -> GenT Identity (Maybe Rational)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Rational
genRational
GenT
Identity
(Maybe Rational
-> Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Rational)
-> GenT
Identity
(Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Rational -> GenT Identity (Maybe Rational)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Rational
genRational
GenT
Identity
(Maybe Entropic
-> Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe Entropic)
-> GenT
Identity
(Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Entropic -> GenT Identity (Maybe Entropic)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Entropic
genEntropic
GenT
Identity
(Map AnyZerepochScriptVersion CostModel
-> Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Map AnyZerepochScriptVersion CostModel)
-> GenT
Identity
(Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity (Map AnyZerepochScriptVersion CostModel)
genCostModels
GenT
Identity
(Maybe ExecutionUnitPrices
-> Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe ExecutionUnitPrices)
-> GenT
Identity
(Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity ExecutionUnitPrices
-> GenT Identity (Maybe ExecutionUnitPrices)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe GenT Identity ExecutionUnitPrices
genExecutionUnitPrices
GenT
Identity
(Maybe ExecutionUnits
-> Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe ExecutionUnits)
-> GenT
Identity
(Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity ExecutionUnits
-> GenT Identity (Maybe ExecutionUnits)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe GenT Identity ExecutionUnits
genExecutionUnits
GenT
Identity
(Maybe ExecutionUnits
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> ProtocolParametersUpdate)
-> GenT Identity (Maybe ExecutionUnits)
-> GenT
Identity
(Maybe Natural
-> Maybe Natural -> Maybe Natural -> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity ExecutionUnits
-> GenT Identity (Maybe ExecutionUnits)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe GenT Identity ExecutionUnits
genExecutionUnits
GenT
Identity
(Maybe Natural
-> Maybe Natural -> Maybe Natural -> ProtocolParametersUpdate)
-> GenT Identity (Maybe Natural)
-> GenT
Identity
(Maybe Natural -> Maybe Natural -> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
GenT
Identity
(Maybe Natural -> Maybe Natural -> ProtocolParametersUpdate)
-> GenT Identity (Maybe Natural)
-> GenT Identity (Maybe Natural -> ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
GenT Identity (Maybe Natural -> ProtocolParametersUpdate)
-> GenT Identity (Maybe Natural) -> Gen ProtocolParametersUpdate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Natural -> GenT Identity (Maybe Natural)
forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a)
Gen.maybe Gen Natural
genNat
genUpdateProposal :: Gen UpdateProposal
genUpdateProposal :: GenT Identity UpdateProposal
genUpdateProposal =
Map (Hash GenesisKey) ProtocolParametersUpdate
-> EpochNo -> UpdateProposal
UpdateProposal
(Map (Hash GenesisKey) ProtocolParametersUpdate
-> EpochNo -> UpdateProposal)
-> GenT Identity (Map (Hash GenesisKey) ProtocolParametersUpdate)
-> GenT Identity (EpochNo -> UpdateProposal)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int
-> GenT Identity (Hash GenesisKey, ProtocolParametersUpdate)
-> GenT Identity (Map (Hash GenesisKey) ProtocolParametersUpdate)
forall (m :: * -> *) k v.
(MonadGen m, Ord k) =>
Range Int -> m (k, v) -> m (Map k v)
Gen.map (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
1 Int
3)
((,) (Hash GenesisKey
-> ProtocolParametersUpdate
-> (Hash GenesisKey, ProtocolParametersUpdate))
-> GenT Identity (Hash GenesisKey)
-> GenT
Identity
(ProtocolParametersUpdate
-> (Hash GenesisKey, ProtocolParametersUpdate))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AsType GenesisKey -> GenT Identity (Hash GenesisKey)
forall keyrole. Key keyrole => AsType keyrole -> Gen (Hash keyrole)
genVerificationKeyHash AsType GenesisKey
AsGenesisKey
GenT
Identity
(ProtocolParametersUpdate
-> (Hash GenesisKey, ProtocolParametersUpdate))
-> Gen ProtocolParametersUpdate
-> GenT Identity (Hash GenesisKey, ProtocolParametersUpdate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen ProtocolParametersUpdate
genProtocolParametersUpdate)
GenT Identity (EpochNo -> UpdateProposal)
-> Gen EpochNo -> GenT Identity UpdateProposal
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen EpochNo
genEpochNo
genCostModel :: Gen CostModel
genCostModel :: Gen CostModel
genCostModel = case Maybe CostModelParams
Zerepoch.defaultCostModelParams of
Maybe CostModelParams
Nothing -> Text -> Gen CostModel
forall a. HasCallStack => Text -> a
panic Text
"Zerepoch defaultCostModelParams is broken."
Just CostModelParams
dcm ->
CostModelParams -> CostModel
CostModel
(CostModelParams -> CostModel)
-> GenT Identity CostModelParams -> Gen CostModel
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Integer -> GenT Identity Integer)
-> CostModelParams -> GenT Identity CostModelParams
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (GenT Identity Integer -> Integer -> GenT Identity Integer
forall a b. a -> b -> a
const (GenT Identity Integer -> Integer -> GenT Identity Integer)
-> GenT Identity Integer -> Integer -> GenT Identity Integer
forall a b. (a -> b) -> a -> b
$ Range Integer -> GenT Identity Integer
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Integer -> Integer -> Range Integer
forall a. Integral a => a -> a -> Range a
Range.linear Integer
0 Integer
5000)) CostModelParams
dcm
genCostModels :: Gen (Map AnyZerepochScriptVersion CostModel)
genCostModels :: GenT Identity (Map AnyZerepochScriptVersion CostModel)
genCostModels =
Range Int
-> GenT Identity (AnyZerepochScriptVersion, CostModel)
-> GenT Identity (Map AnyZerepochScriptVersion CostModel)
forall (m :: * -> *) k v.
(MonadGen m, Ord k) =>
Range Int -> m (k, v) -> m (Map k v)
Gen.map (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 ([AnyZerepochScriptVersion] -> Int
forall a. HasLength a => a -> Int
length [AnyZerepochScriptVersion]
zerepochScriptVersions))
((,) (AnyZerepochScriptVersion
-> CostModel -> (AnyZerepochScriptVersion, CostModel))
-> GenT Identity AnyZerepochScriptVersion
-> GenT
Identity (CostModel -> (AnyZerepochScriptVersion, CostModel))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [AnyZerepochScriptVersion]
-> GenT Identity AnyZerepochScriptVersion
forall (m :: * -> *) a. MonadGen m => [a] -> m a
Gen.element [AnyZerepochScriptVersion]
zerepochScriptVersions
GenT Identity (CostModel -> (AnyZerepochScriptVersion, CostModel))
-> Gen CostModel
-> GenT Identity (AnyZerepochScriptVersion, CostModel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen CostModel
genCostModel)
where
zerepochScriptVersions :: [AnyZerepochScriptVersion]
zerepochScriptVersions :: [AnyZerepochScriptVersion]
zerepochScriptVersions = [AnyZerepochScriptVersion
forall a. Bounded a => a
minBound..AnyZerepochScriptVersion
forall a. Bounded a => a
maxBound]
genExecutionUnits :: Gen ExecutionUnits
genExecutionUnits :: GenT Identity ExecutionUnits
genExecutionUnits = Word64 -> Word64 -> ExecutionUnits
ExecutionUnits (Word64 -> Word64 -> ExecutionUnits)
-> GenT Identity Word64 -> GenT Identity (Word64 -> ExecutionUnits)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Word64 -> GenT Identity Word64
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Word64 -> Word64 -> Range Word64
forall a. a -> a -> Range a
Range.constant Word64
0 Word64
1000)
GenT Identity (Word64 -> ExecutionUnits)
-> GenT Identity Word64 -> GenT Identity ExecutionUnits
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Range Word64 -> GenT Identity Word64
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Word64 -> Word64 -> Range Word64
forall a. a -> a -> Range a
Range.constant Word64
0 Word64
1000)
genExecutionUnitPrices :: Gen ExecutionUnitPrices
genExecutionUnitPrices :: GenT Identity ExecutionUnitPrices
genExecutionUnitPrices = Rational -> Rational -> ExecutionUnitPrices
ExecutionUnitPrices (Rational -> Rational -> ExecutionUnitPrices)
-> Gen Rational -> GenT Identity (Rational -> ExecutionUnitPrices)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Rational
genRational GenT Identity (Rational -> ExecutionUnitPrices)
-> Gen Rational -> GenT Identity ExecutionUnitPrices
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Rational
genRational
genTxOutDatumHash :: BccEra era -> Gen (TxOutDatumHash era)
genTxOutDatumHash :: BccEra era -> Gen (TxOutDatumHash era)
genTxOutDatumHash BccEra era
era = case BccEra era
era of
BccEra era
ColeEra -> TxOutDatumHash era -> Gen (TxOutDatumHash era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxOutDatumHash era
forall era. TxOutDatumHash era
TxOutDatumHashNone
BccEra era
SophieEra -> TxOutDatumHash era -> Gen (TxOutDatumHash era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxOutDatumHash era
forall era. TxOutDatumHash era
TxOutDatumHashNone
BccEra era
EvieEra -> TxOutDatumHash era -> Gen (TxOutDatumHash era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxOutDatumHash era
forall era. TxOutDatumHash era
TxOutDatumHashNone
BccEra era
JenEra -> TxOutDatumHash era -> Gen (TxOutDatumHash era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxOutDatumHash era
forall era. TxOutDatumHash era
TxOutDatumHashNone
BccEra era
AurumEra -> [GenT Identity (TxOutDatumHash AurumEra)]
-> GenT Identity (TxOutDatumHash AurumEra)
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
[ TxOutDatumHash AurumEra -> GenT Identity (TxOutDatumHash AurumEra)
forall (f :: * -> *) a. Applicative f => a -> f a
pure TxOutDatumHash AurumEra
forall era. TxOutDatumHash era
TxOutDatumHashNone
, ScriptDataSupportedInEra AurumEra
-> Hash ScriptData -> TxOutDatumHash AurumEra
forall era.
ScriptDataSupportedInEra era
-> Hash ScriptData -> TxOutDatumHash era
TxOutDatumHash ScriptDataSupportedInEra AurumEra
ScriptDataInAurumEra (Hash ScriptData -> TxOutDatumHash AurumEra)
-> GenT Identity (Hash ScriptData)
-> GenT Identity (TxOutDatumHash AurumEra)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity (Hash ScriptData)
genHashScriptData
]
mkDummyHash :: forall h a. CRYPTO.HashAlgorithm h => Int -> CRYPTO.Hash h a
mkDummyHash :: Int -> Hash h a
mkDummyHash = Hash h Int -> Hash h a
coerce (Hash h Int -> Hash h a) -> (Int -> Hash h Int) -> Int -> Hash h a
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Int -> Encoding) -> Int -> Hash h Int
forall h a. HashAlgorithm h => (a -> Encoding) -> a -> Hash h a
CRYPTO.hashWithSerialiser @h Int -> Encoding
forall a. ToCBOR a => a -> Encoding
CBOR.toCBOR
genHashScriptData :: Gen (Bcc.Api.Hash ScriptData)
genHashScriptData :: GenT Identity (Hash ScriptData)
genHashScriptData = DataHash StandardCrypto -> Hash ScriptData
ScriptDataHash (DataHash StandardCrypto -> Hash ScriptData)
-> (Int -> DataHash StandardCrypto) -> Int -> Hash ScriptData
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Hash Blake2b_256 EraIndependentData -> DataHash StandardCrypto
forall crypto index.
Hash (HASH crypto) index -> SafeHash crypto index
unsafeMakeSafeHash (Hash Blake2b_256 EraIndependentData -> DataHash StandardCrypto)
-> (Int -> Hash Blake2b_256 EraIndependentData)
-> Int
-> DataHash StandardCrypto
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Int -> Hash Blake2b_256 EraIndependentData
forall h a. HashAlgorithm h => Int -> Hash h a
mkDummyHash (Int -> Hash ScriptData)
-> GenT Identity Int -> GenT Identity (Hash ScriptData)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Int -> GenT Identity Int
forall (m :: * -> *). MonadGen m => Range Int -> m Int
Gen.int (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
10)
genScriptDataSupportedInAurumEra :: Gen (ScriptDataSupportedInEra AurumEra)
genScriptDataSupportedInAurumEra :: Gen (ScriptDataSupportedInEra AurumEra)
genScriptDataSupportedInAurumEra = ScriptDataSupportedInEra AurumEra
-> Gen (ScriptDataSupportedInEra AurumEra)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ScriptDataSupportedInEra AurumEra
ScriptDataInAurumEra