| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cooked.Attack.DatumHijacking
Description
This module provides an automated attack to try and redirect outputs to a certain target with a similar datum type.
Synopsis
- redirectOutputTweakAll :: (MonadTweak m, IsTxSkelOutAllowedOwner owner) => (TxSkelOut -> Maybe owner) -> (Integer -> Bool) -> m ([TxSkelOut], [TxSkelOut])
- data DatumHijackingParams where
- DatumHijackingParams :: IsTxSkelOutAllowedOwner owner => {..} -> DatumHijackingParams
- newtype DatumHijackingLabel = DatumHijackingLabel [TxSkelOut]
- redirectOutputTweakAny :: (MonadTweak m, IsTxSkelOutAllowedOwner owner) => (TxSkelOut -> Maybe owner) -> (Integer -> Bool) -> m ([TxSkelOut], [TxSkelOut])
- datumHijackingAttack :: MonadTweak m => DatumHijackingParams -> m [TxSkelOut]
- ownedByDatumHijackingParams :: forall (oldOwner :: Type) owner. (IsTxSkelOutAllowedOwner owner, Typeable oldOwner) => owner -> DatumHijackingParams
- scriptsDatumHijackingParams :: IsTxSkelOutAllowedOwner owner => owner -> DatumHijackingParams
- defaultDatumHijackingParams :: (IsTxSkelOutAllowedOwner owner, Is k An_AffineFold) => Optic' k is TxSkelOut x -> owner -> DatumHijackingParams
- datumOfDatumHijackingParams :: forall dat owner. (IsTxSkelOutAllowedOwner owner, DatumConstrs dat) => owner -> DatumHijackingParams
- txSkelOutPredDatumHijackingParams :: IsTxSkelOutAllowedOwner owner => (TxSkelOut -> Bool) -> owner -> DatumHijackingParams
Documentation
redirectOutputTweakAll :: (MonadTweak m, IsTxSkelOutAllowedOwner owner) => (TxSkelOut -> Maybe owner) -> (Integer -> Bool) -> m ([TxSkelOut], [TxSkelOut]) Source #
Redirects, in the same transaction, all the outputs targetted by an output
and an index predicates. See DatumHijackingParams for more information on
those predicates. Returns a pair of the old outputs before they were
redirected, and the new updated list of outputs.
data DatumHijackingParams where Source #
Parameters of the datum hijacking attacks. They state precisely which outputs should have their owner changed, wich owner should be assigned, to each of these outputs, and whether several modified outputs should be combined in a single transaction, or instead spread out multiple branches.
Constructors
| DatumHijackingParams | |
Fields
| |
newtype DatumHijackingLabel Source #
The DatumHijackingLabel stores the outputs that have been redirected,
before their destination were changed.
Constructors
| DatumHijackingLabel [TxSkelOut] |
Instances
redirectOutputTweakAny :: (MonadTweak m, IsTxSkelOutAllowedOwner owner) => (TxSkelOut -> Maybe owner) -> (Integer -> Bool) -> m ([TxSkelOut], [TxSkelOut]) Source #
Redirects, each in their own transaction, all the outputs targetted by an
output and an index predicates. See DatumHijackingParams for more
information on those predicates.
datumHijackingAttack :: MonadTweak m => DatumHijackingParams -> m [TxSkelOut] Source #
A datum hijacking attack, simplified: This attack tries to substitute a
different recipient on certain outputs based on a DatumHijackingParams.
A DatumHijackingLabel is added to the labels of the TxSkel using
addLabelTweak. It contains the outputs that have been redirected, which
also corresponds to the returned value of this tweak. The tweak fails if no
such outputs have been redirected.
ownedByDatumHijackingParams :: forall (oldOwner :: Type) owner. (IsTxSkelOutAllowedOwner owner, Typeable oldOwner) => owner -> DatumHijackingParams Source #
Datum hijacking parameters targetting all the outputs owned by a certain type of owner, and redirecting each of them in a separate transaction.
scriptsDatumHijackingParams :: IsTxSkelOutAllowedOwner owner => owner -> DatumHijackingParams Source #
Datum hijacking parameters targetting all the outputs owned by a script, and redirecting each of them in a separate transaction.
defaultDatumHijackingParams :: (IsTxSkelOutAllowedOwner owner, Is k An_AffineFold) => Optic' k is TxSkelOut x -> owner -> DatumHijackingParams Source #
Targets all the outputs for which the focus of a given optic exists, and redirects each of them in a separate transaction.
datumOfDatumHijackingParams :: forall dat owner. (IsTxSkelOutAllowedOwner owner, DatumConstrs dat) => owner -> DatumHijackingParams Source #
Datum hijacking parameters targetting all the outputs with a certain type of datum, and redirecting each of them in a separate transaction.
txSkelOutPredDatumHijackingParams :: IsTxSkelOutAllowedOwner owner => (TxSkelOut -> Bool) -> owner -> DatumHijackingParams Source #
Targets all the outputs satisfying a given predicate, and redirects each of them in a separate transaction.