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 triplet 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 #
A label that is added to a TxSkel
that has successfully been modified by
the doubleSatAttack
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. |
-> (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 script outputs, you might want to try adding some script inputs to the transaction. Since it might be interesting to try different redeemers on these extra script inputs, you can just provide a list of all the options you want to try adding for a given script output that's already on the transaction. ################################### 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 input will be paid to the attacker. |
-> 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 # |