hydra-node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Options

Synopsis

Documentation

data Command Source #

Instances

Instances details
Show Command Source # 
Instance details

Defined in Hydra.Options

Eq Command Source # 
Instance details

Defined in Hydra.Options

data RunOptions Source #

Instances

Instances details
FromJSON RunOptions Source # 
Instance details

Defined in Hydra.Options

Methods

parseJSON :: Value -> Parser RunOptions

parseJSONList :: Value -> Parser [RunOptions]

omittedField :: Maybe RunOptions

ToJSON RunOptions Source # 
Instance details

Defined in Hydra.Options

Methods

toJSON :: RunOptions -> Value

toEncoding :: RunOptions -> Encoding

toJSONList :: [RunOptions] -> Value

toEncodingList :: [RunOptions] -> Encoding

omitField :: RunOptions -> Bool

Semigroup RunOptions Source #

Merge two RunOptions: for each field, cli wins if it differs from defaultRunOptions; otherwise base (e.g. loaded from a config file) wins. Nested chain and ledger configs are merged recursively.

Instance details

Defined in Hydra.Options

Generic RunOptions Source # 
Instance details

Defined in Hydra.Options

Associated Types

type Rep RunOptions :: Type -> Type Source #

Show RunOptions Source # 
Instance details

Defined in Hydra.Options

Eq RunOptions Source # 
Instance details

Defined in Hydra.Options

type Rep RunOptions Source # 
Instance details

Defined in Hydra.Options

