| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Cluster.Util
Description
Utilities used across hydra-cluster
Synopsis
- readConfigFile :: FilePath -> IO ByteString
- keysFor :: Actor -> IO (VerificationKey PaymentKey, Secret (SigningKey PaymentKey))
- createAndSaveSigningKey :: FilePath -> IO (Secret (SigningKey PaymentKey))
- type BlockTime = NominalDiffTime
- data Timing = Timing {
- blockTime :: BlockTime
- contestationPeriod :: ContestationPeriod
- depositPeriod :: DepositPeriod
- depositActivation :: DepositPeriod
- truncatedDepositPeriod :: NominalDiffTime -> DepositPeriod
- mkTestTiming :: BlockTime -> Timing
- mkTestTiming' :: Int -> BlockTime -> Timing
- depositTimeout :: Timing -> NominalDiffTime
- onChainObservationBudget :: NominalDiffTime -> NominalDiffTime
- nodeStartupBudget :: NominalDiffTime
- chainConfigFor :: HasCallStack => Actor -> FilePath -> ChainBackendOptions -> [TxId] -> [Actor] -> Timing -> IO ChainConfig
- chainConfigFor' :: HasCallStack => Actor -> FilePath -> ChainBackendOptions -> [TxId] -> [Actor] -> ContestationPeriod -> DepositPeriod -> DepositPeriod -> IO ChainConfig
- modifyConfig :: (CardanoChainConfig -> CardanoChainConfig) -> ChainConfig -> ChainConfig
- setNetworkId :: NetworkId -> ChainConfig -> ChainConfig
Documentation
readConfigFile :: FilePath -> IO ByteString Source #
Lookup a config file similar reading a file from disk.
If the env variable HYDRA_CONFIG_DIR is set, filenames will be
resolved relative to its value otherwise they will be looked up in the
package's data path.
keysFor :: Actor -> IO (VerificationKey PaymentKey, Secret (SigningKey PaymentKey)) Source #
Get the "well-known" keys for given actor. The signing key is
Secret-wrapped so callers cannot accidentally log or serialise it.
createAndSaveSigningKey :: FilePath -> IO (Secret (SigningKey PaymentKey)) Source #
Create and save new signing key at the provided path, returning the
key Secret-wrapped.
NOTE: Uses TextEnvelope format.
type BlockTime = NominalDiffTime Source #
Expected time between blocks (on average)
Timing parameters that determine the behavior of a (cluster of) hydra-node.
Constructors
| Timing | |
Fields
| |
truncatedDepositPeriod :: NominalDiffTime -> DepositPeriod Source #
Truncate a duration to a whole-second DepositPeriod.
mkTestTiming :: BlockTime -> Timing Source #
Set up reasonable timing parameters for testing given a BlockTime.
mkTestTiming' :: Int -> BlockTime -> Timing Source #
Like mkTestTiming but scales Timing by the number of concurrent
deposits expected. Each increment tx must be processed sequentially on-chain,
so N concurrent deposits require N times the base deposit period.
depositTimeout :: Timing -> NominalDiffTime Source #
Get a timeout until a deposit should have happened given a Timing. A
deposit becomes active after Timing and then needs about one
Timing to be picked up and incremented, so both are accounted for
(with the defaults where they are equal this is 2 * depositPeriod).
The slack term covers the two on-chain round trips (deposit and increment:
submit, include, observe) plus multi-node processing. Those costs are
dominated by fixed latencies, not by block time, so the slack has a
constant floor; with the devnet's 0.1s blocks a pure 5 * blockTime came
to 0.5s and timed out regularly on loaded CI runners.
onChainObservationBudget :: NominalDiffTime -> NominalDiffTime Source #
Budget for observing the effect of one L1 transaction on the API: submission, block inclusion, chain-follower observation and node processing. The constant floor covers the fixed latencies, which dominate at devnet block times; a pure blockTime multiple (e.g. a literal 3s) fired regularly on loaded CI runners.
nodeStartupBudget :: NominalDiffTime Source #
Budget for a hydra-node (re)start up to its Greetings. Process spawn, etcd bootstrap and websocket connect are fixed costs, unrelated to block time, so this is a constant.
Arguments
| :: HasCallStack | |
| => Actor | |
| -> FilePath | |
| -> ChainBackendOptions | |
| -> [TxId] | Transaction ids at which Hydra scripts should have been published. |
| -> [Actor] | |
| -> Timing | |
| -> IO ChainConfig |
Create a (test) chain config for a given actor.
Arguments
| :: HasCallStack | |
| => Actor | |
| -> FilePath | |
| -> ChainBackendOptions | |
| -> [TxId] | Transaction ids at which Hydra scripts should have been published. |
| -> [Actor] | |
| -> ContestationPeriod | |
| -> DepositPeriod | |
| -> DepositPeriod | Deposit activation, independent from the deposit period. |
| -> IO ChainConfig |
modifyConfig :: (CardanoChainConfig -> CardanoChainConfig) -> ChainConfig -> ChainConfig Source #
setNetworkId :: NetworkId -> ChainConfig -> ChainConfig Source #