hydra-cluster-0.19.0: Integration test suite using a local cluster of cardano and hydra nodes
Safe HaskellSafe-Inferred
LanguageGHC2021

CardanoNode

Synopsis

Documentation

data NodeLog Source #

Instances

Instances details
FromJSON NodeLog Source # 
Instance details

Defined in CardanoNode

Methods

parseJSON :: Value -> Parser NodeLog

parseJSONList :: Value -> Parser [NodeLog]

omittedField :: Maybe NodeLog

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-0.19.0-FdS6WpgbrGm8HrOQAHMkj7" '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)) :+: 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
FromJSON NodeId Source # 
Instance details

Defined in CardanoNode

Methods

parseJSON :: Value -> Parser NodeId

parseJSONList :: Value -> Parser [NodeId]

omittedField :: Maybe NodeId

ToJSON NodeId Source # 
Instance details

Defined in CardanoNode

Methods

toJSON :: NodeId -> Value

toEncoding :: NodeId -> Encoding

toJSONList :: [NodeId] -> Value

toEncodingList :: [NodeId] -> Encoding

omitField :: NodeId -> Bool

Num NodeId Source # 
Instance details

Defined in CardanoNode

Show NodeId Source # 
Instance details

Defined in CardanoNode

Eq NodeId Source # 
Instance details

Defined in CardanoNode

data DevnetConfig Source #

Configuration parameters for a single node devnet

Constructors

DevnetConfig 

Fields

Instances

Instances details
FromJSON DevnetConfig Source # 
Instance details

Defined in CardanoNode

Methods

parseJSON :: Value -> Parser DevnetConfig

parseJSONList :: Value -> Parser [DevnetConfig]

omittedField :: Maybe DevnetConfig

ToJSON DevnetConfig Source # 
Instance details

Defined in CardanoNode

Methods

toJSON :: DevnetConfig -> Value

toEncoding :: DevnetConfig -> Encoding

toJSONList :: [DevnetConfig] -> Value

toEncodingList :: [DevnetConfig] -> Encoding

omitField :: DevnetConfig -> Bool

Generic DevnetConfig Source # 
Instance details

Defined in CardanoNode

Associated Types

type Rep DevnetConfig :: Type -> Type Source #

Show DevnetConfig Source # 
Instance details

Defined in CardanoNode

Eq DevnetConfig Source # 
Instance details

Defined in CardanoNode

type Rep DevnetConfig Source # 
Instance details

Defined in CardanoNode

type Rep DevnetConfig = D1 ('MetaData "DevnetConfig" "CardanoNode" "hydra-cluster-0.19.0-FdS6WpgbrGm8HrOQAHMkj7" 'False) (C1 ('MetaCons "DevnetConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "stateDirectory") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: (S1 ('MetaSel ('Just "systemStart") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "ports") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PortsConfig))))

data PortsConfig Source #

Configuration of ports from the perspective of a peer in the context of a fully sockected topology.

Constructors

PortsConfig 

Fields

Instances

Instances details
FromJSON PortsConfig Source # 
Instance details

Defined in CardanoNode

Methods

parseJSON :: Value -> Parser PortsConfig

parseJSONList :: Value -> Parser [PortsConfig]

omittedField :: Maybe PortsConfig

ToJSON PortsConfig Source # 
Instance details

Defined in CardanoNode

Methods

toJSON :: PortsConfig -> Value

toEncoding :: PortsConfig -> Encoding

toJSONList :: [PortsConfig] -> Value

toEncodingList :: [PortsConfig] -> Encoding

omitField :: PortsConfig -> Bool

Generic PortsConfig Source # 
Instance details

Defined in CardanoNode

Associated Types

type Rep PortsConfig :: Type -> Type Source #

Show PortsConfig Source # 
Instance details

Defined in CardanoNode

Eq PortsConfig Source # 
Instance details

Defined in CardanoNode

type Rep PortsConfig Source # 
Instance details

Defined in CardanoNode

type Rep PortsConfig = D1 ('MetaData "PortsConfig" "CardanoNode" "hydra-cluster-0.19.0-FdS6WpgbrGm8HrOQAHMkj7" 'False) (C1 ('MetaCons "PortsConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "ours") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Port) :*: S1 ('MetaSel ('Just "peers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Port])))

findRunningCardanoNode :: Tracer IO NodeLog -> FilePath -> KnownNetwork -> IO (Maybe RunningNode) 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 RunningNode) Source #

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

withCardanoNodeDevnet Source #

Arguments

:: Tracer IO NodeLog 
-> FilePath

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

-> (RunningNode -> 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.

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.

-> (RunningNode -> 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 -> (RunningNode -> IO a) -> IO a Source #

computeBlockTime :: NominalDiffTime -> Rational -> NominalDiffTime Source #

Compute the block time (expected time between blocks) given a slot length as diff time and active slot coefficient.

waitForFullySynchronized :: Tracer IO NodeLog -> RunningNode -> 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.

generateCardanoKey :: IO (VerificationKey PaymentKey, SigningKey PaymentKey) Source #

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.

withObject :: (Object -> Object) -> Value -> Value Source #

Do something with an a JSON object. Fails if the given JSON value isn't an object.

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

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