cooked-validators
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.Attack.DatumHijacking

Description

This module provides an attack to try and redirect selectable outputs to a given thief target.

Synopsis

Datum hijacking params

data DatumHijackingParams owner f k is Source #

Parameters of the datum hijacking attacks

Constructors

DatumHijackingParams 

Fields

  • dhpBranching :: Branching

    The branching policy to use when several outputs are targeted

  • dhpOptic :: Optic' k is TxSkel TxSkelOut

    The optic selecting the outputs eligible for redirection, directly from the skeleton. Only outputs focused by this optic are redirected.

  • dhpNewOwner :: TxSkelOut -> f owner

    Returns the new owner (embedded in f) of a targeted output. The f allows this computation to fail or branch, offering an extra layer of selection and multiplication on top of dhpOptic.

  • dhpIndexPred :: Int -> Bool

    The redirection described by the previous arguments might apply to more than one of the outputs of the transaction. Use this predicate to select which of the redirectable outputs to actually redirect. We count the redirectable outputs from the left to the right, starting with zero.

typedByDatumHijackingParams :: forall (oldOwner :: Type) owner. Typeable oldOwner => Branching -> owner -> DatumHijackingParams owner Maybe A_Traversal NoIx Source #

Datum hijacking parameters targeting all the outputs owned by a certain type of owner.

ownedByDatumHijackingParams :: forall oldOwner owner. (Typeable oldOwner, Eq oldOwner) => Branching -> oldOwner -> owner -> DatumHijackingParams owner Maybe A_Traversal NoIx Source #

Datum hijacking parameters targeting all the outputs owned by a given user.

scriptsDatumHijackingParams :: Branching -> owner -> DatumHijackingParams owner Maybe A_Traversal NoIx Source #

Datum hijacking parameters targeting all the outputs owned by a script.

defaultDatumHijackingParams :: Is k An_AffineFold => Branching -> Optic' k is TxSkelOut a -> owner -> DatumHijackingParams owner Maybe A_Traversal NoIx Source #

Hijacks all the outputs for which the focus of a given optic exist. Returns the list of hijacked outputs, as they were before being hijacked.

datumOfDatumHijackingParams :: forall dat owner. DatumConstrs dat => Branching -> owner -> DatumHijackingParams owner Maybe A_Traversal NoIx Source #

Datum hijacking parameters targeting all the outputs with a certain type of datum.

outPredDatumHijackingParams :: Branching -> (TxSkelOut -> Bool) -> owner -> DatumHijackingParams owner Maybe A_Traversal NoIx Source #

Targets all the outputs satisfying a given predicate

Datum hijacking label

newtype DatumHijackingLabel Source #

A label added to a TxSkel on which a tweak hijacking a datum has been applied. The label contains all the outputs that have been hijacked, before the hijacking happened.

Datum hijacking attack

datumHijackingAttack :: (Members '[NonDet, Tweak] effs, IsTxSkelOutAllowedOwner owner, Is k A_Traversal, Foldable f, Alternative f) => DatumHijackingParams owner f k is -> Sem effs [TxSkelOut] Source #

Hijacks all the outputs from which a new owner can be computed, and whose indexes match a given predicate. Returns the list of hijacked outputs, as they were before being hijacked.