@@ -34,11 +34,17 @@ import Cardano.Ledger.Conway.Core (
3434 ppCoinsPerUTxOByteL ,
3535 txIdTx ,
3636 )
37+ import Cardano.Ledger.Conway.Governance
3738import Cardano.Ledger.Conway.Rules (ConwayUtxowPredFailure (.. ))
39+ import Cardano.Ledger.Conway.TxBody
3840import Cardano.Ledger.Credential (Credential (.. ), StakeReference )
41+ import Cardano.Ledger.Keys (asWitness , witVKeyHash )
3942import Cardano.Ledger.Plutus (Language (.. ), SLanguage (.. ), hashPlutusScript )
4043import Cardano.Ledger.TxIn (TxIn (.. ))
41- import Lens.Micro ((&) , (.~) , (^.) )
44+ import qualified Data.Map as Map
45+ import qualified Data.Set as Set
46+ import qualified Data.Set.NonEmpty as NES
47+ import Lens.Micro ((%~) , (&) , (.~) , (^.) )
4248import Test.Cardano.Ledger.Conway.ImpTest
4349import Test.Cardano.Ledger.Imp.Common
4450import Test.Cardano.Ledger.Plutus.Examples (alwaysSucceedsWithDatum )
@@ -48,7 +54,9 @@ spec ::
4854 ConwayEraImp era =>
4955 SpecWith (ImpInit (LedgerSpec era ))
5056spec = do
51- it " Fails with PPViewHashesDontMatch before PV 11" . whenMajorVersionAtMost @ 10 $ do
57+ -- https://github.com/IntersectMBO/formal-ledger-specifications/issues/1029
58+ -- TODO: Re-enable after issue is resolved, by removing this override
59+ disableInConformanceIt " Fails with PPViewHashesDontMatch before PV 11" . whenMajorVersionAtMost @ 10 $ do
5260 fixedTx <- fixupTx =<< setupBadPPViewHashTx
5361 badScriptIntegrityHash <- arbitrary
5462 tx <- substituteIntegrityHashAndFixWits badScriptIntegrityHash fixedTx
@@ -86,6 +94,35 @@ spec = do
8694 tx
8795 [ injectFailure $ ScriptIntegrityHashMismatch mismatch (SJust $ originalBytes scriptIntegrity)
8896 ]
97+ it " Transaction containing SPO vote but no witness for it fails" $ do
98+ spoKh <- freshKeyHash
99+ registerPool spoKh
100+ gaId <- mkProposal InfoAction >>= submitProposal
101+ submitVote_ @ era VoteYes (StakePoolVoter spoKh) gaId
102+ let tx =
103+ mkBasicTx mkBasicTxBody
104+ & bodyTxL . votingProceduresTxBodyL
105+ .~ VotingProcedures
106+ ( Map. singleton
107+ (StakePoolVoter spoKh)
108+ ( Map. singleton
109+ gaId
110+ ( VotingProcedure
111+ { vProcVote = VoteYes
112+ , vProcAnchor = SNothing
113+ }
114+ )
115+ )
116+ )
117+ let isSPOWitness wit = witVKeyHash wit == asWitness spoKh
118+ withPostFixup (pure . (witsTxL . addrTxWitsL %~ Set. filter (not . isSPOWitness))) $
119+ submitFailingTx
120+ tx
121+ [ injectFailure $
122+ MissingVKeyWitnessesUTXOW $
123+ NES. singleton $
124+ asWitness spoKh
125+ ]
89126
90127setupBadPPViewHashTx ::
91128 forall era .
0 commit comments