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

Initial support for tstore/tload #1286

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
pkgs.haskellPackages.callCabal2nix "hevm" (pkgs.fetchFromGitHub {
owner = "trail-of-forks";
repo = "hevm";
rev = "2aa7b3e5fea0e0657fe44549ccefbb18f61eb024";
sha256 = "sha256-/9NMvSOzP0agJ1qEFDN/OQvV0DXRTN3AbntTAzPXbCw=";
rev = "7d4344c5e71d14466e86331af064bab61d06bdad";
sha256 = "sha256-kts6mdwx5KUrVdNztzewWgNM9xGViAhFIZPnWOUllOU=";
}) { secp256k1 = pkgs.secp256k1; });

# FIXME: figure out solc situation, it conflicts with the one from
Expand Down
3 changes: 2 additions & 1 deletion lib/Echidna/Exec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Data.Vector qualified as V
import Data.Vector.Unboxed.Mutable qualified as VMut
import System.Process (readProcessWithExitCode)

import EVM (bytecode, replaceCodeOfSelf, loadContract, exec1, vmOpIx)
import EVM (bytecode, replaceCodeOfSelf, loadContract, exec1, vmOpIx, clearTStorages)
import EVM.ABI
import EVM.Dapp (DappInfo)
import EVM.Exec (exec, vmForEthrunCreation)
Expand Down Expand Up @@ -98,6 +98,7 @@ execTxWith executeTx tx = do
vmResult <- runFully
gasLeftAfterTx <- gets (.state.gas)
handleErrorsAndConstruction vmResult vmBeforeTx
fromEVM clearTStorages
pure (vmResult, gasLeftBeforeTx - gasLeftAfterTx)
where
runFully = do
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ packages:

extra-deps:
- git: https://github.com/trail-of-forks/hevm.git
commit: 2aa7b3e5fea0e0657fe44549ccefbb18f61eb024
commit: 7d4344c5e71d14466e86331af064bab61d06bdad

- restless-git-0.7@sha256:346a5775a586f07ecb291036a8d3016c3484ccdc188b574bcdec0a82c12db293,968
- s-cargot-0.1.4.0@sha256:61ea1833fbb4c80d93577144870e449d2007d311c34d74252850bb48aa8c31fb,3525
Expand Down
24 changes: 24 additions & 0 deletions tstore_test.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pragma solidity >=0.8.25;

contract Test {
uint256 x;
uint256 y;
function A() public {
assembly {
if tload(0) { revert(0,0) }
tstore(0, 1)
if iszero(tload(0)) { revert(0,0) }
}
x = 5;
}
function B() public {
if (x != 5) revert();
assembly {
if tload(0) { revert(0,0) }
}
y = 10;
}
function echidna_foo() public view returns (bool) {
return y != 10;
}
}
Loading