Skip to content

Commit 669b2a0

Browse files
committed
Fix freshAddr
1 parent da79051 commit 669b2a0

File tree

2 files changed

+11
-8
lines changed
  • eras/shelley/impl/testlib/Test/Cardano/Ledger/Shelley
  • libs/cardano-ledger-conformance/test/Test/Cardano/Ledger/Conformance/Imp

2 files changed

+11
-8
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`

libs/cardano-ledger-conformance/test/Test/Cardano/Ledger/Conformance/Imp/Core.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Cardano.Ledger.Conway.Governance
1616
import Cardano.Ledger.Conway.Rules
1717
import Cardano.Ledger.Core
1818
import Cardano.Ledger.Shelley.LedgerState
19-
import Cardano.Ledger.Shelley.Rules (UtxoEnv (..), ledgerSlotNoL)
19+
import Cardano.Ledger.Shelley.Rules (ledgerSlotNoL)
2020
import Cardano.Ledger.TxIn (TxId)
2121
import Control.State.Transition
2222
import Data.Bifunctor (Bifunctor (..))

0 commit comments

Comments
 (0)