88{-# LANGUAGE ScopedTypeVariables #-}
99{-# LANGUAGE TypeApplications #-}
1010
11- module Test.Cardano.Ledger.Conway.Imp.UtxosSpec (spec ) where
11+ module Test.Cardano.Ledger.Conway.Imp.UtxosSpec (spec , shelleyCertsSpec ) where
1212
1313import Cardano.Ledger.Address (Addr (.. ))
1414import Cardano.Ledger.Allegra.Scripts (
@@ -52,7 +52,6 @@ import Test.Cardano.Ledger.Plutus.Examples (
5252spec ::
5353 forall era .
5454 ( ConwayEraImp era
55- , ShelleyEraTxCert era
5655 , Inject (BabbageContextError era ) (ContextError era )
5756 , Inject (ConwayContextError era ) (ContextError era )
5857 , InjectRuleFailure " LEDGER" BabbageUtxoPredFailure era
@@ -207,7 +206,6 @@ datumAndReferenceInputsSpec = do
207206conwayFeaturesPlutusV1V2FailureSpec ::
208207 forall era .
209208 ( ConwayEraImp era
210- , ShelleyEraTxCert era
211209 , InjectRuleFailure " LEDGER" BabbageUtxoPredFailure era
212210 , InjectRuleFailure " LEDGER" AlonzoUtxosPredFailure era
213211 , Inject (ConwayContextError era ) (ContextError era )
@@ -271,7 +269,7 @@ conwayFeaturesPlutusV1V2FailureSpec = do
271269 describe " ProposalProcedures" $ do
272270 it " V1" $ do
273271 deposit <- getsNES $ nesEsL . curPParamsEpochStateL . ppGovActionDepositL
274- rewardAccount <- registerRewardAccount
272+ rewardAccount <- registerRewardAccountWithDeposit
275273 let badField = OSet. singleton $ ProposalProcedure deposit rewardAccount InfoAction def
276274 testPlutusV1V2Failure
277275 (hashPlutusScript $ redeemerSameAsDatum SPlutusV1 )
@@ -281,7 +279,7 @@ conwayFeaturesPlutusV1V2FailureSpec = do
281279 $ ProposalProceduresFieldNotSupported badField
282280 it " V2" $ do
283281 deposit <- getsNES $ nesEsL . curPParamsEpochStateL . ppGovActionDepositL
284- rewardAccount <- registerRewardAccount
282+ rewardAccount <- registerRewardAccountWithDeposit
285283 let badField = OSet. singleton $ ProposalProcedure deposit rewardAccount InfoAction def
286284 testPlutusV1V2Failure
287285 (hashPlutusScript $ redeemerSameAsDatum SPlutusV2 )
@@ -364,21 +362,6 @@ conwayFeaturesPlutusV1V2FailureSpec = do
364362 CertificateNotSupported badCert
365363 ]
366364 )
367- describe " DelegTxCert" $ do
368- it " V1" $ do
369- (drep, delegator, _) <- setupSingleDRep 1_000_000_000
370- let delegTxCert =
371- DelegTxCert @ era
372- delegator
373- (DelegVote (DRepCredential drep))
374- testCertificateNotSupportedV1 delegTxCert
375- it " V2" $ do
376- (drep, delegator, _) <- setupSingleDRep 1_000_000_000
377- let delegTxCert =
378- DelegTxCert @ era
379- delegator
380- (DelegVote (DRepCredential drep))
381- testCertificateNotSupportedV2 delegTxCert
382365 describe " RegDepositDelegTxCert" $ do
383366 it " V1" $ do
384367 (drep, _, _) <- setupSingleDRep 1_000_000_000
@@ -455,7 +438,6 @@ conwayFeaturesPlutusV1V2FailureSpec = do
455438govPolicySpec ::
456439 forall era .
457440 ( ConwayEraImp era
458- , ShelleyEraTxCert era
459441 , InjectRuleFailure " LEDGER" ShelleyUtxowPredFailure era
460442 , InjectRuleFailure " LEDGER" AlonzoUtxosPredFailure era
461443 ) =>
@@ -482,7 +464,7 @@ govPolicySpec = do
482464 submitFailingTx tx [injectFailure $ ScriptWitnessNotValidatingUTXOW [scriptHash]]
483465
484466 impAnn " TreasuryWithdrawals" $ do
485- rewardAccount <- registerRewardAccount
467+ rewardAccount <- registerRewardAccountWithDeposit
486468 let withdrawals = Map. fromList [(rewardAccount, Coin 1000 )]
487469 let govAction = TreasuryWithdrawals withdrawals (SJust scriptHash)
488470 proposal <- mkProposal govAction
@@ -503,7 +485,7 @@ govPolicySpec = do
503485 (Constitution anchor (SJust alwaysSucceedsSh))
504486 dRep
505487 committeeMembers'
506- rewardAccount <- registerRewardAccount
488+ rewardAccount <- registerRewardAccountWithDeposit
507489
508490 impAnn " ParameterChange" $ do
509491 let pparamsUpdate = def & ppuCommitteeMinSizeL .~ SJust 1
@@ -530,7 +512,7 @@ govPolicySpec = do
530512 submitPhase2Invalid_ tx
531513
532514 impAnn " TreasuryWithdrawals" $ do
533- rewardAccount <- registerRewardAccount
515+ rewardAccount <- registerRewardAccountWithDeposit
534516 let withdrawals = Map. fromList [(rewardAccount, Coin 1000 )]
535517 let govAction = TreasuryWithdrawals withdrawals (SJust alwaysFailsSh)
536518 proposal <- mkProposal govAction
@@ -540,7 +522,6 @@ govPolicySpec = do
540522costModelsSpec ::
541523 forall era .
542524 ( ConwayEraImp era
543- , ShelleyEraTxCert era
544525 , InjectRuleFailure " LEDGER" ShelleyUtxowPredFailure era
545526 , InjectRuleFailure " LEDGER" AlonzoUtxosPredFailure era
546527 ) =>
@@ -704,9 +685,7 @@ testPlutusV1V2Failure sh badField lenz errorField = do
704685 )
705686
706687enactCostModels ::
707- ( ConwayEraImp era
708- , ShelleyEraTxCert era
709- ) =>
688+ ConwayEraImp era =>
710689 StrictMaybe (GovPurposeId 'PParamUpdatePurpose) ->
711690 CostModels ->
712691 Credential 'DRepRole ->
@@ -725,3 +704,52 @@ enactCostModels prevGovId cms dRep committeeMembers' = do
725704
726705spendDatum :: P1. Data
727706spendDatum = P1. I 3
707+
708+ shelleyCertsSpec ::
709+ forall era .
710+ ( ConwayEraImp era
711+ , ShelleyEraTxCert era
712+ , Inject (ConwayContextError era ) (ContextError era )
713+ , InjectRuleFailure " LEDGER" AlonzoUtxosPredFailure era
714+ ) =>
715+ SpecWith (ImpInit (LedgerSpec era ))
716+ shelleyCertsSpec = do
717+ describe " Conway features fail in Plutusdescribe v1 and v2" $ do
718+ describe " Certificates" $ do
719+ describe " Unsupported" $ do
720+ let testCertificateNotSupportedV1 badCert =
721+ testCertificateNotSupported badCert
722+ =<< produceScript @ era (hashPlutusScript $ redeemerSameAsDatum SPlutusV1 )
723+ testCertificateNotSupportedV2 badCert =
724+ testCertificateNotSupported badCert
725+ =<< produceScript @ era (hashPlutusScript $ redeemerSameAsDatum SPlutusV2 )
726+ testCertificateNotSupported badCert txIn = do
727+ submitFailingTx
728+ ( mkBasicTx mkBasicTxBody
729+ & bodyTxL . inputsTxBodyL
730+ .~ Set. singleton txIn
731+ & bodyTxL . certsTxBodyL
732+ .~ SSeq. singleton badCert
733+ )
734+ ( pure . injectFailure $
735+ CollectErrors
736+ [ BadTranslation $
737+ inject $
738+ CertificateNotSupported badCert
739+ ]
740+ )
741+ describe " DelegTxCert" $ do
742+ it " V1" $ do
743+ (drep, delegator, _) <- setupSingleDRep 1_000_000_000
744+ let delegTxCert =
745+ DelegTxCert @ era
746+ delegator
747+ (DelegVote (DRepCredential drep))
748+ testCertificateNotSupportedV1 delegTxCert
749+ it " V2" $ do
750+ (drep, delegator, _) <- setupSingleDRep 1_000_000_000
751+ let delegTxCert =
752+ DelegTxCert @ era
753+ delegator
754+ (DelegVote (DRepCredential drep))
755+ testCertificateNotSupportedV2 delegTxCert
0 commit comments