Skip to content

Commit 24d0ccb

Browse files
committed
Fix freshAddr
1 parent da79051 commit 24d0ccb

File tree

1 file changed

+10
-7
lines changed
  • eras/shelley/impl/testlib/Test/Cardano/Ledger/Shelley

1 file changed

+10
-7
lines changed

eras/shelley/impl/testlib/Test/Cardano/Ledger/Shelley/ImpTest.hs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,20 +1492,23 @@ freshKeyPair = do
14921492

14931493
-- | Generate a random `Addr` that uses a `KeyHash`, and add the corresponding `KeyPair`
14941494
-- to the known keys in the Imp state.
1495-
freshKeyAddr_ ::
1496-
(HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadGen m) => m Addr
1495+
freshKeyAddr_ :: EraGov era => ImpTestM era Addr
14971496
freshKeyAddr_ = snd <$> freshKeyAddr
14981497

14991498
-- | Generate a random `Addr` that uses a `KeyHash`, add the corresponding `KeyPair`
15001499
-- to the known keys in the Imp state, and return the `KeyHash` as well as the `Addr`.
1501-
freshKeyAddr ::
1502-
(HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadGen m) =>
1503-
m (KeyHash Payment, Addr)
1500+
freshKeyAddr :: EraGov era => ImpTestM era (KeyHash Payment, Addr)
15041501
freshKeyAddr = do
1502+
ProtVer pv _ <- getProtVer
15051503
paymentKeyHash <- freshKeyHash @Payment
15061504
stakingKeyHash <-
1507-
oneof
1508-
[Just . mkStakeRef <$> freshKeyHash @Staking, Just . mkStakeRef @Ptr <$> arbitrary, pure Nothing]
1505+
oneof $
1506+
[ Just . mkStakeRef <$> freshKeyHash @Staking
1507+
, pure Nothing
1508+
]
1509+
<> [ Just . mkStakeRef @Ptr <$> arbitrary
1510+
| pv < natVersion @12
1511+
]
15091512
pure (paymentKeyHash, mkAddr paymentKeyHash stakingKeyHash)
15101513

15111514
-- | Looks up the keypair corresponding to the `BootstrapAddress`. The `BootstrapAddress`

0 commit comments

Comments
 (0)