module Test.Cardano.Chain.Update.Gen ( genCanonicalProtocolParameters, genApplicationName, genError, genProtocolVersion, genProtocolParameters, genProtocolParametersUpdate, genSoftforkRule, genSoftwareVersion, genSystemTag, genInstallerHash, genPayload, genProof, genProposal, genProposalBody, genUpId, genUpsData, genVote, ) where import Cardano.Chain.Slotting (SlotNumber (..)) import Cardano.Chain.Update ( ApplicationName (..), ApplicationNameError (..), InstallerHash (..), Payload, Proof, Proposal, ProposalBody (..), ProtocolParameters (..), ProtocolParametersUpdate (..), ProtocolVersion (..), SoftforkRule (..), SoftwareVersion (..), SoftwareVersionError (..), SystemTag (..), SystemTagError (..), UpId, Vote, applicationNameMaxLength, mkVote, payload, systemTagMaxLength, unsafeProposal, ) import qualified Cardano.Chain.Update.Validation.Endorsement as Endorsement import Cardano.Chain.Update.Validation.Interface (Error (..)) import qualified Cardano.Chain.Update.Validation.Registration as Registration import qualified Cardano.Chain.Update.Validation.Voting as Voting import Cardano.Crypto (ProtocolMagicId) import Cardano.Prelude import Hedgehog import qualified Hedgehog.Gen as Gen import qualified Hedgehog.Range as Range import Test.Cardano.Chain.Common.Gen ( genCanonicalTxFeePolicy, genKeyHash, genLovelacePortion, genScriptVersion, genTxFeePolicy, ) import Test.Cardano.Chain.Slotting.Gen ( genEpochNumber, genSlotNumber, ) import Test.Cardano.Crypto.Gen ( genAbstractHash, genHashRaw, genSignature, genSigningKey, genVerificationKey, ) import Test.Cardano.Prelude genApplicationName :: Gen ApplicationName genApplicationName :: Gen ApplicationName genApplicationName = Text -> ApplicationName ApplicationName forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *). MonadGen m => Range Int -> m Char -> m Text Gen.text (forall a. a -> a -> Range a Range.constant Int 0 forall i. Integral i => i applicationNameMaxLength) forall (m :: * -> *). MonadGen m => m Char Gen.alphaNum genCanonicalProtocolParameters :: Gen ProtocolParameters genCanonicalProtocolParameters :: Gen ProtocolParameters genCanonicalProtocolParameters = Word16 -> Natural -> Natural -> Natural -> Natural -> Natural -> LovelacePortion -> LovelacePortion -> LovelacePortion -> LovelacePortion -> SlotNumber -> SoftforkRule -> TxFeePolicy -> EpochNumber -> ProtocolParameters ProtocolParameters forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen Word16 genScriptVersion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen SlotNumber genSlotNumber forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen SoftforkRule genSoftforkRule forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen TxFeePolicy genCanonicalTxFeePolicy forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen EpochNumber genEpochNumber genProtocolVersion :: Gen ProtocolVersion genProtocolVersion :: Gen ProtocolVersion genProtocolVersion = Word16 -> Word16 -> Word8 -> ProtocolVersion ProtocolVersion forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *). MonadGen m => Range Word16 -> m Word16 Gen.word16 forall a. (Bounded a, Num a) => Range a Range.constantBounded forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *). MonadGen m => Range Word16 -> m Word16 Gen.word16 forall a. (Bounded a, Num a) => Range a Range.constantBounded forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *). MonadGen m => Range Word8 -> m Word8 Gen.word8 forall a. (Bounded a, Num a) => Range a Range.constantBounded genProtocolParameters :: Gen ProtocolParameters genProtocolParameters :: Gen ProtocolParameters genProtocolParameters = Word16 -> Natural -> Natural -> Natural -> Natural -> Natural -> LovelacePortion -> LovelacePortion -> LovelacePortion -> LovelacePortion -> SlotNumber -> SoftforkRule -> TxFeePolicy -> EpochNumber -> ProtocolParameters ProtocolParameters forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen Word16 genScriptVersion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen SlotNumber genSlotNumber forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen SoftforkRule genSoftforkRule forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen TxFeePolicy genTxFeePolicy forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen EpochNumber genEpochNumber genProtocolParametersUpdate :: Gen ProtocolParametersUpdate genProtocolParametersUpdate :: Gen ProtocolParametersUpdate genProtocolParametersUpdate = Maybe Word16 -> Maybe Natural -> Maybe Natural -> Maybe Natural -> Maybe Natural -> Maybe Natural -> Maybe LovelacePortion -> Maybe LovelacePortion -> Maybe LovelacePortion -> Maybe LovelacePortion -> Maybe SlotNumber -> Maybe SoftforkRule -> Maybe TxFeePolicy -> Maybe EpochNumber -> ProtocolParametersUpdate ProtocolParametersUpdate forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen Word16 genScriptVersion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen SlotNumber genSlotNumber forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen SoftforkRule genSoftforkRule forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen TxFeePolicy genTxFeePolicy forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe Gen EpochNumber genEpochNumber genSoftforkRule :: Gen SoftforkRule genSoftforkRule :: Gen SoftforkRule genSoftforkRule = LovelacePortion -> LovelacePortion -> LovelacePortion -> SoftforkRule SoftforkRule forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen LovelacePortion genLovelacePortion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen LovelacePortion genLovelacePortion genSoftwareVersion :: Gen SoftwareVersion genSoftwareVersion :: Gen SoftwareVersion genSoftwareVersion = ApplicationName -> Word32 -> SoftwareVersion SoftwareVersion forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen ApplicationName genApplicationName forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *). MonadGen m => Range Word32 -> m Word32 Gen.word32 forall a. (Bounded a, Num a) => Range a Range.constantBounded genSystemTag :: Gen SystemTag genSystemTag :: Gen SystemTag genSystemTag = Text -> SystemTag SystemTag forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *). MonadGen m => Range Int -> m Char -> m Text Gen.text (forall a. a -> a -> Range a Range.constant Int 0 forall i. Integral i => i systemTagMaxLength) forall (m :: * -> *). MonadGen m => m Char Gen.alphaNum genInstallerHash :: Gen InstallerHash genInstallerHash :: Gen InstallerHash genInstallerHash = Hash Raw -> InstallerHash InstallerHash forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen (Hash Raw) genHashRaw genPayload :: ProtocolMagicId -> Gen Payload genPayload :: ProtocolMagicId -> Gen Payload genPayload ProtocolMagicId pm = Maybe Proposal -> [Vote] -> Payload payload forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *) a. MonadGen m => m a -> m (Maybe a) Gen.maybe (ProtocolMagicId -> Gen Proposal genProposal ProtocolMagicId pm) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a] Gen.list (forall a. Integral a => a -> a -> Range a Range.linear Int 0 Int 10) (ProtocolMagicId -> Gen Vote genVote ProtocolMagicId pm) genProof :: ProtocolMagicId -> Gen Proof genProof :: ProtocolMagicId -> Gen Proof genProof ProtocolMagicId pm = forall a algo. (EncCBOR a, HashAlgorithm algo) => Gen a -> Gen (AbstractHash algo a) genAbstractHash (ProtocolMagicId -> Gen Payload genPayload ProtocolMagicId pm) genProposal :: ProtocolMagicId -> Gen Proposal genProposal :: ProtocolMagicId -> Gen Proposal genProposal ProtocolMagicId pm = ProposalBody -> VerificationKey -> Signature ProposalBody -> Proposal unsafeProposal forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen ProposalBody genProposalBody forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen VerificationKey genVerificationKey forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall a. EncCBOR a => ProtocolMagicId -> Gen a -> Gen (Signature a) genSignature ProtocolMagicId pm Gen ProposalBody genProposalBody genProposalBody :: Gen ProposalBody genProposalBody :: Gen ProposalBody genProposalBody = ProtocolVersion -> ProtocolParametersUpdate -> SoftwareVersion -> Map SystemTag InstallerHash -> ProposalBody ProposalBody forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen ProtocolVersion genProtocolVersion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen ProtocolParametersUpdate genProtocolParametersUpdate forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen SoftwareVersion genSoftwareVersion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen (Map SystemTag InstallerHash) genUpsData genUpId :: ProtocolMagicId -> Gen UpId genUpId :: ProtocolMagicId -> Gen UpId genUpId ProtocolMagicId pm = forall a algo. (EncCBOR a, HashAlgorithm algo) => Gen a -> Gen (AbstractHash algo a) genAbstractHash (ProtocolMagicId -> Gen Proposal genProposal ProtocolMagicId pm) genUpsData :: Gen (Map SystemTag InstallerHash) genUpsData :: Gen (Map SystemTag InstallerHash) genUpsData = forall (m :: * -> *) k v. (MonadGen m, Ord k) => Range Int -> m (k, v) -> m (Map k v) Gen.map (forall a. Integral a => a -> a -> Range a Range.linear Int 0 Int 20) ((,) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen SystemTag genSystemTag forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen InstallerHash genInstallerHash) genVote :: ProtocolMagicId -> Gen Vote genVote :: ProtocolMagicId -> Gen Vote genVote ProtocolMagicId pm = ProtocolMagicId -> SigningKey -> UpId -> Bool -> Vote mkVote ProtocolMagicId pm forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen SigningKey genSigningKey forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> ProtocolMagicId -> Gen UpId genUpId ProtocolMagicId pm forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *). MonadGen m => m Bool Gen.bool genError :: ProtocolMagicId -> Gen Error genError :: ProtocolMagicId -> Gen Error genError ProtocolMagicId pm = forall (m :: * -> *) a. MonadGen m => [m a] -> m a Gen.choice [ Error -> Error Registration forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen Error genRegistrationError , Error -> Error Voting forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> ProtocolMagicId -> Gen Error genVotingError ProtocolMagicId pm , Error -> Error Endorsement forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen Error genEndorsementError , TooLarge Int -> Error NumberOfGenesisKeysTooLarge forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen (TooLarge Int) genRegistrationTooLarge ] genRegistrationError :: Gen Registration.Error genRegistrationError :: Gen Error genRegistrationError = forall (m :: * -> *) a. MonadGen m => [m a] -> m a Gen.choice [ ProtocolVersion -> Error Registration.DuplicateProtocolVersion forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen ProtocolVersion genProtocolVersion , SoftwareVersion -> Error Registration.DuplicateSoftwareVersion forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen SoftwareVersion genSoftwareVersion , KeyHash -> Error Registration.InvalidProposer forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen KeyHash genKeyHash , ProtocolVersion -> Adopted -> Error Registration.InvalidProtocolVersion forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen ProtocolVersion genProtocolVersion forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> (ProtocolVersion -> Adopted Registration.Adopted forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen ProtocolVersion genProtocolVersion) , Word16 -> Word16 -> Error Registration.InvalidScriptVersion forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen Word16 genWord16 forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Word16 genWord16 , forall (f :: * -> *) a. Applicative f => a -> f a pure Error Registration.InvalidSignature , ApplicationVersions -> SoftwareVersion -> Error Registration.InvalidSoftwareVersion forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> ( forall (m :: * -> *) k v. (MonadGen m, Ord k) => Range Int -> m (k, v) -> m (Map k v) Gen.map (forall a. Integral a => a -> a -> Range a Range.linear Int 1 Int 20) forall a b. (a -> b) -> a -> b $ do ApplicationName name <- Gen ApplicationName genApplicationName Word32 version <- Gen Word32 genWord32 SlotNumber slotNo <- Word64 -> SlotNumber SlotNumber forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *). MonadGen m => Range Word64 -> m Word64 Gen.word64 forall a. (Bounded a, Num a) => Range a Range.constantBounded Map SystemTag InstallerHash meta <- forall (m :: * -> *) k v. (MonadGen m, Ord k) => Range Int -> m (k, v) -> m (Map k v) Gen.map (forall a. Integral a => a -> a -> Range a Range.linear Int 1 Int 10) forall a b. (a -> b) -> a -> b $ (,) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen SystemTag genSystemTag forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen InstallerHash genInstallerHash forall (f :: * -> *) a. Applicative f => a -> f a pure (ApplicationName name, (Word32 -> SlotNumber -> Map SystemTag InstallerHash -> ApplicationVersion Registration.ApplicationVersion Word32 version SlotNumber slotNo Map SystemTag InstallerHash meta)) ) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen SoftwareVersion genSoftwareVersion , TooLarge Natural -> Error Registration.MaxBlockSizeTooLarge forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> (forall n. n -> n -> TooLarge n Registration.TooLarge forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural) , TooLarge Natural -> Error Registration.MaxTxSizeTooLarge forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> (forall n. n -> n -> TooLarge n Registration.TooLarge forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural) , forall (f :: * -> *) a. Applicative f => a -> f a pure Error Registration.ProposalAttributesUnknown , TooLarge Natural -> Error Registration.ProposalTooLarge forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> (forall n. n -> n -> TooLarge n Registration.TooLarge forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen Natural genNatural forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Natural genNatural) , (SoftwareVersionError -> Error Registration.SoftwareVersionError forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . ApplicationNameError -> SoftwareVersionError SoftwareVersionApplicationNameError) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *) a. MonadGen m => [m a] -> m a Gen.choice [ Text -> ApplicationNameError ApplicationNameTooLong forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *). MonadGen m => Range Int -> m Char -> m Text Gen.text (forall a. Integral a => a -> a -> Range a Range.linear Int 0 Int 20) forall (m :: * -> *). MonadGen m => m Char Gen.alphaNum , Text -> ApplicationNameError ApplicationNameNotAscii forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *). MonadGen m => Range Int -> m Char -> m Text Gen.text (forall a. Integral a => a -> a -> Range a Range.linear Int 0 Int 20) forall (m :: * -> *). MonadGen m => m Char Gen.alphaNum ] , SystemTagError -> Error Registration.SystemTagError forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *) a. MonadGen m => [m a] -> m a Gen.choice [ Text -> SystemTagError SystemTagNotAscii forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *). MonadGen m => Range Int -> m Char -> m Text Gen.text (forall a. Integral a => a -> a -> Range a Range.linear Int 0 Int 20) forall (m :: * -> *). MonadGen m => m Char Gen.alphaNum , Text -> SystemTagError SystemTagTooLong forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *). MonadGen m => Range Int -> m Char -> m Text Gen.text (forall a. Integral a => a -> a -> Range a Range.linear Int 0 Int 20) forall (m :: * -> *). MonadGen m => m Char Gen.alphaNum ] ] genVotingError :: ProtocolMagicId -> Gen Voting.Error genVotingError :: ProtocolMagicId -> Gen Error genVotingError ProtocolMagicId pm = forall (m :: * -> *) a. MonadGen m => [m a] -> m a Gen.choice [ forall (f :: * -> *) a. Applicative f => a -> f a pure Error Voting.VotingInvalidSignature , UpId -> Error Voting.VotingProposalNotRegistered forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> ProtocolMagicId -> Gen UpId genUpId ProtocolMagicId pm , KeyHash -> Error Voting.VotingVoterNotDelegate forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen KeyHash genKeyHash ] genEndorsementError :: Gen Endorsement.Error genEndorsementError :: Gen Error genEndorsementError = ProtocolVersion -> Error Endorsement.MultipleProposalsForProtocolVersion forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen ProtocolVersion genProtocolVersion genRegistrationTooLarge :: Gen (Registration.TooLarge Int) genRegistrationTooLarge :: Gen (TooLarge Int) genRegistrationTooLarge = forall n. n -> n -> TooLarge n Registration.TooLarge forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall (m :: * -> *). MonadGen m => Range Int -> m Int Gen.int forall a. (Bounded a, Num a) => Range a Range.constantBounded forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> forall (m :: * -> *). MonadGen m => Range Int -> m Int Gen.int forall a. (Bounded a, Num a) => Range a Range.constantBounded