Merge pull request #217 from crytic/dev-memory-reset-refix

Reset memory reset every time EVM is restarted (again)
pull/222/head
JP Smith 6 years ago committed by GitHub
commit c20ee00507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      examples/solidity/basic/memory-reset.sol
  2. 2
      lib/Echidna/Transaction.hs
  3. 2
      src/test/Spec.hs

@ -0,0 +1,11 @@
contract ShouldNotRevert {
function f() public { }
function echidna_should_not_revert() public returns (bool) {
bool[] memory includeMap = new bool[](1);
if (includeMap[0]) {
revert();
}
return true;
}
}

@ -115,7 +115,7 @@ liftSH = S.state . runState . zoom hasLens
-- 'Transaction's \"on-chain\".
setupTx :: (MonadState x m, Has VM x) => Tx -> m ()
setupTx (Tx c s r v) = S.state . runState . zoom hasLens . sequence_ $
[ result .= Nothing, state . pc .= 0, state . stack .= mempty, state . gas .= 0xffffffff
[ result .= Nothing, state . pc .= 0, state . stack .= mempty, state . memory .= mempty, state . gas .= 0xffffffff
, env . origin .= s, state . caller .= s, state . callvalue .= v, setup] where
setup = case c of
Left cd -> loadContract r >> state . calldata .= encode cd

@ -93,6 +93,8 @@ integrationTests = testGroup "Solidity Integration Testing"
] ++ (["s1", "s2", "s3"] <&> \n ->
("echidna_all_sender solved without " ++ unpack n, solvedWith (n, []) "echidna_all_sender"))
, testContract "basic/memory-reset.sol" Nothing
[ ("echidna_should_not_revert failed", passed "echidna_should_not_revert") ]
, testContract "basic/contractAddr.sol" Nothing
[ ("echidna_address failed", solved "echidna_address") ]
, testContract "basic/contractAddr.sol" (Just "basic/contractAddr.yaml")

Loading…
Cancel
Save