Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support #943

Merged
merged 34 commits into from
Feb 26, 2023
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b760e20
Initial Windows support in CI
elopez Nov 23, 2022
e8764a2
Disable UI on Windows
elopez Feb 3, 2023
e0fca58
Remove ifdef from config, fix build
elopez Feb 4, 2023
78ee8d2
Link against GMP on Windows
elopez Feb 4, 2023
b99a2c5
Upload exe as artifact
elopez Feb 4, 2023
80c3e92
Upgrade secp256k1 to stable release
elopez Feb 4, 2023
56250ae
Try dynamic build
elopez Feb 4, 2023
72d8dff
Remove lib that causes failure to link
elopez Feb 17, 2023
7a2ea77
Update hevm
elopez Feb 17, 2023
ce70f04
Fix compressing Windows artifact
elopez Feb 17, 2023
0963a2d
Enable static build on Windows
elopez Feb 18, 2023
fbce51e
Reorder imports
elopez Feb 18, 2023
043f8e8
Fix emoji output
elopez Feb 18, 2023
b80795c
Remove extra step
elopez Feb 18, 2023
6d561a1
Prettify job name
elopez Feb 18, 2023
ff8088d
Merge remote-tracking branch 'origin/master' into elopez/windows-buil…
elopez Feb 22, 2023
5c07d50
Fix merge build failure
elopez Feb 22, 2023
c4cf16c
Enable static build for Windows tests
elopez Feb 22, 2023
baf05c6
Run tests on Windows as well
elopez Feb 22, 2023
48d90cb
Use solc-select for solc installation
elopez Feb 23, 2023
b74eb17
Fix ffi test by using python instead of echo
elopez Feb 23, 2023
d8fde79
Mark Windows CI as experimental
elopez Feb 23, 2023
6fb9ce0
Fix contract linking on Windows
elopez Feb 23, 2023
c29bb61
Update hevm reference to upstream
elopez Feb 24, 2023
bcddf2b
Merge remote-tracking branch 'origin/master' into elopez/windows-buil…
elopez Feb 24, 2023
2317cc5
ci: configure caching for Windows builds
elopez Feb 24, 2023
bc931db
Merge remote-tracking branch 'origin/master' into elopez/windows-buil…
elopez Feb 24, 2023
90ec456
Move `nullFilePath` definition closer to its usage
elopez Feb 24, 2023
2aa3112
Slightly simplify effective mode logic
elopez Feb 24, 2023
b80079b
Whitespace cleanup
elopez Feb 24, 2023
97fcedd
hlint fixes
elopez Feb 24, 2023
0df567a
Fix Windows build after merge
elopez Feb 24, 2023
5437645
Merge branch 'master' into elopez/windows-build-refresh
elopez Feb 24, 2023
c3f6325
Fix Windows build after merge
elopez Feb 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/master' into elopez/windows-buil…
…d-refresh
elopez committed Feb 24, 2023
commit bc931dba14278316ea03054de6fa837952b6c6aa
18 changes: 11 additions & 7 deletions lib/Echidna/Solidity.hs
Original file line number Diff line number Diff line change
@@ -90,8 +90,11 @@ compileContracts solConf fp = do
compileOne :: FilePath -> IO ([SolcContract], SourceCaches)
compileOne x = do
mSolc <- do
stderr <- if solConf.quiet then UseHandle <$> openFile nullFilePath WriteMode else pure Inherit
(ec, out, err) <- readCreateProcessWithExitCode (proc path $ (solConf.cryticArgs ++ solargs) |> x) {std_err = stderr} ""
stderr <- if solConf.quiet
then UseHandle <$> openFile nullFilePath WriteMode
else pure Inherit
(ec, out, err) <- readCreateProcessWithExitCode
(proc path $ (solConf.cryticArgs ++ solargs) |> x) {std_err = stderr} ""
case ec of
ExitSuccess -> readSolcBatch "crytic-export"
ExitFailure _ -> throwM $ CompileFailure out err
@@ -268,13 +271,14 @@ loadSpecified env name cs = do
Just (VMFailure _) -> throwM SetUpCallFailed
_ -> pure (vm4, neFuns, fst <$> tests, abiMapping)

where choose [] _ = throwM NoContracts
choose (c:_) Nothing = return c
choose _ (Just n) = maybe (throwM $ ContractNotFound n) pure $
find (Data.Text.isSuffixOf (contractId n) . (.contractName)) cs
where choose [] _ = throwM NoContracts
choose (c:_) Nothing = pure c
choose _ (Just n) =
maybe (throwM $ ContractNotFound n) pure $
find (Data.Text.isSuffixOf (contractId n) . (.contractName)) cs
contractId n | T.any (== ':') n = let (splitPath, splitName) = T.breakOn ":" n in
rewritePathSeparators splitPath `T.append` splitName
| otherwise = ":" `append` n
| otherwise = ":" `append` n
rewritePathSeparators = T.pack . joinPath . splitDirectories . T.unpack
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this is needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solc-returned paths use Windows separators (e.g. a\b\c.sol:Foo) so we need to rewrite paths to account for that.

setUpFunction = ("setUp", [])

2 changes: 2 additions & 0 deletions src/Main.hs
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ import Data.Text qualified as Text
import Data.Time.Clock.System (getSystemTime, systemSeconds)
import Data.Vector qualified as Vector
import Data.Version (showVersion)
import GHC.Generics (Generic)
import Main.Utf8 (withUtf8)
import Options.Applicative
import Paths_echidna (version)
@@ -35,6 +36,7 @@ import System.Exit (exitWith, exitSuccess, ExitCode(..))
import System.FilePath ((</>))
import System.IO (hPutStrLn, stderr)
import System.IO.CodePage (withCP65001)
import Text.Read (readMaybe)

import EVM (Contract(..), bytecode, ContractCode (RuntimeCode), RuntimeCode (ConcreteRuntimeCode), initialContract)
import EVM.Dapp (dappInfo, emptyDapp)
You are viewing a condensed version of this merge commit. You can view the full changes here.