diff --git a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal index 0ed523a1e8a..59d9f7f28a6 100644 --- a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal +++ b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: plutus-scripts-bench -version: 1.0.4.0 +version: 1.0.4.1 synopsis: Plutus scripts used for benchmarking description: Plutus scripts used for benchmarking. category: Cardano, @@ -80,10 +80,10 @@ library -- IOG dependencies -------------------------- build-depends: - , cardano-api ^>=9.3 - , plutus-ledger-api ^>=1.32 - , plutus-tx ^>=1.32 - , plutus-tx-plugin ^>=1.32 + , cardano-api ^>=10.0 + , plutus-ledger-api ^>=1.36 + , plutus-tx ^>=1.36 + , plutus-tx-plugin ^>=1.36 ------------------------ -- Non-IOG dependencies diff --git a/bench/tx-generator/CHANGELOG.md b/bench/tx-generator/CHANGELOG.md index c99e8eedcbe..06742baa0a7 100644 --- a/bench/tx-generator/CHANGELOG.md +++ b/bench/tx-generator/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +## 2.14.2 -- Oct 2024 + +* Bump for Node 10 + ## 2.14.1 -- June 2024 * A new NixSvcOptions field is introduced: `_nix_keepalive` and it's propagated down to the `kaClient` that does keepalives. diff --git a/bench/tx-generator/src/Cardano/Benchmarking/Command.hs b/bench/tx-generator/src/Cardano/Benchmarking/Command.hs index 41b391ecb66..0f5c865d5b8 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/Command.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/Command.hs @@ -52,6 +52,7 @@ import Data.Foldable as Fold (forM_) import Data.List as List (unwords) import Data.Time.Format as Time (defaultTimeLocale, formatTime) import Data.Time.Clock.System as Time (getSystemTime, systemToUTCTime) +import Foreign.C (Errno(..)) import GHC.Weak as Weak (deRefWeak) import System.Posix.Signals as Sig (Handler (CatchInfo), @@ -64,6 +65,7 @@ import GHC.Conc.Sync as Conc (threadLabel) #endif #ifdef UNIX +deriving instance Show Errno deriving instance Show SignalInfo deriving instance Show SignalSpecificInfo #endif diff --git a/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs b/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs index b56d4f04786..d17ca92c4e6 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/NodeToNode.hs @@ -102,7 +102,7 @@ benchmarkConnectTxSubmit EnvConsts { .. } handshakeTracer submissionTracer codec OuroborosApplication $ fold bundle n2nVer :: NodeToNodeVersion - n2nVer = NodeToNodeV_12 + n2nVer = NodeToNodeV_14 blkN2nVer :: BlockNodeToNodeVersion blk blkN2nVer = supportedVers Map.! n2nVer supportedVers :: Map.Map NodeToNodeVersion (BlockNodeToNodeVersion blk) diff --git a/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/SubmissionClient.hs b/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/SubmissionClient.hs index 08a21618e74..577c47df682 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/SubmissionClient.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/SubmissionClient.hs @@ -11,8 +11,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-} @@ -26,10 +24,11 @@ module Cardano.Benchmarking.GeneratorTx.SubmissionClient ) where import Cardano.Api hiding (Active) -import Cardano.Api.Shelley (fromShelleyTxId, toConsensusGenTx) +import Cardano.Api.Shelley (fromShelleyTxId, toConsensusGenTx, Tx (..)) import Cardano.Benchmarking.LogTypes import Cardano.Benchmarking.Types +import qualified Cardano.Ledger.Core as Ledger import Cardano.Logging import Cardano.Prelude hiding (ByteString, atomically, retry, state, threadDelay) import Cardano.Tracing.OrphanInstances.Byron () @@ -40,7 +39,7 @@ import Cardano.Tracing.OrphanInstances.Shelley () import qualified Ouroboros.Consensus.Cardano as Consensus (CardanoBlock) import qualified Ouroboros.Consensus.Cardano.Block as Block (TxId (GenTxIdAllegra, GenTxIdAlonzo, GenTxIdBabbage, GenTxIdConway, GenTxIdMary, GenTxIdShelley)) -import Ouroboros.Consensus.Ledger.SupportsMempool (GenTx, GenTxId, txInBlockSize) +import Ouroboros.Consensus.Ledger.SupportsMempool (GenTx, GenTxId) import qualified Ouroboros.Consensus.Ledger.SupportsMempool as Mempool import Ouroboros.Consensus.Shelley.Eras (StandardCrypto) import qualified Ouroboros.Consensus.Shelley.Ledger.Mempool as Mempool (TxId (ShelleyTxId)) @@ -57,6 +56,8 @@ import qualified Data.List as L import qualified Data.List.Extra as L import qualified Data.List.NonEmpty as NE import qualified Data.Text as T +import Lens.Micro ((^.)) + type CardanoBlock = Consensus.CardanoBlock StandardCrypto data SubmissionThreadStats @@ -85,10 +86,9 @@ type LocalState era = (TxSource era, UnAcked (Tx era), SubmissionThreadStats) type EndOfProtocolCallback m = SubmissionThreadStats -> m () txSubmissionClient - :: forall m era tx. + :: forall m era. ( MonadIO m, MonadFail m , IsShelleyBasedEra era - , tx ~ Tx era ) => Trace m NodeToNodeSubmissionTrace -> Trace m (TraceBenchTxSubmit TxId) @@ -110,11 +110,11 @@ txSubmissionClient tr bmtr initialTxSource endOfProtocolCallback = traceWith bmtr $ SubmissionClientDiscardAcknowledged (getTxId . getTxBody <$> acked) return (txSource, UnAcked stillUnacked, newStats) - queueNewTxs :: [tx] -> LocalState era -> LocalState era + queueNewTxs :: [Tx era] -> LocalState era -> LocalState era queueNewTxs newTxs (txSource, UnAcked unAcked, stats) = (txSource, UnAcked (newTxs <> unAcked), stats) - client ::LocalState era -> ClientStIdle (GenTxId CardanoBlock) (GenTx CardanoBlock) m () + client :: LocalState era -> ClientStIdle (GenTxId CardanoBlock) (GenTx CardanoBlock) m () client localState = ClientStIdle { recvMsgRequestTxIds = requestTxIds localState @@ -177,12 +177,15 @@ txSubmissionClient tr bmtr initialTxSource endOfProtocolCallback = , stsUnavailable = stsUnavailable stats + Unav (length missIds)})) - txToIdSize :: tx -> (GenTxId CardanoBlock, SizeInBytes) - txToIdSize = (Mempool.txId &&& (SizeInBytes . txInBlockSize)) . toGenTx - - toGenTx :: tx -> GenTx CardanoBlock - toGenTx tx = toConsensusGenTx $ TxInMode (shelleyBasedEra @era) tx + txToIdSize :: Tx era -> (GenTxId CardanoBlock, SizeInBytes) + txToIdSize = (Mempool.txId . toGenTx) &&& (SizeInBytes . fromInteger . getTxSize) + where + getTxSize :: Tx era -> Integer + getTxSize (ShelleyTx sbe tx) = + shelleyBasedEraConstraints sbe $ tx ^. Ledger.sizeTxF + toGenTx :: Tx era -> GenTx CardanoBlock + toGenTx tx = toConsensusGenTx $ TxInMode shelleyBasedEra tx fromGenTxId :: GenTxId CardanoBlock -> TxId fromGenTxId (Block.GenTxIdShelley (Mempool.ShelleyTxId i)) = fromShelleyTxId i diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index c1fbc0cd1ed..c53de32d79d 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: tx-generator -version: 2.14.1 +version: 2.14.2 synopsis: A transaction workload generator for Cardano clusters description: A transaction workload generator for Cardano clusters. category: Cardano, @@ -106,9 +106,9 @@ library , attoparsec-aeson , base16-bytestring , bytestring - , cardano-api ^>= 9.3 + , cardano-api ^>= 10.0 , cardano-binary - , cardano-cli ^>= 9.4 + , cardano-cli ^>= 10.0 , cardano-crypto-class , cardano-crypto-wrapper , cardano-data @@ -129,6 +129,7 @@ library , generic-monoid , ghc-prim , io-classes + , microlens , mtl , network , network-mux diff --git a/cabal.project b/cabal.project index bb66fb516c2..f8074c50423 100644 --- a/cabal.project +++ b/cabal.project @@ -13,8 +13,8 @@ repository cardano-haskell-packages -- See CONTRIBUTING for information about these, including some Nix commands -- you need to run if you change them index-state: - , hackage.haskell.org 2024-09-05T18:39:40Z - , cardano-haskell-packages 2024-09-10T12:51:27Z + , hackage.haskell.org 2024-10-10T00:52:24Z + , cardano-haskell-packages 2024-10-17T12:07:57Z packages: cardano-node @@ -59,6 +59,7 @@ package plutus-scripts-bench constraints: , wai-extra < 3.1.15 + , Cabal < 3.14 allow-newer: , katip:Win32 diff --git a/cardano-node-chairman/cardano-node-chairman.cabal b/cardano-node-chairman/cardano-node-chairman.cabal index 0670753b83c..b4f539efd9f 100644 --- a/cardano-node-chairman/cardano-node-chairman.cabal +++ b/cardano-node-chairman/cardano-node-chairman.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-node-chairman -version: 9.0.0 +version: 10.0.0 synopsis: The cardano full node description: The cardano full node. category: Cardano, @@ -44,7 +44,7 @@ executable cardano-node-chairman build-depends: cardano-api , cardano-crypto-class , cardano-git-rev ^>= 0.2.2 - , cardano-node ^>= 9.2 + , cardano-node ^>= 10.0 , cardano-prelude , containers , contra-tracer @@ -89,5 +89,5 @@ test-suite chairman-tests ghc-options: -threaded -rtsopts "-with-rtsopts=-N -T" build-tool-depends: cardano-node:cardano-node - , cardano-cli:cardano-cli ^>= 9.4 + , cardano-cli:cardano-cli ^>= 10.0 , cardano-node-chairman:cardano-node-chairman diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index bc2e9f8349f..29e807923a1 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-node -version: 9.2.0 +version: 10.0 synopsis: The cardano full node description: The cardano full node. category: Cardano, @@ -38,8 +38,8 @@ common project-config -Wpartial-fields -Wredundant-constraints -Wunused-packages -common maybe-Win32 - if os(windows) +common maybe-Win32 + if os(windows) build-depends: Win32 common maybe-unix @@ -55,7 +55,7 @@ common text library import: project-config , maybe-unix - , maybe-Win32 + , maybe-Win32 , text if flag(unexpected_thunks) cpp-options: -DUNEXPECTED_THUNKS @@ -145,7 +145,7 @@ library , async , base16-bytestring , bytestring - , cardano-api ^>= 9.3 + , cardano-api ^>= 10.0 , cardano-crypto-class , cardano-crypto-wrapper , cardano-git-rev ^>=0.2.2 @@ -186,14 +186,14 @@ library , network-mux >= 0.4 , nothunks , optparse-applicative-fork >= 0.18.1 - , ouroboros-consensus ^>= 0.20 - , ouroboros-consensus-cardano ^>= 0.19 - , ouroboros-consensus-diffusion ^>= 0.17 + , ouroboros-consensus ^>= 0.21 + , ouroboros-consensus-cardano ^>= 0.20 + , ouroboros-consensus-diffusion ^>= 0.18 , ouroboros-consensus-protocol - , ouroboros-network-api ^>= 0.9 + , ouroboros-network-api ^>= 0.10 , ouroboros-network ^>= 0.17 , ouroboros-network-framework - , ouroboros-network-protocols ^>= 0.10 + , ouroboros-network-protocols ^>= 0.11 , prettyprinter , prettyprinter-ansi-terminal , psqueues @@ -207,7 +207,7 @@ library , strict-stm , time , trace-dispatcher ^>= 2.7.0 - , trace-forward ^>= 2.2.7 + , trace-forward ^>= 2.2.8 , trace-resources ^>= 0.2.2 , tracer-transformers , transformers diff --git a/cardano-node/src/Cardano/Node/Configuration/POM.hs b/cardano-node/src/Cardano/Node/Configuration/POM.hs index 44f02e6a073..3ce3341e431 100644 --- a/cardano-node/src/Cardano/Node/Configuration/POM.hs +++ b/cardano-node/src/Cardano/Node/Configuration/POM.hs @@ -31,8 +31,8 @@ import Cardano.Node.Protocol.Types (Protocol (..)) import Cardano.Node.Types import Cardano.Tracing.Config import Cardano.Tracing.OrphanInstances.Network () -import Ouroboros.Consensus.Mempool (MempoolCapacityBytes (..), - MempoolCapacityBytesOverride (..)) +import Ouroboros.Consensus.Ledger.SupportsMempool +import Ouroboros.Consensus.Mempool (MempoolCapacityBytesOverride (..)) import Ouroboros.Consensus.Node (NodeDatabasePaths (..)) import qualified Ouroboros.Consensus.Node as Consensus (NetworkP2PMode (..)) import Ouroboros.Consensus.Storage.LedgerDB.DiskPolicy (NumOfDiskSnapshots (..), @@ -361,7 +361,7 @@ instance FromJSON PartialNodeConfiguration where where parseMempoolCapacityBytesOverride v = parseNoOverride <|> parseOverride where - parseNoOverride = fmap (MempoolCapacityBytesOverride . MempoolCapacityBytes) <$> v .:? "MempoolCapacityBytesOverride" + parseNoOverride = fmap (MempoolCapacityBytesOverride . ByteSize32) <$> v .:? "MempoolCapacityBytesOverride" parseOverride = do maybeString :: Maybe String <- v .:? "MempoolCapacityBytesOverride" case maybeString of diff --git a/cardano-node/src/Cardano/Node/Configuration/TopologyP2P.hs b/cardano-node/src/Cardano/Node/Configuration/TopologyP2P.hs index f1d8c29a3fd..dfad181fa7f 100644 --- a/cardano-node/src/Cardano/Node/Configuration/TopologyP2P.hs +++ b/cardano-node/src/Cardano/Node/Configuration/TopologyP2P.hs @@ -2,7 +2,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PackageImports #-} module Cardano.Node.Configuration.TopologyP2P ( TopologyError(..) @@ -26,7 +25,6 @@ where import Cardano.Node.Configuration.NodeAddress import Cardano.Node.Configuration.POM (NodeConfiguration (..)) import Cardano.Node.Configuration.Topology (TopologyError (..)) -import Cardano.Node.Startup (StartupTrace (..)) import Cardano.Node.Types import Cardano.Tracing.OrphanInstances.Network () import Ouroboros.Network.NodeToNode (PeerAdvertise (..)) @@ -41,9 +39,7 @@ import Control.Applicative (Alternative (..)) import Control.Exception (IOException) import qualified Control.Exception as Exception import Control.Exception.Base (Exception (..)) -import "contra-tracer" Control.Tracer (Tracer, traceWith) import Data.Aeson -import Data.Bifunctor (Bifunctor (..)) import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy.Char8 as LBS import Data.Text (Text) @@ -198,101 +194,46 @@ instance ToJSON NetworkTopology where , "bootstrapPeers" .= ntUseBootstrapPeers ] --- --- Legacy p2p topology file format --- - --- | A newtype wrapper which provides legacy 'FromJSON' instances. --- -newtype Legacy a = Legacy { getLegacy :: a } - -instance FromJSON (Legacy a) => FromJSON (Legacy [a]) where - parseJSON = fmap (Legacy . map getLegacy) . parseJSONList - -instance FromJSON (Legacy LocalRootPeersGroup) where - parseJSON = withObject "LocalRootPeersGroup" $ \o -> do - hv@(HotValency v) <- o .: "hotValency" - wv <- o .:? "warmValency" .!= WarmValency v - fmap Legacy $ LocalRootPeersGroup - <$> o .: "localRoots" - <*> pure hv - <*> pure wv - <*> o .: "trustable" - -instance FromJSON (Legacy LocalRootPeersGroups) where - parseJSON = withObject "LocalRootPeersGroups" $ \o -> - Legacy . LocalRootPeersGroups . getLegacy - <$> o .: "groups" - -instance FromJSON (Legacy PublicRootPeers) where - parseJSON = withObject "PublicRootPeers" $ \o -> - Legacy . PublicRootPeers - <$> o .: "publicRoots" - -instance FromJSON (Legacy NetworkTopology) where - parseJSON = fmap Legacy - . withObject "NetworkTopology" (\o -> - RealNodeTopology <$> fmap getLegacy (o .: "LocalRoots") - <*> fmap getLegacy (o .: "PublicRoots") - <*> (o .:? "useLedgerAfterSlot" .!= DontUseLedgerPeers) - <*> pure DontUseBootstrapPeers) - -- | Read the `NetworkTopology` configuration from the specified file. -- -readTopologyFile :: Tracer IO (StartupTrace blk) - -> NodeConfiguration -> IO (Either Text NetworkTopology) -readTopologyFile tr nc = do +readTopologyFile :: NodeConfiguration -> IO (Either Text NetworkTopology) +readTopologyFile nc = do eBs <- Exception.try $ BS.readFile (unTopology $ ncTopologyFile nc) case eBs of Left e -> return . Left $ handler e Right bs -> let bs' = LBS.fromStrict bs in - (case eitherDecode bs' of - Left err -> Left (handlerJSON err) - Right t - | isValidTrustedPeerConfiguration t -> Right t - | otherwise -> Left handlerBootstrap - ) - `combine` - first handlerJSON (eitherDecode bs') - - where - combine :: Either Text NetworkTopology - -> Either Text (Legacy NetworkTopology) - -> IO (Either Text NetworkTopology) - combine a b = case (a, b) of - (Right {}, _) -> return a - (_, Right {}) -> traceWith tr NetworkConfigLegacy - >> return (getLegacy <$> b) - (Left _, Left _) -> -- ignore parsing error of legacy format - return a - - handler :: IOException -> Text - handler e = Text.pack $ "Cardano.Node.Configuration.Topology.readTopologyFile: " - ++ displayException e - handlerJSON :: String -> Text - handlerJSON err = mconcat - [ "Is your topology file formatted correctly? " - , "Expecting P2P Topology file format. " - , "The port and valency fields should be numerical. " - , "If you specified the correct topology file " - , "make sure that you correctly setup EnableP2P " - , "configuration flag. " - , Text.pack err - ] - handlerBootstrap :: Text - handlerBootstrap = mconcat - [ "You seem to have not configured any trustable peers. " - , "This is important in order for the node to make progress " - , "in bootstrap mode. Make sure you provide at least one bootstrap peer " - , "source. " - ] + return $ case eitherDecode bs' of + Left err -> Left (handlerJSON err) + Right t + | isValidTrustedPeerConfiguration t -> Right t + | otherwise -> Left handlerBootstrap + where + handler :: IOException -> Text + handler e = Text.pack $ "Cardano.Node.Configuration.Topology.readTopologyFile: " + ++ displayException e + handlerJSON :: String -> Text + handlerJSON err = mconcat + [ "Is your topology file formatted correctly? " + , "Expecting P2P Topology file format. " + , "The port and valency fields should be numerical. " + , "If you specified the correct topology file " + , "make sure that you correctly setup EnableP2P " + , "configuration flag. " + , Text.pack err + ] + handlerBootstrap :: Text + handlerBootstrap = mconcat + [ "You seem to have not configured any trustable peers. " + , "This is important in order for the node to make progress " + , "in bootstrap mode. Make sure you provide at least one bootstrap peer " + , "source. " + ] -readTopologyFileOrError :: Tracer IO (StartupTrace blk) - -> NodeConfiguration -> IO NetworkTopology -readTopologyFileOrError tr nc = - readTopologyFile tr nc +readTopologyFileOrError :: NodeConfiguration -> IO NetworkTopology +readTopologyFileOrError nc = + readTopologyFile nc >>= either (\err -> error $ "Cardano.Node.Configuration.TopologyP2P.readTopologyFile: " <> Text.unpack err) pure diff --git a/cardano-node/src/Cardano/Node/Handlers/Shutdown.hs b/cardano-node/src/Cardano/Node/Handlers/Shutdown.hs index 060491164c1..ada94ad7427 100644 --- a/cardano-node/src/Cardano/Node/Handlers/Shutdown.hs +++ b/cardano-node/src/Cardano/Node/Handlers/Shutdown.hs @@ -8,6 +8,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeApplications #-} {-# OPTIONS_GHC -Wno-orphans #-} module Cardano.Node.Handlers.Shutdown @@ -26,7 +27,6 @@ module Cardano.Node.Handlers.Shutdown ) where -import Cardano.Api (bounded) import Cardano.Slotting.Slot (WithOrigin (..)) import Ouroboros.Consensus.Block (Header) @@ -51,6 +51,8 @@ import System.Exit (ExitCode (..)) import qualified System.IO as IO import qualified System.IO.Error as IO import System.Posix.Types (Fd (Fd)) +import qualified Text.Read as Read + import Generic.Data.Orphans () @@ -81,6 +83,13 @@ parseShutdownOn = asum ] , pure NoShutdown ] + where + bounded :: forall a. (Bounded a, Integral a, Show a) => String -> Opt.ReadM a + bounded t = Opt.eitherReader $ \s -> do + i <- Read.readEither @Integer s + when (i < fromIntegral (minBound @a)) $ Left $ t <> " must not be less than " <> show (minBound @a) + when (i > fromIntegral (maxBound @a)) $ Left $ t <> " must not greater than " <> show (maxBound @a) + pure (fromIntegral i) data ShutdownTrace = ShutdownRequested diff --git a/cardano-node/src/Cardano/Node/Parsers.hs b/cardano-node/src/Cardano/Node/Parsers.hs index 1a5f1fa47e3..d77bb991e28 100644 --- a/cardano-node/src/Cardano/Node/Parsers.hs +++ b/cardano-node/src/Cardano/Node/Parsers.hs @@ -20,7 +20,7 @@ import Cardano.Node.Configuration.Socket import Cardano.Node.Handlers.Shutdown import Cardano.Node.Types import Cardano.Prelude (ConvertText (..)) -import Ouroboros.Consensus.Mempool (MempoolCapacityBytes (..)) +import Ouroboros.Consensus.Ledger.SupportsMempool import Ouroboros.Consensus.Node import Ouroboros.Consensus.Storage.LedgerDB.DiskPolicy (NumOfDiskSnapshots (..), SnapshotInterval (..)) @@ -211,12 +211,12 @@ parseMempoolCapacityOverride = parseOverride <|> parseNoOverride where parseOverride :: Parser MempoolCapacityBytesOverride parseOverride = - MempoolCapacityBytesOverride . MempoolCapacityBytes <$> - Opt.option (auto @Word32) - ( long "mempool-capacity-override" - <> metavar "BYTES" - <> help "[DEPRECATED: Set it in config file with key MempoolCapacityBytesOverride] The number of bytes" - ) + MempoolCapacityBytesOverride . ByteSize32 <$> + Opt.option (auto @Word32) + ( long "mempool-capacity-override" + <> metavar "BYTES" + <> help "[DEPRECATED: Set it in config file with key MempoolCapacityBytesOverride] The number of bytes" + ) parseNoOverride :: Parser MempoolCapacityBytesOverride parseNoOverride = flag' NoMempoolCapacityBytesOverride diff --git a/cardano-node/src/Cardano/Node/Protocol/Byron.hs b/cardano-node/src/Cardano/Node/Protocol/Byron.hs index 57465668589..01f91c07a23 100644 --- a/cardano-node/src/Cardano/Node/Protocol/Byron.hs +++ b/cardano-node/src/Cardano/Node/Protocol/Byron.hs @@ -24,7 +24,7 @@ import Cardano.Node.Protocol.Types import Cardano.Node.Tracing.Era.Byron () import Cardano.Node.Tracing.Era.HardFork () import Cardano.Node.Tracing.Tracers.ChainDB () -import Cardano.Node.Types +import Cardano.Node.Types as Node import Cardano.Prelude (canonicalDecodePretty) import Cardano.Tracing.OrphanInstances.Byron () import Cardano.Tracing.OrphanInstances.HardFork () @@ -83,7 +83,7 @@ mkSomeConsensusProtocolByron NodeByronProtocolConfiguration { } readGenesis :: GenesisFile - -> Maybe GenesisHash + -> Maybe Node.GenesisHash -> RequiresNetworkMagic -> ExceptT ByronProtocolInstantiationError IO Genesis.Config @@ -110,9 +110,9 @@ readGenesis (GenesisFile file) mbExpectedGenesisHash ncReqNetworkMagic = do _ -> return () - fromByronGenesisHash :: Genesis.GenesisHash -> GenesisHash + fromByronGenesisHash :: Genesis.GenesisHash -> Node.GenesisHash fromByronGenesisHash (Genesis.GenesisHash h) = - GenesisHash + Node.GenesisHash . fromMaybe impossible . Crypto.hashFromBytes . Byron.Crypto.hashToBytes @@ -154,7 +154,7 @@ readLeaderCredentials genesisConfig data ByronProtocolInstantiationError = CanonicalDecodeFailure !FilePath !Text - | GenesisHashMismatch !GenesisHash !GenesisHash -- actual, expected + | GenesisHashMismatch !Node.GenesisHash !Node.GenesisHash -- actual, expected | DelegationCertificateFilepathNotSpecified | GenesisConfigurationError !FilePath !Genesis.ConfigurationError | GenesisReadError !FilePath !Genesis.GenesisDataError diff --git a/cardano-node/src/Cardano/Node/Protocol/Cardano.hs b/cardano-node/src/Cardano/Node/Protocol/Cardano.hs index 765fc2723bf..caa24132d04 100644 --- a/cardano-node/src/Cardano/Node/Protocol/Cardano.hs +++ b/cardano-node/src/Cardano/Node/Protocol/Cardano.hs @@ -85,7 +85,6 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration { npcConwayGenesisFileHash } npc@NodeHardForkProtocolConfiguration { - npcExperimentalHardForksEnabled, -- During testing of the Alonzo era, we conditionally declared that we -- knew about the Alonzo era. We do so only when a config option for -- testing development/unstable eras is used. This lets us include @@ -172,10 +171,7 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration { shelleyGenesisHash, shelleyBasedLeaderCredentials = shelleyLeaderCredentials } - , Consensus.cardanoProtocolVersion = - if npcExperimentalHardForksEnabled - then ProtVer (natVersion @10) 0 - else ProtVer (natVersion @9) 1 + , Consensus.cardanoProtocolVersion = ProtVer (natVersion @10) 0 -- The remaining arguments specify the parameters needed to transition between two eras , Consensus.cardanoLedgerTransitionConfig = Ledger.mkLatestTransitionConfig @@ -200,7 +196,8 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration { -- Version 6 is Alonzo (intra era hardfork) -- Version 7 is Babbage -- Version 8 is Babbage (intra era hardfork) - -- Version 9 is Conway + -- Version 9 is Conway (bootstrap era) + -- Version 10 is Conway + 1 -- -- But we also provide an override to allow for simpler test setups -- such as triggering at the 0 -> 1 transition . diff --git a/cardano-node/src/Cardano/Node/Run.hs b/cardano-node/src/Cardano/Node/Run.hs index a44c07226d1..3b88274a99e 100644 --- a/cardano-node/src/Cardano/Node/Run.hs +++ b/cardano-node/src/Cardano/Node/Run.hs @@ -121,7 +121,7 @@ import GHC.Weak (deRefWeak) import System.Posix.Files import qualified System.Posix.Signals as Signals import System.Posix.Types (FileMode) -#else +#else import System.Win32.File #endif import Paths_cardano_node (version) @@ -435,7 +435,7 @@ handleSimpleNode blockType runP p2pMode tracers nc onKernel = do nt@TopologyP2P.RealNodeTopology { ntUseLedgerPeers , ntUseBootstrapPeers - } <- TopologyP2P.readTopologyFileOrError (startupTracer tracers) nc + } <- TopologyP2P.readTopologyFileOrError nc let (localRoots, publicRoots) = producerAddresses nt traceWith (startupTracer tracers) $ NetworkConfig localRoots @@ -764,7 +764,7 @@ updateTopologyConfiguration :: Tracer IO (StartupTrace blk) updateTopologyConfiguration startupTracer nc localRootsVar publicRootsVar useLedgerVar useBootsrapPeersVar = do traceWith startupTracer NetworkConfigUpdate - result <- try $ readTopologyFileOrError startupTracer nc + result <- try $ readTopologyFileOrError nc case result of Left (FatalError err) -> traceWith startupTracer diff --git a/cardano-node/src/Cardano/Node/Startup.hs b/cardano-node/src/Cardano/Node/Startup.hs index a82e7a8229a..9f75890bafc 100644 --- a/cardano-node/src/Cardano/Node/Startup.hs +++ b/cardano-node/src/Cardano/Node/Startup.hs @@ -103,10 +103,6 @@ data StartupTrace blk = -- | NetworkConfigUpdateError Text - -- | Legacy topology file format is used. - -- - | NetworkConfigLegacy - -- | Log peer-to-peer network configuration, either on startup or when its -- updated. -- diff --git a/cardano-node/src/Cardano/Node/TraceConstraints.hs b/cardano-node/src/Cardano/Node/TraceConstraints.hs index 06fbed78e1c..1cdea0b56f2 100644 --- a/cardano-node/src/Cardano/Node/TraceConstraints.hs +++ b/cardano-node/src/Cardano/Node/TraceConstraints.hs @@ -6,7 +6,6 @@ module Cardano.Node.TraceConstraints (TraceConstraints) where - import Cardano.BM.Tracing (ToObject) import Cardano.Ledger.Credential import Cardano.Ledger.Crypto (StandardCrypto) @@ -29,6 +28,7 @@ import Ouroboros.Consensus.Shelley.Ledger.Mempool (GenTx, TxId) import Ouroboros.Network.Block (Serialised) import Data.Aeson +import qualified Data.List.NonEmpty as NonEmpty import Data.Set -- | Tracing-related constraints for monitoring purposes. @@ -71,4 +71,5 @@ type TraceConstraints blk = , LogFormatting (CannotForge blk) , LogFormatting (ForgeStateUpdateError blk) , LogFormatting (Set (Credential 'Staking StandardCrypto)) + , LogFormatting (NonEmpty.NonEmpty (KeyHash 'Staking StandardCrypto)) ) diff --git a/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs b/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs index 4dd0725e8f8..b00ebe1c2d1 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs @@ -32,7 +32,7 @@ import qualified Cardano.Ledger.Alonzo.Rules as Alonzo import qualified Cardano.Ledger.AuxiliaryData as Ledger import Cardano.Ledger.Babbage.Rules (BabbageUtxoPredFailure, BabbageUtxowPredFailure) import qualified Cardano.Ledger.Babbage.Rules as Babbage -import Cardano.Ledger.BaseTypes (activeSlotLog, strictMaybeToMaybe) +import Cardano.Ledger.BaseTypes (activeSlotLog, strictMaybeToMaybe, Mismatch (..)) import Cardano.Ledger.Chain import Cardano.Ledger.Conway.Governance (govActionIdToText) import qualified Cardano.Ledger.Conway.Rules as Conway @@ -100,6 +100,12 @@ instance LogFormatting (Set (Credential 'Staking StandardCrypto)) where , "stakeCreds" .= map toJSON (Set.toList creds) ] +instance LogFormatting (NonEmpty.NonEmpty (KeyHash 'Staking StandardCrypto)) where + forMachine _dtal keyHashes = + mconcat [ "kind" .= String "StakingKeyHashes" + , "stakeKeyHashes" .= toJSON keyHashes + ] + instance ( LogFormatting (PredicateFailure (Ledger.EraRule "DELEG" era)) , LogFormatting (PredicateFailure (Ledger.EraRule "POOL" era)) @@ -152,8 +158,8 @@ instance LogFormatting (Conway.ConwayGovCertPredFailure era) where instance LogFormatting (Conway.ConwayDelegPredFailure era) where forMachine _dtal = mconcat . \case - Conway.DelegateeNotRegisteredDELEG poolID -> - [ "kind" .= String "DelegateeNotRegisteredDELEG" + Conway.DelegateeStakePoolNotRegisteredDELEG poolID -> + [ "kind" .= String "DelegateeStakePoolNotRegisteredDELEG" , "poolID" .= String (textShow poolID) ] Conway.IncorrectDepositDELEG coin -> @@ -176,10 +182,10 @@ instance LogFormatting (Conway.ConwayDelegPredFailure era) where , "amount" .= coin , "error" .= String "Stake key has non-zero account balance" ] - Conway.DRepAlreadyRegisteredForStakeKeyDELEG credential -> - [ "kind" .= String "DRepAlreadyRegisteredForStakeKeyDELEG" - , "amount" .= String (textShow credential) - , "error" .= String "DRep already registered for the stake key" + Conway.DelegateeDRepNotRegisteredDELEG credential -> + [ "kind" .= String "DelegateeDRepNotRegisteredDELEG" + , "credential" .= String (textShow credential) + , "error" .= String "Delegated rep is not registered for provided stake key" ] instance @@ -297,12 +303,14 @@ instance , LogFormatting (PredicateFailure (Ledger.EraRule "LEDGER" era)) , LogFormatting (PredicateFailure (Ledger.EraRule "LEDGERS" era)) ) => LogFormatting (ShelleyBbodyPredFailure era) where - forMachine _dtal (WrongBlockBodySizeBBODY actualBodySz claimedBodySz) = + forMachine _dtal (WrongBlockBodySizeBBODY (Mismatch { mismatchSupplied = actualBodySz + , mismatchExpected = claimedBodySz })) = mconcat [ "kind" .= String "WrongBlockBodySizeBBODY" , "actualBlockBodySize" .= actualBodySz , "claimedBlockBodySize" .= claimedBodySz ] - forMachine _dtal (InvalidBodyHashBBODY actualHash claimedHash) = + forMachine _dtal (InvalidBodyHashBBODY (Mismatch { mismatchSupplied = actualHash + , mismatchExpected = claimedHash })) = mconcat [ "kind" .= String "InvalidBodyHashBBODY" , "actualBodyHash" .= textShow actualHash , "claimedBodyHash" .= textShow claimedHash @@ -417,7 +425,8 @@ instance mconcat [ "kind" .= String "MissingTxMetadata" , "txBodyMetadataHash" .= txBodyMetadataHash ] - forMachine _dtal (ConflictingMetadataHash txBodyMetadataHash fullMetadataHash) = + forMachine _dtal (ConflictingMetadataHash (Mismatch { mismatchSupplied = txBodyMetadataHash + , mismatchExpected = fullMetadataHash })) = mconcat [ "kind" .= String "ConflictingMetadataHash" , "txBodyMetadataHash" .= txBodyMetadataHash , "fullMetadataHash" .= fullMetadataHash @@ -443,7 +452,8 @@ instance mconcat [ "kind" .= String "ExpiredUTxO" , "ttl" .= ttl , "slot" .= slot ] - forMachine _dtal (MaxTxSizeUTxO txsize maxtxsize) = + forMachine _dtal (MaxTxSizeUTxO (Mismatch { mismatchSupplied = txsize + , mismatchExpected = maxtxsize })) = mconcat [ "kind" .= String "MaxTxSizeUTxO" , "size" .= txsize , "maxSize" .= maxtxsize ] @@ -465,7 +475,9 @@ instance ] forMachine _dtal InputSetEmptyUTxO = mconcat [ "kind" .= String "InputSetEmptyUTxO" ] - forMachine _dtal (FeeTooSmallUTxO minfee txfee) = + -- TODO are these arguments in the right order? + forMachine _dtal (FeeTooSmallUTxO (Mismatch { mismatchSupplied = minfee + , mismatchExpected = txfee })) = mconcat [ "kind" .= String "FeeTooSmallUTxO" , "minimum" .= minfee , "fee" .= txfee ] @@ -565,7 +577,9 @@ renderValueNotConservedErr consumed produced = String $ instance ( Ledger.Crypto (Ledger.EraCrypto era) ) => LogFormatting (ShelleyPpupPredFailure era) where - forMachine _dtal (NonGenesisUpdatePPUP proposalKeys genesisKeys) = + -- TODO are these arguments in the right order? + forMachine _dtal (NonGenesisUpdatePPUP (Mismatch { mismatchSupplied = proposalKeys + , mismatchExpected = genesisKeys })) = mconcat [ "kind" .= String "NonGenesisUpdatePPUP" , "keys" .= proposalKeys Set.\\ genesisKeys ] forMachine _dtal (PPUpdateWrongEpoch currEpoch intendedEpoch votingPeriod) = @@ -690,13 +704,20 @@ instance LogFormatting (ShelleyPoolPredFailure era) where , "unregisteredKeyHash" .= String (textShow unregStakePool) , "error" .= String "This stake pool key hash is unregistered" ] - forMachine _dtal (StakePoolRetirementWrongEpochPOOL currentEpoch intendedRetireEpoch maxRetireEpoch) = + forMachine _dtal (StakePoolRetirementWrongEpochPOOL + -- inspired by Ledger's Test.Cardano.Ledger.Generic.PrettyCore + -- but is it correct here? + (Mismatch { mismatchExpected = currentEpoch }) + (Mismatch { mismatchSupplied = intendedRetireEpoch + , mismatchExpected = maxRetireEpoch})) = mconcat [ "kind" .= String "StakePoolRetirementWrongEpochPOOL" , "currentEpoch" .= String (textShow currentEpoch) , "intendedRetirementEpoch" .= String (textShow intendedRetireEpoch) , "maxEpochForRetirement" .= String (textShow maxRetireEpoch) ] - forMachine _dtal (StakePoolCostTooLowPOOL certCost protCost) = + -- TODO are these supplied in the right order? + forMachine _dtal (StakePoolCostTooLowPOOL (Mismatch { mismatchSupplied = certCost + , mismatchExpected = protCost })) = mconcat [ "kind" .= String "StakePoolCostTooLowPOOL" , "certificateCost" .= String (textShow certCost) , "protocolParCost" .= String (textShow protCost) @@ -709,7 +730,8 @@ instance LogFormatting (ShelleyPoolPredFailure era) where , "error" .= String "The stake pool metadata hash is too large" ] - forMachine _dtal (WrongNetworkPOOL networkId listedNetworkId poolId) = + forMachine _dtal (WrongNetworkPOOL (Mismatch { mismatchSupplied = networkId + , mismatchExpected = listedNetworkId }) poolId) = mconcat [ "kind" .= String "WrongNetworkPOOL" , "networkId" .= String (textShow networkId) , "listedNetworkId" .= String (textShow listedNetworkId) @@ -752,23 +774,12 @@ instance instance LogFormatting (ShelleyPoolreapPredFailure era) where forMachine _dtal x = case x of {} -- no constructors - instance LogFormatting (ShelleySnapPredFailure era) where forMachine _dtal x = case x of {} -- no constructors --- TODO: Need to elaborate more on this error -instance LogFormatting (ShelleyNewppPredFailure era) where - forMachine _dtal (UnexpectedDepositPot outstandingDeposits depositPot) = - mconcat [ "kind" .= String "UnexpectedDepositPot" - , "outstandingDeposits" .= String (textShow outstandingDeposits) - , "depositPot" .= String (textShow depositPot) - ] - - instance LogFormatting (ShelleyMirPredFailure era) where forMachine _dtal x = case x of {} -- no constructors - instance LogFormatting (ShelleyRupdPredFailure era) where forMachine _dtal x = case x of {} -- no constructors @@ -891,13 +902,6 @@ instance LogFormatting (OcertPredicateFailure crypto) where instance LogFormatting (UpdnPredicateFailure crypto) where forMachine _dtal x = case x of {} -- no constructors -instance LogFormatting (ShelleyUpecPredFailure era) where - forMachine _dtal (NewPpFailure (UnexpectedDepositPot totalOutstanding depositPot)) = - mconcat [ "kind" .= String "UnexpectedDepositPot" - , "totalOutstanding" .= String (textShow totalOutstanding) - , "depositPot" .= String (textShow depositPot) - ] - -------------------------------------------------------------------------------- -- Alonzo related -------------------------------------------------------------------------------- @@ -1099,6 +1103,7 @@ instance , LogFormatting (PredicateFailure (Ledger.EraRule "GOV" era)) , LogFormatting (PredicateFailure (Ledger.EraRule "CERTS" era)) , LogFormatting (Set (Credential 'Staking (Ledger.EraCrypto era))) + , LogFormatting (NonEmpty.NonEmpty (KeyHash 'Staking (Ledger.EraCrypto era))) ) => LogFormatting (Conway.ConwayLedgerPredFailure era) where forMachine v (Conway.ConwayUtxowFailure f) = forMachine v f forMachine _ (Conway.ConwayTxRefScriptsSizeTooBig actual limit) = @@ -1114,6 +1119,10 @@ instance , "actual" .= actual , "submittedInTx" .= inTx ] + forMachine _ (Conway.ConwayMempoolFailure message) = + mconcat [ "kind" .= String "ConwayMempoolFailure" + , "actual" .= message + ] instance ( Consensus.ShelleyBasedEra era @@ -1184,7 +1193,18 @@ instance mconcat [ "kind" .= String "DisallowedVotesDuringBootstrap" , "votes" .= votes ] - + forMachine _ (Conway.ZeroTreasuryWithdrawals govAction) = + mconcat [ "kind" .= String "ZeroTreasuryWithdrawals" + , "govAction" .= govAction + ] + forMachine _ (Conway.ProposalReturnAccountDoesNotExist account) = + mconcat [ "kind" .= String "ProposalReturnAccountDoesNotExist" + , "invalidAccount" .= account + ] + forMachine _ (Conway.TreasuryWithdrawalReturnAccountsDoNotExist accounts) = + mconcat [ "kind" .= String "TreasuryWithdrawalReturnAccountsDoNotExist" + , "invalidAccounts" .= accounts + ] instance ( Consensus.ShelleyBasedEra era diff --git a/cardano-node/src/Cardano/Node/Tracing/StateRep.hs b/cardano-node/src/Cardano/Node/Tracing/StateRep.hs index bbd32fa6aa3..dca8cd1932a 100644 --- a/cardano-node/src/Cardano/Node/Tracing/StateRep.hs +++ b/cardano-node/src/Cardano/Node/Tracing/StateRep.hs @@ -60,7 +60,7 @@ deriving instance (NFData OpeningDbs) data Replays = ReplayFromGenesis (WithOrigin SlotNo) - | ReplayFromSnapshot SlotNo (WithOrigin SlotNo) (WithOrigin SlotNo) + | ReplayFromSnapshot (WithOrigin SlotNo) (WithOrigin SlotNo) | ReplayedBlock SlotNo (WithOrigin SlotNo) (WithOrigin SlotNo) deriving (Generic, FromJSON, ToJSON) @@ -219,8 +219,8 @@ traceNodeStateChainDB _scp tr ev = case ev' of LgrDb.ReplayFromGenesis (LgrDb.ReplayGoal p) -> traceWith tr $ NodeReplays $ ReplayFromGenesis (pointSlot p) - LgrDb.ReplayFromSnapshot _ (RP.RealPoint s _) (LgrDb.ReplayStart rs) (LgrDb.ReplayGoal rp) -> - traceWith tr $ NodeReplays $ ReplayFromSnapshot s (pointSlot rs) (pointSlot rp) + LgrDb.ReplayFromSnapshot _ (LgrDb.ReplayStart rs) (LgrDb.ReplayGoal rp) -> + traceWith tr $ NodeReplays $ ReplayFromSnapshot (pointSlot rs) (pointSlot rp) LgrDb.ReplayedBlock (RP.RealPoint s _) _ (LgrDb.ReplayStart rs) (LgrDb.ReplayGoal rp) -> traceWith tr $ NodeReplays $ ReplayedBlock s (pointSlot rs) (pointSlot rp) ChainDB.TraceInitChainSelEvent ev' -> diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs index 0486292e199..a0ecf536704 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs @@ -32,7 +32,7 @@ import qualified Ouroboros.Consensus.Storage.ChainDB as ChainDB import qualified Ouroboros.Consensus.Storage.ImmutableDB as ImmDB import Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Internal (chunkNoToInt) import qualified Ouroboros.Consensus.Storage.ImmutableDB.Impl.Types as ImmDB -import Ouroboros.Consensus.Storage.LedgerDB (UpdateLedgerDbTraceEvent (..)) +import Ouroboros.Consensus.Storage.LedgerDB (UpdateLedgerDbTraceEvent (..), ReplayStart (..)) import qualified Ouroboros.Consensus.Storage.LedgerDB as LedgerDB import qualified Ouroboros.Consensus.Storage.VolatileDB as VolDB import Ouroboros.Consensus.Util.Condense (condense) @@ -1572,9 +1572,9 @@ instance (StandardHash blk, ConvertRawHash blk) => LogFormatting (LedgerDB.TraceReplayEvent blk) where forHuman (LedgerDB.ReplayFromGenesis _replayTo) = "Replaying ledger from genesis" - forHuman (LedgerDB.ReplayFromSnapshot snap tip' _ _) = - "Replaying ledger from snapshot " <> showT snap <> " at " <> - renderRealPointAsPhrase tip' + forHuman (LedgerDB.ReplayFromSnapshot snap (ReplayStart tip') _goal) = + "Replaying ledger from snapshot " <> showT snap <> " at " + <> renderPointAsPhrase tip' forHuman (LedgerDB.ReplayedBlock pt _ledgerEvents @@ -1596,7 +1596,7 @@ instance (StandardHash blk, ConvertRawHash blk) forMachine _dtal (LedgerDB.ReplayFromGenesis _replayTo) = mconcat [ "kind" .= String "ReplayFromGenesis" ] - forMachine dtal (LedgerDB.ReplayFromSnapshot snap tip' _ _) = + forMachine dtal (LedgerDB.ReplayFromSnapshot snap tip' _) = mconcat [ "kind" .= String "ReplayFromSnapshot" , "snapshot" .= forMachine dtal snap , "tip" .= show tip' ] diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs index 63019777937..0ec5a5db4bc 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs @@ -37,10 +37,10 @@ import Ouroboros.Consensus.Block import Ouroboros.Consensus.BlockchainTime (SystemStart (..)) import Ouroboros.Consensus.BlockchainTime.WallClock.Util (TraceBlockchainTimeEvent (..)) import Ouroboros.Consensus.Cardano.Block -import Ouroboros.Consensus.Genesis.Governor (DensityBounds (..), TraceGDDEvent (..)) +import Ouroboros.Consensus.Genesis.Governor (DensityBounds (..), TraceGDDEvent (..), GDDDebugInfo (..)) import Ouroboros.Consensus.Ledger.Inspect (LedgerEvent (..), LedgerUpdate, LedgerWarning) import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr, GenTxId, HasTxId, - LedgerSupportsMempool, txForgetValidated, txId) + LedgerSupportsMempool, txForgetValidated, txId, ByteSize32 (..)) import Ouroboros.Consensus.Ledger.SupportsProtocol import Ouroboros.Consensus.Mempool (MempoolSize (..), TraceEventMempool (..)) import Ouroboros.Consensus.MiniProtocol.BlockFetch.Server @@ -74,6 +74,7 @@ import Control.Monad (guard) import Control.Monad.Class.MonadTime.SI (Time (..)) import Data.Aeson (ToJSON, Value (Number, String), toJSON, (.=)) import qualified Data.Aeson as Aeson +import Data.Foldable (Foldable(toList)) import Data.Int (Int64) import Data.IntPSQ (IntPSQ) import qualified Data.IntPSQ as Pq @@ -881,8 +882,8 @@ instance ( LogFormatting peer , HasHeader (Header blk) , ConvertRawHash (Header blk) ) => LogFormatting (TraceGDDEvent peer blk) where - forMachine dtal TraceGDDEvent {..} = mconcat $ - [ "kind" .= String "TraceGDDEvent" + forMachine dtal (TraceGDDDebug (GDDDebugInfo {..})) = mconcat $ + [ "kind" .= String "TraceGDDDebugInfo" , "losingPeers".= toJSON (map (forMachine dtal) losingPeers) , "loeHead" .= forMachine dtal loeHead , "sgen" .= toJSON (unGenesisWindow sgen) @@ -921,6 +922,11 @@ instance ( LogFormatting peer ) ] + forMachine dtal (TraceGDDDisconnected peers) = mconcat + [ "kind" .= String "TraceGDDDisconnected" + , "peers" .= toJSON (map (forMachine dtal) (toList peers)) + ] + forHuman = forHumanOrMachine instance MetaTrace (TraceGDDEvent peer blk) where @@ -1199,33 +1205,46 @@ instance , "mempoolSize" .= forMachine dtal mpSz ] + forMachine _dtal (TraceMempoolSynced et) = + mconcat + [ "kind" .= String "TraceMempoolSynced" + , "enclosingTime" .= et + ] + asMetrics (TraceMempoolAddedTx _tx _mpSzBefore mpSz) = [ IntM "txsInMempool" (fromIntegral $ msNumTxs mpSz) - , IntM "mempoolBytes" (fromIntegral $ msNumBytes mpSz) + , IntM "mempoolBytes" (fromIntegral . unByteSize32 . msNumBytes $ mpSz) ] asMetrics (TraceMempoolRejectedTx _tx _txApplyErr mpSz) = [ IntM "txsInMempool" (fromIntegral $ msNumTxs mpSz) - , IntM "mempoolBytes" (fromIntegral $ msNumBytes mpSz) + , IntM "mempoolBytes" (fromIntegral . unByteSize32 . msNumBytes $ mpSz) ] asMetrics (TraceMempoolRemoveTxs _txs mpSz) = [ IntM "txsInMempool" (fromIntegral $ msNumTxs mpSz) - , IntM "mempoolBytes" (fromIntegral $ msNumBytes mpSz) + , IntM "mempoolBytes" (fromIntegral . unByteSize32 . msNumBytes $ mpSz) ] asMetrics (TraceMempoolManuallyRemovedTxs [] _txs1 mpSz) = [ IntM "txsInMempool" (fromIntegral $ msNumTxs mpSz) - , IntM "mempoolBytes" (fromIntegral $ msNumBytes mpSz) + , IntM "mempoolBytes" (fromIntegral . unByteSize32 . msNumBytes $ mpSz) ] asMetrics (TraceMempoolManuallyRemovedTxs txs _txs1 mpSz) = [ IntM "txsInMempool" (fromIntegral $ msNumTxs mpSz) - , IntM "mempoolBytes" (fromIntegral $ msNumBytes mpSz) + , IntM "mempoolBytes" (fromIntegral . unByteSize32 . msNumBytes $ mpSz) , CounterM "txsProcessedNum" (Just (fromIntegral $ length txs)) ] + asMetrics (TraceMempoolSynced (FallingEdgeWith duration)) = + [ IntM "txsSyncDuration" (round $ 1000 * duration) + ] + + asMetrics (TraceMempoolSynced RisingEdge) = [] + + instance LogFormatting MempoolSize where forMachine _dtal MempoolSize{msNumTxs, msNumBytes} = mconcat [ "numTxs" .= msNumTxs - , "bytes" .= msNumBytes + , "bytes" .= unByteSize32 msNumBytes ] @@ -1234,11 +1253,13 @@ instance MetaTrace (TraceEventMempool blk) where namespaceFor TraceMempoolRejectedTx {} = Namespace [] ["RejectedTx"] namespaceFor TraceMempoolRemoveTxs {} = Namespace [] ["RemoveTxs"] namespaceFor TraceMempoolManuallyRemovedTxs {} = Namespace [] ["ManuallyRemovedTxs"] + namespaceFor TraceMempoolSynced {} = Namespace [] ["Synced"] severityFor (Namespace _ ["AddedTx"]) _ = Just Info severityFor (Namespace _ ["RejectedTx"]) _ = Just Info severityFor (Namespace _ ["RemoveTxs"]) _ = Just Info severityFor (Namespace _ ["ManuallyRemovedTxs"]) _ = Just Info + severityFor (Namespace _ ["Synced"]) _ = Just Info severityFor _ _ = Nothing metricsDocFor (Namespace _ ["AddedTx"]) = @@ -1258,6 +1279,11 @@ instance MetaTrace (TraceEventMempool blk) where , ("mempoolBytes", "Byte size of the mempool") , ("txsProcessedNum", "") ] + + metricsDocFor (Namespace _ ["Synced"]) = + [ ("txsSyncDuration", "Time to sync the mempool in ms after block adoption") + ] + metricsDocFor _ = [] documentFor (Namespace _ ["AddedTx"]) = Just diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs index 0d27397ef89..3553093949c 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs @@ -227,10 +227,6 @@ instance ( Show (BlockNodeToNodeVersion blk) , "publicRoots" .= toJSON publicRoots , "useLedgerAfter" .= useLedgerPeers ] - forMachine _dtal NetworkConfigLegacy = - mconcat [ "kind" .= String "NetworkConfigLegacy" - , "message" .= String p2pNetworkConfigLegacyMessage - ] forMachine _dtal NonP2PWarning = mconcat [ "kind" .= String "NonP2PWarning" , "message" .= String nonP2PWarningMessage ] @@ -313,8 +309,6 @@ instance MetaTrace (StartupTrace blk) where Namespace [] ["NetworkConfigUpdateError"] namespaceFor NetworkConfig {} = Namespace [] ["NetworkConfig"] - namespaceFor NetworkConfigLegacy {} = - Namespace [] ["NetworkConfigLegacy"] namespaceFor NonP2PWarning {} = Namespace [] ["NonP2PWarning"] namespaceFor WarningDevelopmentNodeToNodeVersions {} = @@ -367,8 +361,6 @@ instance MetaTrace (StartupTrace blk) where "" documentFor (Namespace [] ["NetworkConfig"]) = Just "" - documentFor (Namespace [] ["NetworkConfigLegacy"]) = Just - "" documentFor (Namespace [] ["NonP2PWarning"]) = Just "" documentFor (Namespace [] ["WarningDevelopmentNodeToNodeVersions"]) = Just @@ -427,7 +419,6 @@ instance MetaTrace (StartupTrace blk) where , Namespace [] ["NetworkConfigUpdateUnsupported"] , Namespace [] ["NetworkConfigUpdateError"] , Namespace [] ["NetworkConfig"] - , Namespace [] ["NetworkConfigLegacy"] , Namespace [] ["NonP2PWarning"] , Namespace [] ["WarningDevelopmentNodeToNodeVersions"] , Namespace [] ["WarningDevelopmentNodeToClientVersions"] @@ -448,16 +439,12 @@ nodeToClientVersionToInt = \case NodeToClientV_15 -> 15 NodeToClientV_16 -> 16 NodeToClientV_17 -> 17 + NodeToClientV_18 -> 18 nodeToNodeVersionToInt :: NodeToNodeVersion -> Int nodeToNodeVersionToInt = \case - NodeToNodeV_7 -> 7 - NodeToNodeV_8 -> 8 - NodeToNodeV_9 -> 9 - NodeToNodeV_10 -> 10 - NodeToNodeV_11 -> 11 - NodeToNodeV_12 -> 12 NodeToNodeV_13 -> 13 + NodeToNodeV_14 -> 14 -- | Pretty print 'StartupInfoTrace' -- @@ -539,7 +526,6 @@ ppStartupInfoTrace (NetworkConfig localRoots publicRoots useLedgerPeers) = UseLedgerPeers Always -> "Use ledger peers in any slot." ] -ppStartupInfoTrace NetworkConfigLegacy = p2pNetworkConfigLegacyMessage ppStartupInfoTrace NonP2PWarning = nonP2PWarningMessage @@ -581,15 +567,6 @@ nonP2PWarningMessage = "You are using legacy networking stack, " <> "consider upgrading to the p2p network stack." -p2pNetworkConfigLegacyMessage :: Text -p2pNetworkConfigLegacyMessage = - pack - $ intercalate "\n" - [ "You are using legacy p2p topology file format." - , "See https://github.com/intersectmbo/cardano-node/issues/4559" - , "Note that the legacy p2p format will be removed in `1.37` release." - ] - -- | Pretty print 'SocketOrSocketInfo'. -- ppSocketInfo :: Show sock diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Consensus.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Consensus.hs index c7491304090..2a3c60f141b 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Consensus.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Consensus.hs @@ -33,14 +33,15 @@ import Ouroboros.Consensus.Block (BlockProtocol, BlockSupportsProtocol ConvertRawHash (..), ForgeStateUpdateError, GenesisWindow (..), GetHeader (..), Header, RealPoint, blockNo, blockPoint, blockPrevHash, getHeader, headerPoint, pointHash, realPointHash, realPointSlot, withOriginToMaybe) -import Ouroboros.Consensus.Genesis.Governor (DensityBounds (..), TraceGDDEvent (..)) +import Ouroboros.Consensus.Block.SupportsSanityCheck +import Ouroboros.Consensus.Genesis.Governor (DensityBounds (..), TraceGDDEvent (..), GDDDebugInfo (..)) import Ouroboros.Consensus.HeaderValidation import Ouroboros.Consensus.Ledger.Abstract import Ouroboros.Consensus.Ledger.Extended import Ouroboros.Consensus.Ledger.Inspect (InspectLedger, LedgerEvent (..), LedgerUpdate, LedgerWarning) import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr, GenTx, GenTxId, HasTxId, - LedgerSupportsMempool, TxId, txForgetValidated, txId) + LedgerSupportsMempool, TxId, txForgetValidated, txId, ByteSize32 (..)) import Ouroboros.Consensus.Ledger.SupportsProtocol (LedgerSupportsProtocol) import Ouroboros.Consensus.Mempool (MempoolSize (..), TraceEventMempool (..)) import Ouroboros.Consensus.MiniProtocol.BlockFetch.Server @@ -64,12 +65,11 @@ import qualified Ouroboros.Consensus.Storage.ImmutableDB.API as ImmDB import Ouroboros.Consensus.Storage.ImmutableDB.Chunks.Internal (ChunkNo (..), chunkNoToInt) import qualified Ouroboros.Consensus.Storage.ImmutableDB.Impl.Types as ImmDB -import Ouroboros.Consensus.Storage.LedgerDB (PushGoal (..), PushStart (..), Pushing (..)) +import Ouroboros.Consensus.Storage.LedgerDB (PushGoal (..), PushStart (..), Pushing (..), ReplayStart (..)) import qualified Ouroboros.Consensus.Storage.LedgerDB as LedgerDB import qualified Ouroboros.Consensus.Storage.VolatileDB.Impl as VolDb import Ouroboros.Consensus.Util.Condense import Ouroboros.Consensus.Util.Enclose -import Ouroboros.Consensus.Block.SupportsSanityCheck import Ouroboros.Consensus.Util.Orphans () import qualified Ouroboros.Network.AnchoredFragment as AF import Ouroboros.Network.Block (BlockNo (..), ChainUpdate (..), SlotNo (..), StandardHash, @@ -589,9 +589,9 @@ instance ( ConvertRawHash blk ChainDB.TraceLedgerReplayEvent ev -> case ev of LedgerDB.ReplayFromGenesis _replayTo -> "Replaying ledger from genesis" - LedgerDB.ReplayFromSnapshot _ tip' _ _ -> + LedgerDB.ReplayFromSnapshot _ (ReplayStart tip') _goal -> "Replaying ledger from snapshot at " <> - renderRealPointAsPhrase tip' + renderPointAsPhrase tip' LedgerDB.ReplayedBlock pt _ledgerEvents (LedgerDB.ReplayStart replayFrom) (LedgerDB.ReplayGoal replayTo) -> let fromSlot = withOrigin 0 Prelude.id $ unSlotNo <$> pointSlot replayFrom atSlot = unSlotNo $ realPointSlot pt @@ -1077,7 +1077,7 @@ instance ( ConvertRawHash blk toObject verb (ChainDB.TraceLedgerReplayEvent ev) = case ev of LedgerDB.ReplayFromGenesis _replayTo -> mconcat [ "kind" .= String "TraceLedgerReplayEvent.ReplayFromGenesis" ] - LedgerDB.ReplayFromSnapshot snap tip' _replayFrom _replayTo -> + LedgerDB.ReplayFromSnapshot snap tip' _replayFrom -> mconcat [ "kind" .= String "TraceLedgerReplayEvent.ReplayFromSnapshot" , "snapshot" .= toObject verb snap , "tip" .= show tip' ] @@ -1510,12 +1510,17 @@ instance ( ToObject (ApplyTxErr blk), ToObject (GenTx blk), , "txsInvalidated" .= map (toObject verb . txForgetValidated) txs1 , "mempoolSize" .= toObject verb mpSz ] + toObject _verb (TraceMempoolSynced et) = + mconcat + [ "kind" .= String "TraceMempoolSynced" + , "enclosingTime" .= et + ] instance ToObject MempoolSize where toObject _verb MempoolSize{msNumTxs, msNumBytes} = mconcat [ "numTxs" .= msNumTxs - , "bytes" .= msNumBytes + , "bytes" .= unByteSize32 msNumBytes ] instance HasTextFormatter () where @@ -1704,7 +1709,7 @@ instance (ToObject peer, ConvertRawHash blk, GetHeader blk) => Transformable Tex trTransformer = trStructured instance (ToObject peer, ConvertRawHash blk, GetHeader blk) => ToObject (TraceGDDEvent peer blk) where - toObject verb TraceGDDEvent {..} = mconcat $ + toObject verb (TraceGDDDebug (GDDDebugInfo {..})) = mconcat $ [ "kind" .= String "TraceGDDEvent" , "losingPeers".= toJSON (map (toObject verb) losingPeers) , "loeHead" .= toObject verb loeHead @@ -1744,6 +1749,11 @@ instance (ToObject peer, ConvertRawHash blk, GetHeader blk) => ToObject (TraceGD ) ] + toObject verb (TraceGDDDisconnected peer) = mconcat + [ "kind" .= String "TraceGDDDisconnected" + , "peer" .= toJSON (map (toObject verb) $ toList peer) + ] + instance (ConvertRawHash blk, GetHeader blk) => ToObject (DensityBounds blk) where toObject verb DensityBounds {..} = mconcat [ "kind" .= String "DensityBounds" diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs index e1db4ae25c8..5ca65ab077a 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs @@ -61,7 +61,7 @@ import Ouroboros.Network.NodeToNode (ErrorPolicyTrace (..), NodeToNode NodeToNodeVersionData (..), RemoteAddress, TraceSendRecv (..), WithAddr (..)) import qualified Ouroboros.Network.NodeToNode as NtN import Ouroboros.Network.PeerSelection.Bootstrap -import Ouroboros.Network.PeerSelection.Governor (DebugPeerSelection (..), +import Ouroboros.Network.PeerSelection.Governor (AssociationMode (..), DebugPeerSelection (..), DebugPeerSelectionState (..), PeerSelectionCounters, PeerSelectionState (..), PeerSelectionTargets (..), PeerSelectionView (..), TracePeerSelection (..), peerSelectionStateToCounters) @@ -1956,6 +1956,8 @@ instance ToObject (TracePeerSelection SockAddr) where , "inProgressDemoteToCold" .= dpssInProgressDemoteToCold ds , "upstreamyness" .= dpssUpstreamyness ds , "fetchynessBlocks" .= dpssFetchynessBlocks ds + , "ledgerStateJudgement" .= dpssLedgerStateJudgement ds + , "associationMode" .= dpssAssociationMode ds ] -- Connection manager abstract state. For explanation of each state see @@ -2169,22 +2171,12 @@ instance Show vNumber => ToJSON (HandshakeException vNumber) where ] instance ToJSON NodeToNodeVersion where - toJSON NodeToNodeV_7 = Number 7 - toJSON NodeToNodeV_8 = Number 8 - toJSON NodeToNodeV_9 = Number 9 - toJSON NodeToNodeV_10 = Number 10 - toJSON NodeToNodeV_11 = Number 11 - toJSON NodeToNodeV_12 = Number 12 toJSON NodeToNodeV_13 = Number 13 + toJSON NodeToNodeV_14 = Number 14 instance FromJSON NodeToNodeVersion where - parseJSON (Number 7) = return NodeToNodeV_7 - parseJSON (Number 8) = return NodeToNodeV_8 - parseJSON (Number 9) = return NodeToNodeV_9 - parseJSON (Number 10) = return NodeToNodeV_10 - parseJSON (Number 11) = return NodeToNodeV_11 - parseJSON (Number 12) = return NodeToNodeV_12 parseJSON (Number 13) = return NodeToNodeV_13 + parseJSON (Number 14) = return NodeToNodeV_14 parseJSON (Number x) = fail ("FromJSON.NodeToNodeVersion: unsupported node-to-node protocol version " ++ show x) parseJSON x = fail ("FromJSON.NodeToNodeVersion: error parsing NodeToNodeVersion: " ++ show x) @@ -2198,6 +2190,8 @@ instance ToJSON NodeToClientVersion where toJSON NodeToClientV_15 = Number 15 toJSON NodeToClientV_16 = Number 16 toJSON NodeToClientV_17 = Number 17 + toJSON NodeToClientV_18 = Number 18 + -- NB: When adding a new version here, update FromJSON below as well! instance FromJSON NodeToClientVersion where parseJSON (Number 9) = return NodeToClientV_9 @@ -2207,6 +2201,9 @@ instance FromJSON NodeToClientVersion where parseJSON (Number 13) = return NodeToClientV_13 parseJSON (Number 14) = return NodeToClientV_14 parseJSON (Number 15) = return NodeToClientV_15 + parseJSON (Number 16) = return NodeToClientV_16 + parseJSON (Number 17) = return NodeToClientV_17 + parseJSON (Number 18) = return NodeToClientV_18 parseJSON (Number x) = fail ("FromJSON.NodeToClientVersion: unsupported node-to-client protocol version " ++ show x) parseJSON x = fail ("FromJSON.NodeToClientVersion: error parsing NodeToClientVersion: " ++ show x) @@ -2630,6 +2627,15 @@ instance FromJSON LedgerStateJudgement where parseJSON (String "TooOld") = pure TooOld parseJSON _ = fail "Invalid JSON for LedgerStateJudgement" +instance ToJSON AssociationMode where + toJSON LocalRootsOnly = String "LocalRootsOnly" + toJSON Unrestricted = String "Unrestricted" + +instance FromJSON AssociationMode where + parseJSON (String "LocalRootsOnly") = pure LocalRootsOnly + parseJSON (String "Unrestricted") = pure Unrestricted + parseJSON _ = fail "Invalid JSON for AssociationMode" + instance ToJSON UseLedgerPeers where toJSON DontUseLedgerPeers = Number (-1) toJSON (UseLedgerPeers Always) = Number 0 diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs index a8b7f0c578e..4d93eaea489 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs @@ -33,7 +33,7 @@ import qualified Cardano.Ledger.Alonzo.Rules as Alonzo import qualified Cardano.Ledger.Api as Ledger import Cardano.Ledger.Babbage.Rules (BabbageUtxoPredFailure, BabbageUtxowPredFailure) import qualified Cardano.Ledger.Babbage.Rules as Babbage -import Cardano.Ledger.BaseTypes (activeSlotLog, strictMaybeToMaybe) +import Cardano.Ledger.BaseTypes (activeSlotLog, strictMaybeToMaybe, Mismatch (..)) import Cardano.Ledger.Chain import Cardano.Ledger.Conway.Governance (govActionIdToText) import Cardano.Ledger.Conway.Rules (ConwayUtxosPredFailure) @@ -196,7 +196,7 @@ instance ToObject (Conway.ConwayGovCertPredFailure era) where instance ToObject (Conway.ConwayDelegPredFailure era) where toObject _verb = mconcat . \case - Conway.DelegateeNotRegisteredDELEG (KeyHash targetPool) -> + Conway.DelegateeStakePoolNotRegisteredDELEG (KeyHash targetPool) -> [ "kind" .= String "DelegateeNotRegisteredDELEG" , "targetPool" .= Crypto.hashToTextAsHex targetPool ] @@ -220,10 +220,10 @@ instance ToObject (Conway.ConwayDelegPredFailure era) where , "amount" .= coin , "error" .= String "Stake key has non-zero account balance" ] - Conway.DRepAlreadyRegisteredForStakeKeyDELEG credential -> - [ "kind" .= String "DRepAlreadyRegisteredForStakeKeyDELEG" - , "amount" .= String (textShow credential) - , "error" .= String "DRep already registered for the stake key" + Conway.DelegateeDRepNotRegisteredDELEG credential -> + [ "kind" .= String "DelegateeDRepNotRegisteredDELEG" + , "credential" .= String (textShow credential) + , "error" .= String "Delegated rep is not registered for provided stake key" ] instance ToObject (Set (Credential 'Staking StandardCrypto)) where @@ -232,6 +232,12 @@ instance ToObject (Set (Credential 'Staking StandardCrypto)) where , "stakeCreds" .= map toJSON (Set.toList creds) ] +instance ToObject (NonEmpty.NonEmpty (KeyHash 'Staking StandardCrypto)) where + toObject _verb keyHashes = + mconcat [ "kind" .= String "StakeKeyHashes" + , "stakeKeyHashes" .= toJSON keyHashes + ] + instance Core.Crypto crypto => ToObject (ChainTransitionError crypto) where toObject verb (ChainTransitionError fs) = mconcat [ "kind" .= String "ChainTransitionError" @@ -283,12 +289,14 @@ instance ToObject (PrtlSeqFailure crypto) where instance ( ToObject (PredicateFailure (Ledger.EraRule "LEDGERS" ledgerera)) ) => ToObject (ShelleyBbodyPredFailure ledgerera) where - toObject _verb (WrongBlockBodySizeBBODY actualBodySz claimedBodySz) = + toObject _verb (WrongBlockBodySizeBBODY (Mismatch { mismatchSupplied = actualBodySz + , mismatchExpected = claimedBodySz })) = mconcat [ "kind" .= String "WrongBlockBodySizeBBODY" , "actualBlockBodySize" .= actualBodySz , "claimedBlockBodySize" .= claimedBodySz ] - toObject _verb (InvalidBodyHashBBODY actualHash claimedHash) = + toObject _verb (InvalidBodyHashBBODY (Mismatch { mismatchSupplied = actualHash + , mismatchExpected = claimedHash })) = mconcat [ "kind" .= String "InvalidBodyHashBBODY" , "actualBodyHash" .= textShow actualHash , "claimedBodyHash" .= textShow claimedHash @@ -314,6 +322,7 @@ instance , ToObject (PredicateFailure (Core.EraRule "UTXOW" ledgerera)) , ToObject (PredicateFailure (Core.EraRule "GOV" ledgerera)) , ToObject (Set (Credential 'Staking (Consensus.EraCrypto ledgerera))) + , ToObject (NonEmpty.NonEmpty (KeyHash 'Staking (Consensus.EraCrypto ledgerera))) ) => ToObject (Conway.ConwayLedgerPredFailure ledgerera) where toObject verb (Conway.ConwayUtxowFailure f) = toObject verb f toObject _ (Conway.ConwayTxRefScriptsSizeTooBig actual limit) = @@ -329,6 +338,10 @@ instance , "actual" .= actual , "submittedInTx" .= inTx ] + toObject _ (Conway.ConwayMempoolFailure msg) = + mconcat [ "kind" .= String "ConwayMempoolFailure" + , "message" .= msg + ] instance Ledger.EraPParams era => ToObject (Conway.ConwayGovPredFailure era) where @@ -400,6 +413,21 @@ instance Ledger.EraPParams era => ToObject (Conway.ConwayGovPredFailure era) whe , "votes" .= votes ] + toObject _ (Conway.ZeroTreasuryWithdrawals govAction) = + mconcat [ "kind" .= String "ZeroTreasuryWithdrawals" + , "govAction" .= govAction + ] + + toObject _ (Conway.ProposalReturnAccountDoesNotExist account) = + mconcat [ "kind" .= String "DisallowedVotesDuringBootstrap" + , "invalidAccount" .= account + ] + + toObject _ (Conway.TreasuryWithdrawalReturnAccountsDoNotExist accounts) = + mconcat [ "kind" .= String "TreasuryWithdrawalReturnAccountsDoNotExist" + , "invalidAccounts" .= accounts + ] + instance ( Core.Crypto (Consensus.EraCrypto era) , ToObject (PredicateFailure (Ledger.EraRule "CERT" era)) @@ -500,7 +528,9 @@ instance mconcat [ "kind" .= String "MissingTxMetadata" , "txBodyMetadataHash" .= txBodyMetadataHash ] - toObject _verb (ConflictingMetadataHash txBodyMetadataHash fullMetadataHash) = + -- TODO are these arguments in the right order? + toObject _verb (ConflictingMetadataHash (Mismatch { mismatchSupplied = txBodyMetadataHash + , mismatchExpected = fullMetadataHash })) = mconcat [ "kind" .= String "ConflictingMetadataHash" , "txBodyMetadataHash" .= txBodyMetadataHash , "fullMetadataHash" .= fullMetadataHash @@ -525,7 +555,8 @@ instance mconcat [ "kind" .= String "ExpiredUTxO" , "ttl" .= ttl , "slot" .= slot ] - toObject _verb (MaxTxSizeUTxO txsize maxtxsize) = + toObject _verb (MaxTxSizeUTxO (Mismatch { mismatchSupplied = txsize + , mismatchExpected = maxtxsize })) = mconcat [ "kind" .= String "MaxTxSizeUTxO" , "size" .= txsize , "maxSize" .= maxtxsize ] @@ -547,7 +578,8 @@ instance ] toObject _verb InputSetEmptyUTxO = mconcat [ "kind" .= String "InputSetEmptyUTxO" ] - toObject _verb (FeeTooSmallUTxO minfee txfee) = + toObject _verb (FeeTooSmallUTxO (Mismatch { mismatchSupplied = minfee + , mismatchExpected = txfee })) = mconcat [ "kind" .= String "FeeTooSmallUTxO" , "minimum" .= minfee , "fee" .= txfee ] @@ -647,7 +679,8 @@ renderValueNotConservedErr consumed produced = String $ "This transaction consumed " <> textShow consumed <> " but produced " <> textShow produced instance Ledger.Era era => ToObject (ShelleyPpupPredFailure era) where - toObject _verb (NonGenesisUpdatePPUP proposalKeys genesisKeys) = + toObject _verb (NonGenesisUpdatePPUP (Mismatch { mismatchSupplied = proposalKeys + , mismatchExpected = genesisKeys })) = mconcat [ "kind" .= String "NonGenesisUpdatePPUP" , "keys" .= proposalKeys Set.\\ genesisKeys ] toObject _verb (PPUpdateWrongEpoch currEpoch intendedEpoch votingPeriod) = @@ -770,13 +803,21 @@ instance ToObject (ShelleyPoolPredFailure era) where , "unregisteredKeyHash" .= String (textShow unregStakePool) , "error" .= String "This stake pool key hash is unregistered" ] - toObject _verb (StakePoolRetirementWrongEpochPOOL currentEpoch intendedRetireEpoch maxRetireEpoch) = + toObject _dtal (StakePoolRetirementWrongEpochPOOL + -- inspired by Ledger's Test.Cardano.Ledger.Generic.PrettyCore + -- but is it correct here? + (Mismatch { mismatchExpected = currentEpoch }) + (Mismatch { mismatchSupplied = intendedRetireEpoch + , mismatchExpected = maxRetireEpoch})) = mconcat [ "kind" .= String "StakePoolRetirementWrongEpochPOOL" , "currentEpoch" .= String (textShow currentEpoch) , "intendedRetirementEpoch" .= String (textShow intendedRetireEpoch) , "maxEpochForRetirement" .= String (textShow maxRetireEpoch) ] - toObject _verb (StakePoolCostTooLowPOOL certCost protCost) = + -- TODO is this in the right order? + toObject _verb (StakePoolCostTooLowPOOL + (Mismatch { mismatchSupplied = certCost + , mismatchExpected = protCost })) = mconcat [ "kind" .= String "StakePoolCostTooLowPOOL" , "certificateCost" .= String (textShow certCost) , "protocolParCost" .= String (textShow protCost) @@ -806,7 +847,10 @@ instance ToObject (ShelleyPoolPredFailure era) where -- , "error" .= String "Wrong certificate type: Unknown certificate type" -- ] - toObject _verb (WrongNetworkPOOL networkId listedNetworkId poolId) = + -- TODO are these in the right order? + toObject _verb (WrongNetworkPOOL (Mismatch { mismatchSupplied = networkId + , mismatchExpected = listedNetworkId }) + poolId) = mconcat [ "kind" .= String "WrongNetworkPOOL" , "networkId" .= String (textShow networkId) , "listedNetworkId" .= String (textShow listedNetworkId) @@ -852,15 +896,6 @@ instance ToObject (ShelleyPoolreapPredFailure ledgerera) where instance ToObject (ShelleySnapPredFailure ledgerera) where toObject _verb x = case x of {} -- no constructors --- TODO: Need to elaborate more on this error -instance ToObject (ShelleyNewppPredFailure ledgerera) where - toObject _verb (UnexpectedDepositPot outstandingDeposits depositPot) = - mconcat [ "kind" .= String "UnexpectedDepositPot" - , "outstandingDeposits" .= String (textShow outstandingDeposits) - , "depositPot" .= String (textShow depositPot) - ] - - instance ToObject (ShelleyMirPredFailure ledgerera) where toObject _verb x = case x of {} -- no constructors @@ -1005,12 +1040,12 @@ instance ToObject HotKey.KESEvolutionError where instance ToObject (UpdnPredicateFailure crypto) where toObject _verb x = case x of {} -- no constructors -instance ToObject (ShelleyUpecPredFailure era) where - toObject _verb (NewPpFailure (UnexpectedDepositPot totalOutstanding depositPot)) = - mconcat [ "kind" .= String "UnexpectedDepositPot" - , "totalOutstanding" .= String (textShow totalOutstanding) - , "depositPot" .= String (textShow depositPot) - ] +-- instance ToObject (ShelleyUpecPredFailure era) where +-- toObject _verb (NewPpFailure (UnexpectedDepositPot totalOutstanding depositPot)) = +-- mconcat [ "kind" .= String "UnexpectedDepositPot" +-- , "totalOutstanding" .= String (textShow totalOutstanding) +-- , "depositPot" .= String (textShow depositPot) +-- ] -------------------------------------------------------------------------------- @@ -1310,6 +1345,7 @@ instance ToJSON ShelleyNodeToClientVersion where toJSON ShelleyNodeToClientVersion7 = String "ShelleyNodeToClientVersion7" toJSON ShelleyNodeToClientVersion8 = String "ShelleyNodeToClientVersion8" toJSON ShelleyNodeToClientVersion9 = String "ShelleyNodeToClientVersion9" + toJSON ShelleyNodeToClientVersion10 = String "ShelleyNodeToClientVersion10" instance Ledger.Crypto c => ToObject (PraosChainSelectView c) where toObject _ PraosChainSelectView { diff --git a/cardano-node/src/Cardano/Tracing/Tracers.hs b/cardano-node/src/Cardano/Tracing/Tracers.hs index 4ca0bf61f09..78ea014e3e5 100644 --- a/cardano-node/src/Cardano/Tracing/Tracers.hs +++ b/cardano-node/src/Cardano/Tracing/Tracers.hs @@ -71,7 +71,7 @@ import Ouroboros.Consensus.Ledger.Extended (ledgerState) import Ouroboros.Consensus.Ledger.Inspect (InspectLedger, LedgerEvent) import Ouroboros.Consensus.Ledger.Query (BlockQuery) import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr, GenTx, GenTxId, HasTxs, - LedgerSupportsMempool) + LedgerSupportsMempool, ByteSize32 (..)) import Ouroboros.Consensus.Ledger.SupportsProtocol (LedgerSupportsProtocol) import Ouroboros.Consensus.Mempool (MempoolSize (..), TraceEventMempool (..)) import Ouroboros.Consensus.MiniProtocol.BlockFetch.Server @@ -1249,6 +1249,9 @@ notifyTxsProcessed fStats tr = Tracer $ \case -- so we can treat them as completely processed. updatedTxProcessed <- mapForgingStatsTxsProcessed fStats (+ (length txs)) traceCounter "txsProcessedNum" tr (fromIntegral updatedTxProcessed) + TraceMempoolSynced (FallingEdgeWith duration) -> do + traceCounter "txsSyncDuration" tr (round $ 1000 * duration :: Int) + -- The rest of the constructors. _ -> return () @@ -1256,18 +1259,22 @@ notifyTxsProcessed fStats tr = Tracer $ \case mempoolMetricsTraceTransformer :: Trace IO a -> Tracer IO (TraceEventMempool blk) mempoolMetricsTraceTransformer tr = Tracer $ \mempoolEvent -> do let tr' = appendName "metrics" tr - (_n, tot) = case mempoolEvent of - TraceMempoolAddedTx _tx0 _ tot0 -> (1, tot0) - TraceMempoolRejectedTx _tx0 _ tot0 -> (1, tot0) - TraceMempoolRemoveTxs txs0 tot0 -> (length txs0, tot0) - TraceMempoolManuallyRemovedTxs txs0 txs1 tot0 -> ( length txs0 + length txs1, tot0) - logValue1 :: LOContent a - logValue1 = LogValue "txsInMempool" $ PureI $ fromIntegral (msNumTxs tot) - logValue2 :: LOContent a - logValue2 = LogValue "mempoolBytes" $ PureI $ fromIntegral (msNumBytes tot) - meta <- mkLOMeta Critical Confidential - traceNamedObject tr' (meta, logValue1) - traceNamedObject tr' (meta, logValue2) + (_n, tot_m) = case mempoolEvent of + TraceMempoolAddedTx _tx0 _ tot0 -> (1, Just tot0) + TraceMempoolRejectedTx _tx0 _ tot0 -> (1, Just tot0) + TraceMempoolRemoveTxs txs0 tot0 -> (length txs0, Just tot0) + TraceMempoolManuallyRemovedTxs txs0 txs1 tot0 -> ( length txs0 + length txs1, Just tot0) + TraceMempoolSynced _ -> (0, Nothing) + case tot_m of + Just tot -> do + let logValue1 :: LOContent a + logValue1 = LogValue "txsInMempool" $ PureI $ fromIntegral (msNumTxs tot) + logValue2 :: LOContent a + logValue2 = LogValue "mempoolBytes" . PureI . fromIntegral . unByteSize32 . msNumBytes $ tot + meta <- mkLOMeta Critical Confidential + traceNamedObject tr' (meta, logValue1) + traceNamedObject tr' (meta, logValue2) + Nothing -> return () mempoolTracer :: ( ToJSON (GenTxId blk) diff --git a/cardano-submit-api/CHANGELOG.md b/cardano-submit-api/CHANGELOG.md index 44635a5354b..b80c679ea8d 100644 --- a/cardano-submit-api/CHANGELOG.md +++ b/cardano-submit-api/CHANGELOG.md @@ -2,6 +2,10 @@ ## vNext +## 10.0 -- Oct 2024 + +* Bump for Node 10.0 + ## 3.2.0 -- Nov 2023 ** Using `cardano-api-8.33` and `cardano-cli-8.15` diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index 0e5f6834e8d..d75fae9b14f 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-submit-api -version: 9.0.0 +version: 10.0 synopsis: A web server that allows transactions to be POSTed to the cardano chain description: A web server that allows transactions to be POSTed to the cardano chain. homepage: https://github.com/intersectmbo/cardano-node @@ -39,9 +39,9 @@ library , aeson , async , bytestring - , cardano-api ^>= 9.3 + , cardano-api ^>= 10.0 , cardano-binary - , cardano-cli ^>= 9.4 + , cardano-cli ^>= 10.0 , cardano-crypto-class ^>= 2.1.2 , http-media , iohk-monitoring diff --git a/cardano-testnet/CHANGELOG.md b/cardano-testnet/CHANGELOG.md index c2f218e929e..9a3632b9832 100644 --- a/cardano-testnet/CHANGELOG.md +++ b/cardano-testnet/CHANGELOG.md @@ -2,6 +2,12 @@ ## Next version +## 10.0.0 + +* Bump for node 10 + +## + * Update `cardano-ping` dependency * Add `--num-dreps` parameter diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index d6d33d436bf..c076da89ee4 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: cardano-testnet -version: 9.0.0 +version: 10.0.0 synopsis: The cardano full node description: The cardano full node. copyright: 2021-2023 Input Output Global Inc (IOG), 2023-2024 Intersect. @@ -35,8 +35,8 @@ library , aeson-pretty , ansi-terminal , bytestring - , cardano-api ^>= 9.3 - , cardano-cli ^>= 9.4 + , cardano-api ^>= 10.0 + , cardano-cli ^>= 10.0 , cardano-crypto-class , cardano-crypto-wrapper , cardano-git-rev ^>= 0.2.2 @@ -49,7 +49,7 @@ library , cardano-ledger-core:{cardano-ledger-core, testlib} , cardano-ledger-shelley , cardano-node - , cardano-ping ^>= 0.4 + , cardano-ping ^>= 0.5 , contra-tracer , containers , data-default-class diff --git a/cardano-testnet/src/Parsers/Cardano.hs b/cardano-testnet/src/Parsers/Cardano.hs index f6ce51dafc4..aa4767e89ba 100644 --- a/cardano-testnet/src/Parsers/Cardano.hs +++ b/cardano-testnet/src/Parsers/Cardano.hs @@ -2,7 +2,7 @@ module Parsers.Cardano ( cmdCardano ) where -import Cardano.Api (AnyShelleyBasedEra (AnyShelleyBasedEra), EraInEon (..), bounded) +import Cardano.Api (AnyShelleyBasedEra (AnyShelleyBasedEra), EraInEon (..)) import Cardano.CLI.Environment import Cardano.CLI.EraBased.Options.Common hiding (pNetworkId) @@ -129,4 +129,3 @@ pMaxLovelaceSupply = <> showDefault <> value (cardanoMaxSupply def) ) - diff --git a/cardano-testnet/src/Testnet/Components/Query.hs b/cardano-testnet/src/Testnet/Components/Query.hs index 226bc232f7e..b4ce6aec66e 100644 --- a/cardano-testnet/src/Testnet/Components/Query.hs +++ b/cardano-testnet/src/Testnet/Components/Query.hs @@ -302,13 +302,13 @@ findAllUtxos findAllUtxos epochStateView sbe = withFrozenCallStack $ do AnyNewEpochState sbe' newEpochState <- getEpochState epochStateView Refl <- H.leftFail $ assertErasEqual sbe sbe' - pure $ fromLedgerUTxO $ newEpochState ^. L.nesEsL . L.esLStateL . L.lsUTxOStateL . L.utxosUtxoL + pure $ fromLedgerUTxO' $ newEpochState ^. L.nesEsL . L.esLStateL . L.lsUTxOStateL . L.utxosUtxoL where - fromLedgerUTxO + fromLedgerUTxO' :: () => L.UTxO (ShelleyLedgerEra era) -> Map TxIn (TxOut CtxUTxO era) - fromLedgerUTxO (L.UTxO utxo) = + fromLedgerUTxO' (L.UTxO utxo) = shelleyBasedEraConstraints sbe $ Map.fromList . map (bimap fromShelleyTxIn (fromShelleyTxOut sbe)) diff --git a/cardano-testnet/src/Testnet/Defaults.hs b/cardano-testnet/src/Testnet/Defaults.hs index ca79f883a86..0511cd77417 100644 --- a/cardano-testnet/src/Testnet/Defaults.hs +++ b/cardano-testnet/src/Testnet/Defaults.hs @@ -222,7 +222,7 @@ defaultYamlHardforkViaConfig sbe = , ("TestBabbageHardForkAtEpoch", Aeson.Number 0) , ("TestConwayHardForkAtEpoch", Aeson.Number 0) ]) - -- | Various tracers we can turn on or off + -- | Various tracers we can turn on or off tracers :: Aeson.KeyMap Aeson.Value tracers = Aeson.fromList $ map (bimap Aeson.fromText Aeson.Bool) [ (proxyName (Proxy @TraceBlockFetchClient), False) @@ -543,4 +543,3 @@ defaultUtxoKeys n = plutusV3Script :: Text plutusV3Script = "{ \"type\": \"PlutusScriptV3\", \"description\": \"\", \"cborHex\": \"46450101002499\" }" - diff --git a/cardano-testnet/src/Testnet/Process/Cli/DRep.hs b/cardano-testnet/src/Testnet/Process/Cli/DRep.hs index 0181cdcaf31..eb877002a6b 100644 --- a/cardano-testnet/src/Testnet/Process/Cli/DRep.hs +++ b/cardano-testnet/src/Testnet/Process/Cli/DRep.hs @@ -37,7 +37,6 @@ import Lens.Micro ((^?)) import System.FilePath (()) import Testnet.Components.Query -import Testnet.Process.Cli.Keys (cliStakeAddressKeyGen) import Testnet.Process.Cli.Transaction import Testnet.Process.Run (execCli', execCliStdoutToJson) import Testnet.Types @@ -344,29 +343,22 @@ makeActivityChangeProposal -> EpochStateView -- ^ Current epoch state view for transaction building. It can be obtained -- using the 'getEpochStateView' function. -> ConwayEraOnwards era -- ^ The 'ConwayEraOnwards' witness for current era. - -> FilePath -- ^ Base directory path where generated files will be stored. - -> String -- ^ Name for the subfolder that will be created under 'work' folder. + -> FilePath -- ^ Working directory where the files will be stored -> Maybe (String, Word16) -- ^ The transaction id and the index of the previosu governance action if any. -> EpochInterval -- ^ The target DRep activity interval to be set by the proposal. + -> KeyPair StakeKey -- ^ registered staking keys -> PaymentKeyInfo -- ^ Wallet that will pay for the transaction. -> EpochInterval -- ^ Number of epochs to wait for the proposal to be registered by the chain. -> m (String, Word16) -- ^ The transaction id and the index of the governance action. -makeActivityChangeProposal execConfig epochStateView ceo work prefix - prevGovActionInfo drepActivity wallet timeout = do +makeActivityChangeProposal execConfig epochStateView ceo work + prevGovActionInfo drepActivity stakeKeyPair wallet timeout = do let sbe = conwayEraOnwardsToShelleyBasedEra ceo era = toCardanoEra sbe cEra = AnyCardanoEra era + KeyPair{verificationKey=File stakeVkeyFp} = stakeKeyPair - baseDir <- H.createDirectoryIfMissing $ work prefix - - let stakeVkeyFp = baseDir "stake.vkey" - stakeSKeyFp = baseDir "stake.skey" - - cliStakeAddressKeyGen - $ KeyPair { verificationKey = File stakeVkeyFp - , signingKey = File stakeSKeyFp - } + baseDir <- H.createDirectoryIfMissing work proposalAnchorFile <- H.note $ baseDir "sample-proposal-anchor" H.writeFile proposalAnchorFile "dummy anchor data" diff --git a/cardano-testnet/src/Testnet/Process/Cli/Keys.hs b/cardano-testnet/src/Testnet/Process/Cli/Keys.hs index 9886098f7a4..9d424bd3f5a 100644 --- a/cardano-testnet/src/Testnet/Process/Cli/Keys.hs +++ b/cardano-testnet/src/Testnet/Process/Cli/Keys.hs @@ -58,6 +58,7 @@ cliNodeKeyGenKes :: () -> m () cliNodeKeyGenKes = GHC.withFrozenCallStack $ shelleyKeyGen "node" "key-gen-KES" +-- | NB this automatically selects the latest era. shelleyKeyGen :: () => (MonadTest m, MonadCatch m, MonadIO m, HasCallStack) => String -- ^ command @@ -67,7 +68,7 @@ shelleyKeyGen :: () shelleyKeyGen command subCommand keyPair = GHC.withFrozenCallStack $ execCli_ - [ command, subCommand + [ "latest", command, subCommand , "--verification-key-file", verificationKeyFp keyPair , "--signing-key-file", signingKeyFp keyPair ] @@ -79,7 +80,7 @@ cliNodeKeyGen -> m () cliNodeKeyGen keyPair (File counterPath) = execCli_ - [ "node", "key-gen" + [ "latest", "node", "key-gen" , "--cold-verification-key-file", verificationKeyFp keyPair , "--cold-signing-key-file", signingKeyFp keyPair , "--operational-certificate-issue-counter-file", counterPath diff --git a/cardano-testnet/src/Testnet/Process/Cli/SPO.hs b/cardano-testnet/src/Testnet/Process/Cli/SPO.hs index fc3701a10a2..39a5f199429 100644 --- a/cardano-testnet/src/Testnet/Process/Cli/SPO.hs +++ b/cardano-testnet/src/Testnet/Process/Cli/SPO.hs @@ -61,13 +61,13 @@ checkStakePoolRegistered tempAbsP execConfig poolColdVkeyFp outputFp = oFpAbs = tempAbsPath' outputFp stakePoolId' <- filter ( /= '\n') <$> - execCli [ "stake-pool", "id" + execCli [ "latest", "stake-pool", "id" , "--cold-verification-key-file", poolColdVkeyFp ] -- Check to see if stake pool was registered void $ execCli' execConfig - [ "query", "stake-pools" + [ "latest", "query", "stake-pools" , "--out-file", oFpAbs ] @@ -113,7 +113,7 @@ checkStakeKeyRegistered tempAbsP nodeConfigFile sPath terminationEpoch execConfi Right (_, dag) -> return dag Left e -> do void $ execCli' execConfig - [ "query", "stake-address-info" + [ "latest", "query", "stake-address-info" , "--address", stakeAddr , "--out-file", oFpAbs ] @@ -284,7 +284,7 @@ registerSingleSpo asbe identifier tap@(TmpAbsolutePath tempAbsPath') nodeConfigF poolownerstakeaddr <- filter (/= '\n') <$> execCli - [ "stake-address", "build" + [ "latest", "stake-address", "build" , "--stake-verification-key-file", poolOwnerstakeVkeyFp , "--testnet-magic", show @Int testnetMag ] @@ -296,7 +296,7 @@ registerSingleSpo asbe identifier tap@(TmpAbsolutePath tempAbsPath') nodeConfigF $ KeyPair (File poolOwnerPaymentVkeyFp) (File poolOwnerPaymentSkeyFp) poolowneraddresswstakecred <- - execCli [ "address", "build" + execCli [ "latest", "address", "build" , "--payment-verification-key-file", poolOwnerPaymentVkeyFp , "--stake-verification-key-file", poolOwnerstakeVkeyFp , "--testnet-magic", show @Int testnetMag @@ -307,7 +307,7 @@ registerSingleSpo asbe identifier tap@(TmpAbsolutePath tempAbsPath') nodeConfigF poolColdSkeyFp = spoReqDir "pool-cold.skey" execCli_ - [ "node", "key-gen" + [ "latest", "node", "key-gen" , "--cold-verification-key-file", poolColdVkeyFp , "--cold-signing-key-file", poolColdSkeyFp , "--operational-certificate-issue-counter-file", spoReqDir "operator.counter" @@ -362,7 +362,7 @@ registerSingleSpo asbe identifier tap@(TmpAbsolutePath tempAbsPath') nodeConfigF let pledgeAndPoolRegistrationTx = workDir "pledger-and-pool-registration-cert.tx" void $ execCli - [ "transaction", "sign" + [ "latest", "transaction", "sign" , "--tx-body-file", workDir "pledge-registration-cert.txbody" , "--testnet-magic", show @Int testnetMag , "--signing-key-file", fundingSigninKey @@ -374,7 +374,7 @@ registerSingleSpo asbe identifier tap@(TmpAbsolutePath tempAbsPath') nodeConfigF H.note_ "Submitting pool owner/pledger stake registration cert and funding stake pool owner address..." void $ execCli' execConfig - [ "transaction", "submit" + [ "latest", "transaction", "submit" , "--tx-file", pledgeAndPoolRegistrationTx ] diff --git a/cardano-testnet/src/Testnet/Process/Cli/Transaction.hs b/cardano-testnet/src/Testnet/Process/Cli/Transaction.hs index 935ea144cc8..6f4e691ac81 100644 --- a/cardano-testnet/src/Testnet/Process/Cli/Transaction.hs +++ b/cardano-testnet/src/Testnet/Process/Cli/Transaction.hs @@ -216,7 +216,7 @@ retrieveTransactionId -> m String retrieveTransactionId execConfig signedTxBody = do txidOutput <- execCli' execConfig - [ "transaction", "txid" + [ "latest", "transaction", "txid" , "--tx-file", unFile signedTxBody ] return $ mconcat $ lines txidOutput diff --git a/cardano-testnet/src/Testnet/Property/Assert.hs b/cardano-testnet/src/Testnet/Property/Assert.hs index 476286abb6f..6b83481aef1 100644 --- a/cardano-testnet/src/Testnet/Property/Assert.hs +++ b/cardano-testnet/src/Testnet/Property/Assert.hs @@ -88,7 +88,7 @@ assertExpectedSposInLedgerState -> m () assertExpectedSposInLedgerState output (NumPools numExpectedPools) execConfig = withFrozenCallStack $ do void $ execCli' execConfig - [ "query", "stake-pools" + [ "latest", "query", "stake-pools" , "--out-file", output ] diff --git a/cardano-testnet/src/Testnet/Start/Cardano.hs b/cardano-testnet/src/Testnet/Start/Cardano.hs index 129f238b1be..7609da32952 100644 --- a/cardano-testnet/src/Testnet/Start/Cardano.hs +++ b/cardano-testnet/src/Testnet/Start/Cardano.hs @@ -263,7 +263,7 @@ cardanoTestnet let paymentAddrFile = tmpAbsPath "utxo-keys" "utxo" <> show idx "utxo.addr" execCli_ - [ "address", "build" + [ "latest", "address", "build" , "--payment-verification-key-file", unFile verificationKey , "--testnet-magic", show testnetMagic , "--out-file", paymentAddrFile @@ -388,7 +388,7 @@ cardanoTestnet H.cat . verificationKeyFp $ paymentKeyInfoPair wallet utxos <- execCli' execConfig - [ "query", "utxo" + [ "latest", "query", "utxo" , "--address", Text.unpack $ paymentKeyInfoAddr wallet , "--cardano-mode" ] @@ -441,5 +441,3 @@ retryOnAddressInUseError act = withFrozenCallStack $ go maximumTimeout retryTime maximumTimeout = 150 -- Wait for that many seconds before retrying. retryTimeout = 5 - - 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 94d7a66b737..926e6a57769 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 @@ -84,7 +84,7 @@ hprop_plutus_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBa plutusSpendingScriptAddr <- execCli' execConfig - [ "address", "build" + [ "latest", "address", "build" , "--payment-script-file", plutusScript ] @@ -99,7 +99,7 @@ hprop_plutus_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBa scriptdatumhash <- filter (/= '\n') <$> execCli' execConfig - [ "transaction", "hash-script-data" + [ "latest", "transaction", "hash-script-data" , "--script-data-value", "0" ] @@ -127,14 +127,14 @@ hprop_plutus_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBa let sendAdaToScriptAddressTx = work "send-ada-to-script-address-tx" void $ execCli' execConfig - [ "transaction", "sign" + [ "latest", "transaction", "sign" , "--tx-body-file", sendAdaToScriptAddressTxBody , "--signing-key-file", utxoSKeyFile , "--out-file", sendAdaToScriptAddressTx ] void $ execCli' execConfig - [ "transaction", "submit" + [ "latest", "transaction", "submit" , "--tx-file", sendAdaToScriptAddressTx ] @@ -169,14 +169,14 @@ hprop_plutus_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBa ] void $ execCli' execConfig - [ "transaction", "sign" + [ "latest", "transaction", "sign" , "--tx-body-file", spendScriptUTxOTxBody , "--signing-key-file", utxoSKeyFile2 , "--out-file", spendScriptUTxOTx ] void $ execCli' execConfig - [ "transaction", "submit" + [ "latest", "transaction", "submit" , "--tx-file", spendScriptUTxOTx ] H.success diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Conway/StakeSnapshot.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Conway/StakeSnapshot.hs index ef3797de8ab..d6d0f2c5312 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Conway/StakeSnapshot.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Conway/StakeSnapshot.hs @@ -49,7 +49,7 @@ hprop_stakeSnapshot = integrationRetryWorkspace 2 "conway-stake-snapshot" $ \tem (Api.File $ IO.sprocketSystemName poolSprocket1) (EpochNo 3) - json <- execCliStdoutToJson execConfig [ "query", "stake-snapshot", "--all-stake-pools" ] + json <- execCliStdoutToJson execConfig [ "latest", "query", "stake-snapshot", "--all-stake-pools" ] -- There are three stake pools so check that "pools" has three entries case json of diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/KesPeriodInfo.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/KesPeriodInfo.hs index c9eb3c159a5..7c7e38d5be4 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/KesPeriodInfo.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/KesPeriodInfo.hs @@ -122,7 +122,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs -- NB: We must include the stake credential testDelegatorPaymentAddr <- execCli - [ "address", "build" + [ "latest", "address", "build" , "--testnet-magic", show @Int testnetMagic , "--payment-verification-key-file", testDelegatorPaymentVKeyFp , "--stake-verification-key-file", testDelegatorVkeyFp @@ -130,7 +130,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs testDelegatorStakeAddress <- filter (/= '\n') <$> execCli - [ "stake-address", "build" + [ "latest", "stake-address", "build" , "--stake-verification-key-file", testDelegatorVkeyFp , "--testnet-magic", show @Int testnetMagic ] @@ -183,7 +183,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs let delegRegTestDelegatorTxFp = work "deleg-register-test-delegator.tx" void $ execCli - [ "transaction", "sign" + [ "latest", "transaction", "sign" , "--tx-body-file", delegRegTestDelegatorTxBodyFp , "--testnet-magic", show @Int testnetMagic , "--signing-key-file", utxoSKeyFile @@ -194,7 +194,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs H.note_ "Submitting test delegator registration and delegation certificates..." void $ execCli' execConfig - [ "transaction", "submit" + [ "latest", "transaction", "submit" , "--tx-file", delegRegTestDelegatorTxFp ] @@ -231,7 +231,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs let testSpoOperationalCertFp = testSpoDir "node-operational.cert" void $ execCli' execConfig - [ "node", "new-counter" + [ "latest", "node", "new-counter" , "--cold-verification-key-file", stakePoolColdVKey , "--counter-value", "0" , "--operational-certificate-issue-counter-file", testSpoOperationalCertFp @@ -239,7 +239,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs void $ execCli' execConfig - [ "node", "issue-op-cert" + [ "latest", "node", "issue-op-cert" , "--kes-period", "0" , "--kes-verification-key-file", testSpoKesVKey , "--cold-signing-key-file", stakePoolColdSigningKey @@ -265,20 +265,20 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs threadDelay 5_000_000 stakeSnapshot1 <- execCli' execConfig - [ "query", "stake-snapshot" + [ "latest", "query", "stake-snapshot" , "--all-stake-pools" ] H.writeFile (work "stake-snapshot-1.json") stakeSnapshot1 ledgerStateJson <- execCli' execConfig - [ "query", "ledger-state" + [ "latest", "query", "ledger-state" , "--cardano-mode" ] H.writeFile (work "ledger-state-1.json") ledgerStateJson let kesPeriodInfoOutput = testSpoDir "kes-period-info-expected-success.json" void $ execCli' execConfig - [ "query", "kes-period-info" + [ "latest", "query", "kes-period-info" , "--op-cert-file", testSpoOperationalCertFp , "--out-file", kesPeriodInfoOutput ] @@ -294,7 +294,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs ] void $ execCli' execConfig - [ "query", "tip" + [ "latest", "query", "tip" , "--out-file", work "current-tip.json" ] @@ -322,7 +322,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs void $ execCli' execConfig - [ "query", "tip" + [ "latest", "query", "tip" , "--out-file", work "current-tip-2.json" ] @@ -342,7 +342,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs , " certificate is valid" ] stakeSnapshot2 <- execCli' execConfig - [ "query", "stake-snapshot" + [ "latest", "query", "stake-snapshot" , "--all-stake-pools" ] @@ -350,7 +350,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs H.writeFile (work "stake-snapshot-2.json") stakeSnapshot2 ledgerStateJson2 <- execCli' execConfig - [ "query", "ledger-state" + [ "latest", "query", "ledger-state" , "--cardano-mode" ] H.writeFile (work "ledger-state-2.json") ledgerStateJson2 diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/LeadershipSchedule.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/LeadershipSchedule.hs index 44fc8086e01..b6397560a06 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/LeadershipSchedule.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/LeadershipSchedule.hs @@ -127,7 +127,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \ -- NB: We must include the stake credential testDelegatorPaymentAddr <- execCli - [ "address", "build" + [ "latest", "address", "build" , "--testnet-magic", show @Int testnetMagic , "--payment-verification-key-file", testDelegatorPaymentVKeyFp , "--stake-verification-key-file", testDelegatorVkeyFp @@ -135,7 +135,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \ testDelegatorStakeAddress <- filter (/= '\n') <$> execCli - [ "stake-address", "build" + [ "latest", "stake-address", "build" , "--stake-verification-key-file", testDelegatorVkeyFp , "--testnet-magic", show @Int testnetMagic ] @@ -160,7 +160,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \ H.note_ "Get updated UTxO" void $ execCli' execConfig - [ "query", "utxo" + [ "latest", "query", "utxo" , "--address", utxoAddr , "--cardano-mode" , "--out-file", work "utxo-2.json" @@ -188,7 +188,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \ let delegRegTestDelegatorTxFp = work "deleg-register-test-delegator.tx" void $ execCli - [ "transaction", "sign" + [ "latest", "transaction", "sign" , "--tx-body-file", delegRegTestDelegatorTxBodyFp , "--testnet-magic", show @Int testnetMagic , "--signing-key-file", utxoSKeyFile @@ -199,7 +199,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \ H.note_ "Submitting test delegator registration and delegation certificates..." void $ execCli' execConfig - [ "transaction", "submit" + [ "latest", "transaction", "submit" , "--tx-file", delegRegTestDelegatorTxFp ] @@ -233,7 +233,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \ let testSpoOperationalCertFp = testSpoDir "node-operational.cert" void $ execCli' execConfig - [ "node", "new-counter" + [ "latest", "node", "new-counter" , "--cold-verification-key-file", stakePoolColdVKey , "--counter-value", "0" , "--operational-certificate-issue-counter-file", testSpoOperationalCertFp @@ -241,7 +241,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \ void $ execCli' execConfig - [ "node", "issue-op-cert" + [ "latest", "node", "issue-op-cert" , "--kes-period", "0" , "--kes-verification-key-file", testSpoKesVKey , "--cold-signing-key-file", stakePoolColdSigningKey @@ -273,7 +273,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \ currentLeaderShipScheduleFile <- H.noteTempFile work "current-schedule.log" void $ execCli' execConfig - [ "query", "leadership-schedule" + [ "latest", "query", "leadership-schedule" , "--genesis", shelleyGenesisFile tr , "--stake-pool-id", stakePoolIdNewSpo , "--vrf-signing-key-file", vrfSkey @@ -326,7 +326,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \ H.byDeadlineM 5 leadershipScheduleDeadline "Failed to query for leadership schedule" $ do void $ execCli' execConfig - [ "query", "leadership-schedule" + [ "latest", "query", "leadership-schedule" , "--genesis", shelleyGenesisFile tr , "--stake-pool-id", stakePoolIdNewSpo , "--vrf-signing-key-file", vrfSkey diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/QuerySlotNumber.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/QuerySlotNumber.hs index aa8acaead4a..d7903e05c0f 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/QuerySlotNumber.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/QuerySlotNumber.hs @@ -63,7 +63,7 @@ hprop_querySlotNumber = integrationRetryWorkspace 2 "query-slot-number" $ \tempA H.note_ "Try to retrieve slot 5s before genesis" testTime <- H.note . formatTime $ (-5) `DT.addUTCTime` startTime (result, _) <- H.runTestT $ execCli' execConfig - [ "query", "slot-number" + [ "latest", "query", "slot-number" , testTime ] H.assertWith result isLeft @@ -73,7 +73,7 @@ hprop_querySlotNumber = integrationRetryWorkspace 2 "query-slot-number" $ \tempA testTime <- H.note $ formatTime startTime let expectedSlot = 0 slot <- H.readNoteM =<< execCli' execConfig - [ "query", "slot-number" + [ "latest", "query", "slot-number" , testTime ] H.assertWithinTolerance slot expectedSlot slotPrecision @@ -84,7 +84,7 @@ hprop_querySlotNumber = integrationRetryWorkspace 2 "query-slot-number" $ \tempA passedTime = fromIntegral expectedSlot * slotLength testTime <- H.note . formatTime $ passedTime `DT.addUTCTime` startTime slot <- H.readNoteM @Int =<< execCli' execConfig - [ "query", "slot-number" + [ "latest", "query", "slot-number" , testTime ] H.assertWithinTolerance slot expectedSlot slotPrecision @@ -98,7 +98,7 @@ hprop_querySlotNumber = integrationRetryWorkspace 2 "query-slot-number" $ \tempA passedTime = fromIntegral expectedSlot * slotLength testTime <- H.note . formatTime $ passedTime `DT.addUTCTime` startTime slot <- H.readNoteM @Int =<< execCli' execConfig - [ "query", "slot-number" + [ "latest", "query", "slot-number" , testTime ] H.assertWithinTolerance slot expectedSlot slotPrecision @@ -108,7 +108,7 @@ hprop_querySlotNumber = integrationRetryWorkspace 2 "query-slot-number" $ \tempA let timeOffset = slotLength * fromIntegral epochSize * 2 testTime <- H.note . formatTime $ timeOffset `DT.addUTCTime` startTime (result, _) <- H.runTestT $ execCli' execConfig - [ "query", "slot-number" + [ "latest", "query", "slot-number" , testTime ] H.assertWith result isLeft diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/StakeSnapshot.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/StakeSnapshot.hs index 2eb9a2cb034..847d9d4847f 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/StakeSnapshot.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/StakeSnapshot.hs @@ -50,7 +50,7 @@ hprop_stakeSnapshot = integrationRetryWorkspace 2 "stake-snapshot" $ \tempAbsBas void $ waitUntilEpoch configurationFile (Api.File $ IO.sprocketSystemName poolSprocket1) (EpochNo 3) - json <- execCliStdoutToJson execConfig [ "query", "stake-snapshot", "--all-stake-pools" ] + json <- execCliStdoutToJson execConfig [ "latest", "query", "stake-snapshot", "--all-stake-pools" ] -- There are three stake pools so check that "pools" has three entries case json of 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 d7031658585..61dbe2b2f2b 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 @@ -86,7 +86,7 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co runtime@TestnetRuntime { testnetMagic - , wallets=wallet0:_ + , wallets=wallet0:wallet1:_ , configurationFile } <- cardanoTestnetDefault fastTestnetOptions shelleyOptions conf @@ -120,12 +120,51 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co ccColdVKeyFp n = gov "cc-" <> show n <> "-cold.vkey" stakeVkeyFp = gov "stake.vkey" stakeSKeyFp = gov "stake.skey" + stakeCertFp = gov "stake.regcert" cliStakeAddressKeyGen $ KeyPair { verificationKey = File stakeVkeyFp , signingKey = File stakeSKeyFp } + -- Register stake address + + void $ execCli' execConfig + [ eraName, "stake-address", "registration-certificate" + , "--stake-verification-key-file", stakeVkeyFp + , "--key-reg-deposit-amt", show @Int 0 -- TODO: why this needs to be 0???? + , "--out-file", stakeCertFp + ] + + stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" + stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" + + txin1 <- findLargestUtxoForPaymentKey epochStateView sbe wallet1 + + void $ execCli' execConfig + [ eraName, "transaction", "build" + , "--change-address", Text.unpack $ paymentKeyInfoAddr wallet1 + , "--tx-in", Text.unpack $ renderTxIn txin1 + , "--tx-out", Text.unpack (paymentKeyInfoAddr wallet0) <> "+" <> show @Int 10_000_000 + , "--certificate-file", stakeCertFp + , "--witness-override", show @Int 2 + , "--out-file", stakeCertTxBodyFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "sign" + , "--tx-body-file", stakeCertTxBodyFp + , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 + , "--signing-key-file", stakeSKeyFp + , "--out-file", stakeCertTxSignedFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "submit" + , "--tx-file", stakeCertTxSignedFp + ] + + minGovActDeposit <- getMinGovActionDeposit epochStateView ceo ccColdKeys <- H.noteShowM $ @@ -161,11 +200,11 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co ccColdKeyFps txbodyFp <- H.note $ work "tx.body" - txin1 <- findLargestUtxoForPaymentKey epochStateView sbe wallet0 + txin1' <- findLargestUtxoForPaymentKey epochStateView sbe wallet0 void $ execCli' execConfig [ eraName, "transaction", "build" , "--change-address", Text.unpack $ paymentKeyInfoAddr wallet0 - , "--tx-in", Text.unpack $ renderTxIn txin1 + , "--tx-in", Text.unpack $ renderTxIn txin1' , "--tx-out", Text.unpack (paymentKeyInfoAddr wallet0) <> "+" <> show @Int 5_000_000 , "--proposal-file", updateCommitteeFp , "--out-file", txbodyFp diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepActivity.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepActivity.hs index c1611010b87..d958e9c502a 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepActivity.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepActivity.hs @@ -1,8 +1,10 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE NumericUnderscores #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} module Cardano.Testnet.Test.Gov.DRepActivity ( hprop_check_drep_activity @@ -24,6 +26,7 @@ import Control.Monad.Catch (MonadCatch) import Data.Data (Typeable) import Data.Default.Class import qualified Data.Map as Map +import qualified Data.Text as Text import Data.Word (Word16) import GHC.Stack (HasCallStack, withFrozenCallStack) import System.FilePath (()) @@ -31,8 +34,9 @@ import System.FilePath (()) import Testnet.Components.Query import Testnet.Defaults (defaultDRepKeyPair, defaultDelegatorStakeKeyPair) import Testnet.Process.Cli.DRep +import Testnet.Process.Cli.Keys (cliStakeAddressKeyGen) import Testnet.Process.Cli.Transaction -import Testnet.Process.Run (mkExecConfig) +import Testnet.Process.Run (execCli', mkExecConfig) import Testnet.Property.Util (integrationWorkspace) import Testnet.Start.Types import Testnet.Types @@ -59,6 +63,7 @@ hprop_check_drep_activity = integrationWorkspace "test-activity" $ \tempAbsBaseP { cardanoNodeEra = AnyShelleyBasedEra sbe , cardanoNumDReps = 1 } + eraName = eraToString sbe shelleyOptions = def { genesisEpochLength = 200 } TestnetRuntime @@ -83,6 +88,53 @@ hprop_check_drep_activity = integrationWorkspace "test-activity" $ \tempAbsBaseP gov <- H.createDirectoryIfMissing $ work "governance" + let stakeVkeyFp = gov "stake.vkey" + stakeSKeyFp = gov "stake.skey" + stakeCertFp = gov "stake.regcert" + stakeKeys = KeyPair { verificationKey = File stakeVkeyFp + , signingKey = File stakeSKeyFp + } + + cliStakeAddressKeyGen stakeKeys + + -- Register stake address + + void $ execCli' execConfig + [ eraName, "stake-address", "registration-certificate" + , "--stake-verification-key-file", stakeVkeyFp + , "--key-reg-deposit-amt", show @Int 0 -- TODO: why this needs to be 0???? + , "--out-file", stakeCertFp + ] + + stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" + stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" + + txin1 <- findLargestUtxoForPaymentKey epochStateView sbe wallet1 + + void $ execCli' execConfig + [ eraName, "transaction", "build" + , "--change-address", Text.unpack $ paymentKeyInfoAddr wallet0 + , "--tx-in", Text.unpack $ renderTxIn txin1 + , "--tx-out", Text.unpack (paymentKeyInfoAddr wallet0) <> "+" <> show @Int 10_000_000 + , "--certificate-file", stakeCertFp + , "--witness-override", show @Int 2 + , "--out-file", stakeCertTxBodyFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "sign" + , "--tx-body-file", stakeCertTxBodyFp + , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 + , "--signing-key-file", stakeSKeyFp + , "--out-file", stakeCertTxSignedFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "submit" + , "--tx-file", stakeCertTxSignedFp + ] + + -- This proposal should pass let minEpochsToWaitIfChanging = EpochInterval 0 -- We don't need a min wait since we are changing -- the parameter, to a new value, if the parameter @@ -95,7 +147,7 @@ hprop_check_drep_activity = integrationWorkspace "test-activity" $ \tempAbsBaseP maxEpochsToWaitAfterProposal = EpochInterval 2 -- If it takes more than 2 epochs we give up in any case. firstTargetDRepActivity = EpochInterval 3 void $ activityChangeProposalTest execConfig epochStateView ceo gov - "firstProposal" wallet0 [(1, "yes")] firstTargetDRepActivity + "firstProposal" stakeKeys wallet0 [(1, "yes")] firstTargetDRepActivity minEpochsToWaitIfChanging (Just firstTargetDRepActivity) maxEpochsToWaitAfterProposal @@ -118,7 +170,7 @@ hprop_check_drep_activity = integrationWorkspace "test-activity" $ \tempAbsBaseP -- and we have the stake distributed evenly let secondTargetDRepActivity = EpochInterval (unEpochInterval firstTargetDRepActivity + 1) void $ activityChangeProposalTest execConfig epochStateView ceo gov - "failingProposal" wallet2 [(1, "yes")] secondTargetDRepActivity + "failingProposal" stakeKeys wallet2 [(1, "yes")] secondTargetDRepActivity minEpochsToWaitIfNotChanging (Just firstTargetDRepActivity) maxEpochsToWaitAfterProposal @@ -130,7 +182,7 @@ hprop_check_drep_activity = integrationWorkspace "test-activity" $ \tempAbsBaseP let numOfFillerProposals = 4 :: Int sequence_ [activityChangeProposalTest execConfig epochStateView ceo gov - ("fillerProposalNum" ++ show proposalNum) wallet [(1, "yes")] + ("fillerProposalNum" ++ show proposalNum) stakeKeys wallet [(1, "yes")] (EpochInterval (unEpochInterval secondTargetDRepActivity + fromIntegral proposalNum)) minEpochsToWaitIfNotChanging Nothing maxEpochsToWaitAfterProposal @@ -143,7 +195,7 @@ hprop_check_drep_activity = integrationWorkspace "test-activity" $ \tempAbsBaseP -- Because 2 out of 3 DReps were inactive, prop should pass let lastTargetDRepActivity = EpochInterval (unEpochInterval secondTargetDRepActivity + fromIntegral numOfFillerProposals + 1) void $ activityChangeProposalTest execConfig epochStateView ceo gov - "lastProposal" wallet0 [(1, "yes")] lastTargetDRepActivity + "lastProposal" stakeKeys wallet0 [(1, "yes")] lastTargetDRepActivity minEpochsToWaitIfChanging (Just lastTargetDRepActivity) maxEpochsToWaitAfterProposal @@ -159,6 +211,7 @@ activityChangeProposalTest -> ConwayEraOnwards era -- ^ The ConwayEraOnwards witness for current era. -> FilePath -- ^ Base directory path where generated files will be stored. -> String -- ^ Name for the subfolder that will be created under 'work' folder. + -> KeyPair StakeKey -- ^ Registered stake keys -> PaymentKeyInfo -- ^ Wallet that will pay for the transactions. -> t (Int, String) -- ^ Votes to be casted for the proposal. Each tuple contains the number -- of votes of each type and the type of vote (i.e: "yes", "no", "abstain"). @@ -171,7 +224,7 @@ activityChangeProposalTest -- become expected value. -> m (String, Word16) -- ^ The transaction id and the index of the governance action. activityChangeProposalTest execConfig epochStateView ceo work prefix - wallet votes change minWait mExpected maxWait = do + stakeKeys wallet votes change minWait mExpected maxWait = do let sbe = conwayEraOnwardsToShelleyBasedEra ceo mPreviousProposalInfo <- getLastPParamUpdateActionId execConfig @@ -185,8 +238,8 @@ activityChangeProposalTest execConfig epochStateView ceo work prefix H.note_ $ "Epoch before \"" <> prefix <> "\" prop: " <> show epochBeforeProp thisProposal@(governanceActionTxId, governanceActionIndex) <- - makeActivityChangeProposal execConfig epochStateView ceo baseDir "proposal" - mPreviousProposalInfo change wallet maxWait + makeActivityChangeProposal execConfig epochStateView ceo (baseDir "proposal") + mPreviousProposalInfo change stakeKeys wallet maxWait voteChangeProposal execConfig epochStateView sbe baseDir "vote" governanceActionTxId governanceActionIndex propVotes wallet diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/GovActionTimeout.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/GovActionTimeout.hs index a9ca837e71a..633e0127191 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/GovActionTimeout.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/GovActionTimeout.hs @@ -1,8 +1,10 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE NumericUnderscores #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} module Cardano.Testnet.Test.Gov.GovActionTimeout ( hprop_check_gov_action_timeout @@ -18,13 +20,16 @@ import Prelude import Control.Monad (void) import Data.Default.Class import Data.String (fromString) +import qualified Data.Text as Text import System.FilePath (()) import Testnet.Components.Query import Testnet.Process.Cli.DRep (makeActivityChangeProposal) -import Testnet.Process.Run (mkExecConfig) +import Testnet.Process.Cli.Keys (cliStakeAddressKeyGen) +import Testnet.Process.Run (execCli', mkExecConfig) import Testnet.Property.Util (integrationWorkspace) import Testnet.Start.Types +import Testnet.Types import Hedgehog (Property) import qualified Hedgehog as H @@ -46,6 +51,7 @@ hprop_check_gov_action_timeout = integrationWorkspace "gov-action-timeout" $ \te -- Create default testnet let ceo = ConwayEraOnwardsConway sbe = conwayEraOnwardsToShelleyBasedEra ceo + eraName = eraToString sbe asbe = AnyShelleyBasedEra sbe fastTestnetOptions = def { cardanoNodeEra = asbe } shelleyOptions = def { genesisEpochLength = 200 } @@ -53,7 +59,7 @@ hprop_check_gov_action_timeout = integrationWorkspace "gov-action-timeout" $ \te TestnetRuntime { testnetMagic , testnetNodes - , wallets=wallet0:_ + , wallets=wallet0:wallet1:_ , configurationFile } <- cardanoTestnetDefault fastTestnetOptions shelleyOptions conf @@ -79,10 +85,56 @@ hprop_check_gov_action_timeout = integrationWorkspace "gov-action-timeout" $ \te govActionLifetime <- getGovActionLifetime epochStateView ceo H.note_ $ "govActionLifetime: " <> show govActionLifetime + let stakeVkeyFp = gov "stake.vkey" + stakeSKeyFp = gov "stake.skey" + stakeCertFp = gov "stake.regcert" + stakeKeys = KeyPair { verificationKey = File stakeVkeyFp + , signingKey = File stakeSKeyFp + } + + cliStakeAddressKeyGen stakeKeys + + -- Register stake address + + void $ execCli' execConfig + [ eraName, "stake-address", "registration-certificate" + , "--stake-verification-key-file", stakeVkeyFp + , "--key-reg-deposit-amt", show @Int 0 -- TODO: why this needs to be 0???? + , "--out-file", stakeCertFp + ] + + stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" + stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" + + txin1 <- findLargestUtxoForPaymentKey epochStateView sbe wallet1 + + void $ execCli' execConfig + [ eraName, "transaction", "build" + , "--change-address", Text.unpack $ paymentKeyInfoAddr wallet1 + , "--tx-in", Text.unpack $ renderTxIn txin1 + , "--tx-out", Text.unpack (paymentKeyInfoAddr wallet1) <> "+" <> show @Int 10_000_000 + , "--certificate-file", stakeCertFp + , "--witness-override", show @Int 2 + , "--out-file", stakeCertTxBodyFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "sign" + , "--tx-body-file", stakeCertTxBodyFp + , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 + , "--signing-key-file", stakeSKeyFp + , "--out-file", stakeCertTxSignedFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "submit" + , "--tx-file", stakeCertTxSignedFp + ] + -- Create a proposal (governanceActionTxId, _governanceActionIndex) <- - makeActivityChangeProposal execConfig epochStateView ceo baseDir "proposal" - Nothing (EpochInterval 3) wallet0 (EpochInterval 2) + makeActivityChangeProposal execConfig epochStateView ceo (baseDir "proposal") + Nothing (EpochInterval 3) stakeKeys wallet0 (EpochInterval 2) -- Wait for proposal to expire void $ waitForEpochs epochStateView (EpochInterval $ unEpochInterval govActionLifetime + 1) 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 5877ee1c53a..d0bbc1e79ad 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 @@ -59,6 +59,7 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem let ceo = ConwayEraOnwardsConway sbe = conwayEraOnwardsToShelleyBasedEra ceo asbe = AnyShelleyBasedEra sbe + eraName = eraToString sbe fastTestnetOptions = def { cardanoNodeEra = asbe } shelleyOptions = def { genesisEpochLength = 200 } @@ -94,16 +95,54 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem let stakeVkeyFp = gov "stake.vkey" stakeSKeyFp = gov "stake.skey" + stakeCertFp = gov "stake.regcert" + stakeKeys = KeyPair { verificationKey = File stakeVkeyFp + , signingKey = File stakeSKeyFp + } - cliStakeAddressKeyGen - $ KeyPair { verificationKey = File stakeVkeyFp - , signingKey= File stakeSKeyFp - } + cliStakeAddressKeyGen stakeKeys + + -- Register stake address + + void $ execCli' execConfig + [ eraName, "stake-address", "registration-certificate" + , "--stake-verification-key-file", stakeVkeyFp + , "--key-reg-deposit-amt", show @Int 0 -- TODO: why this needs to be 0???? + , "--out-file", stakeCertFp + ] + + stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" + stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" + + txin1 <- findLargestUtxoForPaymentKey epochStateView sbe wallet0 + + void $ execCli' execConfig + [ eraName, "transaction", "build" + , "--change-address", Text.unpack $ paymentKeyInfoAddr wallet0 + , "--tx-in", Text.unpack $ renderTxIn txin1 + , "--tx-out", Text.unpack (paymentKeyInfoAddr wallet1) <> "+" <> show @Int 10_000_000 + , "--certificate-file", stakeCertFp + , "--witness-override", show @Int 2 + , "--out-file", stakeCertTxBodyFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "sign" + , "--tx-body-file", stakeCertTxBodyFp + , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet0 + , "--signing-key-file", stakeSKeyFp + , "--out-file", stakeCertTxSignedFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "submit" + , "--tx-file", stakeCertTxSignedFp + ] -- Create info action proposal void $ execCli' execConfig - [ "conway", "governance", "action", "create-info" + [ eraName, "governance", "action", "create-info" , "--testnet" , "--governance-action-deposit", show @Int 1_000_000 -- TODO: Get this from the node , "--deposit-return-stake-verification-key-file", stakeVkeyFp @@ -118,7 +157,7 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem txin2 <- findLargestUtxoForPaymentKey epochStateView sbe wallet1 H.noteM_ $ execCli' execConfig - [ "conway", "transaction", "build" + [ eraName, "transaction", "build" , "--change-address", Text.unpack $ paymentKeyInfoAddr wallet1 , "--tx-in", Text.unpack $ renderTxIn txin2 , "--tx-out", Text.unpack (paymentKeyInfoAddr wallet0) <> "+" <> show @Int 5_000_000 @@ -127,19 +166,19 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem ] void $ execCli' execConfig - [ "conway", "transaction", "sign" + [ eraName, "transaction", "sign" , "--tx-body-file", txbodyFp , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 , "--out-file", txbodySignedFp ] void $ execCli' execConfig - [ "conway", "transaction", "submit" + [ eraName, "transaction", "submit" , "--tx-file", txbodySignedFp ] txidString <- mconcat . lines <$> execCli' execConfig - [ "transaction", "txid" + [ "latest", "transaction", "txid" , "--tx-file", txbodySignedFp ] @@ -153,7 +192,7 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem -- Proposal was successfully submitted, now we vote on the proposal and confirm it was ratified H.forConcurrently_ [1..3] $ \n -> do execCli' execConfig - [ "conway", "governance", "vote", "create" + [ eraName, "governance", "vote", "create" , "--yes" , "--governance-action-tx-id", txidString , "--governance-action-index", show @Word16 governanceActionIndex @@ -169,7 +208,7 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem -- Submit votes void $ execCli' execConfig - [ "conway", "transaction", "build" + [ eraName, "transaction", "build" , "--change-address", Text.unpack $ paymentKeyInfoAddr wallet0 , "--tx-in", Text.unpack $ renderTxIn txin3 , "--tx-out", Text.unpack (paymentKeyInfoAddr wallet1) <> "+" <> show @Int 3_000_000 @@ -182,7 +221,7 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem void $ execCli' execConfig - [ "conway", "transaction", "sign" + [ eraName, "transaction", "sign" , "--tx-body-file", voteTxBodyFp , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet0 , "--signing-key-file", signingKeyFp $ defaultDRepKeyPair 1 @@ -192,7 +231,7 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 2 "info-hash" $ \tem ] void $ execCli' execConfig - [ "conway", "transaction", "submit" + [ eraName, "transaction", "submit" , "--tx-file", voteTxFp ] diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/PParamChangeFailsSPO.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/PParamChangeFailsSPO.hs index 43375ee7af4..522f7e3224a 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/PParamChangeFailsSPO.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/PParamChangeFailsSPO.hs @@ -1,8 +1,10 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE NumericUnderscores #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} module Cardano.Testnet.Test.Gov.PParamChangeFailsSPO ( hprop_check_pparam_fails_spo @@ -15,8 +17,10 @@ import Cardano.Testnet import Prelude +import Control.Monad import Control.Monad.Catch (MonadCatch) import Data.Default.Class +import qualified Data.Text as Text import Data.Typeable (Typeable) import Data.Word (Word16) import System.FilePath (()) @@ -24,9 +28,10 @@ import System.FilePath (()) import Testnet.Components.Query import Testnet.Defaults (defaultSpoColdKeyPair, defaultSpoKeys) import Testnet.Process.Cli.DRep +import Testnet.Process.Cli.Keys (cliStakeAddressKeyGen) import qualified Testnet.Process.Cli.SPO as SPO import Testnet.Process.Cli.Transaction (failToSubmitTx, signTx) -import Testnet.Process.Run (mkExecConfig) +import Testnet.Process.Run (execCli', mkExecConfig) import Testnet.Property.Util (integrationWorkspace) import Testnet.Start.Types import Testnet.Types @@ -53,6 +58,7 @@ hprop_check_pparam_fails_spo = integrationWorkspace "test-pparam-spo" $ \tempAbs let ceo = ConwayEraOnwardsConway sbe = conwayEraOnwardsToShelleyBasedEra ceo asbe = AnyShelleyBasedEra sbe + eraName = eraToString sbe fastTestnetOptions = def { cardanoNodeEra = asbe } shelleyOptions = def { genesisEpochLength = 200 } @@ -80,6 +86,52 @@ hprop_check_pparam_fails_spo = integrationWorkspace "test-pparam-spo" $ \tempAbs baseDir <- H.createDirectoryIfMissing $ gov "output" + let stakeVkeyFp = gov "stake.vkey" + stakeSKeyFp = gov "stake.skey" + stakeCertFp = gov "stake.regcert" + stakingKeys = KeyPair { verificationKey = File stakeVkeyFp + , signingKey= File stakeSKeyFp + } + + cliStakeAddressKeyGen stakingKeys + + -- Register stake address + + void $ execCli' execConfig + [ eraName, "stake-address", "registration-certificate" + , "--stake-verification-key-file", stakeVkeyFp + , "--key-reg-deposit-amt", show @Int 0 -- TODO: why this needs to be 0???? + , "--out-file", stakeCertFp + ] + + stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" + stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" + + txin1 <- findLargestUtxoForPaymentKey epochStateView sbe wallet1 + + void $ execCli' execConfig + [ eraName, "transaction", "build" + , "--change-address", Text.unpack $ paymentKeyInfoAddr wallet1 + , "--tx-in", Text.unpack $ renderTxIn txin1 + , "--tx-out", Text.unpack (paymentKeyInfoAddr wallet0) <> "+" <> show @Int 10_000_000 + , "--certificate-file", stakeCertFp + , "--witness-override", show @Int 2 + , "--out-file", stakeCertTxBodyFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "sign" + , "--tx-body-file", stakeCertTxBodyFp + , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 + , "--signing-key-file", stakeSKeyFp + , "--out-file", stakeCertTxSignedFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "submit" + , "--tx-file", stakeCertTxSignedFp + ] + let propVotes :: [(String, Int)] propVotes = mkVotes [(1, "yes")] @@ -90,8 +142,8 @@ hprop_check_pparam_fails_spo = integrationWorkspace "test-pparam-spo" $ \tempAbs annotateShow propVotes (governanceActionTxId, governanceActionIndex) <- - makeActivityChangeProposal execConfig epochStateView ceo baseDir "proposal" - Nothing (EpochInterval 3) wallet0 (EpochInterval 2) + makeActivityChangeProposal execConfig epochStateView ceo (baseDir "proposal") + Nothing (EpochInterval 3) stakingKeys wallet0 (EpochInterval 2) failToVoteChangeProposalWithSPOs ceo execConfig epochStateView baseDir "vote" governanceActionTxId governanceActionIndex propVotes wallet1 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 21d8486622b..4c2ee15182b 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 @@ -70,6 +70,7 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new sbe = conwayEraOnwardsToShelleyBasedEra ceo era = toCardanoEra sbe cEra = AnyCardanoEra era + eraName = eraToString sbe fastTestnetOptions = def { cardanoNodeEra = AnyShelleyBasedEra sbe , cardanoNumDReps = fromIntegral numVotes @@ -114,11 +115,48 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new let stakeVkeyFp = gov "stake.vkey" stakeSKeyFp = gov "stake.skey" + stakeCertFp = gov "stake.regcert" cliStakeAddressKeyGen $ KeyPair { verificationKey = File stakeVkeyFp , signingKey = File stakeSKeyFp } + -- Register stake address + + void $ execCli' execConfig + [ eraName, "stake-address", "registration-certificate" + , "--stake-verification-key-file", stakeVkeyFp + , "--key-reg-deposit-amt", show @Int 0 -- TODO: why this needs to be 0???? + , "--out-file", stakeCertFp + ] + + stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" + stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" + + txin1 <- findLargestUtxoForPaymentKey epochStateView sbe wallet1 + + void $ execCli' execConfig + [ eraName, "transaction", "build" + , "--change-address", Text.unpack $ paymentKeyInfoAddr wallet1 + , "--tx-in", Text.unpack $ renderTxIn txin1 + , "--tx-out", Text.unpack (paymentKeyInfoAddr wallet0) <> "+" <> show @Int 10_000_000 + , "--certificate-file", stakeCertFp + , "--witness-override", show @Int 2 + , "--out-file", stakeCertTxBodyFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "sign" + , "--tx-body-file", stakeCertTxBodyFp + , "--signing-key-file", signingKeyFp $ paymentKeyInfoPair wallet1 + , "--signing-key-file", stakeSKeyFp + , "--out-file", stakeCertTxSignedFp + ] + + void $ execCli' execConfig + [ eraName, "transaction", "submit" + , "--tx-file", stakeCertTxSignedFp + ] -- Create constitution proposal guardRailScriptFp <- H.note $ work "guard-rail-script.plutusV3" @@ -148,6 +186,7 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new txbodyFp <- H.note $ work "tx.body" + H.noteShowM_ $ waitForBlocks epochStateView 1 txin2 <- findLargestUtxoForPaymentKey epochStateView sbe wallet1 void $ execCli' execConfig 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 0b100412893..881c2519b0b 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 @@ -189,7 +189,7 @@ hprop_ledger_events_treasury_withdrawal = integrationRetryWorkspace 2 "treasury -- }}} txidString <- mconcat . lines <$> execCli' execConfig - [ "transaction", "txid" + [ "latest", "transaction", "txid" , "--tx-file", txbodySignedFp ] diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Node/Shutdown.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Node/Shutdown.hs index bf96df3a827..773b85d24fa 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Node/Shutdown.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Node/Shutdown.hs @@ -112,7 +112,7 @@ hprop_shutdown = integrationRetryWorkspace 2 "shutdown" $ \tempAbsBasePath' -> H -- 4. Create Shelley genesis execCli_ - [ "genesis", "create" + [ "latest", "genesis", "create" , "--testnet-magic", show @Int testnetMagic' , "--genesis-dir", shelleyDir , "--start-time", formatIso8601 startTime diff --git a/flake.lock b/flake.lock index d7b3cb19416..e5079d846d8 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1725978043, - "narHash": "sha256-3AwgQ308g74rISxUlbzQRX3At0trVoH836vBwkcFFYg=", + "lastModified": 1729171858, + "narHash": "sha256-Frktcy6z3/CeT5I0S/SdQWia+yOXm1DMTxlwVtxLh2o=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "ce5ba82d474225506523e66a4050718de7e2b3fe", + "rev": "caf870b8abb957eaebf5db28da3181a3487fbbec", "type": "github" }, "original": { @@ -526,11 +526,11 @@ "hackageNix": { "flake": false, "locked": { - "lastModified": 1725928375, - "narHash": "sha256-XO/6kJ77bR99bAuRGr9PleQX75vde5CbSU+6Xf3e8NQ=", + "lastModified": 1729039425, + "narHash": "sha256-sIglYcw8Dacj4n0bRlUWo+NLkDMcVi6vtmKvUyG+ZrQ=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "68cfb288b958e9d7a1329df614684132f44bd2b3", + "rev": "6dc43e5e01f113ce151056a8f94bce7bb2f13eb9", "type": "github" }, "original": { @@ -562,7 +562,6 @@ "hls-2.6": "hls-2.6", "hls-2.7": "hls-2.7", "hls-2.8": "hls-2.8", - "hls-2.9": "hls-2.9", "hpc-coveralls": "hpc-coveralls", "hydra": "hydra", "iserv-proxy": "iserv-proxy", @@ -591,6 +590,7 @@ "original": { "owner": "input-output-hk", "repo": "haskell.nix", + "rev": "cb139fa956158397aa398186bb32dd26f7318784", "type": "github" } }, @@ -769,23 +769,6 @@ "type": "github" } }, - "hls-2.9": { - "flake": false, - "locked": { - "lastModified": 1718469202, - "narHash": "sha256-qnDx8Pk0UxtoPr7BimEsAZh9g2WuTuMB/kGqnmdryKs=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "0c1817cb2babef0765e4e72dd297c013e8e3d12b", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.9.0.1", - "repo": "haskell-language-server", - "type": "github" - } - }, "hpc-coveralls": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index e8b28188559..0d63226bc9f 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,9 @@ flake = false; }; haskellNix = { - url = "github:input-output-hk/haskell.nix"; + # GHC 8.10.7 cross compilation for windows is broken in newer versions of haskell.nix. + # Unpin this once we no longer need GHC 8.10.7. + url = "github:input-output-hk/haskell.nix/cb139fa956158397aa398186bb32dd26f7318784"; inputs.nixpkgs.follows = "nixpkgs"; inputs.hackage.follows = "hackageNix"; }; diff --git a/nix/haskell.nix b/nix/haskell.nix index 6d3864f228a..ec137f41207 100644 --- a/nix/haskell.nix +++ b/nix/haskell.nix @@ -116,6 +116,7 @@ let packages.plutus-tx-plugin.components.library.platforms = with lib.platforms; [ linux darwin ]; packages.tx-generator.package.buildable = with pkgs.stdenv.hostPlatform; !isMusl; + packages.fs-api.components.library.doHaddock = false; packages.cardano-ledger-allegra.components.library.doHaddock = false; packages.cardano-ledger-alonzo.components.library.doHaddock = false; packages.cardano-ledger-api.components.library.doHaddock = false; @@ -126,6 +127,7 @@ let packages.cardano-protocol-tpraos.components.library.doHaddock = false; packages.ouroboros-consensus-cardano.components.library.doHaddock = false; packages.ouroboros-consensus.components.library.doHaddock = false; + packages.plutus-ledger-api.components.library.doHaddock = false; }) ({ lib, pkgs, ...}: lib.mkIf (pkgs.stdenv.hostPlatform.isWindows) { # Remvoe this once mingwx is mapped to null in haskell.nix (haskell.nix#2032), and we bumped _past_ that. diff --git a/trace-forward/CHANGELOG.md b/trace-forward/CHANGELOG.md index b41a7ec341f..17819411f08 100644 --- a/trace-forward/CHANGELOG.md +++ b/trace-forward/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +## 2.2.8 - Oct 2024 + +* Bump for version bound + ## 2.2.7 - Sep 2024 * Remove potentially leaky continuation passing from `TraceObjectForwarder` and `DataPointForwarder`. diff --git a/trace-forward/trace-forward.cabal b/trace-forward/trace-forward.cabal index 606bd8d2a55..fbce68d6d9a 100644 --- a/trace-forward/trace-forward.cabal +++ b/trace-forward/trace-forward.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: trace-forward -version: 2.2.7 +version: 2.2.8 synopsis: The forwarding protocols library for cardano node. description: The library providing typed protocols for forwarding different information from the cardano node to an external application. @@ -64,7 +64,7 @@ library , deepseq , extra , io-classes - , ouroboros-network-api ^>= 0.9 + , ouroboros-network-api ^>= 0.10 , ouroboros-network-framework , serialise , stm