File tree Expand file tree Collapse file tree 9 files changed +16
-16
lines changed Expand file tree Collapse file tree 9 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ runWorker
9191 -> Int -- ^ Worker id starting from 0
9292 -> [(FilePath , [Tx ])]
9393 -- ^ Initial corpus of transactions
94- -> Int -- ^ Test limit for this worker
94+ -> Maybe Int -- ^ Test limit for this worker
9595 -> m (WorkerStopReason , WorkerState )
9696runWorker callback vm world dict workerId initialCorpus testLimit = do
9797 let
@@ -136,10 +136,10 @@ runWorker callback vm world dict workerId initialCorpus testLimit = do
136136 if | stopOnFail && any final tests ->
137137 lift callback >> pure FastFailed
138138
139- | (null tests || any isOpen tests) && ncalls < testLimit ->
139+ | (null tests || any isOpen tests) && maybe True ( ncalls < ) testLimit ->
140140 fuzz >> continue
141141
142- | ncalls >= testLimit && any (\ t -> isOpen t && isOptimizationTest t) tests -> do
142+ | maybe False ( ncalls >= ) testLimit && any (\ t -> isOpen t && isOptimizationTest t) tests -> do
143143 liftIO $ atomicModifyIORef' testsRef $ \ sharedTests ->
144144 (closeOptimizationTest <$> sharedTests, () )
145145 continue
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ instance FromJSON EConfigWithUsage where
8484 pure $ TestConf classify (const psender)
8585
8686 campaignConfParser = CampaignConf
87- <$> v ..:? " testLimit" ..!= defaultTestLimit
87+ <$> v ..:? " testLimit"
8888 <*> v ..:? " stopOnFail" ..!= False
8989 <*> v ..:? " estimateGas" ..!= False
9090 <*> 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
@@ -148,9 +148,6 @@ initialWorkerState =
148148 , ncalls = 0
149149 }
150150
151- defaultTestLimit :: Int
152- defaultTestLimit = 50000
153-
154151defaultSequenceLength :: Int
155152defaultSequenceLength = 100
156153
Original file line number Diff line number Diff line change @@ -77,8 +77,10 @@ ui vm world dict initialCorpus = do
7777
7878 -- Distribute over all workers, could be slightly bigger overall due to
7979 -- ceiling but this doesn't matter
80- perWorkerTestLimit = ceiling
81- (fromIntegral conf. campaignConf. testLimit / fromIntegral nworkers :: Double )
80+ perWorkerTestLimit =
81+ case conf. campaignConf. testLimit of
82+ Nothing -> Nothing
83+ Just t -> Just $ ceiling (fromIntegral t / fromIntegral nworkers :: Double )
8284
8385 chunkSize = ceiling
8486 (fromIntegral (length initialCorpus) / fromIntegral nworkers :: Double )
Original file line number Diff line number Diff line change @@ -169,8 +169,8 @@ summaryWidget env uiState =
169169 <=>
170170 perfWidget uiState
171171 <=>
172- str (" Total calls: " <> progress ( sum $ ( . ncalls) <$> uiState . campaigns )
173- env . cfg . campaignConf . testLimit )
172+ str (" Total calls: " <> maybe ( show totalCalls) (progress totalCalls) env . cfg . campaignConf . testLimit )
173+ totalCalls = ( sum $ ( . ncalls) <$> uiState . campaigns )
174174 middle =
175175 padLeft (Pad 1 ) $
176176 str (" Unique instructions: " <> show uiState. coverage)
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ options = Options
175175 <> help " Timeout given in seconds." )
176176 <*> optional (option auto $ long " test-limit"
177177 <> metavar " INTEGER"
178- <> help ( " Number of sequences of transactions to generate during testing. Default is " ++ show defaultTestLimit) )
178+ <> help " Number of sequences of transactions to generate during testing. Default is unbounded. " )
179179 <*> optional (option auto $ long " rpc-block"
180180 <> metavar " BLOCK"
181181 <> help " Block number to use when fetching over RPC." )
@@ -239,7 +239,7 @@ overrideConfig config Options{..} = do
239239
240240 overrideCampaignConf campaignConf = campaignConf
241241 { corpusDir = cliCorpusDir <|> campaignConf. corpusDir
242- , testLimit = fromMaybe campaignConf. testLimit cliTestLimit
242+ , testLimit = cliTestLimit <|> campaignConf. testLimit
243243 , shrinkLimit = fromMaybe campaignConf. shrinkLimit cliShrinkLimit
244244 , seqLen = fromMaybe campaignConf. seqLen cliSeqLen
245245 , seed = cliSeed <|> campaignConf. seed
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ overrideQuiet conf =
6060
6161overrideLimits :: EConfig -> EConfig
6262overrideLimits conf =
63- conf { campaignConf = conf. campaignConf { testLimit = 10000
63+ conf { campaignConf = conf. campaignConf { testLimit = Just 10000
6464 , shrinkLimit = 4000 }}
6565
6666type SolcVersion = Version
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ seedTests =
2222 where
2323 cfg s = defaultConfig
2424 { campaignConf = CampaignConf
25- { testLimit = 600
25+ { testLimit = Just 600
2626 , stopOnFail = False
2727 , estimateGas = False
2828 , seqLen = 20
Original file line number Diff line number Diff line change 11maxValue : 10000000000000000000000000
22testMode : assertion
3+ testLimit : 50000
You can’t perform that action at this time.
0 commit comments