@@ -60,17 +60,18 @@ getTargetMethodFromTx _ _ _ = return Nothing
6060-- This function selects a random method from the contract's ABI to explore.
6161-- It uses the campaign configuration to determine which methods are suitable for symbolic execution.
6262-- Additionally, it filter methods that are associated with failed properties, if any.
63- getRandomTargetMethod :: (MonadIO m , MonadReader Echidna.Types.Config. Env m ) => SolcContract -> [String ] -> m (Maybe Method )
64- getRandomTargetMethod contract failedProperties = do
63+ getRandomTargetMethod :: (MonadIO m , MonadReader Echidna.Types.Config. Env m ) => SolcContract -> Maybe [ Text ] -> [String ] -> m (Maybe Method )
64+ getRandomTargetMethod contract targets failedProperties = do
6565 env <- ask
6666 let allMethods = Map. assocs contract. abiMap
6767 assertSigs = env. world. assertSigs
6868 filterFunc (selector, method) = (null assertSigs || selector `elem` assertSigs) && suitableForSymExec method && (unpack method. methodSignature) `notElem` failedProperties
6969 filteredMethods = filter filterFunc allMethods
7070
71- case filteredMethods of
72- [] -> return Nothing
73- _ -> liftIO $ rElem (fromList $ map (Just . snd ) filteredMethods)
71+ case (targets, filteredMethods) of
72+ (Just ms, _) -> liftIO $ rElem (fromList $ map (Just . snd ) $ filter (\ (_, m) -> m. name `elem` ms) allMethods)
73+ (_, [] ) -> return Nothing
74+ _ -> liftIO $ rElem (fromList $ map (Just . snd ) filteredMethods)
7475
7576
7677-- | Filters methods based on the campaign configuration.
0 commit comments