File tree 9 files changed +16
-16
lines changed
9 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ runWorker
91
91
-> Int -- ^ Worker id starting from 0
92
92
-> [(FilePath , [Tx ])]
93
93
-- ^ Initial corpus of transactions
94
- -> Int -- ^ Test limit for this worker
94
+ -> Maybe Int -- ^ Test limit for this worker
95
95
-> m (WorkerStopReason , WorkerState )
96
96
runWorker callback vm world dict workerId initialCorpus testLimit = do
97
97
let
@@ -136,10 +136,10 @@ runWorker callback vm world dict workerId initialCorpus testLimit = do
136
136
if | stopOnFail && any final tests ->
137
137
lift callback >> pure FastFailed
138
138
139
- | (null tests || any isOpen tests) && ncalls < testLimit ->
139
+ | (null tests || any isOpen tests) && maybe True ( ncalls < ) testLimit ->
140
140
fuzz >> continue
141
141
142
- | ncalls >= testLimit && any (\ t -> isOpen t && isOptimizationTest t) tests -> do
142
+ | maybe False ( ncalls >= ) testLimit && any (\ t -> isOpen t && isOptimizationTest t) tests -> do
143
143
liftIO $ atomicModifyIORef' testsRef $ \ sharedTests ->
144
144
(closeOptimizationTest <$> sharedTests, () )
145
145
continue
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ instance FromJSON EConfigWithUsage where
84
84
pure $ TestConf classify (const psender)
85
85
86
86
campaignConfParser = CampaignConf
87
- <$> v ..:? " testLimit" ..!= defaultTestLimit
87
+ <$> v ..:? " testLimit"
88
88
<*> v ..:? " stopOnFail" ..!= False
89
89
<*> v ..:? " estimateGas" ..!= False
90
90
<*> 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
@@ -148,9 +148,6 @@ initialWorkerState =
148
148
, ncalls = 0
149
149
}
150
150
151
- defaultTestLimit :: Int
152
- defaultTestLimit = 50000
153
-
154
151
defaultSequenceLength :: Int
155
152
defaultSequenceLength = 100
156
153
Original file line number Diff line number Diff line change @@ -77,8 +77,10 @@ ui vm world dict initialCorpus = do
77
77
78
78
-- Distribute over all workers, could be slightly bigger overall due to
79
79
-- 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 )
82
84
83
85
chunkSize = ceiling
84
86
(fromIntegral (length initialCorpus) / fromIntegral nworkers :: Double )
Original file line number Diff line number Diff line change @@ -169,8 +169,8 @@ summaryWidget env uiState =
169
169
<=>
170
170
perfWidget uiState
171
171
<=>
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 )
174
174
middle =
175
175
padLeft (Pad 1 ) $
176
176
str (" Unique instructions: " <> show uiState. coverage)
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ options = Options
175
175
<> help " Timeout given in seconds." )
176
176
<*> optional (option auto $ long " test-limit"
177
177
<> 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. " )
179
179
<*> optional (option auto $ long " rpc-block"
180
180
<> metavar " BLOCK"
181
181
<> help " Block number to use when fetching over RPC." )
@@ -239,7 +239,7 @@ overrideConfig config Options{..} = do
239
239
240
240
overrideCampaignConf campaignConf = campaignConf
241
241
{ corpusDir = cliCorpusDir <|> campaignConf. corpusDir
242
- , testLimit = fromMaybe campaignConf. testLimit cliTestLimit
242
+ , testLimit = cliTestLimit <|> campaignConf. testLimit
243
243
, shrinkLimit = fromMaybe campaignConf. shrinkLimit cliShrinkLimit
244
244
, seqLen = fromMaybe campaignConf. seqLen cliSeqLen
245
245
, seed = cliSeed <|> campaignConf. seed
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ overrideQuiet conf =
60
60
61
61
overrideLimits :: EConfig -> EConfig
62
62
overrideLimits conf =
63
- conf { campaignConf = conf. campaignConf { testLimit = 10000
63
+ conf { campaignConf = conf. campaignConf { testLimit = Just 10000
64
64
, shrinkLimit = 4000 }}
65
65
66
66
type SolcVersion = Version
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ seedTests =
22
22
where
23
23
cfg s = defaultConfig
24
24
{ campaignConf = CampaignConf
25
- { testLimit = 600
25
+ { testLimit = Just 600
26
26
, stopOnFail = False
27
27
, estimateGas = False
28
28
, seqLen = 20
Original file line number Diff line number Diff line change 1
1
maxValue : 10000000000000000000000000
2
2
testMode : assertion
3
+ testLimit : 50000
You can’t perform that action at this time.
0 commit comments