Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module provide tweaks to tamper with output datums in a typed manner. There are many use cases where slight changes in datum can have a drastic effect on the bahavior of a contract, and can be unchecked. Here is the way to test those cases.
Synopsis
- tamperDatumTweak :: forall a m. (MonadTweak m, Show a, PrettyCooked a, ToData a, FromData a, Typeable a) => (a -> Maybe a) -> m [a]
- data TamperDatumLbl = TamperDatumLbl
- malformDatumTweak :: forall a m. (MonadTweak m, ToData a, FromData a, Typeable a) => (a -> [BuiltinData]) -> m ()
- data MalformDatumLbl = MalformDatumLbl
Documentation
:: forall a m. (MonadTweak m, Show a, PrettyCooked a, ToData a, FromData a, Typeable a) | |
=> (a -> Maybe a) | Use this function to return |
-> m [a] |
A tweak that tries to change the datum on outputs carrying datums of a certain type with a prescribed tampering function.
The tweak returns a list of the modified datums, as they were *before* the modification was applied to them.
data TamperDatumLbl Source #
Instances
Show TamperDatumLbl Source # | |
Defined in Cooked.Tweak.TamperDatum showsPrec :: Int -> TamperDatumLbl -> ShowS # show :: TamperDatumLbl -> String # showList :: [TamperDatumLbl] -> ShowS # | |
PrettyCooked TamperDatumLbl Source # | |
Defined in Cooked.Tweak.TamperDatum | |
Eq TamperDatumLbl Source # | |
Defined in Cooked.Tweak.TamperDatum (==) :: TamperDatumLbl -> TamperDatumLbl -> Bool # (/=) :: TamperDatumLbl -> TamperDatumLbl -> Bool # | |
Ord TamperDatumLbl Source # | |
Defined in Cooked.Tweak.TamperDatum compare :: TamperDatumLbl -> TamperDatumLbl -> Ordering # (<) :: TamperDatumLbl -> TamperDatumLbl -> Bool # (<=) :: TamperDatumLbl -> TamperDatumLbl -> Bool # (>) :: TamperDatumLbl -> TamperDatumLbl -> Bool # (>=) :: TamperDatumLbl -> TamperDatumLbl -> Bool # max :: TamperDatumLbl -> TamperDatumLbl -> TamperDatumLbl # min :: TamperDatumLbl -> TamperDatumLbl -> TamperDatumLbl # |
malformDatumTweak :: forall a m. (MonadTweak m, ToData a, FromData a, Typeable a) => (a -> [BuiltinData]) -> m () Source #
A tweak that tries to change the datum on outputs carrying datums of a
certain type with a prescribed tampering function. There are two main
differences with tamperDatumTweak
. First, the tampering function returns
BuiltinData
, allowing it to do pretty much anything with the
datums. Second, for every output datum there are zero or more options for how
to modify it, and all combinations of these modifications are tried.
That is, if there are n
output datums, for which there are 'k_1,...,k_n'
possible modifications, this tweak will try
k_1 + ... + k_n + k_1 * k_2 + ... + k_{n-1} * k_n + k_1 * k_2 * k_3 + ... + k_{n-2} * k_{n-1} * k_n + ... + k_1 * k_2 * ... * k_{n-1} * k_n == (k_1 + 1) * ... * (k_n + 1) - 1
modified transactions.
data MalformDatumLbl Source #
Instances
Show MalformDatumLbl Source # | |
Defined in Cooked.Tweak.TamperDatum showsPrec :: Int -> MalformDatumLbl -> ShowS # show :: MalformDatumLbl -> String # showList :: [MalformDatumLbl] -> ShowS # | |
PrettyCooked MalformDatumLbl Source # | |
Defined in Cooked.Tweak.TamperDatum | |
Eq MalformDatumLbl Source # | |
Defined in Cooked.Tweak.TamperDatum (==) :: MalformDatumLbl -> MalformDatumLbl -> Bool # (/=) :: MalformDatumLbl -> MalformDatumLbl -> Bool # | |
Ord MalformDatumLbl Source # | |
Defined in Cooked.Tweak.TamperDatum compare :: MalformDatumLbl -> MalformDatumLbl -> Ordering # (<) :: MalformDatumLbl -> MalformDatumLbl -> Bool # (<=) :: MalformDatumLbl -> MalformDatumLbl -> Bool # (>) :: MalformDatumLbl -> MalformDatumLbl -> Bool # (>=) :: MalformDatumLbl -> MalformDatumLbl -> Bool # max :: MalformDatumLbl -> MalformDatumLbl -> MalformDatumLbl # min :: MalformDatumLbl -> MalformDatumLbl -> MalformDatumLbl # |