diff --git a/server/test/unit/Test/Generators.hs b/server/test/unit/Test/Generators.hs index f17607090d..6f29190ed7 100644 --- a/server/test/unit/Test/Generators.hs +++ b/server/test/unit/Test/Generators.hs @@ -17,7 +17,7 @@ import Cardano.Ledger.Keys import Cardano.Ledger.Serialization ( ToCBORGroup ) import Cardano.Network.Protocol.NodeToClient - ( Block ) + ( Block, GenTxId ) import Cardano.Slotting.Slot ( EpochNo (..) ) import Cardano.Slotting.Time @@ -44,6 +44,7 @@ import Ouroboros.Consensus.Cardano.Block , HardForkBlock (..) , MaryEra , ShelleyEra + , TxId (..) ) import Ouroboros.Consensus.HardFork.Combinator ( LedgerEraInfo (..), Mismatch (..), MismatchEraInfo (..), singleEraInfo ) @@ -57,12 +58,16 @@ import Ouroboros.Consensus.Shelley.Ledger.Block ( ShelleyBlock (..) ) import Ouroboros.Consensus.Shelley.Ledger.Config ( CompactGenesis, compactGenesis ) +import Ouroboros.Consensus.Shelley.Ledger.Mempool + ( TxId (..) ) import Ouroboros.Consensus.Shelley.Ledger.Query ( NonMyopicMemberRewards (..) ) import Ouroboros.Network.Block ( BlockNo (..), HeaderHash, Point (..), SlotNo (..), Tip (..) ) import Ouroboros.Network.Protocol.LocalStateQuery.Type ( AcquireFailure (..) ) +import Ouroboros.Network.Protocol.LocalTxMonitor.Type + ( MempoolSizeAndCapacity (..) ) import Ouroboros.Network.Protocol.LocalTxSubmission.Type ( SubmitResult (..) ) import Test.Cardano.Ledger.Shelley.ConcreteCryptoTypes @@ -115,6 +120,16 @@ genBlock = reasonablySized $ oneof <$> (Ledger.Block <$> arbitrary <*> (toTxSeq @era <$> arbitrary)) <*> arbitrary +genTxId :: Gen (GenTxId Block) +genTxId = + GenTxIdAlonzo . ShelleyTxId <$> arbitrary + +genMempoolSizeAndCapacity :: Gen MempoolSizeAndCapacity +genMempoolSizeAndCapacity = MempoolSizeAndCapacity + <$> arbitrary + <*> arbitrary + <*> arbitrary + genWithOrigin :: Gen a -> Gen (Point.WithOrigin a) genWithOrigin genA = frequency [ (1, pure Point.Origin)