| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Cluster.Scenarios
Synopsis
- oneOfThreeNodesStopsForAWhile :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- headIsOpenWith :: Set Party -> Value -> Maybe HeadId
- refuelIfNeeded :: Tracer IO EndToEndLog -> ChainBackendOptions -> Actor -> Coin -> IO ()
- returnFundsToFaucet :: Tracer IO EndToEndLog -> ChainBackendOptions -> Actor -> IO ()
- restartedNodeCanObserveCommitTx :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- resumeFromLatestKnownPoint :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- restartedNodeCanClose :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- nodeReObservesOnChainTxs :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- hydraNodeBaseUrl :: HydraClient -> String
- headIsFinalizedWith :: HeadId -> UTxO -> Value -> Maybe ()
- singlePartyHeadFullLifeCycle :: Tracer IO EndToEndLog -> FilePath -> (BlockTime -> Timing) -> ChainBackendOptions -> [TxId] -> IO ()
- refuelAndSeed :: Tracer IO EndToEndLog -> ChainBackendOptions -> Actor -> Coin -> [(VerificationKey PaymentKey, Value)] -> IO [UTxO]
- hydraApiPort :: HydraClient -> Option scheme
- singlePartyOpenAHead :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> Maybe (Positive Natural) -> (HydraClient -> Secret (SigningKey PaymentKey) -> HeadId -> IO a) -> IO a
- canDeposit :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- singlePartyUsesScriptOnL2 :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- recomputeIntegrityHash :: (AlonzoEraPParams ppera, AlonzoEraTxWits txera, AlonzoEraTxBody txera, EraTx txera) => PParams ppera -> [Language] -> Tx TopTx txera -> Tx TopTx txera
- singlePartyMintsTokensOnL2 :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- singlePartyFansOutTokensMintedOnL1 :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- singlePartyUsesWithdrawZeroTrick :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- canDepositScriptBlueprint :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- persistenceCanLoadWithNothingCommitted :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- canCloseWithLongContestationPeriod :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- canSubmitTransactionThroughAPI :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- expectErrorStatus :: Int -> Maybe ByteString -> HttpException -> Bool
- threeNodesNoErrorsOnOpen :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- nodeCanSupportMultipleEtcdClusters :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- initWithWrongKeys :: FilePath -> Tracer IO EndToEndLog -> ChainBackendOptions -> [TxId] -> IO ()
- initWithDifferentDepositPeriod :: FilePath -> Tracer IO EndToEndLog -> ChainBackendOptions -> [TxId] -> IO ()
- startWithWrongPeers :: FilePath -> Tracer IO EndToEndLog -> ChainBackendOptions -> [TxId] -> IO ()
- canDepositConcurrently :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- canDepositPartially :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- canRecoverDeposit :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- canRecoverDepositInAnyState :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- canDecommit :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- canSideLoadSnapshot :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- canResumeOnMemberAlreadyBootstrapped :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- waitsForChainInSync :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- threeNodesWithMirrorParty :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO ()
- respendNTimes :: HasCallStack => HydraClient -> Secret (SigningKey PaymentKey) -> DiffTime -> Int -> IO ()
- data EndToEndLog
- = ClusterOptions { }
- | FromCardanoNode NodeLog
- | FromFaucet FaucetLog
- | FromHydraNode HydraNodeLog
- | FromMithril MithrilLog
- | StartingFunds { }
- | RefueledFunds {
- actor :: String
- refuelingAmount :: Coin
- utxo :: UTxO
- | RemainingFunds { }
- | PublishedHydraScriptsAt {
- hydraScriptsTxId :: [TxId]
- | UsingHydraScriptsAt {
- hydraScriptsTxId :: [TxId]
- | CreatedKey { }
Documentation
oneOfThreeNodesStopsForAWhile :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
headIsOpenWith :: Set Party -> Value -> Maybe HeadId Source #
refuelIfNeeded :: Tracer IO EndToEndLog -> ChainBackendOptions -> Actor -> Coin -> IO () Source #
Refuel given Actor with given Lovelace if current marked UTxO is below that amount.
returnFundsToFaucet :: Tracer IO EndToEndLog -> ChainBackendOptions -> Actor -> IO () Source #
Return the remaining funds to the faucet
restartedNodeCanObserveCommitTx :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
resumeFromLatestKnownPoint :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
restartedNodeCanClose :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
nodeReObservesOnChainTxs :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
hydraNodeBaseUrl :: HydraClient -> String Source #
Get the base URL for HTTP API calls to a hydra-node, using the actual
API port the node was started on (allocated dynamically by
allocateHydraNodePorts).
headIsFinalizedWith :: HeadId -> UTxO -> Value -> Maybe () Source #
singlePartyHeadFullLifeCycle Source #
Arguments
| :: Tracer IO EndToEndLog | |
| -> FilePath | |
| -> (BlockTime -> Timing) | How to derive the timing parameters from the chain's block time. |
| -> ChainBackendOptions | |
| -> [TxId] | |
| -> IO () |
Step through the full life cycle of a Hydra Head with only a single
participant. This scenario is also used by the smoke test run via the
`hydra-cluster` executable, which passes mkSmokeTiming rather than
mkTestTiming on the networks where the protocol waits dominate.
Arguments
| :: Tracer IO EndToEndLog | |
| -> ChainBackendOptions | |
| -> Actor | |
| -> Coin | Amount the actor is to hold before the scenario starts. |
| -> [(VerificationKey PaymentKey, Value)] | Further keys to seed, and the value each is to receive. |
| -> IO [UTxO] | The seeded UTxO of each further key, in the order given. |
Like refuelIfNeeded, but seeds further keys from the same faucet
transaction and returns their UTxO. Each faucet transaction costs an on-chain
confirmation, a block time on a public network, so a scenario needing several
funded keys is better off asking for them together.
hydraApiPort :: HydraClient -> Option scheme Source #
An Option carrying a hydra-node's actual API port. Use to set
the port in a req call.
Arguments
| :: Tracer IO EndToEndLog | |
| -> FilePath | |
| -> ChainBackendOptions | |
| -> [TxId] | |
| -> Maybe (Positive Natural) | |
| -> (HydraClient -> Secret (SigningKey PaymentKey) -> HeadId -> IO a) | Continuation called when the head is open |
| -> IO a |
Open a Hydra Head with only a single participant but some arbitrary UTxO committed.
canDeposit :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Single hydra-node where the deposit is done using some wallet UTxO.
singlePartyUsesScriptOnL2 :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
recomputeIntegrityHash :: (AlonzoEraPParams ppera, AlonzoEraTxWits txera, AlonzoEraTxBody txera, EraTx txera) => PParams ppera -> [Language] -> Tx TopTx txera -> Tx TopTx txera Source #
Compute the integrity hash of a transaction using a list of plutus languages.
singlePartyMintsTokensOnL2 :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Open a head, mint tokens on L2 using a dummy minting policy and observe
what happens on fanout: the minted tokens exist on L2 but never entered the
head output on L1, so no fanout transaction can distribute them and the head
cannot be finalized (see
https://github.com/cardano-scaling/hydra/issues/2334). The node reports this
as a PostTxOnChainFailed and keeps running.
singlePartyFansOutTokensMintedOnL1 :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Mint tokens on L1 using a dummy minting policy, deposit them into an open head and fan out. Tokens which entered the head output on L1 are distributed by the fanout transaction like any other value.
singlePartyUsesWithdrawZeroTrick :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Open a head and run a script using Rewarding script purpose and a zero
lovelace withdrawal.
canDepositScriptBlueprint :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
persistenceCanLoadWithNothingCommitted :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
canCloseWithLongContestationPeriod :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Close a head whose contestation period is a week, on a real node started from the chain tip.
Not reducible to a unit test: the point is that
calculateTxUpperBoundFromContestationPeriod caps the close transaction's
upper validity bound at maxGraceTime, keeping it inside the ledger's
forecast horizon. StateSpec's close properties pass their validity bounds in
directly and never reach that code, and the io-sim tests install an era
history without a horizon, so only a real node exercises it.
canSubmitTransactionThroughAPI :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Arguments
| :: Int | Expected http status code |
| -> Maybe ByteString | Optional string expected to be present somewhere in the response body |
| -> HttpException | Expected exception |
| -> Bool |
threeNodesNoErrorsOnOpen :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Three hydra nodes open a head and we assert that none of them sees errors. This was particularly misleading when everyone tries to post the collect transaction concurrently.
nodeCanSupportMultipleEtcdClusters :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Hydra nodes ABC run on ABC cluster and connect to each other. Hydra nodes BC shut down. Hydra nodes BC run on BC cluster and connect to each other. Hydra nodes BC shut down. Hydra nodes BC run and connect ABC cluster again.
initWithWrongKeys :: FilePath -> Tracer IO EndToEndLog -> ChainBackendOptions -> [TxId] -> IO () Source #
Two hydra node setup where Alice is wrongly configured to use Carol's
cardano keys instead of Bob's which will prevent him to be notified the
HeadIsInitializing but he should still receive some notification.
initWithDifferentDepositPeriod :: FilePath -> Tracer IO EndToEndLog -> ChainBackendOptions -> [TxId] -> IO () Source #
Scenario for a deposit-period mismatch between peers: alice initializes a head while bob is configured with a different --deposit-period, so bob's node must ignore the head entirely (issue #2664).
startWithWrongPeers :: FilePath -> Tracer IO EndToEndLog -> ChainBackendOptions -> [TxId] -> IO () Source #
canDepositConcurrently :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Open a a two participant head, deposit funds to it and distribute them on fanout.
canDepositPartially :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Open a single participant head and deposit part of a UTxO, with the
remainder returned to a change address. This exercises the changeAddress
balancing path in the deposit blueprint API.
canRecoverDeposit :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Open a a single participant head, deposit and then recover it.
canRecoverDepositInAnyState :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Open a single-participant head, perform 3 deposits, and then: 1. Close the head and recover deposit #1 2. Fanout the head and recover deposit #2 3. Open a new head and recover deposit #3
canDecommit :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Open a a single participant head with some UTxO and incrementally decommit it.
canSideLoadSnapshot :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Integration test for the SideLoadSnapshot API: open a single-party head, deposit UTxO, side-load the deposit snapshot, then spend the deposited UTxO. This exercises the real Cardano ledger and network to ensure the API inputs and outputs are wired up correctly. The consensus-resumption logic is covered by the BehaviorSpec unit tests.
canResumeOnMemberAlreadyBootstrapped :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
waitsForChainInSync :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
threeNodesWithMirrorParty :: Tracer IO EndToEndLog -> FilePath -> ChainBackendOptions -> [TxId] -> IO () Source #
Three hydra nodes open a head and we assert that none of them sees errors if a party is duplicated.
respendNTimes :: HasCallStack => HydraClient -> Secret (SigningKey PaymentKey) -> DiffTime -> Int -> IO () Source #
Respend all outputs owned by a given key in the head every delay seconds,
for numTimes times.
data EndToEndLog Source #
Constructors
| ClusterOptions | |
| FromCardanoNode NodeLog | |
| FromFaucet FaucetLog | |
| FromHydraNode HydraNodeLog | |
| FromMithril MithrilLog | |
| StartingFunds | |
| RefueledFunds | |
Fields
| |
| RemainingFunds | |
| PublishedHydraScriptsAt | |
Fields
| |
| UsingHydraScriptsAt | |
Fields
| |
| CreatedKey | |