hydra-cluster
Safe HaskellSafe-Inferred
LanguageGHC2021

CardanoNode

Synopsis

Documentation

data HydraNodeLog Source #

Constructors

HydraNodeCommandSpec 

Fields

NodeStarted 

Fields

SentMessage 

Fields

StartWaiting 

Fields

ReceivedMessage 

Fields

EndWaiting 

Fields

Instances

Instances details
ToJSON HydraNodeLog Source # 
Instance details

Defined in CardanoNode

Methods

toJSON :: HydraNodeLog -> Value

toEncoding :: HydraNodeLog -> Encoding

toJSONList :: [HydraNodeLog] -> Value

toEncodingList :: [HydraNodeLog] -> Encoding

omitField :: HydraNodeLog -> Bool

Generic HydraNodeLog Source # 
Instance details

Defined in CardanoNode

Associated Types

type Rep HydraNodeLog :: Type -> Type Source #

Show HydraNodeLog Source # 
Instance details

Defined in CardanoNode

Eq HydraNodeLog Source # 
Instance details

Defined in CardanoNode

type Rep HydraNodeLog Source # 
Instance details

Defined in CardanoNode

type Rep HydraNodeLog = D1 ('MetaData "HydraNodeLog" "CardanoNode" "hydra-cluster-2.3.0-AKuIRMQTBGS8QbUdMcH2lm" 'False) ((C1 ('MetaCons "HydraNodeCommandSpec" 'PrefixI 'True) (S1 ('MetaSel ('Just "cmd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: (C1 ('MetaCons "NodeStarted" 'PrefixI 'True) (S1 ('MetaSel ('Just "nodeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "SentMessage" 'PrefixI 'True) (S1 ('MetaSel ('Just "nodeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)))) :+: (C1 ('MetaCons "StartWaiting" 'PrefixI 'True) (S1 ('MetaSel ('Just "nodeIds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Int]) :*: S1 ('MetaSel ('Just "messages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Value])) :+: (C1 ('MetaCons "ReceivedMessage" 'PrefixI 'True) (S1 ('MetaSel ('Just "nodeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)) :+: C1 ('MetaCons "EndWaiting" 'PrefixI 'True) (S1 ('MetaSel ('Just "nodeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))))

data EndToEndLog Source #

Instances

Instances details
ToJSON EndToEndLog Source # 
Instance details

Defined in CardanoNode

Methods

toJSON :: EndToEndLog -> Value

toEncoding :: EndToEndLog -> Encoding

toJSONList :: [EndToEndLog] -> Value

toEncodingList :: [EndToEndLog] -> Encoding

omitField :: EndToEndLog -> Bool

Generic EndToEndLog Source # 
Instance details

Defined in CardanoNode

Associated Types

type Rep EndToEndLog :: Type -> Type Source #

Show EndToEndLog Source # 
Instance details

Defined in CardanoNode

Eq EndToEndLog Source # 
Instance details

Defined in CardanoNode

type Rep EndToEndLog Source # 
Instance details

Defined in CardanoNode

type Rep EndToEndLog = D1 ('MetaData "EndToEndLog" "CardanoNode" "hydra-cluster-2.3.0-AKuIRMQTBGS8QbUdMcH2lm" 'False) (((C1 ('MetaCons "ClusterOptions" 'PrefixI 'True) (S1 ('MetaSel ('Just "options") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Options)) :+: C1 ('MetaCons "FromCardanoNode" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NodeLog))) :+: (C1 ('MetaCons "FromFaucet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FaucetLog)) :+: (C1 ('MetaCons "FromHydraNode" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HydraNodeLog)) :+: C1 ('MetaCons "FromMithril" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MithrilLog))))) :+: ((C1 ('MetaCons "StartingFunds" 'PrefixI 'True) (S1 ('MetaSel ('Just "actor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "utxo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxO)) :+: (C1 ('MetaCons "RefueledFunds" 'PrefixI 'True) (S1 ('MetaSel ('Just "actor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "refuelingAmount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: S1 ('MetaSel ('Just "utxo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxO))) :+: C1 ('MetaCons "RemainingFunds" 'PrefixI 'True) (S1 ('MetaSel ('Just "actor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "utxo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxO)))) :+: (C1 ('MetaCons "PublishedHydraScriptsAt" 'PrefixI 'True) (S1 ('MetaSel ('Just "hydraScriptsTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TxId])) :+: (C1 ('MetaCons "UsingHydraScriptsAt" 'PrefixI 'True) (S1 ('MetaSel ('Just "hydraScriptsTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TxId])) :+: C1 ('MetaCons "CreatedKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "keyPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))))

data NodeLog Source #

Instances

Instances details
ToJSON NodeLog Source # 
Instance details

Defined in CardanoNode

Methods

toJSON :: NodeLog -> Value

toEncoding :: NodeLog -> Encoding

toJSONList :: [NodeLog] -> Value

toEncodingList :: [NodeLog] -> Encoding

omitField :: NodeLog -> Bool

Generic NodeLog Source # 
Instance details

Defined in CardanoNode

Associated Types

type Rep NodeLog :: Type -> Type Source #

Show NodeLog Source # 
Instance details

Defined in CardanoNode

Eq NodeLog Source # 
Instance details

Defined in CardanoNode

type Rep NodeLog Source # 
Instance details

Defined in CardanoNode

type Rep NodeLog = D1 ('MetaData "NodeLog" "CardanoNode" "hydra-cluster-2.3.0-AKuIRMQTBGS8QbUdMcH2lm" 'False) (((C1 ('MetaCons "MsgNodeCmdSpec" 'PrefixI 'True) (S1 ('MetaSel ('Just "cmd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "MsgCLI" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]))) :+: (C1 ('MetaCons "MsgCLIStatus" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "MsgCLIRetry" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))) :+: ((C1 ('MetaCons "MsgCLIRetryResult" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "MsgNodeStarting" 'PrefixI 'True) (S1 ('MetaSel ('Just "stateDirectory") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))) :+: (C1 ('MetaCons "MsgSocketIsReady" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SocketPath)) :+: (C1 ('MetaCons "MsgSynchronizing" 'PrefixI 'True) ((S1 ('MetaSel ('Just "percentDone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Centi) :*: S1 ('MetaSel ('Just "timeDifference") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NominalDiffTime)) :*: (S1 ('MetaSel ('Just "blockTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NominalDiffTime) :*: (S1 ('MetaSel ('Just "tipTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NominalDiffTime) :*: S1 ('MetaSel ('Just "targetTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NominalDiffTime)))) :+: C1 ('MetaCons "MsgQueryGenesisParametersFailed" 'PrefixI 'True) (S1 ('MetaSel ('Just "err") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))))

type Port = Int Source #

newtype NodeId Source #

Constructors

NodeId Int 

Instances

Instances details
Num NodeId Source # 
Instance details

Defined in CardanoNode

Show NodeId Source # 
Instance details

Defined in CardanoNode

Eq NodeId Source # 
Instance details

Defined in CardanoNode

findRunningCardanoNode :: Tracer IO NodeLog -> FilePath -> KnownNetwork -> IO (Maybe (NominalDiffTime, DirectOptions)) Source #

Tries to find an communicate with an existing cardano-node running in given work directory. NOTE: This is using the default node socket name as defined by defaultCardanoNodeArgs.

findRunningCardanoNode' :: Tracer IO NodeLog -> NetworkId -> SocketPath -> IO (Maybe (NominalDiffTime, DirectOptions)) Source #

Tries to find an communicate with an existing cardano-node running in given network id and socket path.

runBackend :: ChainBackendOptions -> (forall m. (ChainBackend m, MonadIO m, MonadThrow m, MonadCatch m) => m a) -> IO a Source #

Run a backend action using the given ChainBackendOptions.

withCardanoNodeDevnet Source #

Arguments

:: Tracer IO NodeLog 
-> FilePath

State directory in which credentials, db & logs are persisted.

-> (NominalDiffTime -> DirectOptions -> IO a) 
-> IO a 

Start a single cardano-node devnet using the config from config/ and credentials from configcredentials. Only the Faucet actor will receive "initialFunds". Use seedFromFaucet to distribute funds other wallets.

withBlockfrostBackend Source #

Arguments

:: Tracer IO EndToEndLog 
-> FilePath

State directory in which credentials, db & logs are persisted.

-> (NominalDiffTime -> ChainBackendOptions -> IO a) 
-> IO a 

findFileStartingAtDirectory :: Int -> FilePath -> IO FilePath Source #

Find the given file in the current directory or its parents.

This function starts from the current working directory and checks if the specified file exists there. If not found, it recursively checks the parent directories up to the given maximum depth.

withBackend :: forall a. Tracer IO EndToEndLog -> FilePath -> (NominalDiffTime -> ChainBackendOptions -> IO a) -> IO a Source #

withHydraScriptsAndBackendRunning :: forall a. Tracer IO EndToEndLog -> FilePath -> (ChainBackendOptions -> [TxId] -> IO a) -> IO a Source #

Like withBackend, but also publishes (or reuses cached) Hydra scripts. On public testnets the cache file is stored in the persistent HYDRA_WORK_DIR, so scripts are published once and reused across test runs. On local devnet, the per-test $sel:stateDirectory:MsgNodeCmdSpec is used, so scripts are always published fresh.

withCardanoNodeOnKnownNetwork Source #

Arguments

:: Tracer IO NodeLog 
-> FilePath

State directory in which node db & logs are persisted.

-> KnownNetwork

A well-known Cardano network to connect to.

-> (NominalDiffTime -> DirectOptions -> IO a) 
-> IO a 

Run a cardano-node as normal network participant on a known network.

setupCardanoDevnet :: FilePath -> IO CardanoNodeArgs Source #

Setup the cardano-node to run a local devnet producing blocks. This copies the appropriate files and prepares CardanoNodeArgs for withCardanoNode.

withCardanoNode :: Tracer IO NodeLog -> FilePath -> CardanoNodeArgs -> (NominalDiffTime -> DirectOptions -> IO a) -> IO a Source #

waitForFullySynchronized :: Tracer IO NodeLog -> ChainBackendOptions -> IO () Source #

Wait until the node is fully caught up with the network. This can take a while!

waitForSocket :: SocketPath -> IO () Source #

Wait for the node socket file to become available.

cardanoNodeProcess :: Maybe FilePath -> CardanoNodeArgs -> CreateProcess Source #

Generate command-line arguments for launching cardano-node.

initSystemStart :: IO UTCTime Source #

Initialize the system start time to now (modulo a small offset needed to give time to the system to bootstrap correctly).

refreshSystemStart Source #

Arguments

:: FilePath

Working directory in which paths of CardanoNodeArgs are resolved.

-> CardanoNodeArgs 
-> IO () 

Re-generate configuration and genesis files with fresh system start times.

mkTopology :: [Port] -> Value Source #

Generate a topology file from a list of peers.

data ProcessHasExited Source #

Constructors

ProcessHasExited Text ExitCode 

Instances

Instances details
Show ProcessHasExited Source # 
Instance details

Defined in CardanoNode

cliQueryProtocolParameters :: SocketPath -> NetworkId -> IO Value Source #

Cardano-cli wrapper to query protocol parameters. While we have also client functions in Hydra.Chain.CardanoClient and Hydra.Cluster.CardanoClient, sometimes we deliberately want to use the cardano-cli to ensure compatibility.

unsafeDecodeJson :: FromJSON a => ByteString -> IO a Source #

unsafeDecodeJsonFile :: FromJSON a => FilePath -> IO a Source #