File tree Expand file tree Collapse file tree 8 files changed +15
-16
lines changed Expand file tree Collapse file tree 8 files changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ runWorker
8585 -> GenDict -- ^ Generation dictionary
8686 -> Int -- ^ Worker id starting from 0
8787 -> [[Tx ]] -- ^ Initial corpus of transactions
88- -> Int -- ^ Test limit for this worker
88+ -> Maybe Int -- ^ Test limit for this worker
8989 -> m (WorkerStopReason , WorkerState )
9090runWorker callback vm world dict workerId initialCorpus testLimit = do
9191 metaCacheRef <- asks (. metadataCache)
@@ -135,10 +135,10 @@ runWorker callback vm world dict workerId initialCorpus testLimit = do
135135 if | stopOnFail && any final tests ->
136136 lift callback >> pure FastFailed
137137
138- | (null tests || any isOpen tests) && ncalls < testLimit ->
138+ | (null tests || any isOpen tests) && maybe True ( ncalls < ) testLimit ->
139139 fuzz >> continue
140140
141- | ncalls >= testLimit && any (\ t -> isOpen t && isOptimizationTest t) tests -> do
141+ | maybe False ( ncalls >= ) testLimit && any (\ t -> isOpen t && isOptimizationTest t) tests -> do
142142 liftIO $ atomicModifyIORef' testsRef $ \ sharedTests ->
143143 (closeOptimizationTest <$> sharedTests, () )
144144 continue
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ instance FromJSON EConfigWithUsage where
8585 pure $ TestConf classify (const psender)
8686
8787 campaignConfParser = CampaignConf
88- <$> v ..:? " testLimit" ..!= defaultTestLimit
88+ <$> v ..:? " testLimit"
8989 <*> v ..:? " stopOnFail" ..!= False
9090 <*> v ..:? " estimateGas" ..!= False
9191 <*> v ..:? " seqLen" ..!= defaultSequenceLength
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import Echidna.Types.Tx (Tx)
1414
1515-- | Configuration for running an Echidna 'Campaign'.
1616data CampaignConf = CampaignConf
17- { testLimit :: Int
17+ { testLimit :: Maybe Int
1818 -- ^ Maximum number of function calls to execute while fuzzing
1919 , stopOnFail :: Bool
2020 -- ^ Whether to stop the campaign immediately if any property fails
@@ -116,9 +116,6 @@ initialWorkerState =
116116 , ncalls = 0
117117 }
118118
119- defaultTestLimit :: Int
120- defaultTestLimit = 50000
121-
122119defaultSequenceLength :: Int
123120defaultSequenceLength = 100
124121
Original file line number Diff line number Diff line change @@ -78,8 +78,10 @@ ui vm world dict initialCorpus = do
7878
7979 -- Distribute over all workers, could be slightly bigger overall due to
8080 -- ceiling but this doesn't matter
81- perWorkerTestLimit = ceiling
82- (fromIntegral conf. campaignConf. testLimit / fromIntegral nworkers :: Double )
81+ perWorkerTestLimit =
82+ case conf. campaignConf. testLimit of
83+ Nothing -> Nothing
84+ Just t -> Just $ ceiling (fromIntegral t / fromIntegral nworkers :: Double )
8385
8486 chunkSize = ceiling
8587 (fromIntegral (length initialCorpus) / fromIntegral nworkers :: Double )
Original file line number Diff line number Diff line change @@ -159,8 +159,8 @@ summaryWidget env uiState =
159159 <=>
160160 perfWidget uiState
161161 <=>
162- str (" Total calls: " <> progress ( sum $ ( . ncalls) <$> uiState . campaigns )
163- env . cfg . campaignConf . testLimit )
162+ str (" Total calls: " <> maybe ( show totalCalls) (progress totalCalls) env . cfg . campaignConf . testLimit )
163+ totalCalls = ( sum $ ( . ncalls) <$> uiState . campaigns )
164164 middle =
165165 padLeft (Pad 1 ) $
166166 str (" Unique instructions: " <> show uiState. coverage)
Original file line number Diff line number Diff line change @@ -275,7 +275,7 @@ options = Options
275275 <> help " Timeout given in seconds." )
276276 <*> optional (option auto $ long " test-limit"
277277 <> metavar " INTEGER"
278- <> help (" Number of sequences of transactions to generate during testing. Default is " ++ show defaultTestLimit ))
278+ <> help (" Number of sequences of transactions to generate during testing. Default is unbounded. " ))
279279 <*> optional (option auto $ long " shrink-limit"
280280 <> metavar " INTEGER"
281281 <> help (" Number of tries to attempt to shrink a failing sequence of transactions. Default is " ++ show defaultShrinkLimit))
@@ -333,7 +333,7 @@ overrideConfig config Options{..} = do
333333
334334 overrideCampaignConf campaignConf = campaignConf
335335 { corpusDir = cliCorpusDir <|> campaignConf. corpusDir
336- , testLimit = fromMaybe campaignConf. testLimit cliTestLimit
336+ , testLimit = cliTestLimit <|> campaignConf. testLimit
337337 , shrinkLimit = fromMaybe campaignConf. shrinkLimit cliShrinkLimit
338338 , seqLen = fromMaybe campaignConf. seqLen cliSeqLen
339339 , seed = cliSeed <|> campaignConf. seed
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ overrideQuiet conf =
6767
6868overrideLimits :: EConfig -> EConfig
6969overrideLimits conf =
70- conf { campaignConf = conf. campaignConf { testLimit = 10000
70+ conf { campaignConf = conf. campaignConf { testLimit = Just 10000
7171 , shrinkLimit = 4000 }}
7272
7373type SolcVersion = Version
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ seedTests =
2121 where
2222 cfg s = defaultConfig
2323 { campaignConf = CampaignConf
24- { testLimit = 600
24+ { testLimit = Just 600
2525 , stopOnFail = False
2626 , estimateGas = False
2727 , seqLen = 20
You can’t perform that action at this time.
0 commit comments