diff --git a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal index 4e8c548c814..9aefca71ad8 100644 --- a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal +++ b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal @@ -82,7 +82,7 @@ library -- IOG dependencies -------------------------- build-depends: - , cardano-api ^>=10.14 + , cardano-api ^>=10.16 , plutus-ledger-api ^>=1.45 , plutus-tx ^>=1.45 , plutus-tx-plugin ^>=1.45 diff --git a/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs b/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs index 694bc9be015..c05e0f64da3 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs @@ -69,7 +69,7 @@ instance ToJSON (SigningKey PaymentKey) where instance FromJSON (SigningKey PaymentKey) where parseJSON o = do te <- parseJSON o - case deserialiseFromTextEnvelope (AsSigningKey AsPaymentKey) te of + case deserialiseFromTextEnvelope te of Right k -> pure k Left err -> fail $ show err diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index bcc18d87933..52875757e6e 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -113,9 +113,9 @@ library , attoparsec-aeson , base16-bytestring , bytestring - , cardano-api ^>= 10.14 + , cardano-api ^>= 10.16 , cardano-binary - , cardano-cli ^>= 10.8 + , cardano-cli ^>= 10.9 , cardano-crypto-class , cardano-crypto-wrapper , cardano-data diff --git a/cabal.project b/cabal.project index 35af620d187..3f11d42112b 100644 --- a/cabal.project +++ b/cabal.project @@ -14,7 +14,7 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2025-04-16T18:30:40Z - , cardano-haskell-packages 2025-04-29T14:14:35Z + , cardano-haskell-packages 2025-05-15T08:36:14Z packages: cardano-node diff --git a/cardano-node-chairman/cardano-node-chairman.cabal b/cardano-node-chairman/cardano-node-chairman.cabal index 42547971ff4..227f6638882 100644 --- a/cardano-node-chairman/cardano-node-chairman.cabal +++ b/cardano-node-chairman/cardano-node-chairman.cabal @@ -90,5 +90,5 @@ test-suite chairman-tests ghc-options: -threaded -rtsopts "-with-rtsopts=-N -T" build-tool-depends: cardano-node:cardano-node - , cardano-cli:cardano-cli ^>= 10.8 + , cardano-cli:cardano-cli ^>= 10.9 , cardano-node-chairman:cardano-node-chairman diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index 6635bd6056c..f5a10cd6e28 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -149,7 +149,7 @@ library , async , base16-bytestring , bytestring - , cardano-api ^>= 10.14 + , cardano-api ^>= 10.16 , cardano-crypto-class , cardano-crypto-wrapper , cardano-git-rev ^>=0.2.2 diff --git a/cardano-node/src/Cardano/Node/Protocol/Shelley.hs b/cardano-node/src/Cardano/Node/Protocol/Shelley.hs index e6b75ba0318..24b24b5951c 100644 --- a/cardano-node/src/Cardano/Node/Protocol/Shelley.hs +++ b/cardano-node/src/Cardano/Node/Protocol/Shelley.hs @@ -150,7 +150,7 @@ readLeaderCredentialsSingleton shelleyKESFile = Just kesFile } = do vrfSKey <- - firstExceptT FileError (newExceptT $ readFileTextEnvelope (AsSigningKey AsVrfKey) (File vrfFile)) + firstExceptT FileError (newExceptT $ readFileTextEnvelope (File vrfFile)) (opCert, kesSKey) <- opCertKesKeyCheck (File kesFile) (File opCertFile) @@ -172,9 +172,9 @@ opCertKesKeyCheck -> ExceptT PraosLeaderCredentialsError IO (OperationalCertificate, SigningKey KesKey) opCertKesKeyCheck kesFile certFile = do opCert <- - firstExceptT FileError (newExceptT $ readFileTextEnvelope AsOperationalCertificate certFile) + firstExceptT FileError (newExceptT $ readFileTextEnvelope certFile) kesSKey <- - firstExceptT FileError (newExceptT $ readFileTextEnvelope (AsSigningKey AsKesKey) kesFile) + firstExceptT FileError (newExceptT $ readFileTextEnvelope kesFile) let opCertSpecifiedKesKeyhash = verificationKeyHash $ getHotKey opCert suppliedKesKeyHash = verificationKeyHash $ getVerificationKey kesSKey -- Specified KES key in operational certificate should match the one @@ -201,9 +201,9 @@ readLeaderCredentialsBulk ProtocolFilepaths { shelleyBulkCredsFile = mfp } = -> ExceptT PraosLeaderCredentialsError IO (ShelleyLeaderCredentials StandardCrypto) parseShelleyCredentials ShelleyCredentials { scCert, scVrf, scKes } = do mkPraosLeaderCredentials - <$> parseEnvelope AsOperationalCertificate scCert - <*> parseEnvelope (AsSigningKey AsVrfKey) scVrf - <*> parseEnvelope (AsSigningKey AsKesKey) scKes + <$> parseEnvelope scCert + <*> parseEnvelope scVrf + <*> parseEnvelope scKes readBulkFile :: Maybe FilePath @@ -246,12 +246,11 @@ mkPraosLeaderCredentials parseEnvelope :: HasTextEnvelope a - => AsType a - -> (TextEnvelope, String) + => (TextEnvelope, String) -> ExceptT PraosLeaderCredentialsError IO a -parseEnvelope as (te, loc) = +parseEnvelope (te, loc) = firstExceptT (FileError . Api.FileError loc) . hoistEither $ - deserialiseFromTextEnvelope as te + deserialiseFromTextEnvelope te ------------------------------------------------------------------------------ diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index b37fee94692..b8f36fa76c6 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -39,9 +39,9 @@ library , aeson , async , bytestring - , cardano-api ^>= 10.14 + , cardano-api ^>= 10.16 , cardano-binary - , cardano-cli ^>= 10.8 + , cardano-cli ^>= 10.9 , cardano-crypto-class ^>= 2.2 , http-media , iohk-monitoring diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index d3cfa2a3977..2ae75d7c5ff 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -35,8 +35,8 @@ library , aeson-pretty , ansi-terminal , bytestring - , cardano-api ^>= 10.14 - , cardano-cli:{cardano-cli, cardano-cli-test-lib} ^>= 10.8 + , cardano-api ^>= 10.16 + , cardano-cli:{cardano-cli, cardano-cli-test-lib} ^>= 10.9 , cardano-crypto-class , cardano-crypto-wrapper , cardano-git-rev ^>= 0.2.2 diff --git a/cardano-testnet/src/Testnet/Process/Cli/Transaction.hs b/cardano-testnet/src/Testnet/Process/Cli/Transaction.hs index ac47a74fb24..f51c0818ff7 100644 --- a/cardano-testnet/src/Testnet/Process/Cli/Transaction.hs +++ b/cardano-testnet/src/Testnet/Process/Cli/Transaction.hs @@ -1,5 +1,7 @@ {-# LANGUAGE DataKinds #-} +{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} module Testnet.Process.Cli.Transaction ( mkSimpleSpendOutputsOnlyTx @@ -23,21 +25,25 @@ import Prelude import Control.Monad (void) import Control.Monad.Catch (MonadCatch) +import qualified Data.Aeson.Lens as A import Data.List (isInfixOf) +import Data.String (fromString) import qualified Data.Text as T import Data.Typeable (Typeable) +import qualified Data.Yaml as A import GHC.IO.Exception (ExitCode (..)) import GHC.Stack +import Lens.Micro import System.FilePath (()) -import Hedgehog (MonadTest) -import qualified Hedgehog.Extras as H - import Testnet.Components.Query (EpochStateView, findLargestUtxoForPaymentKey) import Testnet.Process.Run (execCli') import Testnet.Start.Types (anyEraToString) import Testnet.Types +import Hedgehog (MonadTest) +import qualified Hedgehog.Extras as H + -- Transaction signing data VoteFile @@ -231,5 +237,6 @@ retrieveTransactionId execConfig signedTxBody = do [ "latest", "transaction", "txid" , "--tx-file", unFile signedTxBody ] - return $ mconcat $ lines txidOutput + result <- H.leftFail $ A.decodeEither' @A.Value $ fromString txidOutput + H.nothingFail . fmap T.unpack $ result ^? A.key "txhash" . A._String diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/CostCalculation.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/CostCalculation.hs index 7a57a8d3aae..a4fdb793fbf 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/CostCalculation.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/CostCalculation.hs @@ -40,13 +40,6 @@ import System.Directory (makeAbsolute) import System.FilePath (()) import qualified System.Info as SYS -import Hedgehog (Property) -import qualified Hedgehog as H -import qualified Hedgehog.Extras.Test.Base as H -import qualified Hedgehog.Extras.Test.File as H -import qualified Hedgehog.Extras.Test.Golden as H -import qualified Hedgehog.Extras.Test.TestWatchdog as H - import Testnet.Components.Query (findLargestUtxoForPaymentKey, getEpochStateView, getTxIx, watchEpochStateUpdate) import Testnet.Process.Cli.Transaction (TxOutAddress (..), mkSpendOutputsOnlyTx, @@ -57,6 +50,13 @@ import Testnet.Start.Types (eraToString) import Testnet.Types (PaymentKeyInfo (paymentKeyInfoAddr), paymentKeyInfoPair, verificationKey) +import Hedgehog (Property) +import qualified Hedgehog as H +import qualified Hedgehog.Extras.Test.Base as H +import qualified Hedgehog.Extras.Test.File as H +import qualified Hedgehog.Extras.Test.Golden as H +import qualified Hedgehog.Extras.Test.TestWatchdog as H + -- @DISABLE_RETRIES=1 cabal run cardano-testnet-test -- -p "/Spec.hs.Spec.Ledger Events.Plutus.Cost Calc.Ref Script/"@ hprop_ref_plutus_cost_calculation :: Property hprop_ref_plutus_cost_calculation = integrationRetryWorkspace 2 "ref plutus script" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do @@ -183,7 +183,7 @@ hprop_ref_plutus_cost_calculation = integrationRetryWorkspace 2 "ref plutus scri execCli' execConfig [ eraName - , "transaction", "calculate-plutus-script-cost" + , "transaction", "calculate-plutus-script-cost", "online" , "--tx-file", unFile signedUnlockTx , "--out-file", unFile txCostOutput ] @@ -199,7 +199,7 @@ hprop_ref_plutus_cost_calculation = integrationRetryWorkspace 2 "ref plutus scri execCli' execConfig [ eraName - , "transaction", "calculate-plutus-script-cost" + , "transaction", "calculate-plutus-script-cost", "online" , "--tx-file", unFile signedUnlockTx ] @@ -306,7 +306,7 @@ hprop_included_plutus_cost_calculation = integrationRetryWorkspace 2 "included p execCli' execConfig [ eraName - , "transaction", "calculate-plutus-script-cost" + , "transaction", "calculate-plutus-script-cost", "online" , "--tx-file", unFile signedIncludedScript , "--out-file", unFile includedScriptCostOutput ] @@ -421,7 +421,7 @@ hprop_included_simple_script_cost_calculation = integrationRetryWorkspace 2 "inc execCli' execConfig [ eraName - , "transaction", "calculate-plutus-script-cost" + , "transaction", "calculate-plutus-script-cost", "online" , "--tx-file", unFile signedScriptUnlock ] 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 8b45d8078a4..9d071faedf0 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 @@ -8,6 +8,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeApplications #-} module Cardano.Testnet.Test.Cli.Query ( hprop_cli_queries @@ -36,10 +37,10 @@ import qualified Data.Aeson.Encode.Pretty as Aeson import qualified Data.Aeson.Key as Aeson import qualified Data.Aeson.KeyMap as Aeson import qualified Data.Aeson.Lens as Aeson -import Data.Bifunctor (bimap) import qualified Data.ByteString.Lazy as LBS import Data.Default.Class import qualified Data.Map as Map +import Data.Map.Strict (Map) import Data.String (IsString (fromString)) import Data.Text (Text) import qualified Data.Text as T @@ -128,7 +129,7 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H. -- leadership-schedule do let spoKeys = Defaults.defaultSpoKeys 1 - spoVerificationKey :: VerificationKey StakePoolKey <- readVerificationKeyFromFile AsStakePoolKey work $ verificationKey $ poolNodeKeysCold spoKeys + spoVerificationKey :: VerificationKey StakePoolKey <- readVerificationKeyFromFile work $ verificationKey $ poolNodeKeysCold spoKeys H.noteM_ $ execCli' execConfig [ eraName, "query", "leadership-schedule" , "--genesis", shelleyGeneisFile , "--stake-pool-verification-key", T.unpack $ serialiseToBech32 spoVerificationKey @@ -179,10 +180,11 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H. do -- to stdout stakePoolsOut <- execCli' execConfig [ eraName, "query", "stake-pools" ] - H.assertWith stakePoolsOut $ \pools -> - NumPools (length $ lines pools) == nPools + stakePools <- H.noteShowM $ H.leftFail $ Aeson.eitherDecode @[String] $ fromString stakePoolsOut + H.assertWith stakePools $ \pools -> + NumPools (length pools) == nPools -- Light test of the query's answer, the ids should exist: - forM_ (lines stakePoolsOut) $ \stakePoolId -> do + forM_ stakePools $ \stakePoolId -> do execCli' execConfig [ eraName, "query", "pool-state" , "--stake-pool-id", stakePoolId ] -- to a file @@ -199,22 +201,15 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H. do -- to stdout stakeDistrOut <- execCli' execConfig [ eraName, "query", "stake-distribution" ] - -- stake addresses with stake - let stakeAddresses :: [(Text, Text)] = - map - ( bimap T.strip T.strip - . T.breakOn " " -- separate address and stake - . T.strip - . fromString ) - . drop 2 -- drop header - . lines - $ stakeDistrOut - H.assertWith stakeAddresses $ \sa -> + stakeDistr <- H.leftFail $ Aeson.eitherDecode @(Map String Aeson.Value) $ fromString stakeDistrOut + H.note_ stakeDistrOut + let stakePools = Map.keys stakeDistr + H.assertWith stakePools $ \sa -> NumPools (length sa) == nPools -- Light test of the query's answer, the ids should exist: - forM_ stakeAddresses $ \(stakePoolId, _) -> do + forM_ stakePools $ \stakePoolId -> do execCli' execConfig [ eraName, "query", "pool-state" - , "--stake-pool-id", T.unpack stakePoolId ] + , "--stake-pool-id", stakePoolId ] -- to a file let stakePoolsOutFile = work "stake-distribution-out.json" H.noteM_ $ execCli' execConfig [ eraName, "query", "stake-distribution" @@ -244,7 +239,7 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H. fileQueryAmount <- H.evalMaybe $ fileQueryResult ^? Aeson.nth 0 . Aeson.nth 1 . Aeson._Number -- Query individual SPO using SPOs bech32 of key and compare to previous result - delegatorVKey :: VerificationKey StakePoolKey <- readVerificationKeyFromFile AsStakePoolKey work spoKey + delegatorVKey :: VerificationKey StakePoolKey <- readVerificationKeyFromFile work spoKey keyQueryResult :: Aeson.Value <- execCliStdoutToJson execConfig [ eraName, "query", "spo-stake-distribution" , "--spo-verification-key", T.unpack $ serialiseToBech32 delegatorVKey ] @@ -449,6 +444,10 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H. -- TODO @cardano-cli team pure () + TestQueryEraHistoryCmd -> do + -- TODO @cardano-cli team + pure () + where -- | Wait for the part of the epoch when futurePParams are known waitForFuturePParamsToStabilise @@ -482,13 +481,19 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H. minSlotInThisEpochToWaitTo = firstSlotOfEpoch + slotsInEpochToWaitOut + 1 in slotNo >= minSlotInThisEpochToWaitTo - readVerificationKeyFromFile :: (HasCallStack, MonadIO m, MonadCatch m, MonadTest m, HasTextEnvelope (VerificationKey keyrole), SerialiseAsBech32 (VerificationKey keyrole)) - => AsType keyrole - -> FilePath + readVerificationKeyFromFile + :: ( HasCallStack + , MonadIO m + , MonadCatch m + , MonadTest m + , HasTextEnvelope (VerificationKey keyrole) + , SerialiseAsBech32 (VerificationKey keyrole) + ) + => FilePath -> File content direction -> m (VerificationKey keyrole) - readVerificationKeyFromFile asKey work = - H.evalEitherM . liftIO . runExceptT . readVerificationKeyOrFile asKey . VerificationKeyFilePath . File . (work ) . unFile + readVerificationKeyFromFile work = + H.evalEitherM . liftIO . runExceptT . readVerificationKeyOrFile . VerificationKeyFilePath . File . (work ) . unFile _verificationStakeKeyToStakeAddress :: Int -> VerificationKey StakeKey -> StakeAddress _verificationStakeKeyToStakeAddress testnetMagic delegatorVKey = diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Transaction.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Transaction.hs index 8a00b95f47b..fd7141e9d05 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Transaction.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Transaction.hs @@ -52,7 +52,6 @@ hprop_transaction = integrationRetryWorkspace 2 "simple transaction build" $ \te let sbe = ShelleyBasedEraConway - txEra = AsConwayEra era = toCardanoEra sbe cEra = AnyCardanoEra era tempBaseAbsPath = makeTmpBaseAbsPath $ TmpAbsolutePath tempAbsPath' @@ -93,8 +92,8 @@ hprop_transaction = integrationRetryWorkspace 2 "simple transaction build" $ \te , "--out-file", txbodyFp ] cddlUnwitnessedTx <- H.readJsonFileOk txbodyFp - apiTx <- H.evalEither $ deserialiseFromTextEnvelope (AsTx txEra) cddlUnwitnessedTx - let txFee = L.unCoin $ extractTxFee apiTx + apiTx <- H.evalEither $ deserialiseFromTextEnvelope cddlUnwitnessedTx + let txFee = L.unCoin $ extractTxFee sbe apiTx -- This is the current calculated fee. -- It's a sanity check to see if anything has @@ -133,6 +132,6 @@ hprop_transaction = integrationRetryWorkspace 2 "simple transaction build" $ \te txOutValue :: TxOut ctx era -> TxOutValue era txOutValue (TxOut _ v _ _) = v -extractTxFee :: Tx era -> L.Coin -extractTxFee (ShelleyTx sbe ledgerTx) = +extractTxFee :: ShelleyBasedEra era -> Tx era -> L.Coin +extractTxFee _ (ShelleyTx sbe ledgerTx) = shelleyBasedEraConstraints sbe $ ledgerTx ^. (L.bodyTxL . L.feeTxBodyL) 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 c01984f8db2..b3d80a7a2ba 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,7 +44,7 @@ import qualified Testnet.Process.Cli.DRep as DRep import Testnet.Process.Cli.Keys import qualified Testnet.Process.Cli.SPO as SPO import Testnet.Process.Cli.SPO (createStakeKeyRegistrationCertificate) -import Testnet.Process.Cli.Transaction +import Testnet.Process.Cli.Transaction (retrieveTransactionId, signTx, submitTx) import Testnet.Process.Run (addEnvVarsToConfig, execCli', mkExecConfig) import Testnet.Property.Util (integrationWorkspace) import Testnet.Start.Types (GenesisOptions (..), cardanoNumPools) diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs index c205a135b40..b583503fdf3 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs @@ -39,6 +39,7 @@ import Testnet.Components.Query import Testnet.Defaults import Testnet.Process.Cli.Keys import Testnet.Process.Cli.SPO (createStakeKeyRegistrationCertificate) +import Testnet.Process.Cli.Transaction (retrieveTransactionId) import Testnet.Process.Run (addEnvVarsToConfig, execCli', mkExecConfig) import Testnet.Property.Util (integrationRetryWorkspace) import Testnet.Start.Types @@ -189,14 +190,11 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem , "--tx-file", txbodySignedFp ] - txidString <- mconcat . lines <$> execCli' execConfig - [ "latest", "transaction", "txid" - , "--tx-file", txbodySignedFp - ] + txIdString <- H.noteShowM $ retrieveTransactionId execConfig (File txbodySignedFp) governanceActionIndex <- H.nothingFailM $ watchEpochStateUpdate epochStateView (EpochInterval 1) $ \(anyNewEpochState, _, _) -> - pure $ maybeExtractGovernanceActionIndex (fromString txidString) anyNewEpochState + pure $ maybeExtractGovernanceActionIndex (fromString txIdString) anyNewEpochState let voteFp :: Int -> FilePath voteFp n = work gov "vote-" <> show n @@ -206,7 +204,7 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem execCli' execConfig [ eraName, "governance", "vote", "create" , "--yes" - , "--governance-action-tx-id", txidString + , "--governance-action-tx-id", txIdString , "--governance-action-index", show @Word16 governanceActionIndex , "--drep-verification-key-file", verificationKeyFp $ defaultDRepKeyPair n , "--out-file", voteFp n diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/NoConfidence.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/NoConfidence.hs index b2252c3fb29..df6a6e7b6e9 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/NoConfidence.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/NoConfidence.hs @@ -97,7 +97,7 @@ hprop_gov_no_confidence = integrationWorkspace "no-confidence" $ \tempAbsBasePat CommitteeColdKeyHash comKeyHash1 <- H.evalEither - $ deserialiseFromRawBytesHex (AsHash AsCommitteeColdKey) + $ deserialiseFromRawBytesHex $ BSC.pack comKeyHash1Str let comKeyCred1 = L.KeyHashObj comKeyHash1 diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitution.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitution.hs index c16195c8e20..213ce6d8067 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitution.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitution.hs @@ -47,7 +47,7 @@ import Testnet.Process.Cli.Keys import Testnet.Process.Cli.SPO (createStakeKeyRegistrationCertificate) import Testnet.Process.Cli.Transaction import Testnet.Process.Run (addEnvVarsToConfig, execCli', mkExecConfig) -import Testnet.Property.Util (integrationWorkspace) +import Testnet.Property.Util (integrationRetryWorkspace) import Testnet.Start.Types import Testnet.Types @@ -58,7 +58,7 @@ import qualified Hedgehog.Extras as H -- | Execute me with: -- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/Propose And Ratify New Constitution/"'@ hprop_ledger_events_propose_new_constitution :: Property -hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new-constitution" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do +hprop_ledger_events_propose_new_constitution = integrationRetryWorkspace 2 "propose-new-constitution" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do -- Start a local test net conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath' let tempAbsPath' = unTmpAbsPath tempAbsPath @@ -248,10 +248,7 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new waitForGovActionVotes epochStateView (EpochInterval 1) - txid <- execCli' execConfig [ eraName, "transaction", "txid", "--tx-file", unFile signedProposalTx ] - - let txNoNewline = Text.unpack (Text.strip (Text.pack txid)) - H.noteShow_ txNoNewline + txId <- H.noteShowM $ retrieveTransactionId execConfig signedProposalTx -- Count votes before checking for ratification. It may happen that the proposal gets removed after -- ratification because of a long waiting time, so we won't be able to access votes. @@ -275,7 +272,7 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new (\epochState _ _ -> foldBlocksCheckConstitutionWasRatified constitutionHash constitutionScriptHash epochState) proposalsJSON :: Aeson.Value <- execCliStdoutToJson execConfig - [ eraName, "query", "proposals", "--governance-action-tx-id", txNoNewline + [ eraName, "query", "proposals", "--governance-action-tx-id", txId , "--governance-action-index", "0" ] @@ -289,7 +286,7 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new -- Check TxId returned is the same as the one we used proposalsTxId <- H.evalMaybe $ proposal ^? Aeson.key "actionId" . Aeson.key "txId" . Aeson._String - proposalsTxId === Text.pack txNoNewline + proposalsTxId === Text.pack txId -- Check that committeeVotes is an empty object proposalsCommitteeVotes <- H.evalMaybe $ proposal ^? Aeson.key "committeeVotes" . Aeson._Object diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitutionSPO.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitutionSPO.hs index ff2bbefbece..65b33ac6840 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitutionSPO.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/ProposeNewConstitutionSPO.hs @@ -33,7 +33,7 @@ import Testnet.Process.Cli.Keys 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.Property.Util (integrationRetryWorkspace) import Testnet.Start.Types import Testnet.Types @@ -45,7 +45,7 @@ import qualified Hedgehog.Extras as H -- Execute me with: -- @cabal test cardano-testnet-test --test-options '-p "/Propose New Constitution SPO/"'@ hprop_ledger_events_propose_new_constitution_spo :: Property -hprop_ledger_events_propose_new_constitution_spo = integrationWorkspace "propose-new-constitution-spo" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do +hprop_ledger_events_propose_new_constitution_spo = integrationRetryWorkspace 2 "propose-new-constitution-spo" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do conf@Conf { tempAbsPath=tempAbsPath@(TmpAbsolutePath work) } <- mkConf tempAbsBasePath' let tempBaseAbsPath = makeTmpBaseAbsPath tempAbsPath diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryWithdrawal.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryWithdrawal.hs index 5c1b6a9ef04..d5fafc806cf 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryWithdrawal.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryWithdrawal.hs @@ -42,6 +42,7 @@ import Testnet.Components.Query import Testnet.Defaults import Testnet.Process.Cli.Keys (cliStakeAddressKeyGen) import Testnet.Process.Cli.SPO (createStakeKeyRegistrationCertificate) +import Testnet.Process.Cli.Transaction (retrieveTransactionId) import Testnet.Process.Run (addEnvVarsToConfig, execCli', mkExecConfig) import Testnet.Property.Util (integrationRetryWorkspace) import Testnet.Start.Types @@ -195,10 +196,7 @@ hprop_ledger_events_treasury_withdrawal = integrationRetryWorkspace 2 "treasury ] -- }}} - txidString <- mconcat . lines <$> execCli' execConfig - [ "latest", "transaction", "txid" - , "--tx-file", txbodySignedFp - ] + txIdString <- H.noteShowM $ retrieveTransactionId execConfig (File txbodySignedFp) currentEpoch <- getCurrentEpochNo epochStateView let terminationEpoch = succ . succ $ currentEpoch @@ -213,7 +211,7 @@ hprop_ledger_events_treasury_withdrawal = integrationRetryWorkspace 2 "treasury execCli' execConfig [ eraName, "governance", "vote", "create" , "--yes" - , "--governance-action-tx-id", txidString + , "--governance-action-tx-id", txIdString , "--governance-action-index", show governanceActionIndex , "--drep-verification-key-file", verificationKeyFp $ defaultDRepKeyPair n , "--out-file", voteFp n diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/SubmitApi/Transaction.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/SubmitApi/Transaction.hs index cb67051f18a..2c828dcb2c9 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/SubmitApi/Transaction.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/SubmitApi/Transaction.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NumericUnderscores #-} diff --git a/flake.lock b/flake.lock index ea0482b1e94..12eb53809a5 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1745944473, - "narHash": "sha256-zKJE6viU6JKUGlesde00In7VrALXv+lC6r/1QiQBB4s=", + "lastModified": 1747299417, + "narHash": "sha256-VRwq8JRAMnIgoxfgR60ppz37Wo6NixL9BbzwVhBveik=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "60bade9ab7b16121307e12a0fb9aefb2e245faef", + "rev": "10ebc8624f5440c245112f2e3dbf0e123e7e99e5", "type": "github" }, "original": {