{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
module Test.Cardano.Ledger.Shelley.Serialisation.Golden.Genesis (
tests,
golden_json_ShelleyGenesis,
golden_cbor_ShelleyGenesis,
)
where
import Cardano.Ledger.BaseTypes (textToDns, textToUrl)
import Cardano.Ledger.Binary (Tokens (..))
import qualified Cardano.Ledger.Binary.Plain as Plain
import Cardano.Ledger.Core (emptyPParams, ppDL, ppMaxBBSizeL, ppMaxBHSizeL)
import Cardano.Ledger.Crypto (Crypto, StandardCrypto)
import Cardano.Ledger.Keys (KeyRoleVRF (..), VRFVerKeyHash (..), hashKey, hashVerKeyVRF)
import Cardano.Ledger.Shelley (ShelleyEra)
import qualified Cardano.Ledger.Shelley.API as L
import Cardano.Ledger.Shelley.Genesis
import Cardano.Slotting.Slot (EpochSize (..))
import Control.Monad
import Data.Aeson hiding (Encoding)
import qualified Data.ByteString.Char8 as BS (pack)
import qualified Data.ListMap as LM
import qualified Data.Map.Strict as Map
import Data.Maybe (fromJust)
import Data.Scientific (Scientific)
import qualified Data.Sequence.Strict as StrictSeq
import qualified Data.Set as Set
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
import Lens.Micro
import Paths_cardano_ledger_shelley_test (getDataFileName)
import Test.Cardano.Ledger.Binary.TreeDiff (CBORBytes (CBORBytes), ansiDocToString, diffExpr)
import Test.Cardano.Ledger.Core.KeyPair (vKey)
import qualified Test.Cardano.Ledger.Shelley.Examples.Cast as Cast
import Test.Cardano.Ledger.Shelley.Generator.Core (VRFKeyPair (..))
import Test.Cardano.Ledger.Shelley.Utils (
RawSeed (..),
mkKeyPair,
mkVRFKeyPair,
unsafeBoundRational,
)
import Test.Tasty
import Test.Tasty.HUnit (Assertion, assertFailure, testCase, (@?=))
goldenTestJSON :: ToJSON a => a -> FilePath -> Assertion
goldenTestJSON :: forall a. ToJSON a => a -> FilePath -> Assertion
goldenTestJSON a
actual FilePath
expectedFile =
case forall a. FromJSON a => ByteString -> Either FilePath a
eitherDecode' (forall a. ToJSON a => a -> ByteString
encode a
actual) of
Left FilePath
err -> forall a. HasCallStack => FilePath -> a
error FilePath
err
Right (Value
val :: Value) -> do
Value
expected <- forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either forall a. HasCallStack => FilePath -> a
error forall a. a -> a
id forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => FilePath -> IO (Either FilePath a)
eitherDecodeFileStrict FilePath
expectedFile
Value
val forall a. (Eq a, Show a, HasCallStack) => a -> a -> Assertion
@?= Value
expected
golden_json_ShelleyGenesis :: Assertion
golden_json_ShelleyGenesis :: Assertion
golden_json_ShelleyGenesis =
forall a. ToJSON a => a -> FilePath -> Assertion
goldenTestJSON ShelleyGenesis StandardCrypto
example forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< FilePath -> IO FilePath
getDataFileName FilePath
"test/Golden/ShelleyGenesis"
where
example :: ShelleyGenesis StandardCrypto
example :: ShelleyGenesis StandardCrypto
example = forall c. Crypto c => ShelleyGenesis c
exampleShelleyGenesis
golden_cbor_ShelleyGenesis :: Assertion
golden_cbor_ShelleyGenesis :: Assertion
golden_cbor_ShelleyGenesis =
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (ByteString
received forall a. Eq a => a -> a -> Bool
/= ByteString
expected) forall a b. (a -> b) -> a -> b
$
forall a. HasCallStack => FilePath -> IO a
assertFailure forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc AnsiStyle -> FilePath
ansiDocToString forall a b. (a -> b) -> a -> b
$
forall a. ToExpr a => a -> a -> Doc AnsiStyle
diffExpr (ByteString -> CBORBytes
CBORBytes ByteString
expected) (ByteString -> CBORBytes
CBORBytes ByteString
received)
where
example :: ShelleyGenesis StandardCrypto
example :: ShelleyGenesis StandardCrypto
example = forall c. Crypto c => ShelleyGenesis c
exampleShelleyGenesis
received :: ByteString
received = forall a. ToCBOR a => a -> ByteString
Plain.serialize' Tokens -> Tokens
expectedTokens
expected :: ByteString
expected = forall a. ToCBOR a => a -> ByteString
Plain.serialize' ShelleyGenesis StandardCrypto
example
expectedTokens :: Tokens -> Tokens
expectedTokens =
Word -> Tokens -> Tokens
TkListLen Word
15
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
3
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
2009
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
44
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
83589000000000000
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
4036000900
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
259
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
1000
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
120842
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
1215
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
8541
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
28899
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
8000000
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
16991
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
71
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
18
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
239857
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
2048
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
17569
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
100
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkTag Word
30
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkTag Word
30
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkTag Word
30
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkTag Word
30
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
19
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
1000
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkMapLen Word
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes
ByteString
"8\231\197\152j4\243\&4\225\155q,\n\165%\DC4m\171\143\SI\248\137\178\173\SYN\137BA"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes
ByteString
"\230\150\r\214q\238\141s\222\SUB\131\209\&4[f\DC1e\220\221\235\169\150#\190\239/\NAKz"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes
ByteString
"\252\227\FSo1\135S\RS\228\163\154\167C\194M\"'_AZ\136\149\233\205\"\195\f\138%\205\239\r"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkMapLen Word
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes
ByteString
"\NUL\225\186\222*\185FZ$\253^\170Ks\136\&09\ETB3\143\133:H\177\SUB_\201\150J\245\202\147\251e\SYN\235\222=\NAK\v>*\203\EM\tS'0\222\&3\131/\251\"\156\178\r"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
12157196
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkMapLen Word
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes
ByteString
"\245\131\164^IG\193\STX\t\ESC\150\ETB\SO\245\SO\240\207\142\219bfa\147\162\SYN2G\187"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
9
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes
ByteString
"N\DC3\f\v\222\183v\142\223.\143\133\NUL\DEL\213 s\227\220\CANq\244\196\DEL\157\252\169."
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes
ByteString
"h\249\207\211:\200\240D\250\204fM\181\170\ESCs\192\176\245C[\133\231\181 \187/\SUB\146\240)\153"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
5
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkTag Word
30
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
4
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes
ByteString
"\224N\136\204-'\195d\170\249\ACKH\168}\251\149\248\238\DLE;\166\DEL\161\241/^\134\196*"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes ByteString
"N\136\204-'\195d\170\249\ACKH\168}\251\149\248\238\DLE;\166\DEL\161\241/^\134\196*"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
3
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
4
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
0
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
1234
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes ByteString
"\NUL\NUL\NUL\NUL"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes ByteString
"\184\r\SOH \NUL\NUL\n\NUL\NUL\NUL\NUL\NUL#\SOH\NUL\NUL"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
3
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Tokens -> Tokens
TkNull
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Tokens -> Tokens
TkString Text
"cool.domain.com"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tokens -> Tokens
TkInt Int
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Tokens -> Tokens
TkString Text
"cool.domain.com"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Tokens -> Tokens
TkString Text
"best.pool.com"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes ByteString
"100ab{}100ab{}"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkMapLen Word
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes
ByteString
"\131\161\146\222\192\232\218!\136\229 \208\197\&6\166\154t|\241s\163\223\SYN\166\218\169M\134"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes ByteString
"d\158\218\130\191dM4\166\146_$\234LL6\210~Q\222\ESCD\239G\227V\v\231"
tests :: TestTree
tests :: TestTree
tests =
FilePath -> [TestTree] -> TestTree
testGroup
FilePath
"Shelley Genesis golden tests"
[ FilePath -> Assertion -> TestTree
testCase FilePath
"ShelleyGenesis JSON golden test" Assertion
golden_json_ShelleyGenesis
, FilePath -> Assertion -> TestTree
testCase FilePath
"ShelleyGenesis CBOR golden test" Assertion
golden_cbor_ShelleyGenesis
]
exampleShelleyGenesis ::
forall c.
Crypto c =>
ShelleyGenesis c
exampleShelleyGenesis :: forall c. Crypto c => ShelleyGenesis c
exampleShelleyGenesis =
ShelleyGenesis
{ sgSystemStart :: UTCTime
sgSystemStart = POSIXTime -> UTCTime
posixSecondsToUTCTime forall a b. (a -> b) -> a -> b
$ forall a b. (Real a, Fractional b) => a -> b
realToFrac (Integer
1234566789 :: Integer)
, sgNetworkMagic :: Word32
sgNetworkMagic = Word32
4036000900
, sgNetworkId :: Network
sgNetworkId = Network
L.Testnet
, sgActiveSlotsCoeff :: PositiveUnitInterval
sgActiveSlotsCoeff = forall r.
(HasCallStack, Typeable r, BoundedRational r) =>
Rational -> r
unsafeBoundRational Rational
0.259
, sgSecurityParam :: Word64
sgSecurityParam = Word64
120842
, sgEpochLength :: EpochSize
sgEpochLength = Word64 -> EpochSize
EpochSize Word64
1215
, sgSlotsPerKESPeriod :: Word64
sgSlotsPerKESPeriod = Word64
8541
, sgMaxKESEvolutions :: Word64
sgMaxKESEvolutions = Word64
28899
, sgSlotLength :: NominalDiffTimeMicro
sgSlotLength = NominalDiffTimeMicro
8
, sgUpdateQuorum :: Word64
sgUpdateQuorum = Word64
16991
, sgMaxLovelaceSupply :: Word64
sgMaxLovelaceSupply = Word64
71
, sgProtocolParams :: PParams (ShelleyEra c)
sgProtocolParams =
forall era. EraPParams era => PParams era
emptyPParams @(ShelleyEra c)
forall a b. a -> (a -> b) -> b
& forall era.
(EraPParams era, ProtVerAtMost era 6) =>
Lens' (PParams era) UnitInterval
ppDL forall s t a b. ASetter s t a b -> b -> s -> t
.~ forall r.
(HasCallStack, Typeable r, BoundedRational r) =>
Rational -> r
unsafeBoundRational (forall a b. (Real a, Fractional b) => a -> b
realToFrac (Scientific
1.9e-2 :: Scientific))
forall a b. a -> (a -> b) -> b
& forall era. EraPParams era => Lens' (PParams era) Word32
ppMaxBBSizeL forall s t a b. ASetter s t a b -> b -> s -> t
.~ Word32
239857
forall a b. a -> (a -> b) -> b
& forall era. EraPParams era => Lens' (PParams era) Word16
ppMaxBHSizeL forall s t a b. ASetter s t a b -> b -> s -> t
.~ Word16
17569
, sgGenDelegs :: Map (KeyHash 'Genesis c) (GenDelegPair c)
sgGenDelegs = forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(KeyHash 'Genesis c
genesisVerKeyHash, GenDelegPair c
genDelegPair)]
, sgInitialFunds :: ListMap (Addr c) Coin
sgInitialFunds = forall k v. [(k, v)] -> ListMap k v
LM.ListMap [(Addr c
initialFundedAddress, Coin
initialFunds)]
, sgStaking :: ShelleyGenesisStaking c
sgStaking = ShelleyGenesisStaking c
staking
}
where
genesisVerKeyHash :: L.KeyHash 'L.Genesis c
genesisVerKeyHash :: KeyHash 'Genesis c
genesisVerKeyHash = forall (r :: KeyRole) c.
Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c)) -> KeyHash r c
L.KeyHash Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c))
"38e7c5986a34f334e19b712c0aa525146dab8f0ff889b2ad16894241"
genDelegPair :: GenDelegPair c
genDelegPair = forall c.
KeyHash 'GenesisDelegate c
-> VRFVerKeyHash 'GenDelegVRF c -> GenDelegPair c
L.GenDelegPair KeyHash 'GenesisDelegate c
delegVerKeyHash VRFVerKeyHash 'GenDelegVRF c
delegVrfKeyHash
delegVerKeyHash :: L.KeyHash 'L.GenesisDelegate c
delegVerKeyHash :: KeyHash 'GenesisDelegate c
delegVerKeyHash = forall (r :: KeyRole) c.
Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c)) -> KeyHash r c
L.KeyHash Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c))
"e6960dd671ee8d73de1a83d1345b661165dcddeba99623beef2f157a"
delegVrfKeyHash :: VRFVerKeyHash 'GenDelegVRF c
delegVrfKeyHash :: VRFVerKeyHash 'GenDelegVRF c
delegVrfKeyHash = forall (r :: KeyRoleVRF) c.
Hash (HASH c) KeyRoleVRF -> VRFVerKeyHash r c
VRFVerKeyHash Hash (HASH c) KeyRoleVRF
"fce31c6f3187531ee4a39aa743c24d22275f415a8895e9cd22c30c8a25cdef0d"
initialFundedAddress :: L.Addr c
initialFundedAddress :: Addr c
initialFundedAddress =
forall c.
Network -> PaymentCredential c -> StakeReference c -> Addr c
L.Addr
Network
L.Testnet
forall {kr :: KeyRole}. Credential kr c
paymentCredential
(forall c. StakeCredential c -> StakeReference c
L.StakeRefBase forall {kr :: KeyRole}. Credential kr c
stakingCredential)
where
paymentCredential :: Credential kr c
paymentCredential =
forall (kr :: KeyRole) c. KeyHash kr c -> Credential kr c
L.KeyHashObj forall a b. (a -> b) -> a -> b
$
forall (r :: KeyRole) c.
Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c)) -> KeyHash r c
L.KeyHash
Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c))
"e1bade2ab9465a24fd5eaa4b7388303917338f853a48b11a5fc9964a"
stakingCredential :: Credential kr c
stakingCredential =
forall (kr :: KeyRole) c. KeyHash kr c -> Credential kr c
L.KeyHashObj forall a b. (a -> b) -> a -> b
$
forall (r :: KeyRole) c.
Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c)) -> KeyHash r c
L.KeyHash
Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c))
"f5ca93fb6516ebde3d150b3e2acb1909532730de33832ffb229cb20d"
initialFunds :: L.Coin
initialFunds :: Coin
initialFunds = Integer -> Coin
L.Coin Integer
12157196
relays :: StrictSeq StakePoolRelay
relays =
forall a. [a] -> StrictSeq a
StrictSeq.fromList
[ StrictMaybe Port
-> StrictMaybe IPv4 -> StrictMaybe IPv6 -> StakePoolRelay
L.SingleHostAddr
(forall a. a -> StrictMaybe a
L.SJust forall a b. (a -> b) -> a -> b
$ Word16 -> Port
L.Port Word16
1234)
(forall a. a -> StrictMaybe a
L.SJust forall a b. (a -> b) -> a -> b
$ forall a. Read a => FilePath -> a
read FilePath
"0.0.0.0")
(forall a. a -> StrictMaybe a
L.SJust forall a b. (a -> b) -> a -> b
$ forall a. Read a => FilePath -> a
read FilePath
"2001:db8:a::123")
, StrictMaybe Port -> DnsName -> StakePoolRelay
L.SingleHostName forall a. StrictMaybe a
L.SNothing (forall a. HasCallStack => Maybe a -> a
fromJust forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). MonadFail m => Int -> Text -> m DnsName
textToDns Int
64 Text
"cool.domain.com")
, DnsName -> StakePoolRelay
L.MultiHostName (forall a. HasCallStack => Maybe a -> a
fromJust forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). MonadFail m => Int -> Text -> m DnsName
textToDns Int
64 Text
"cool.domain.com")
]
poolParams :: L.PoolParams c
poolParams :: PoolParams c
poolParams =
L.PoolParams
{ ppId :: KeyHash 'StakePool c
L.ppId = forall c (kd :: KeyRole). Crypto c => VKey kd c -> KeyHash kd c
hashKey forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ forall c (kd :: KeyRole).
DSIGNAlgorithm (DSIGN c) =>
RawSeed -> (SignKeyDSIGN (DSIGN c), VKey kd c)
mkKeyPair (Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RawSeed
RawSeed Word64
1 Word64
0 Word64
0 Word64
0 Word64
1)
, ppVrf :: VRFVerKeyHash 'StakePoolVRF c
L.ppVrf = forall c (r :: KeyRoleVRF).
Crypto c =>
VerKeyVRF c -> VRFVerKeyHash r c
hashVerKeyVRF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c. VRFKeyPair c -> VerKeyVRF c
vrfVerKey forall a b. (a -> b) -> a -> b
$ forall c. Crypto c => RawSeed -> VRFKeyPair c
mkVRFKeyPair @c (Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RawSeed
RawSeed Word64
1 Word64
0 Word64
0 Word64
0 Word64
2)
, ppPledge :: Coin
L.ppPledge = Integer -> Coin
L.Coin Integer
1
, ppCost :: Coin
L.ppCost = Integer -> Coin
L.Coin Integer
5
, ppMargin :: UnitInterval
L.ppMargin = forall r.
(HasCallStack, Typeable r, BoundedRational r) =>
Rational -> r
unsafeBoundRational Rational
0.25
, ppRewardAccount :: RewardAccount c
L.ppRewardAccount = forall c. Network -> Credential 'Staking c -> RewardAccount c
L.RewardAccount Network
L.Testnet forall c. Crypto c => Credential 'Staking c
Cast.aliceSHK
, ppOwners :: Set (KeyHash 'Staking c)
L.ppOwners = forall a. a -> Set a
Set.singleton forall a b. (a -> b) -> a -> b
$ forall c (kd :: KeyRole). Crypto c => VKey kd c -> KeyHash kd c
hashKey (forall (kd :: KeyRole) c. KeyPair kd c -> VKey kd c
vKey forall c. Crypto c => KeyPair 'Staking c
Cast.aliceStake)
, ppRelays :: StrictSeq StakePoolRelay
L.ppRelays = StrictSeq StakePoolRelay
relays
, ppMetadata :: StrictMaybe PoolMetadata
L.ppMetadata =
forall a. a -> StrictMaybe a
L.SJust forall a b. (a -> b) -> a -> b
$
L.PoolMetadata
{ pmUrl :: Url
L.pmUrl = forall a. HasCallStack => Maybe a -> a
fromJust forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). MonadFail m => Int -> Text -> m Url
textToUrl Int
64 Text
"best.pool.com"
, pmHash :: ByteString
L.pmHash = FilePath -> ByteString
BS.pack FilePath
"100ab{}100ab{}"
}
}
staking :: ShelleyGenesisStaking c
staking =
ShelleyGenesisStaking
{ sgsPools :: ListMap (KeyHash 'StakePool c) (PoolParams c)
sgsPools =
forall k v. [(k, v)] -> ListMap k v
LM.ListMap
[ (forall (r :: KeyRole) c.
Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c)) -> KeyHash r c
L.KeyHash Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c))
"f583a45e4947c102091b96170ef50ef0cf8edb62666193a2163247bb", PoolParams c
poolParams)
]
, sgsStake :: ListMap (KeyHash 'Staking c) (KeyHash 'StakePool c)
sgsStake =
forall k v. [(k, v)] -> ListMap k v
LM.ListMap
[
( forall (r :: KeyRole) c.
Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c)) -> KeyHash r c
L.KeyHash Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c))
"83a192dec0e8da2188e520d0c536a69a747cf173a3df16a6daa94d86"
, forall (r :: KeyRole) c.
Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c)) -> KeyHash r c
L.KeyHash Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c))
"649eda82bf644d34a6925f24ea4c4c36d27e51de1b44ef47e3560be7"
)
]
}