Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Hydra.Chain.Direct.Contract.Close
Synopsis
- healthyCloseTx :: (Tx, UTxO)
- healthyCloseInitialTx :: (Tx, UTxO)
- healthyCloseLowerBoundSlot :: SlotNo
- healthyCloseUpperBoundPointInTime :: PointInTime
- healthyOpenHeadTxIn :: TxIn
- healthyOpenHeadTxOut :: TxOut CtxUTxO
- healthySnapshot :: Snapshot Tx
- healthyCloseUTxO :: UTxO
- healthyCloseSnapshotNumber :: SnapshotNumber
- healthyOpenHeadDatum :: State
- healthyContestationPeriod :: ContestationPeriod
- healthyContestationPeriodSeconds :: Integer
- healthyUTxO :: UTxO
- somePartyCardanoVerificationKey :: VerificationKey PaymentKey
- healthySigningKeys :: [SigningKey HydraKey]
- healthyParties :: [Party]
- healthyOnChainParties :: [Party]
- healthySignature :: SnapshotNumber -> MultiSignature (Snapshot Tx)
- healthyContestationDeadline :: UTCTime
- healthyClosedUTxOHash :: BuiltinByteString
- healthyClosedUTxO :: UTxO
- data CloseMutation
- = NotContinueContract
- | MutateSignatureButNotSnapshotNumber
- | MutateSnapshotNumberButNotSignature
- | MutateSnapshotNumberToLessThanEqualZero
- | SnapshotNotSignedByAllParties
- | MutateRequiredSigner
- | MutateNoRequiredSigner
- | MutateMultipleRequiredSigner
- | MutateCloseUTxOHash
- | MutatePartiesInOutput
- | MutateHeadIdInOutput
- | MutateInfiniteLowerBound
- | MutateInfiniteUpperBound
- | MutateContestationDeadline
- | MutateValidityInterval
- | CloseFromDifferentHead
- | MutateTokenMintingOrBurning
- | MutateContesters
- | MutateValueInOutput
- genCloseMutation :: (Tx, UTxO) -> Gen SomeMutation
- data CloseInitialMutation = MutateCloseContestationDeadline'
- genCloseInitialMutation :: (Tx, UTxO) -> Gen SomeMutation
- genMutatedDeadline :: Gen POSIXTime
Documentation
healthyCloseTx :: (Tx, UTxO) Source #
Healthy close transaction for the generic case were we close a head after one or more snapshot have been agreed upon between the members.
healthyCloseInitialTx :: (Tx, UTxO) Source #
Healthy close transaction for the specific case were we close a head with the initial UtxO, that is, no snapshot have been agreed upon and signed by the head members yet.
healthyCloseLowerBoundSlot :: SlotNo Source #
healthyCloseUpperBoundPointInTime :: PointInTime Source #
healthyOpenHeadTxIn :: TxIn Source #
healthyOpenHeadTxOut :: TxOut CtxUTxO Source #
healthySnapshot :: Snapshot Tx Source #
healthyCloseUTxO :: UTxO Source #
healthyCloseSnapshotNumber :: SnapshotNumber Source #
healthyOpenHeadDatum :: State Source #
healthyContestationPeriod :: ContestationPeriod Source #
healthyUTxO :: UTxO Source #
somePartyCardanoVerificationKey :: VerificationKey PaymentKey Source #
healthySigningKeys :: [SigningKey HydraKey] Source #
healthyParties :: [Party] Source #
healthyOnChainParties :: [Party] Source #
healthySignature :: SnapshotNumber -> MultiSignature (Snapshot Tx) Source #
healthyContestationDeadline :: UTCTime Source #
healthyClosedUTxOHash :: BuiltinByteString Source #
healthyClosedUTxO :: UTxO Source #
data CloseMutation Source #
Constructors
NotContinueContract | Ensures collectCom does not allow any output address but νHead. |
MutateSignatureButNotSnapshotNumber | Ensures the snapshot signature is multisigned by all valid Head participants. Invalidates the tx by changing the redeemer signature but not the snapshot number in output head datum. |
MutateSnapshotNumberButNotSignature | Ensures the snapshot number is consistent with the signature. Invalidates the tx by changing the snapshot number in resulting head output but not the redeemer signature. |
MutateSnapshotNumberToLessThanEqualZero | Check that snapshot numbers <= 0 need to close the head with the initial UTxO hash. |
SnapshotNotSignedByAllParties | Ensures the close snapshot is multisigned by all Head participants by changing the parties in the input head datum. If they do not align the multisignature will not be valid anymore. |
MutateRequiredSigner | Ensures close is authenticated by a one of the Head members by changing the signer used on the tx to not be one of PTs. |
MutateNoRequiredSigner | Ensures close is authenticated by a one of the Head members by changing the signer used on the tx to be empty. |
MutateMultipleRequiredSigner | Ensures close is authenticated by a one of the Head members by changing the signer used on the tx to have multiple signers (including the signer to not fail for SignerIsNotAParticipant). |
MutateCloseUTxOHash | Invalidates the tx by changing the utxo hash in resulting head output. Ensures the output state is consistent with the redeemer. |
MutatePartiesInOutput | Ensures parties do not change between head input datum and head output datum. |
MutateHeadIdInOutput | Ensures headId do not change between head input datum and head output datum. |
MutateInfiniteLowerBound | Invalidates the tx by changing the lower bound to be non finite. |
MutateInfiniteUpperBound | Invalidates the tx by changing the upper bound to be non finite. |
MutateContestationDeadline | Invalidates the tx by changing the contestation deadline to not satisfy `contestationDeadline = upperBound + contestationPeriod`. |
MutateValidityInterval | Invalidates the tx by changing the lower and upper bound to be not bounded as per spec `upperBound - lowerBound <= contestationPeriod`. This also changes the resulting `head output` contestation deadline to be valid, so it satisfy `contestationDeadline = upperBound + contestationPeriod`. |
CloseFromDifferentHead | Ensure the Head cannot be closed with correct authentication from a different Head. We simulate this by changing the head policy id of the ST and PTs to be of a different head - a real attack would be to add inputs with those tokens on top of spending the head output, a bit like a double satisfaction attack. Note that the token name stays the same and consistent with the signer. This will cause authentication failure because the signer's PT, although with a consistent name, is not from the right head (has a different policy id than in the datum). |
MutateTokenMintingOrBurning | Minting or burning of tokens should not be possible in close. |
MutateContesters | Invalidates the tx by changing the contesters to be non empty. |
MutateValueInOutput | Invalidates the tx by changing output values arbitrarily to be different (not preserved) from the head. Ensures values are preserved between head input and output. |
Instances
genCloseMutation :: (Tx, UTxO) -> Gen SomeMutation Source #
data CloseInitialMutation Source #
Constructors
MutateCloseContestationDeadline' |
Instances
genCloseInitialMutation :: (Tx, UTxO) -> Gen SomeMutation Source #
Mutations for the specific case of closing with the intial state. We should probably validate all the mutation to this initial state but at least we keep this regression test as we stumbled upon problems with the following case. The nice thing to do would probably to generate either "normal" healthyCloseTx or or healthyCloseInitialTx and apply all the mutations to it but we didn't manage to do that right away.
genMutatedDeadline :: Gen POSIXTime Source #
Generate not acceptable, but interesting deadlines.