{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Test.Consensus.Ledger.Mock.Generators () where
import Cardano.Crypto.DSIGN
import Cardano.Crypto.Hash
import Codec.Serialise (Serialise, encode, serialise)
import qualified Data.ByteString.Lazy as Lazy
import qualified Data.Map.Strict as Map
import qualified Data.Set as Set
import Data.Typeable
import Ouroboros.Consensus.Block
import Ouroboros.Consensus.HeaderValidation
import Ouroboros.Consensus.Ledger.SupportsMempool
import Ouroboros.Consensus.Mock.Ledger.Block
import Ouroboros.Consensus.Mock.Ledger.Block.BFT
import qualified Ouroboros.Consensus.Mock.Ledger.State as L
import qualified Ouroboros.Consensus.Mock.Ledger.UTxO as L
import Ouroboros.Consensus.Mock.Node.Serialisation ()
import Ouroboros.Consensus.Protocol.BFT
import Test.ChainGenerators ()
import Test.Crypto.Hash ()
import Test.QuickCheck
import Test.Util.Orphans.Arbitrary ()
import Test.Util.Serialisation.Roundtrip
import Test.Util.Serialisation.SomeResult (SomeResult (..))
instance Arbitrary (HeaderHash blk) => Arbitrary (ChainHash blk) where
arbitrary :: Gen (ChainHash blk)
arbitrary = [Gen (ChainHash blk)] -> Gen (ChainHash blk)
forall a. HasCallStack => [Gen a] -> Gen a
oneof [
ChainHash blk -> Gen (ChainHash blk)
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return ChainHash blk
forall {k} (b :: k). ChainHash b
GenesisHash
, HeaderHash blk -> ChainHash blk
forall {k} (b :: k). HeaderHash b -> ChainHash b
BlockHash (HeaderHash blk -> ChainHash blk)
-> Gen (HeaderHash blk) -> Gen (ChainHash blk)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (HeaderHash blk)
forall a. Arbitrary a => Gen a
arbitrary
]
instance Arbitrary (HeaderHash blk) => Arbitrary (Point blk) where
arbitrary :: Gen (Point blk)
arbitrary = [Gen (Point blk)] -> Gen (Point blk)
forall a. HasCallStack => [Gen a] -> Gen a
oneof [
Point blk -> Gen (Point blk)
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return Point blk
forall {k} (block :: k). Point block
GenesisPoint
, SlotNo -> HeaderHash blk -> Point blk
forall {k} (block :: k). SlotNo -> HeaderHash block -> Point block
BlockPoint (SlotNo -> HeaderHash blk -> Point blk)
-> Gen SlotNo -> Gen (HeaderHash blk -> Point blk)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen SlotNo
forall a. Arbitrary a => Gen a
arbitrary Gen (HeaderHash blk -> Point blk)
-> Gen (HeaderHash blk) -> Gen (Point blk)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen (HeaderHash blk)
forall a. Arbitrary a => Gen a
arbitrary
]
instance (SimpleCrypto c, Arbitrary ext, Serialise ext)
=> Arbitrary (SimpleBlock c ext) where
arbitrary :: Gen (SimpleBlock c ext)
arbitrary = do
SimpleStdHeader c ext
simpleStdHeader <- Gen (SimpleStdHeader c ext)
forall a. Arbitrary a => Gen a
arbitrary
SimpleBody
body <- Gen SimpleBody
forall a. Arbitrary a => Gen a
arbitrary
ext
ext <- Gen ext
forall a. Arbitrary a => Gen a
arbitrary
let hdr :: Header (SimpleBlock c ext)
hdr = (ext -> Encoding)
-> SimpleStdHeader c ext -> ext -> Header (SimpleBlock c ext)
forall c ext' ext.
SimpleCrypto c =>
(ext' -> Encoding)
-> SimpleStdHeader c ext
-> ext'
-> Header (SimpleBlock' c ext ext')
mkSimpleHeader ext -> Encoding
forall a. Serialise a => a -> Encoding
encode SimpleStdHeader c ext
simpleStdHeader ext
ext
SimpleBlock c ext -> Gen (SimpleBlock c ext)
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (SimpleBlock c ext -> Gen (SimpleBlock c ext))
-> SimpleBlock c ext -> Gen (SimpleBlock c ext)
forall a b. (a -> b) -> a -> b
$ Header (SimpleBlock c ext) -> SimpleBody -> SimpleBlock c ext
forall c ext ext'.
Header (SimpleBlock' c ext ext')
-> SimpleBody -> SimpleBlock' c ext ext'
SimpleBlock Header (SimpleBlock c ext)
hdr SimpleBody
body
instance (SimpleCrypto c, Arbitrary ext, Serialise ext)
=> Arbitrary (Coherent (SimpleBlock c ext)) where
arbitrary :: Gen (Coherent (SimpleBlock c ext))
arbitrary = do
SimpleStdHeader c ext
simpleStdHeader <- Gen (SimpleStdHeader c ext)
forall a. Arbitrary a => Gen a
arbitrary
SimpleBody
body <- Gen SimpleBody
forall a. Arbitrary a => Gen a
arbitrary
ext
ext <- Gen ext
forall a. Arbitrary a => Gen a
arbitrary
let simpleStdHeader' :: SimpleStdHeader c ext
simpleStdHeader' = SimpleStdHeader c ext
simpleStdHeader {
simpleBodySize = fromIntegral $ Lazy.length $ serialise body
}
hdr :: Header (SimpleBlock c ext)
hdr = (ext -> Encoding)
-> SimpleStdHeader c ext -> ext -> Header (SimpleBlock c ext)
forall c ext' ext.
SimpleCrypto c =>
(ext' -> Encoding)
-> SimpleStdHeader c ext
-> ext'
-> Header (SimpleBlock' c ext ext')
mkSimpleHeader ext -> Encoding
forall a. Serialise a => a -> Encoding
encode SimpleStdHeader c ext
simpleStdHeader' ext
ext
Coherent (SimpleBlock c ext) -> Gen (Coherent (SimpleBlock c ext))
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (Coherent (SimpleBlock c ext)
-> Gen (Coherent (SimpleBlock c ext)))
-> Coherent (SimpleBlock c ext)
-> Gen (Coherent (SimpleBlock c ext))
forall a b. (a -> b) -> a -> b
$ SimpleBlock c ext -> Coherent (SimpleBlock c ext)
forall a. a -> Coherent a
Coherent (SimpleBlock c ext -> Coherent (SimpleBlock c ext))
-> SimpleBlock c ext -> Coherent (SimpleBlock c ext)
forall a b. (a -> b) -> a -> b
$ Header (SimpleBlock c ext) -> SimpleBody -> SimpleBlock c ext
forall c ext ext'.
Header (SimpleBlock' c ext ext')
-> SimpleBody -> SimpleBlock' c ext ext'
SimpleBlock Header (SimpleBlock c ext)
hdr SimpleBody
body
instance (SimpleCrypto c, Arbitrary ext, Serialise ext, Typeable ext)
=> Arbitrary (Header (SimpleBlock c ext)) where
arbitrary :: Gen (Header (SimpleBlock c ext))
arbitrary = SimpleBlock c ext -> Header (SimpleBlock c ext)
forall blk. GetHeader blk => blk -> Header blk
getHeader (SimpleBlock c ext -> Header (SimpleBlock c ext))
-> Gen (SimpleBlock c ext) -> Gen (Header (SimpleBlock c ext))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (SimpleBlock c ext)
forall a. Arbitrary a => Gen a
arbitrary
instance (HashAlgorithm (SimpleHash c), Arbitrary ext, Serialise ext)
=> Arbitrary (SimpleStdHeader c ext) where
arbitrary :: Gen (SimpleStdHeader c ext)
arbitrary = ChainHash (SimpleBlock c ext)
-> SlotNo
-> BlockNo
-> Hash (SimpleHash c) SimpleBody
-> SizeInBytes
-> SimpleStdHeader c ext
forall c ext.
ChainHash (SimpleBlock c ext)
-> SlotNo
-> BlockNo
-> Hash (SimpleHash c) SimpleBody
-> SizeInBytes
-> SimpleStdHeader c ext
SimpleStdHeader
(ChainHash (SimpleBlock c ext)
-> SlotNo
-> BlockNo
-> Hash (SimpleHash c) SimpleBody
-> SizeInBytes
-> SimpleStdHeader c ext)
-> Gen (ChainHash (SimpleBlock c ext))
-> Gen
(SlotNo
-> BlockNo
-> Hash (SimpleHash c) SimpleBody
-> SizeInBytes
-> SimpleStdHeader c ext)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (ChainHash (SimpleBlock c ext))
forall a. Arbitrary a => Gen a
arbitrary
Gen
(SlotNo
-> BlockNo
-> Hash (SimpleHash c) SimpleBody
-> SizeInBytes
-> SimpleStdHeader c ext)
-> Gen SlotNo
-> Gen
(BlockNo
-> Hash (SimpleHash c) SimpleBody
-> SizeInBytes
-> SimpleStdHeader c ext)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen SlotNo
forall a. Arbitrary a => Gen a
arbitrary
Gen
(BlockNo
-> Hash (SimpleHash c) SimpleBody
-> SizeInBytes
-> SimpleStdHeader c ext)
-> Gen BlockNo
-> Gen
(Hash (SimpleHash c) SimpleBody
-> SizeInBytes -> SimpleStdHeader c ext)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen BlockNo
forall a. Arbitrary a => Gen a
arbitrary
Gen
(Hash (SimpleHash c) SimpleBody
-> SizeInBytes -> SimpleStdHeader c ext)
-> Gen (Hash (SimpleHash c) SimpleBody)
-> Gen (SizeInBytes -> SimpleStdHeader c ext)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen (Hash (SimpleHash c) SimpleBody)
forall a. Arbitrary a => Gen a
arbitrary
Gen (SizeInBytes -> SimpleStdHeader c ext)
-> Gen SizeInBytes -> Gen (SimpleStdHeader c ext)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen SizeInBytes
forall a. Arbitrary a => Gen a
arbitrary
instance Arbitrary SimpleBody where
arbitrary :: Gen SimpleBody
arbitrary = [Tx] -> SimpleBody
SimpleBody ([Tx] -> SimpleBody) -> Gen [Tx] -> Gen SimpleBody
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Tx -> Gen [Tx]
forall a. Gen a -> Gen [a]
listOf Gen Tx
forall a. Arbitrary a => Gen a
arbitrary
instance Arbitrary (SomeSecond (NestedCtxt Header) (SimpleBlock c ext)) where
arbitrary :: Gen (SomeSecond (NestedCtxt Header) (SimpleBlock c ext))
arbitrary = SomeSecond (NestedCtxt Header) (SimpleBlock c ext)
-> Gen (SomeSecond (NestedCtxt Header) (SimpleBlock c ext))
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeSecond (NestedCtxt Header) (SimpleBlock c ext)
-> Gen (SomeSecond (NestedCtxt Header) (SimpleBlock c ext)))
-> SomeSecond (NestedCtxt Header) (SimpleBlock c ext)
-> Gen (SomeSecond (NestedCtxt Header) (SimpleBlock c ext))
forall a b. (a -> b) -> a -> b
$ NestedCtxt Header (SimpleBlock c ext) (Header (SimpleBlock c ext))
-> SomeSecond (NestedCtxt Header) (SimpleBlock c ext)
forall {k1} {k2} (f :: k1 -> k2 -> *) (a :: k1) (b :: k2).
f a b -> SomeSecond f a
SomeSecond NestedCtxt
Header
(SimpleBlock c ext)
(TrivialIndex (NestedCtxt Header (SimpleBlock c ext)))
NestedCtxt Header (SimpleBlock c ext) (Header (SimpleBlock c ext))
forall (f :: * -> *). TrivialDependency f => f (TrivialIndex f)
indexIsTrivial
instance Arbitrary (SomeSecond BlockQuery (SimpleBlock c ext)) where
arbitrary :: Gen (SomeSecond BlockQuery (SimpleBlock c ext))
arbitrary = SomeSecond BlockQuery (SimpleBlock c ext)
-> Gen (SomeSecond BlockQuery (SimpleBlock c ext))
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeSecond BlockQuery (SimpleBlock c ext)
-> Gen (SomeSecond BlockQuery (SimpleBlock c ext)))
-> SomeSecond BlockQuery (SimpleBlock c ext)
-> Gen (SomeSecond BlockQuery (SimpleBlock c ext))
forall a b. (a -> b) -> a -> b
$ BlockQuery (SimpleBlock c ext) (Point (SimpleBlock c ext))
-> SomeSecond BlockQuery (SimpleBlock c ext)
forall {k1} {k2} (f :: k1 -> k2 -> *) (a :: k1) (b :: k2).
f a b -> SomeSecond f a
SomeSecond BlockQuery (SimpleBlock c ext) (Point (SimpleBlock c ext))
forall c ext.
BlockQuery (SimpleBlock c ext) (Point (SimpleBlock c ext))
QueryLedgerTip
instance (SimpleCrypto c, Typeable ext) => Arbitrary (SomeResult (SimpleBlock c ext)) where
arbitrary :: Gen (SomeResult (SimpleBlock c ext))
arbitrary = BlockQuery (SimpleBlock c ext) (Point (SimpleBlock c ext))
-> Point (SimpleBlock c ext) -> SomeResult (SimpleBlock c ext)
forall result blk.
(Eq result, Show result, Typeable result) =>
BlockQuery blk result -> result -> SomeResult blk
SomeResult BlockQuery (SimpleBlock c ext) (Point (SimpleBlock c ext))
forall c ext.
BlockQuery (SimpleBlock c ext) (Point (SimpleBlock c ext))
QueryLedgerTip (Point (SimpleBlock c ext) -> SomeResult (SimpleBlock c ext))
-> Gen (Point (SimpleBlock c ext))
-> Gen (SomeResult (SimpleBlock c ext))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (Point (SimpleBlock c ext))
forall a. Arbitrary a => Gen a
arbitrary
instance Arbitrary (LedgerState (SimpleBlock c ext)) where
arbitrary :: Gen (LedgerState (SimpleBlock c ext))
arbitrary = MockState (SimpleBlock c ext) -> LedgerState (SimpleBlock c ext)
forall c ext.
MockState (SimpleBlock c ext) -> LedgerState (SimpleBlock c ext)
SimpleLedgerState (MockState (SimpleBlock c ext) -> LedgerState (SimpleBlock c ext))
-> Gen (MockState (SimpleBlock c ext))
-> Gen (LedgerState (SimpleBlock c ext))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (MockState (SimpleBlock c ext))
forall a. Arbitrary a => Gen a
arbitrary
instance HashAlgorithm (SimpleHash c) => Arbitrary (AnnTip (SimpleBlock c ext)) where
arbitrary :: Gen (AnnTip (SimpleBlock c ext))
arbitrary = do
SlotNo
annTipSlotNo <- Word64 -> SlotNo
SlotNo (Word64 -> SlotNo) -> Gen Word64 -> Gen SlotNo
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Word64
forall a. Arbitrary a => Gen a
arbitrary
BlockNo
annTipBlockNo <- Word64 -> BlockNo
BlockNo (Word64 -> BlockNo) -> Gen Word64 -> Gen BlockNo
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Word64
forall a. Arbitrary a => Gen a
arbitrary
Hash (SimpleHash c) (Header (SimpleBlock c ext))
annTipInfo <- Gen (Hash (SimpleHash c) (Header (SimpleBlock c ext)))
forall a. Arbitrary a => Gen a
arbitrary
AnnTip (SimpleBlock c ext) -> Gen (AnnTip (SimpleBlock c ext))
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return AnnTip{Hash (SimpleHash c) (Header (SimpleBlock c ext))
BlockNo
SlotNo
TipInfo (SimpleBlock c ext)
annTipSlotNo :: SlotNo
annTipBlockNo :: BlockNo
annTipInfo :: Hash (SimpleHash c) (Header (SimpleBlock c ext))
annTipSlotNo :: SlotNo
annTipBlockNo :: BlockNo
annTipInfo :: TipInfo (SimpleBlock c ext)
..}
instance Arbitrary (GenTx (SimpleBlock c ext)) where
arbitrary :: Gen (GenTx (SimpleBlock c ext))
arbitrary = do
Tx
simpleGenTx <- Gen Tx
forall a. Arbitrary a => Gen a
arbitrary
TxId
simpleGenTxId <- Gen TxId
forall a. Arbitrary a => Gen a
arbitrary
GenTx (SimpleBlock c ext) -> Gen (GenTx (SimpleBlock c ext))
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return SimpleGenTx{TxId
Tx
simpleGenTx :: Tx
simpleGenTxId :: TxId
simpleGenTx :: Tx
simpleGenTxId :: TxId
..}
instance Arbitrary (TxId (GenTx (SimpleBlock c ext))) where
arbitrary :: Gen (TxId (GenTx (SimpleBlock c ext)))
arbitrary = TxId -> TxId (GenTx (SimpleBlock c ext))
forall c ext. TxId -> TxId (GenTx (SimpleBlock c ext))
SimpleGenTxId (TxId -> TxId (GenTx (SimpleBlock c ext)))
-> Gen TxId -> Gen (TxId (GenTx (SimpleBlock c ext)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen TxId
forall a. Arbitrary a => Gen a
arbitrary
instance Arbitrary L.Tx where
arbitrary :: Gen Tx
arbitrary = Expiry -> Set TxIn -> [TxOut] -> Tx
L.Tx Expiry
L.DoNotExpire
(Set TxIn -> [TxOut] -> Tx)
-> Gen (Set TxIn) -> Gen ([TxOut] -> Tx)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set TxIn -> Gen (Set TxIn)
forall a. a -> Gen a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Set TxIn
forall a. Monoid a => a
mempty
Gen ([TxOut] -> Tx) -> Gen [TxOut] -> Gen Tx
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen [TxOut]
forall a. Arbitrary a => Gen a
arbitrary
instance Arbitrary L.Addr where
arbitrary :: Gen Addr
arbitrary = [Addr] -> Gen Addr
forall a. HasCallStack => [a] -> Gen a
elements [Addr
"a", Addr
"b", Addr
"c"]
instance Arbitrary (L.MockState blk) where
arbitrary :: Gen (MockState blk)
arbitrary = MockState blk -> Gen (MockState blk)
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return (MockState blk -> Gen (MockState blk))
-> MockState blk -> Gen (MockState blk)
forall a b. (a -> b) -> a -> b
$ L.MockState {
mockUtxo :: Utxo
mockUtxo = Utxo
forall k a. Map k a
Map.empty
, mockConfirmed :: Set TxId
mockConfirmed = Set TxId
forall a. Set a
Set.empty
, mockTip :: Point blk
mockTip = Point blk
forall {k} (block :: k). Point block
GenesisPoint
}
instance Arbitrary (HeaderHash blk) => Arbitrary (L.MockError blk) where
arbitrary :: Gen (MockError blk)
arbitrary = [Gen (MockError blk)] -> Gen (MockError blk)
forall a. HasCallStack => [Gen a] -> Gen a
oneof [
SlotNo -> SlotNo -> MockError blk
forall blk. SlotNo -> SlotNo -> MockError blk
L.MockExpired (SlotNo -> SlotNo -> MockError blk)
-> Gen SlotNo -> Gen (SlotNo -> MockError blk)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen SlotNo
forall a. Arbitrary a => Gen a
arbitrary Gen (SlotNo -> MockError blk) -> Gen SlotNo -> Gen (MockError blk)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen SlotNo
forall a. Arbitrary a => Gen a
arbitrary
, ChainHash blk -> ChainHash blk -> MockError blk
forall blk. ChainHash blk -> ChainHash blk -> MockError blk
L.MockInvalidHash (ChainHash blk -> ChainHash blk -> MockError blk)
-> Gen (ChainHash blk) -> Gen (ChainHash blk -> MockError blk)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (ChainHash blk)
forall a. Arbitrary a => Gen a
arbitrary Gen (ChainHash blk -> MockError blk)
-> Gen (ChainHash blk) -> Gen (MockError blk)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen (ChainHash blk)
forall a. Arbitrary a => Gen a
arbitrary
]
instance Arbitrary (SimpleBftExt c BftMockCrypto) where
arbitrary :: Gen (SimpleBftExt c BftMockCrypto)
arbitrary = do
BftFields BftMockCrypto (SignedSimpleBft c BftMockCrypto)
simpleBftExt <- Gen (BftFields BftMockCrypto (SignedSimpleBft c BftMockCrypto))
forall a. Arbitrary a => Gen a
arbitrary
SimpleBftExt c BftMockCrypto -> Gen (SimpleBftExt c BftMockCrypto)
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return SimpleBftExt{BftFields BftMockCrypto (SignedSimpleBft c BftMockCrypto)
simpleBftExt :: BftFields BftMockCrypto (SignedSimpleBft c BftMockCrypto)
simpleBftExt :: BftFields BftMockCrypto (SignedSimpleBft c BftMockCrypto)
..}
instance Arbitrary (BftFields BftMockCrypto toSign) where
arbitrary :: Gen (BftFields BftMockCrypto toSign)
arbitrary = do
SignedDSIGN MockDSIGN toSign
bftSignature <- SigDSIGN MockDSIGN -> SignedDSIGN MockDSIGN toSign
forall v a. SigDSIGN v -> SignedDSIGN v a
SignedDSIGN (SigDSIGN MockDSIGN -> SignedDSIGN MockDSIGN toSign)
-> Gen (SigDSIGN MockDSIGN) -> Gen (SignedDSIGN MockDSIGN toSign)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
(Hash ShortHash () -> Word64 -> SigDSIGN MockDSIGN
SigMockDSIGN (Hash ShortHash () -> Word64 -> SigDSIGN MockDSIGN)
-> Gen (Hash ShortHash ()) -> Gen (Word64 -> SigDSIGN MockDSIGN)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen (Hash ShortHash ())
forall a. Arbitrary a => Gen a
arbitrary Gen (Word64 -> SigDSIGN MockDSIGN)
-> Gen Word64 -> Gen (SigDSIGN MockDSIGN)
forall a b. Gen (a -> b) -> Gen a -> Gen b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Word64
forall a. Arbitrary a => Gen a
arbitrary)
BftFields BftMockCrypto toSign
-> Gen (BftFields BftMockCrypto toSign)
forall a. a -> Gen a
forall (m :: * -> *) a. Monad m => a -> m a
return BftFields{SignedDSIGN MockDSIGN toSign
SignedDSIGN (BftDSIGN BftMockCrypto) toSign
bftSignature :: SignedDSIGN MockDSIGN toSign
bftSignature :: SignedDSIGN (BftDSIGN BftMockCrypto) toSign
..}