diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Conway/Plutus.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Conway/Plutus.hs index bf588a78884..1a878c6f46b 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Conway/Plutus.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Conway/Plutus.hs @@ -139,6 +139,7 @@ hprop_plutus_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBa ] -- 2. Successfully spend conway spending script + _ <- waitForBlocks epochStateView 2 txinCollateral <- findLargestUtxoForPaymentKey epochStateView sbe wallet1 plutusScriptTxIn <- fmap fst . retryUntilJustM epochStateView (WaitForBlocks 3) $ findLargestUtxoWithAddress epochStateView sbe $ Text.pack plutusSpendingScriptAddr diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs index ea7fda32054..e62be796407 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs @@ -57,19 +57,19 @@ import GHC.Exts (IsList (..)) import GHC.Stack (HasCallStack, withFrozenCallStack) import qualified GHC.Stack as GHC import Lens.Micro ((^.)) +import System.Directory (makeAbsolute) import System.FilePath (()) import Testnet.Components.Configuration (eraToString) import Testnet.Components.Query (EpochStateView, checkDRepsNumber, getEpochStateView, watchEpochStateUpdate) import qualified Testnet.Defaults as Defaults -import Testnet.Process.Cli.Transaction ( - mkSimpleSpendOutputsOnlyTx, retrieveTransactionId, signTx, - submitTx) +import Testnet.Process.Cli.Transaction (TxOutAddress (..), mkSimpleSpendOutputsOnlyTx, + mkSpendOutputsOnlyTx, retrieveTransactionId, signTx, submitTx) import Testnet.Process.Run (execCli', execCliStdoutToJson, mkExecConfig) import Testnet.Property.Assert (assertErasEqual) import Testnet.Property.Util (integrationWorkspace) -import Testnet.Start.Types (ShelleyTestnetOptions(..)) +import Testnet.Start.Types (ShelleyTestnetOptions (..)) import Testnet.TestQueryCmds (TestQueryCmds (..), forallQueryCommands) import Testnet.Types @@ -328,31 +328,31 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H. -- This is tested in hprop_querySlotNumber in Cardano.Testnet.Test.Cli.QuerySlotNumber pure () - - TestQueryRefScriptSizeCmd -> pure () -- TODO: Failing intermittently cardano-node-9.2 - -- -- ref-script-size - -- do - -- -- Set up files and vars - -- refScriptSizeWork <- H.createDirectoryIfMissing $ work "ref-script-size-test" - -- plutusV3Script <- File <$> liftIO (makeAbsolute "test/cardano-testnet-test/files/plutus/v3/always-succeeds.plutus") - -- let transferAmount = Coin 10_000_000 - -- -- Submit a transaction to publish the reference script - -- txBody <- mkSpendOutputsOnlyTx execConfig epochStateView sbe refScriptSizeWork "tx-body" wallet1 - -- [(ReferenceScriptAddress plutusV3Script, transferAmount)] - -- signedTx <- signTx execConfig cEra refScriptSizeWork "signed-tx" txBody [SomeKeyPair $ paymentKeyInfoPair wallet1] - -- submitTx execConfig cEra signedTx - -- -- Wait until transaction is on chain and obtain transaction identifier - -- txId <- retrieveTransactionId execConfig signedTx - -- txIx <- H.evalMaybeM $ watchEpochStateUpdate epochStateView (EpochInterval 2) (getTxIx sbe txId transferAmount) - -- -- Query the reference script size - -- let protocolParametersOutFile = refScriptSizeWork "ref-script-size-out.json" - -- H.noteM_ $ execCli' execConfig [ eraName, "query", "ref-script-size" - -- , "--tx-in", txId ++ "#" ++ show (txIx :: Int) - -- , "--out-file", protocolParametersOutFile - -- ] - -- H.diffFileVsGoldenFile - -- protocolParametersOutFile - -- "test/cardano-testnet-test/files/golden/queries/refScriptSizeOut.json" + + TestQueryRefScriptSizeCmd -> + -- ref-script-size + do + -- Set up files and vars + refScriptSizeWork <- H.createDirectoryIfMissing $ work "ref-script-size-test" + plutusV3Script <- File <$> liftIO (makeAbsolute "test/cardano-testnet-test/files/plutus/v3/always-succeeds.plutus") + let transferAmount = Coin 10_000_000 + -- Submit a transaction to publish the reference script + txBody <- mkSpendOutputsOnlyTx execConfig epochStateView sbe refScriptSizeWork "tx-body" wallet1 + [(ReferenceScriptAddress plutusV3Script, transferAmount)] + signedTx <- signTx execConfig cEra refScriptSizeWork "signed-tx" txBody [SomeKeyPair $ paymentKeyInfoPair wallet1] + submitTx execConfig cEra signedTx + -- Wait until transaction is on chain and obtain transaction identifier + txId <- retrieveTransactionId execConfig signedTx + txIx <- H.evalMaybeM $ watchEpochStateUpdate epochStateView (EpochInterval 2) (getTxIx sbe txId transferAmount) + -- Query the reference script size + let protocolParametersOutFile = refScriptSizeWork "ref-script-size-out.json" + H.noteM_ $ execCli' execConfig [ eraName, "query", "ref-script-size" + , "--tx-in", txId ++ "#" ++ show (txIx :: Int) + , "--out-file", protocolParametersOutFile + ] + H.diffFileVsGoldenFile + protocolParametersOutFile + "test/cardano-testnet-test/files/golden/queries/refScriptSizeOut.json" TestQueryConstitutionCmd -> -- constitution @@ -465,8 +465,8 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H. verificationStakeKeyToStakeAddress testnetMagic delegatorVKey = makeStakeAddress (fromNetworkMagic $ NetworkMagic $ fromIntegral testnetMagic) (StakeCredentialByKey $ verificationKeyHash delegatorVKey) - _getTxIx :: forall m era. HasCallStack => MonadTest m => ShelleyBasedEra era -> String -> Coin -> (AnyNewEpochState, SlotNo, BlockNo) -> m (Maybe Int) - _getTxIx sbe txId amount (AnyNewEpochState sbe' newEpochState, _, _) = do + getTxIx :: forall m era. HasCallStack => MonadTest m => ShelleyBasedEra era -> String -> Coin -> (AnyNewEpochState, SlotNo, BlockNo) -> m (Maybe Int) + getTxIx sbe txId amount (AnyNewEpochState sbe' newEpochState, _, _) = do Refl <- H.leftFail $ assertErasEqual sbe sbe' shelleyBasedEraConstraints sbe' (do return $ Map.foldlWithKey (\acc (L.TxIn (L.TxId thisTxId) (L.TxIx thisTxIx)) txOut -> diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs index de36044ce08..cded1fe0438 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs @@ -44,8 +44,8 @@ import qualified Testnet.Process.Cli.SPO as SPO import Testnet.Process.Cli.Transaction import Testnet.Process.Run (execCli', mkExecConfig) import Testnet.Property.Util (integrationWorkspace) +import Testnet.Start.Types (ShelleyTestnetOptions (..)) import Testnet.Types -import Testnet.Start.Types (ShelleyTestnetOptions(..)) import Hedgehog import qualified Hedgehog.Extras as H @@ -63,7 +63,7 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co -- how many votes to cast let drepVotes, spoVotes :: [(String, Int)] drepVotes = zip (concatMap (uncurry replicate) [(5, "yes"), (3, "no"), (2, "abstain")]) [1..] - spoVotes = zip (concatMap (uncurry replicate) [(1, "yes")]) [1..] + spoVotes = zip (replicate 1 "yes") [1..] H.noteShow_ drepVotes let nDrepVotes :: Int @@ -225,7 +225,8 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co length (filter ((== L.VoteYes) . snd) gaSpoVotes) === 1 length spoVotes === length gaSpoVotes - H.nothingFailM $ watchEpochStateUpdate epochStateView (L.EpochInterval 1) (return . committeeIsPresent) + _ <- waitForBlocks epochStateView 2 + H.nothingFailM $ watchEpochStateUpdate epochStateView (L.EpochInterval 2) (return . committeeIsPresent) -- show proposed committe meembers H.noteShow_ ccCredentials diff --git a/cardano-testnet/test/cardano-testnet-test/cardano-testnet-test.hs b/cardano-testnet/test/cardano-testnet-test/cardano-testnet-test.hs index 18bfee7f7fe..dd5e46e6e9f 100644 --- a/cardano-testnet/test/cardano-testnet-test/cardano-testnet-test.hs +++ b/cardano-testnet/test/cardano-testnet-test/cardano-testnet-test.hs @@ -5,11 +5,25 @@ module Main ) where import qualified Cardano.Crypto.Init as Crypto -import qualified Cardano.Testnet.Test.Cli.StakeSnapshot -import qualified Cardano.Testnet.Test.Cli.Transaction +import qualified Cardano.Testnet.Test.Cli.Conway.Plutus import qualified Cardano.Testnet.Test.Cli.KesPeriodInfo +import qualified Cardano.Testnet.Test.Cli.LeadershipSchedule +import qualified Cardano.Testnet.Test.Cli.Query import qualified Cardano.Testnet.Test.Cli.QuerySlotNumber +import qualified Cardano.Testnet.Test.Cli.StakeSnapshot +import qualified Cardano.Testnet.Test.Cli.Transaction import qualified Cardano.Testnet.Test.FoldEpochState +import qualified Cardano.Testnet.Test.Gov.CommitteeAddNew as Gov +import qualified Cardano.Testnet.Test.Gov.DRepDeposit as Gov +import qualified Cardano.Testnet.Test.Gov.DRepRetirement as Gov +import qualified Cardano.Testnet.Test.Gov.GovActionTimeout as Gov +import qualified Cardano.Testnet.Test.Gov.NoConfidence as Gov +import qualified Cardano.Testnet.Test.Gov.PParamChangeFailsSPO as Gov +import qualified Cardano.Testnet.Test.Gov.ProposeNewConstitution as Gov +import qualified Cardano.Testnet.Test.Gov.ProposeNewConstitutionSPO as Gov +import qualified Cardano.Testnet.Test.Gov.TreasuryDonation as Gov +import qualified Cardano.Testnet.Test.Gov.TreasuryGrowth as Gov +import qualified Cardano.Testnet.Test.Gov.TreasuryWithdrawal as Gov import qualified Cardano.Testnet.Test.Node.Shutdown import qualified Cardano.Testnet.Test.SanityCheck as LedgerEvents import qualified Cardano.Testnet.Test.SubmitApi.Transaction @@ -29,34 +43,30 @@ tests = do pure $ T.testGroup "test/Spec.hs" [ T.testGroup "Spec" [ T.testGroup "Ledger Events" - [ ignoreOnWindows "Sanity Check" LedgerEvents.hprop_ledger_events_sanity_check - -- , ignoreOnWindows "Treasury Growth" Gov.prop_check_if_treasury_is_growing + [ ignoreOnWindows "Sanity Check" LedgerEvents.hprop_ledger_events_sanity_check + , ignoreOnWindows "Treasury Growth" Gov.prop_check_if_treasury_is_growing -- TODO: Replace foldBlocks with checkConditionResult -- TODO: All governance related tests disabled in cardano-node-9.2 due to flakiness - --, T.testGroup "Governance" - -- [ ignoreOnMacAndWindows "Committee Add New" Gov.hprop_constitutional_committee_add_new - -- Committee Motion Of No Confidence - disabled in cardano-node-9.2 - -- , ignoreOnMacAndWindows "Committee Motion Of No Confidence" Gov.hprop_gov_no_confidence + , T.testGroup "Governance" + [ ignoreOnMacAndWindows "Committee Add New" Gov.hprop_constitutional_committee_add_new + , ignoreOnMacAndWindows "Committee Motion Of No Confidence" Gov.hprop_gov_no_confidence -- TODO: Disabled because proposals for parameter changes are not working -- , ignoreOnWindows "DRep Activity" Gov.hprop_check_drep_activity - -- , ignoreOnWindows "Predefined Abstain DRep" Gov.hprop_check_predefined_abstain_drep - -- DRep Deposits flakey - disabled in cardano-node-9.2 - -- , ignoreOnWindows "DRep Deposits" Gov.hprop_ledger_events_drep_deposits - -- , ignoreOnWindows "DRep Retirement" Gov.hprop_drep_retirement - -- , ignoreOnMacAndWindows "Propose And Ratify New Constitution" Gov.hprop_ledger_events_propose_new_constitution - -- , ignoreOnWindows "Propose New Constitution SPO" Gov.hprop_ledger_events_propose_new_constitution_spo - -- , ignoreOnWindows "Gov Action Timeout" Gov.hprop_check_gov_action_timeout - -- , ignoreOnWindows "Treasury Donation" Gov.hprop_ledger_events_treasury_donation - -- Treasury Withdrawal flakey - disabled in cardano-node-9.2 - -- , ignoreOnMacAndWindows "Treasury Withdrawal" Gov.hprop_ledger_events_treasury_withdrawal - -- , ignoreOnWindows "PParam change fails for SPO" Gov.hprop_check_pparam_fails_spo + -- , ignoreOnWindows "Predefined Abstain DRep" Gov.hprop_check_predefined_abstain_drep + , ignoreOnWindows "DRep Deposits" Gov.hprop_ledger_events_drep_deposits + , ignoreOnWindows "DRep Retirement" Gov.hprop_drep_retirement + , ignoreOnMacAndWindows "Propose And Ratify New Constitution" Gov.hprop_ledger_events_propose_new_constitution + , ignoreOnWindows "Propose New Constitution SPO" Gov.hprop_ledger_events_propose_new_constitution_spo + , ignoreOnWindows "Gov Action Timeout" Gov.hprop_check_gov_action_timeout + , ignoreOnWindows "Treasury Donation" Gov.hprop_ledger_events_treasury_donation + , ignoreOnMacAndWindows "Treasury Withdrawal" Gov.hprop_ledger_events_treasury_withdrawal + , ignoreOnWindows "PParam change fails for SPO" Gov.hprop_check_pparam_fails_spo -- FIXME Those tests are flaky -- , ignoreOnWindows "InfoAction" LedgerEvents.hprop_ledger_events_info_action ] - -- Plutus flakey - disabled in cardano-node-9.2 - -- , T.testGroup "Plutus" - -- [ ignoreOnWindows "PlutusV3" Cardano.Testnet.Test.Cli.Conway.Plutus.hprop_plutus_v3] - + , T.testGroup "Plutus" + [ ignoreOnWindows "PlutusV3" Cardano.Testnet.Test.Cli.Conway.Plutus.hprop_plutus_v3] + ] , T.testGroup "CLI" [ ignoreOnWindows "Shutdown" Cardano.Testnet.Test.Node.Shutdown.hprop_shutdown -- ShutdownOnSigint fails on Mac with @@ -66,8 +76,7 @@ tests = do -- , ignoreOnWindows "ShutdownOnSlotSynced" Cardano.Testnet.Test.Node.Shutdown.hprop_shutdownOnSlotSynced , ignoreOnWindows "stake-snapshot" Cardano.Testnet.Test.Cli.StakeSnapshot.hprop_stakeSnapshot , ignoreOnWindows "simple transaction build" Cardano.Testnet.Test.Cli.Transaction.hprop_transaction - -- "leadership-schedule" flakey - disabled in cardano-node-9.2 - -- , ignoreOnMacAndWindows "leadership-schedule" Cardano.Testnet.Test.Cli.LeadershipSchedule.hprop_leadershipSchedule + , ignoreOnMacAndWindows "leadership-schedule" Cardano.Testnet.Test.Cli.LeadershipSchedule.hprop_leadershipSchedule -- TODO: Conway - Re-enable when create-staked is working in conway again --, T.testGroup "Conway" @@ -78,13 +87,12 @@ tests = do , ignoreOnWindows "kes-period-info" Cardano.Testnet.Test.Cli.KesPeriodInfo.hprop_kes_period_info , ignoreOnWindows "query-slot-number" Cardano.Testnet.Test.Cli.QuerySlotNumber.hprop_querySlotNumber , ignoreOnWindows "foldEpochState receives ledger state" Cardano.Testnet.Test.FoldEpochState.prop_foldEpochState - -- , ignoreOnMacAndWindows "CliQueries" Cardano.Testnet.Test.Cli.Query.hprop_cli_queries + , ignoreOnMacAndWindows "CliQueries" Cardano.Testnet.Test.Cli.Query.hprop_cli_queries ] ] , T.testGroup "SubmitApi" - [ ignoreOnMacAndWindows "transaction" Cardano.Testnet.Test.SubmitApi.Transaction.hprop_transaction - ] - + [ ignoreOnMacAndWindows "transaction" Cardano.Testnet.Test.SubmitApi.Transaction.hprop_transaction + ] ] main :: IO ()