View on GitHub
File Changes

                      
-- | Constant list of KeyPairs intended to be used in the generators.
traceKeyPairs :: KeyPairs
-
traceKeyPairs = mkKeyPairs <$> [1 .. 50]
+
traceKeyPairs = mkKeyPairs <$> [1 .. 150]

                      
-- | Select between _lower_ and _upper_ keys from 'traceKeyPairs'
someKeyPairs :: Int -> Int -> Gen KeyPairs
  -> VrfKeyPairs
  -> DPState
  -> Gen (Maybe (DCert, KeyPair))
-
  -- -> Gen (Maybe (DCert, DCertReturnStuff))
genDCert keys vrfKeys dpState =
  -- TODO @uroboros Generate _RetirePool_ Certificates
  -- TODO @uroboros Generate _Delegate_ Certificates
-
  Gen.frequency [ (2, genRegKeyCert keys dState)
-
                , (3, genDeRegKeyCert keys dState)
+
  Gen.frequency [ (3, genRegKeyCert keys dState)
+
                , (4, genDeRegKeyCert keys dState)
                , (3, genRegPool keys vrfKeys dpState)
                , (1, pure Nothing)
                ]

                      
-- | Generate PoolParams and the key witness.
genStakePool :: KeyPairs -> VrfKeyPairs -> Gen (PoolParams, KeyPair)
-
genStakePool skeys vrfKeys = do
-
  poolKeyPair   <- Gen.element skeys
-
  vrfKey        <- snd <$> Gen.element vrfKeys
-
  cost          <- Coin <$> genInteger 1 100
-
  pledge        <- Coin <$> genInteger 1 100
-
  marginPercent <- genNatural 0 100
-
  acntKey       <- getAnyStakeKey skeys
-
  let interval = unsafeMkUnitInterval $ fromIntegral marginPercent % 100
-
  let pps = PoolParams
-
              (hashKey . vKey . snd $ poolKeyPair)
-
              (hashKeyVRF vrfKey)
-
              pledge
-
              cost
-
              interval
-
              (RewardAcnt $ KeyHashObj $ hashKey acntKey)
-
              Set.empty
-
  pure (pps, snd poolKeyPair)
+
genStakePool skeys vrfKeys =
+
  mkPoolParams
+
    <$> (Gen.element skeys)
+
    <*> (snd <$> Gen.element vrfKeys)
+
    <*> (Coin <$> genInteger 1 100)
+
    <*> (Coin <$> genInteger 1 100)
+
    <*> (genNatural 0 100)
+
    <*> (getAnyStakeKey skeys)
+
 where
+
  mkPoolParams poolKeyPair vrfKey cost pledge marginPercent acntKey =
+
    let interval = unsafeMkUnitInterval $ fromIntegral marginPercent % 100
+
        pps = PoolParams
+
                (hashKey . vKey . snd $ poolKeyPair)
+
                (hashKeyVRF vrfKey)
+
                pledge
+
                cost
+
                interval
+
                (RewardAcnt $ KeyHashObj $ hashKey acntKey)
+
                Set.empty
+
     in (pps, snd poolKeyPair)

                      
-- | Generate `RegPool` and the key witness.
genDCertRegPool :: KeyPairs -> VrfKeyPairs -> Gen (DCert, KeyPair)
        (traceLength tr <= 5 * length (filter isDeRegKey certs_))

                      
  cover 75
-
        "there is at least 1 RegPool certificate for every 60 transactions"
-
        (traceLength tr <= 60 * length (filter isRegPool certs_))
+
        "there is at least 1 RegPool certificate for every 20 transactions"
+
        (traceLength tr <= 20 * length (filter isRegPool certs_))

                      
  cover 25
        "at most 75% of transactions have no certificates"