type Rep RunOptions = D1 ('MetaData "RunOptions" "Hydra.Options" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "RunOptions" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "verbosity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Verbosity) :*: S1 ('MetaSel ('Just "nodeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 NodeId)) :*: (S1 ('MetaSel ('Just "listen") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Host) :*: S1 ('MetaSel ('Just "advertise") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Host)))) :*: ((S1 ('MetaSel ('Just "peers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Host]) :*: S1 ('MetaSel ('Just "apiHost") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 IP)) :*: (S1 ('MetaSel ('Just "apiPort") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 PortNumber) :*: (S1 ('MetaSel ('Just "tlsCertPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe FilePath)) :*: S1 ('MetaSel ('Just "tlsKeyPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe FilePath)))))) :*: (((S1 ('MetaSel ('Just "monitoringPort") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe PortNumber)) :*: S1 ('MetaSel ('Just "hydraSigningKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 FilePath)) :*: (S1 ('MetaSel ('Just "hydraVerificationKeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [FilePath]) :*: S1 ('MetaSel ('Just "persistenceDir") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 FilePath))) :*: ((S1 ('MetaSel ('Just "persistenceRotateAfter") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (Positive Natural))) :*: S1 ('MetaSel ('Just "chainConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ChainConfig)) :*: (S1 ('MetaSel ('Just "ledgerConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 LedgerConfig) :*: (S1 ('MetaSel ('Just "whichEtcd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 WhichEtcd) :*: S1 ('MetaSel ('Just "apiTransactionTimeout") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ApiTransactionTimeout)))))))

newtype BlockfrostOptions Source #

Constructors

BlockfrostOptions 

Instances

Instances details
FromJSON BlockfrostOptions Source # 
Instance details

Defined in Hydra.Options

ToJSON BlockfrostOptions Source # 
Instance details

Defined in Hydra.Options

Semigroup BlockfrostOptions Source # 
Instance details

Defined in Hydra.Options

Generic BlockfrostOptions Source # 
Instance details

Defined in Hydra.Options

Associated Types

type Rep BlockfrostOptions :: Type -> Type Source #

Show BlockfrostOptions Source # 
Instance details

Defined in Hydra.Options

Eq BlockfrostOptions Source # 
Instance details

Defined in Hydra.Options

type Rep BlockfrostOptions Source # 
Instance details

Defined in Hydra.Options

type Rep BlockfrostOptions = D1 ('MetaData "BlockfrostOptions" "Hydra.Options" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'True) (C1 ('MetaCons "BlockfrostOptions" 'PrefixI 'True) (S1 ('MetaSel ('Just "projectPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)))

data CardanoChainConfig Source #

Constructors

CardanoChainConfig 

Fields

Instances

Instances details
FromJSON CardanoChainConfig Source # 
Instance details

Defined in Hydra.Options

ToJSON CardanoChainConfig Source # 
Instance details

Defined in Hydra.Options

Semigroup CardanoChainConfig Source # 
Instance details

Defined in Hydra.Options

Generic CardanoChainConfig Source # 
Instance details

Defined in Hydra.Options

Associated Types

type Rep CardanoChainConfig :: Type -> Type Source #

Show CardanoChainConfig Source # 
Instance details

Defined in Hydra.Options

Eq CardanoChainConfig Source # 
Instance details

Defined in Hydra.Options

type Rep CardanoChainConfig Source # 
Instance details

Defined in Hydra.Options

type Rep CardanoChainConfig = D1 ('MetaData "CardanoChainConfig" "Hydra.Options" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "CardanoChainConfig" 'PrefixI 'True) (((S1 ('MetaSel ('Just "hydraScriptsTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [TxId]) :*: S1 ('MetaSel ('Just "cardanoSigningKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 FilePath)) :*: (S1 ('MetaSel ('Just "cardanoVerificationKeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [FilePath]) :*: S1 ('MetaSel ('Just "startChainFrom") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ChainPoint)))) :*: ((S1 ('MetaSel ('Just "contestationPeriod") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ContestationPeriod) :*: S1 ('MetaSel ('Just "depositPeriod") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 DepositPeriod)) :*: (S1 ('MetaSel ('Just "depositActivation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 DepositPeriod) :*: (S1 ('MetaSel ('Just "unsyncedPeriod") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UnsyncedPeriod) :*: S1 ('MetaSel ('Just "chainBackendOptions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ChainBackendOptions))))))

data ChainBackendOptions Source #

Instances

Instances details
FromJSON ChainBackendOptions Source # 
Instance details

Defined in Hydra.Options

ToJSON ChainBackendOptions Source # 
Instance details

Defined in Hydra.Options

Semigroup ChainBackendOptions Source # 
Instance details

Defined in Hydra.Options

Generic ChainBackendOptions Source # 
Instance details

Defined in Hydra.Options

Associated Types

type Rep ChainBackendOptions :: Type -> Type Source #

Show ChainBackendOptions Source # 
Instance details

Defined in Hydra.Options

Eq ChainBackendOptions Source # 
Instance details

Defined in Hydra.Options

type Rep ChainBackendOptions Source # 
Instance details

Defined in Hydra.Options

type Rep ChainBackendOptions = D1 ('MetaData "ChainBackendOptions" "Hydra.Options" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "Direct" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 DirectOptions)) :+: C1 ('MetaCons "Blockfrost" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 BlockfrostOptions)))

data DirectOptions Source #

Constructors

DirectOptions 

Fields

  • networkId :: NetworkId

    Network identifier to which we expect to connect.

  • nodeSocket :: SocketPath

    Path to a domain socket used to connect to the server.

Instances

Instances details
FromJSON DirectOptions Source # 
Instance details

Defined in Hydra.Options

Methods

parseJSON :: Value -> Parser DirectOptions

parseJSONList :: Value -> Parser [DirectOptions]

omittedField :: Maybe DirectOptions

ToJSON DirectOptions Source # 
Instance details

Defined in Hydra.Options

Semigroup DirectOptions Source # 
Instance details

Defined in Hydra.Options

Generic DirectOptions Source # 
Instance details

Defined in Hydra.Options

Associated Types

type Rep DirectOptions :: Type -> Type Source #

Show DirectOptions Source # 
Instance details

Defined in Hydra.Options

Eq DirectOptions Source # 
Instance details

Defined in Hydra.Options

type Rep DirectOptions Source # 
Instance details

Defined in Hydra.Options

type Rep DirectOptions = D1 ('MetaData "DirectOptions" "Hydra.Options" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "DirectOptions" 'PrefixI 'True) (S1 ('MetaSel ('Just "networkId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 NetworkId) :*: S1 ('MetaSel ('Just "nodeSocket") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SocketPath)))

data OfflineChainConfig Source #

Constructors

OfflineChainConfig 

Fields

Instances

Instances details
FromJSON OfflineChainConfig Source # 
Instance details

Defined in Hydra.Options

ToJSON OfflineChainConfig Source # 
Instance details

Defined in Hydra.Options

Generic OfflineChainConfig Source # 
Instance details

Defined in Hydra.Options

Associated Types

type Rep OfflineChainConfig :: Type -> Type Source #

Show OfflineChainConfig Source # 
Instance details

Defined in Hydra.Options

Eq OfflineChainConfig Source # 
Instance details

Defined in Hydra.Options

type Rep OfflineChainConfig Source # 
Instance details

Defined in Hydra.Options

type Rep OfflineChainConfig = D1 ('MetaData "OfflineChainConfig" "Hydra.Options" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "OfflineChainConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "offlineHeadSeed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadSeed) :*: (S1 ('MetaSel ('Just "initialUTxOFile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 FilePath) :*: S1 ('MetaSel ('Just "ledgerGenesisFile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe FilePath)))))

data ChainConfig Source #

Instances

Instances details
FromJSON ChainConfig Source # 
Instance details

Defined in Hydra.Options

Methods

parseJSON :: Value -> Parser ChainConfig

parseJSONList :: Value -> Parser [ChainConfig]

omittedField :: Maybe ChainConfig

ToJSON ChainConfig Source # 
Instance details

Defined in Hydra.Options

Methods

toJSON :: ChainConfig -> Value

toEncoding :: ChainConfig -> Encoding

toJSONList :: [ChainConfig] -> Value

toEncodingList :: [ChainConfig] -> Encoding

omitField :: ChainConfig -> Bool

Semigroup ChainConfig Source # 
Instance details

Defined in Hydra.Options

Generic ChainConfig Source # 
Instance details

Defined in Hydra.Options

Associated Types

type Rep ChainConfig :: Type -> Type Source #

Show ChainConfig Source # 
Instance details

Defined in Hydra.Options

Eq ChainConfig Source # 
Instance details

Defined in Hydra.Options

type Rep ChainConfig Source # 
Instance details

Defined in Hydra.Options

newtype LedgerConfig Source #

Instances

Instances details
FromJSON LedgerConfig Source # 
Instance details

Defined in Hydra.Options

Methods

parseJSON :: Value -> Parser LedgerConfig

parseJSONList :: Value -> Parser [LedgerConfig]

omittedField :: Maybe LedgerConfig

ToJSON LedgerConfig Source # 
Instance details

Defined in Hydra.Options

Methods

toJSON :: LedgerConfig -> Value

toEncoding :: LedgerConfig -> Encoding

toJSONList :: [LedgerConfig] -> Value

toEncodingList :: [LedgerConfig] -> Encoding

omitField :: LedgerConfig -> Bool

Semigroup LedgerConfig Source # 
Instance details

Defined in Hydra.Options

Generic LedgerConfig Source # 
Instance details

Defined in Hydra.Options

Associated Types

type Rep LedgerConfig :: Type -> Type Source #

Show LedgerConfig Source # 
Instance details

Defined in Hydra.Options

Eq LedgerConfig Source # 
Instance details

Defined in Hydra.Options

type Rep LedgerConfig Source # 
Instance details

Defined in Hydra.Options

type Rep LedgerConfig = D1 ('MetaData "LedgerConfig" "Hydra.Options" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'True) (C1 ('MetaCons "CardanoLedgerConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "cardanoLedgerProtocolParametersFile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)))

data PublishOptions Source #

Instances

Instances details
Generic PublishOptions Source # 
Instance details

Defined in Hydra.Options

Associated Types

type Rep PublishOptions :: Type -> Type Source #

Show PublishOptions Source # 
Instance details

Defined in Hydra.Options

Eq PublishOptions Source # 
Instance details

Defined in Hydra.Options

type Rep PublishOptions Source # 
Instance details

Defined in Hydra.Options

type Rep PublishOptions = D1 ('MetaData "PublishOptions" "Hydra.Options" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "PublishOptions" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainBackendOptions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ChainBackendOptions) :*: S1 ('MetaSel ('Just "publishSigningKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 FilePath)))

toArgs :: RunOptions -> [String] Source #

Convert an Options instance into the corresponding list of command-line arguments.

This is useful in situations where one wants to programmatically define Options, providing some measure of type safety, without having to juggle with strings.

defaultContestationPeriod :: ContestationPeriod Source #

Default contestation period of 12 hours, aligned with Cardano's safe zone on mainnet. The safe zone is approximately 3 * k / f where k = 2160 (security parameter) and f = 0.05 (active slot coefficient), ensuring finality guarantees. See: https://github.com/cardano-scaling/hydra/issues/2389

defaultDepositPeriod :: DepositPeriod Source #

defaultRunOptions :: RunOptions Source #

Default options as they should also be provided by runOptionsParser.

validateRunOptions :: RunOptions -> Either InvalidOptions () Source #

Validate cmd line arguments for hydra-node and check if they make sense before actually running the node. Rules we apply: - Check if number of parties is bigger than our hardcoded limit (by looking at loaded hydra or cardano keys and comparing it to the maximumNumberOfParties) - Check that number of loaded hydra keys match with the number of loaded cardano keys (by comparing lengths of the two lists)

subcommandNames :: [String] Source #

Subcommand names recognized by commandParser.

Derived from the same string literals used to register the subcommands below, so that hs can't drift out of sync with the parser when a new subcommand is added.

runOptionsParser :: Parser RunOptions Source #

Parser for running the cardano-node with all its RunOptions.

overrideField :: Eq a => a -> a -> a -> a Source #

Use cli if it differs from def, otherwise keep base.

Note: if the user explicitly passes a CLI flag whose value happens to equal the default (e.g. --api-port 4001 when 4001 is the default), the config file value wins. This is a known limitation of inferring intent from equality with the default; a proper fix would require tracking which flags were explicitly set (e.g. via Maybe-wrapped parser results).

networkIdParser :: Parser NetworkId Source #

nodeSocketParser :: Parser SocketPath Source #

defaultUnsyncedPeriod :: UnsyncedPeriod Source #

Default unsynced period, computed as half of the default contestation period.

offlineHeadSeedParser :: Parser HeadSeed Source #

startChainFromParser :: Parser ChainPoint Source #

contestationPeriodParser :: Parser ContestationPeriod Source #

depositPeriodParser :: Parser DepositPeriod Source #

depositActivationParser :: Parser DepositPeriod Source #

parseHydraCommandFromArgs :: [String] -> ParserResult Command Source #

Pure parsing of Option from a list of arguments.

parseHydraCommandFromArgsWith :: [String] -> IO Command Source #

Parse the given list of arguments, exiting on failure.

toArgNetworkId :: NetworkId -> [String] Source #

toArgNodeSocket :: SocketPath -> [String] Source #

data ParserResult a #

Constructors

Success a 
Failure (ParserFailure ParserHelp) 
CompletionInvoked CompletionResult 

Instances

Instances details
Applicative ParserResult 
Instance details

Defined in Options.Applicative.Types

Functor ParserResult 
Instance details

Defined in Options.Applicative.Types

Methods

fmap :: (a -> b) -> ParserResult a -> ParserResult b Source #

(<$) :: a -> ParserResult b -> ParserResult a Source #

Monad ParserResult 
Instance details

Defined in Options.Applicative.Types

Show a => Show (ParserResult a) 
Instance details

Defined in Options.Applicative.Types

renderFailure :: ParserFailure ParserHelp -> String -> (String, ExitCode) #

Orphan instances

FromJSON a => FromJSON (Positive a) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (Positive a)

parseJSONList :: Value -> Parser [Positive a]

omittedField :: Maybe (Positive a)

ToJSON a => ToJSON (Positive a) Source # 
Instance details

Methods

toJSON :: Positive a -> Value

toEncoding :: Positive a -> Encoding

toJSONList :: [Positive a] -> Value

toEncodingList :: [Positive a] -> Encoding

omitField :: Positive a -> Bool