File tree 8 files changed +15
-16
lines changed
8 files changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ runWorker
85
85
-> GenDict -- ^ Generation dictionary
86
86
-> Int -- ^ Worker id starting from 0
87
87
-> [[Tx ]] -- ^ Initial corpus of transactions
88
- -> Int -- ^ Test limit for this worker
88
+ -> Maybe Int -- ^ Test limit for this worker
89
89
-> m (WorkerStopReason , WorkerState )
90
90
runWorker callback vm world dict workerId initialCorpus testLimit = do
91
91
metaCacheRef <- asks (. metadataCache)
@@ -135,10 +135,10 @@ runWorker callback vm world dict workerId initialCorpus testLimit = do
135
135
if | stopOnFail && any final tests ->
136
136
lift callback >> pure FastFailed
137
137
138
- | (null tests || any isOpen tests) && ncalls < testLimit ->
138
+ | (null tests || any isOpen tests) && maybe True ( ncalls < ) testLimit ->
139
139
fuzz >> continue
140
140
141
- | ncalls >= testLimit && any (\ t -> isOpen t && isOptimizationTest t) tests -> do
141
+ | maybe False ( ncalls >= ) testLimit && any (\ t -> isOpen t && isOptimizationTest t) tests -> do
142
142
liftIO $ atomicModifyIORef' testsRef $ \ sharedTests ->
143
143
(closeOptimizationTest <$> sharedTests, () )
144
144
continue
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ instance FromJSON EConfigWithUsage where
85
85
pure $ TestConf classify (const psender)
86
86
87
87
campaignConfParser = CampaignConf
88
- <$> v ..:? " testLimit" ..!= defaultTestLimit
88
+ <$> v ..:? " testLimit"
89
89
<*> v ..:? " stopOnFail" ..!= False
90
90
<*> v ..:? " estimateGas" ..!= False
91
91
<*> v ..:? " seqLen" ..!= defaultSequenceLength
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import Echidna.Types.Tx (Tx)
14
14
15
15
-- | Configuration for running an Echidna 'Campaign'.
16
16
data CampaignConf = CampaignConf
17
- { testLimit :: Int
17
+ { testLimit :: Maybe Int
18
18
-- ^ Maximum number of function calls to execute while fuzzing
19
19
, stopOnFail :: Bool
20
20
-- ^ Whether to stop the campaign immediately if any property fails
@@ -116,9 +116,6 @@ initialWorkerState =
116
116
, ncalls = 0
117
117
}
118
118
119
- defaultTestLimit :: Int
120
- defaultTestLimit = 50000
121
-
122
119
defaultSequenceLength :: Int
123
120
defaultSequenceLength = 100
124
121
Original file line number Diff line number Diff line change @@ -78,8 +78,10 @@ ui vm world dict initialCorpus = do
78
78
79
79
-- Distribute over all workers, could be slightly bigger overall due to
80
80
-- 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 )
83
85
84
86
chunkSize = ceiling
85
87
(fromIntegral (length initialCorpus) / fromIntegral nworkers :: Double )
Original file line number Diff line number Diff line change @@ -159,8 +159,8 @@ summaryWidget env uiState =
159
159
<=>
160
160
perfWidget uiState
161
161
<=>
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 )
164
164
middle =
165
165
padLeft (Pad 1 ) $
166
166
str (" Unique instructions: " <> show uiState. coverage)
Original file line number Diff line number Diff line change @@ -275,7 +275,7 @@ options = Options
275
275
<> help " Timeout given in seconds." )
276
276
<*> optional (option auto $ long " test-limit"
277
277
<> 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. " ))
279
279
<*> optional (option auto $ long " shrink-limit"
280
280
<> metavar " INTEGER"
281
281
<> 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
333
333
334
334
overrideCampaignConf campaignConf = campaignConf
335
335
{ corpusDir = cliCorpusDir <|> campaignConf. corpusDir
336
- , testLimit = fromMaybe campaignConf. testLimit cliTestLimit
336
+ , testLimit = cliTestLimit <|> campaignConf. testLimit
337
337
, shrinkLimit = fromMaybe campaignConf. shrinkLimit cliShrinkLimit
338
338
, seqLen = fromMaybe campaignConf. seqLen cliSeqLen
339
339
, seed = cliSeed <|> campaignConf. seed
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ overrideQuiet conf =
67
67
68
68
overrideLimits :: EConfig -> EConfig
69
69
overrideLimits conf =
70
- conf { campaignConf = conf. campaignConf { testLimit = 10000
70
+ conf { campaignConf = conf. campaignConf { testLimit = Just 10000
71
71
, shrinkLimit = 4000 }}
72
72
73
73
type SolcVersion = Version
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ seedTests =
21
21
where
22
22
cfg s = defaultConfig
23
23
{ campaignConf = CampaignConf
24
- { testLimit = 600
24
+ { testLimit = Just 600
25
25
, stopOnFail = False
26
26
, estimateGas = False
27
27
, seqLen = 20
You can’t perform that action at this time.
0 commit comments