Skip to content

Commit 344bcfe

Browse files
authored
Do not save onchain coverage if RPC url was not provided (#1504)
1 parent 9567215 commit 344bcfe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/Echidna.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ instance ReadConfig IO where
121121
mkEnv :: EConfig -> BuildOutput -> [EchidnaTest] -> World -> Maybe SlitherInfo -> IO Env
122122
mkEnv cfg buildOutput tests world slitherInfo = do
123123
codehashMap <- newIORef mempty
124-
chainId <- maybe (pure Nothing) Onchain.fetchChainIdFrom (Just cfg.rpcUrl)
124+
chainId <- Onchain.fetchChainIdFrom cfg.rpcUrl
125125
eventQueue <- newChan
126126
coverageRefInit <- newIORef mempty
127127
coverageRefRuntime <- newIORef mempty

src/Main.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Main where
44

5-
import Control.Monad (unless, forM_)
5+
import Control.Monad (unless, when, forM_)
66
import Control.Monad.Random (getRandomR)
77
import Control.Monad.Reader (runReaderT, liftIO)
88
import Data.Aeson.Key qualified as Aeson.Key
@@ -12,7 +12,7 @@ import Data.Hashable (hash)
1212
import Data.IORef (readIORef)
1313
import Data.List.NonEmpty qualified as NE
1414
import Data.Map qualified as Map
15-
import Data.Maybe (fromMaybe)
15+
import Data.Maybe (fromMaybe, isJust)
1616
import Data.Set qualified as Set
1717
import Data.Text (Text)
1818
import Data.Text qualified as T
@@ -116,7 +116,7 @@ main = withUtf8 $ withCP65001 $ do
116116
-- as it orders the runs chronologically.
117117
runId <- fromIntegral . systemSeconds <$> getSystemTime
118118

119-
Onchain.saveCoverageReport env runId
119+
when (isJust env.cfg.rpcUrl) $ Onchain.saveCoverageReport env runId
120120

121121
-- save source coverage reports
122122
let contracts = Map.elems env.dapp.solcByName

0 commit comments

Comments
 (0)