@@ -22,7 +22,7 @@ import Cardano.Ledger.BaseTypes (
2222 addEpochInterval ,
2323 natVersion ,
2424 )
25- import Cardano.Ledger.Coin (Coin (.. ), compactCoinOrError )
25+ import Cardano.Ledger.Coin (Coin (.. ))
2626import Cardano.Ledger.Conway
2727import Cardano.Ledger.Conway.Core
2828import Cardano.Ledger.Conway.Governance
@@ -61,7 +61,7 @@ spec = do
6161 submitTx_ $
6262 mkBasicTx mkBasicTxBody
6363 & bodyTxL . certsTxBodyL .~ [regTxCert]
64- expectRegistered cred
64+ expectStakeCredRegistered cred
6565
6666 it " With correct deposit" $ do
6767 expectedDeposit <- getsNES $ nesEsL . curPParamsEpochStateL . ppKeyDepositL
@@ -70,7 +70,7 @@ spec = do
7070 mkBasicTx mkBasicTxBody
7171 & bodyTxL . certsTxBodyL
7272 .~ [RegDepositTxCert (KeyHashObj kh) expectedDeposit]
73- expectRegistered (KeyHashObj kh)
73+ expectStakeCredRegistered (KeyHashObj kh)
7474
7575 it " Twice the same certificate in the same transaction" $ do
7676 -- This is expected behavior because `certsTxBodyL` removes duplicates
@@ -80,7 +80,7 @@ spec = do
8080 mkBasicTx mkBasicTxBody
8181 & bodyTxL . certsTxBodyL
8282 .~ [regTxCert, regTxCert]
83- expectRegistered (KeyHashObj kh)
83+ expectStakeCredRegistered (KeyHashObj kh)
8484
8585 it " When already already registered" $ do
8686 cred <- ScriptHashObj <$> impAddNativeScript (RequireAllOf [] )
@@ -94,7 +94,7 @@ spec = do
9494 tx
9595 [ injectFailure $ Shelley. StakeKeyAlreadyRegisteredDELEG cred
9696 ]
97- expectRegistered cred
97+ expectStakeCredRegistered cred
9898
9999 it " With incorrect deposit" $ do
100100 expectedDeposit <- getsNES $ nesEsL . curPParamsEpochStateL . ppKeyDepositL
@@ -119,7 +119,7 @@ spec = do
119119 }
120120 else IncorrectDepositDELEG wrongDeposit
121121 ]
122- expectNotRegistered (KeyHashObj kh)
122+ expectStakeCredNotRegistered (KeyHashObj kh)
123123
124124 describe " Unregister stake credentials" $ do
125125 it " When registered" $ do
@@ -128,14 +128,14 @@ spec = do
128128 submitTx_ $
129129 mkBasicTx mkBasicTxBody
130130 & bodyTxL . certsTxBodyL .~ [regTxCert]
131- expectRegistered cred
131+ expectStakeCredRegistered cred
132132
133133 unRegTxCert <- genUnRegTxCert cred
134134 submitTx_ $
135135 mkBasicTx mkBasicTxBody
136136 & bodyTxL . certsTxBodyL
137137 .~ [unRegTxCert]
138- expectNotRegistered cred
138+ expectStakeCredNotRegistered cred
139139
140140 it " When not registered" $ do
141141 freshKeyHash >>= \ kh -> do
@@ -176,7 +176,7 @@ spec = do
176176 else IncorrectDepositDELEG wrongDeposit
177177 ]
178178
179- expectRegistered cred
179+ expectStakeCredRegistered cred
180180
181181 -- https://github.com/IntersectMBO/formal-ledger-specifications/issues/917
182182 -- impacts `registerAndRetirePoolToMakeReward`
@@ -198,7 +198,7 @@ spec = do
198198 & bodyTxL . certsTxBodyL .~ [unRegTxCert]
199199 )
200200 [injectFailure $ Shelley. StakeKeyNonZeroAccountBalanceDELEG balance]
201- expectRegistered cred
201+ expectStakeCredRegistered cred
202202
203203 it " Register and unregister in the same transaction" $ do
204204 freshKeyHash >>= \ kh -> do
@@ -207,7 +207,7 @@ spec = do
207207 submitTx_ $
208208 mkBasicTx mkBasicTxBody
209209 & bodyTxL . certsTxBodyL .~ [regTxCert, unRegTxCert]
210- expectNotRegistered (KeyHashObj kh)
210+ expectStakeCredNotRegistered (KeyHashObj kh)
211211
212212 it " deregistering returns the deposit" $ do
213213 let
@@ -291,7 +291,7 @@ spec = do
291291 then Shelley. StakeDelegationImpossibleDELEG cred
292292 else Shelley. StakeKeyNotRegisteredDELEG cred
293293 ]
294- expectNotRegistered cred
294+ expectStakeCredNotRegistered cred
295295
296296 it " Delegate to unregistered pool" $ do
297297 expectedDeposit <- getsNES $ nesEsL . curPParamsEpochStateL . ppKeyDepositL
@@ -358,7 +358,7 @@ spec = do
358358 mkBasicTx mkBasicTxBody
359359 & bodyTxL . certsTxBodyL
360360 .~ [regTxCert, delegStakeTxCert cred poolKh, unRegTxCert]
361- expectNotRegistered cred
361+ expectStakeCredNotRegistered cred
362362
363363 describe " Delegate vote" $ do
364364 it " Delegate vote of registered stake credentials to registered drep" $ do
@@ -433,7 +433,7 @@ spec = do
433433 )
434434 [injectFailure $ StakeKeyNotRegisteredDELEG cred]
435435
436- expectNotRegistered cred
436+ expectStakeCredNotRegistered cred
437437
438438 it " Redelegate vote" $ do
439439 expectedDeposit <- getsNES $ nesEsL . curPParamsEpochStateL . ppKeyDepositL
@@ -472,7 +472,7 @@ spec = do
472472 mkBasicTx mkBasicTxBody
473473 & bodyTxL . certsTxBodyL
474474 .~ [UnRegDepositTxCert cred expectedDeposit]
475- expectNotRegistered cred
475+ expectStakeCredNotRegistered cred
476476 expectNotDelegatedVote cred
477477 -- https://github.com/IntersectMBO/formal-ledger-specifications/issues/917
478478 -- TODO: Re-enable after issue is resolved, by removing this override
@@ -502,7 +502,7 @@ spec = do
502502 & bodyTxL . certsTxBodyL
503503 .~ [RegDepositDelegTxCert cred (DelegVote DRepAlwaysAbstain ) expectedDeposit]
504504 registerAndRetirePoolToMakeReward cred
505- expectRegistered cred
505+ expectStakeCredRegistered cred
506506 expectDelegatedVote cred DRepAlwaysAbstain
507507 impAnn " Version should be unchanged" $
508508 getProtVer `shouldReturn` initialProtVer
@@ -523,7 +523,7 @@ spec = do
523523 & bodyTxL . certsTxBodyL .~ [UnRegDepositTxCert cred expectedDeposit]
524524 & bodyTxL . withdrawalsTxBodyL
525525 .~ Withdrawals (Map. singleton rewardAccount withdrawalAmount)
526- expectNotRegistered cred
526+ expectStakeCredNotRegistered cred
527527 expectNotDelegatedVote cred
528528 -- https://github.com/IntersectMBO/formal-ledger-specifications/issues/916
529529 -- TODO: Re-enable after issue is resolved, by removing this override
@@ -536,7 +536,7 @@ spec = do
536536 & bodyTxL . certsTxBodyL
537537 .~ [RegDepositDelegTxCert cred (DelegVote DRepAlwaysAbstain ) expectedDeposit]
538538 registerAndRetirePoolToMakeReward cred
539- expectRegistered cred
539+ expectStakeCredRegistered cred
540540 expectDelegatedVote cred DRepAlwaysAbstain
541541 forM_ @ [] [1 .. 3 :: Int ] $ \ _ -> do
542542 submitTx_ $
@@ -552,7 +552,7 @@ spec = do
552552 .~ [UnRegDepositTxCert cred expectedDeposit]
553553 & bodyTxL . withdrawalsTxBodyL
554554 .~ Withdrawals (Map. singleton rewardAccount withdrawalAmount)
555- expectNotRegistered cred
555+ expectStakeCredNotRegistered cred
556556 expectNotDelegatedVote cred
557557
558558 -- https://github.com/IntersectMBO/formal-ledger-specifications/issues/640
@@ -648,7 +648,7 @@ spec = do
648648 mkBasicTx mkBasicTxBody
649649 & bodyTxL . certsTxBodyL
650650 .~ [UnRegDepositTxCert cred expectedDeposit]
651- expectNotRegistered cred
651+ expectStakeCredNotRegistered cred
652652
653653 it " Delegate to DRep and SPO and change delegation to a different SPO" $ do
654654 expectedDeposit <- getsNES $ nesEsL . curPParamsEpochStateL . ppKeyDepositL
@@ -678,19 +678,6 @@ spec = do
678678 expectDelegatedToPool cred poolKh'
679679 expectDelegatedVote cred (DRepCredential drepCred)
680680 where
681- expectNotRegistered :: Credential 'Staking -> ImpTestM era ()
682- expectNotRegistered cred = do
683- accounts <- getsNES $ nesEsL . esLStateL . lsCertStateL . certDStateL . accountsL
684- impAnn (show cred <> " expected to not be in Accounts" ) $ do
685- expectNothingExpr $ lookupAccountState cred accounts
686-
687- expectNotDelegatedToPool :: Credential 'Staking -> ImpTestM era ()
688- expectNotDelegatedToPool cred = do
689- accounts <- getsNES $ nesEsL . esLStateL . lsCertStateL . certDStateL . accountsL
690- impAnn (show cred <> " expected to not have delegated to a stake pool" ) $ do
691- accountState <- expectJust $ lookupAccountState cred accounts
692- expectNothingExpr (accountState ^. stakePoolDelegationAccountStateL)
693-
694681 expectDelegatedVote :: HasCallStack => Credential 'Staking -> DRep -> ImpTestM era ()
695682 expectDelegatedVote cred drep = do
696683 accounts <- getsNES $ nesEsL . esLStateL . lsCertStateL . certDStateL . accountsL
@@ -742,20 +729,3 @@ conwayEraSpecificSpec = do
742729 , DelegStakeTxCert cred2 poolKh -- using the pattern from Shelley
743730 ]
744731 expectDelegatedToPool cred2 poolKh
745-
746- expectRegistered :: (HasCallStack , ConwayEraImp era ) => Credential 'Staking -> ImpTestM era ()
747- expectRegistered cred = do
748- accounts <- getsNES $ nesEsL . esLStateL . lsCertStateL . certDStateL . accountsL
749- expectedDeposit <- getsNES $ nesEsL . curPParamsEpochStateL . ppKeyDepositL
750-
751- accountState <- expectJust $ lookupAccountState cred accounts
752- impAnn (show cred <> " expected to be in Accounts with the correct deposit" ) $ do
753- accountState ^. depositAccountStateL `shouldBe` compactCoinOrError expectedDeposit
754-
755- expectDelegatedToPool ::
756- (HasCallStack , ConwayEraImp era ) => Credential 'Staking -> KeyHash 'StakePool -> ImpTestM era ()
757- expectDelegatedToPool cred poolKh = do
758- accounts <- getsNES $ nesEsL . esLStateL . lsCertStateL . certDStateL . accountsL
759- impAnn (show cred <> " expected to have delegated to " <> show poolKh) $ do
760- accountState <- expectJust $ lookupAccountState cred accounts
761- accountState ^. stakePoolDelegationAccountStateL `shouldBe` Just poolKh
0 commit comments