File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,5 +140,5 @@ datumHijackingAttack (DatumHijackingParams branching mChange select) = do
140140 simple
141141 (\ out -> (\ owner -> set txSkelOutOwnerL (toPKHOrVScript owner) out) <$> mChange out)
142142 select
143- addLabelTweak $ DatumHijackingLabel modified
143+ insertInTweak txSkelLabelsL $ TxSkelLabel $ DatumHijackingLabel modified
144144 return modified
Original file line number Diff line number Diff line change @@ -97,5 +97,5 @@ datumTamperingAttack DatumTamperingParams {..} = do
9797 modified <-
9898 modifyTweakFromParams $
9999 ModifyTweakParams tdpBranching tdpOptic txSkelOutDatumTypedAT tdpModification tdpIndexPred
100- addLabelTweak $ DatumTamperingLabel modified
100+ insertInTweak txSkelLabelsL $ TxSkelLabel $ DatumTamperingLabel modified
101101 return modified
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import Control.Monad
1414import Cooked.Pretty.Class
1515import Cooked.Skeleton
1616import Cooked.Tweak.Common
17- import Cooked.Tweak.Labels
17+ import Cooked.Tweak.Insertion
1818import Data.List (permutations )
1919import Polysemy (Members , Sem )
2020import Polysemy.NonDet
@@ -65,7 +65,7 @@ outputsReorderingAttack params = do
6565 Shuffle -> permutations outputs
6666 ManualReordering f -> f outputs
6767 _ -> []
68- addLabelTweak OutputsReorderingLabel
68+ insertInTweak txSkelLabelsL $ TxSkelLabel OutputsReorderingLabel
6969 where
7070 valid :: Int -> Int -> Bool
7171 valid i iMax = i >= 0 && i < iMax
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import Control.Monad
2020import Cooked.Pretty.Class
2121import Cooked.Skeleton
2222import Cooked.Tweak.Common
23- import Cooked.Tweak.Labels
23+ import Cooked.Tweak.Insertion
2424import Cooked.Tweak.Modification
2525import Optics.Core
2626import Plutus.Script.Utils.Address qualified as Script
@@ -98,5 +98,5 @@ peerTamperingAttack (PeerTamperingParams branching mChanges) = do
9898 branching
9999 ((txSkelAllocatedPeersT % userPubKeyHashI) `adjoin` (txSkelRedeemedPeersT % userPubKeyHashI))
100100 $ \ pkh -> if pkh == existing then targets else []
101- addLabelTweak $ PeerTamperingLabel modified
101+ insertInTweak txSkelLabelsL $ TxSkelLabel $ PeerTamperingLabel modified
102102 return modified
Original file line number Diff line number Diff line change @@ -127,5 +127,5 @@ redeemerTamperingAttack RedeemerTamperingParams {..} = do
127127 modified <-
128128 modifyTweakFromParams $
129129 ModifyTweakParams trpBranching trpOptic txSkelRedeemerTypedAT trpModification trpIndexPred
130- addLabelTweak $ RedeemerTamperingLabel modified
130+ insertInTweak txSkelLabelsL $ TxSkelLabel $ RedeemerTamperingLabel modified
131131 return modified
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ import Control.Monad
2121import Cooked.Pretty.Class
2222import Cooked.Skeleton
2323import Cooked.Tweak.Common
24- import Cooked.Tweak.Labels
24+ import Cooked.Tweak.Insertion
2525import Cooked.Tweak.Mint
2626import Cooked.Tweak.Outputs
2727import Optics.Core
@@ -121,6 +121,6 @@ tokenDuplicationAttack TokenDuplicationParams {..} = do
121121 -- We redirect the extra value to an attacker
122122 addOutputTweak $ atpThief `receives` Value totalIncrement
123123 -- We label the transaction by the added tokens
124- addLabelTweak $ TokenDuplicationLabel totalIncrement
124+ insertInTweak txSkelLabelsL $ TxSkelLabel $ TokenDuplicationLabel totalIncrement
125125 -- We return the added tokens
126126 return totalIncrement
Original file line number Diff line number Diff line change @@ -128,5 +128,5 @@ validityTamperingAttack (ValidityTamperingParams optics change) = do
128128 OneBranchForAllFoci
129129 (txSkelValidityRangeL % castOptic @ A_Traversal optics)
130130 change
131- addLabelTweak $ ValidityTamperingLabel currentValidityRange
131+ insertInTweak txSkelLabelsL $ TxSkelLabel $ ValidityTamperingLabel currentValidityRange
132132 return currentValidityRange
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ insertInTweak ::
8383 a ->
8484 Sem effs ()
8585insertInTweak (castOptic @ A_Traversal -> optic) a = do
86- guardPredTweak optic $ view $ contains a
86+ guardTweak $ optic % contains a % filtered not
8787 setTweak (optic % contains a) True
8888
8989-- * Inserting elements in maps
@@ -100,5 +100,5 @@ insertAtTweak ::
100100 v ->
101101 Sem effs ()
102102insertAtTweak (castOptic @ A_Traversal -> optic) k v = do
103- guardTweak $ optic % at k
103+ guardTweak $ optic % at k % _Nothing
104104 setTweak (optic % at k) (Just v)
You can’t perform that action at this time.
0 commit comments