Skip to content

Commit 3c23cd8

Browse files
authored
Merge pull request #919 from argotorg/Update-tests
Update cli tests to use solc rather than raw assemby
2 parents 710ba6b + 86c6a2d commit 3c23cd8

File tree

1 file changed

+43
-9
lines changed

1 file changed

+43
-9
lines changed

test/clitest.hs

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,48 @@ main = do
247247
, "--number", "10307563", "--cache-dir", "test/contracts/fail/"]
248248
stdout `shouldContain` "[FAIL]"
249249
stderr `shouldNotContain` "CallStack"
250-
it "equiv-rpc-null" $ do
251-
let hexStr1 = "617fff600180808069040000000000000000016940000000000000000001fa166a0400000000000000000001617fff48163e00fe"
252-
let hexStr2 = "600180808069040000000000000000016940000000000000000001fa617fff1648617fff166a0400000000000000000001903e00fe"
253-
(_, stdout, _) <- readProcessWithExitCode "cabal" [
254-
"run", "exe:hevm", "--", "equivalence", "--code-a", hexStr1, "--code-b", hexStr2] ""
250+
it "nowarn-rpc-empty-precompile-symbolic" $ do
251+
Just c <- runApp $ solcRuntime (T.pack "C") (T.pack [i|
252+
contract C {
253+
function computeHash() public view {
254+
bytes memory data = hex"68656c6c6f";
255+
(bool success,) = address(2).staticcall(data); //SHA precompile
256+
assert(success);
257+
}
258+
}
259+
|])
260+
(_, stdout, _) <- readProcessWithExitCode "cabal" ["run", "exe:hevm", "--", "symbolic", "--code", Types.bsToHex c] ""
261+
stdout `shouldNotContain` "Warning: no RPC info provided"
262+
it "warn-rpc-empty-unknown-addr-symbolic" $ do
263+
Just c <- runApp $ solcRuntime (T.pack "C") (T.pack [i|
264+
contract C {
265+
function computeHash() public view {
266+
bytes memory data = hex"68656c6c6f";
267+
(bool success,) = address(878492734777777).staticcall(data);
268+
assert(success);
269+
}
270+
}
271+
|])
272+
(_, stdout, _) <- readProcessWithExitCode "cabal" ["run", "exe:hevm", "--", "symbolic", "--code", Types.bsToHex c] ""
255273
stdout `shouldContain` "Warning: no RPC info provided"
256-
it "rpc-null-norm" $ do
257-
let hexStr1 = "617fff600180808069040000000000000000016940000000000000000001fa166a0400000000000000000001617fff48163e00fe"
258-
(_, stdout, _) <- readProcessWithExitCode "cabal" [
259-
"run", "exe:hevm", "--", "symbolic", "--code", hexStr1] ""
274+
it "warn-rpc-empty-unknown-addr-equiv" $ do
275+
Just c <- runApp $ solcRuntime (T.pack "C") (T.pack [i|
276+
contract C {
277+
function computeHash() public view {
278+
bytes memory data = hex"68656c6c6f";
279+
(bool success,) = address(8492734777777).staticcall(data);
280+
assert(success);
281+
}
282+
}
283+
|])
284+
Just c2 <- runApp $ solcRuntime (T.pack "C") (T.pack [i|
285+
contract C {
286+
function computeHash() public view {
287+
bytes memory data = hex"68656c6c6f";
288+
(bool success,) = address(923741898892).staticcall(data);
289+
assert(success);
290+
}
291+
}
292+
|])
293+
(_, stdout, _) <- readProcessWithExitCode "cabal" ["run", "exe:hevm", "--", "equivalence", "--code-a", Types.bsToHex c, "--code-b", Types.bsToHex c2] ""
260294
stdout `shouldContain` "Warning: no RPC info provided"

0 commit comments

Comments
 (0)