Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Cooked.Attack.DoubleSat
Contents
Description
This module provides an automated attack to try and perform double satisfaction on a contract.
Synopsis
- type DoubleSatDelta = (Map TxOutRef TxSkelRedeemer, [TxSkelOut], TxSkelMints)
- data DoubleSatLbl = DoubleSatLbl
- doubleSatAttack :: (MonadTweak m, Eq is, Is k A_Traversal) => ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel a -> (is -> a -> m [(a, DoubleSatDelta)]) -> Wallet -> m ()
Documentation
type DoubleSatDelta = (Map TxOutRef TxSkelRedeemer, [TxSkelOut], TxSkelMints) Source #
A triple of transaction inputs, transaction outputs, and minted value. This is what we can add to the transaction in order to try a double satisfaction attack.
data DoubleSatLbl Source #
Constructors
DoubleSatLbl |
Instances
Show DoubleSatLbl Source # | |
Defined in Cooked.Attack.DoubleSat Methods showsPrec :: Int -> DoubleSatLbl -> ShowS # show :: DoubleSatLbl -> String # showList :: [DoubleSatLbl] -> ShowS # | |
PrettyCooked DoubleSatLbl Source # | |
Defined in Cooked.Attack.DoubleSat Methods prettyCooked :: DoubleSatLbl -> DocCooked Source # prettyCookedOpt :: PrettyCookedOpts -> DoubleSatLbl -> DocCooked Source # | |
Eq DoubleSatLbl Source # | |
Defined in Cooked.Attack.DoubleSat | |
Ord DoubleSatLbl Source # | |
Defined in Cooked.Attack.DoubleSat Methods compare :: DoubleSatLbl -> DoubleSatLbl -> Ordering # (<) :: DoubleSatLbl -> DoubleSatLbl -> Bool # (<=) :: DoubleSatLbl -> DoubleSatLbl -> Bool # (>) :: DoubleSatLbl -> DoubleSatLbl -> Bool # (>=) :: DoubleSatLbl -> DoubleSatLbl -> Bool # max :: DoubleSatLbl -> DoubleSatLbl -> DoubleSatLbl # min :: DoubleSatLbl -> DoubleSatLbl -> DoubleSatLbl # |
Arguments
:: (MonadTweak m, Eq is, Is k A_Traversal) | |
=> ([is] -> [[is]]) | how to combine modifications from caused by different foci. See
the comment at |
-> Optic' k (WithIx is) TxSkel a | Each focus of this optic is a potential reason to add some extra constraints. As an example, one could go through the txSkelOutsL % itaversed % txSkelOutputToTypedValidatorP @t |
-> (is -> a -> m [(a, DoubleSatDelta)]) | How to change each focus, and which inputs, outputs, and mints to add, for each of the foci. There might be different options for each focus, that's why the return value is a list. Continuing the example, for each of the focused ################################### ATTENTION: If you modify the state while computing these lists,
the behaviour of the TODO: Make this interface safer, for example by using (some kind
of) an ################################### |
-> Wallet | The wallet of the attacker, where any surplus is paid to. In the example, the extra value in the added |
-> m () |
Double satisfaction attack. See the comment above for what such an attack is about conceptually.
This attack consists in adding some extra constraints to a transaction, and hoping that the additional minting policies or validator scripts thereby involved are fooled by what's already present on the transaction. Any extra value contained in new inputs to the transaction is then paid to the attacker.
Orphan instances
Monoid DoubleSatDelta Source # | |
Methods mappend :: DoubleSatDelta -> DoubleSatDelta -> DoubleSatDelta # mconcat :: [DoubleSatDelta] -> DoubleSatDelta # | |
Semigroup DoubleSatDelta Source # | |
Methods (<>) :: DoubleSatDelta -> DoubleSatDelta -> DoubleSatDelta # sconcat :: NonEmpty DoubleSatDelta -> DoubleSatDelta # stimes :: Integral b => b -> DoubleSatDelta -> DoubleSatDelta # |