Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
msooseth committed Jan 27, 2025
1 parent 1523e0a commit 16fea4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
11 changes: 0 additions & 11 deletions src/EVM/Fetch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import Data.Vector qualified as RegularVector
import Network.Wreq
import Network.Wreq.Session (Session)
import Network.Wreq.Session qualified as Session
import Numeric.Natural (Natural)
import System.Environment (lookupEnv, getEnvironment)
import System.Process
import Control.Monad.IO.Class
Expand Down Expand Up @@ -185,16 +184,6 @@ fetchChainIdFrom url = do
sess <- Session.newAPISession
fetchQuery Latest (fetchWithSession url sess) QueryChainId

http :: Natural -> Maybe Natural -> BlockNumber -> Text -> Fetcher t m s
http smtjobs smttimeout n url q =
withSolvers Z3 smtjobs 1 smttimeout $ \s ->
oracle s (Just (n, url)) q

zero :: Natural -> Maybe Natural -> Fetcher t m s
zero smtjobs smttimeout q =
withSolvers Z3 smtjobs 1 smttimeout $ \s ->
oracle s Nothing q

-- smtsolving + (http or zero)
oracle :: SolverGroup -> RpcInfo -> Fetcher t m s
oracle solvers info q = do
Expand Down
10 changes: 8 additions & 2 deletions test/EVM/Test/BlockchainTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ import System.Process (readProcessWithExitCode)
import GHC.IO.Exception (ExitCode(ExitSuccess))
import Witch (into, unsafeInto)
import Witherable (Filterable, catMaybes)
import EVM.Solvers (withSolvers, Solver(..))

import Test.Tasty
import Test.Tasty.ExpectedFailure
import Test.Tasty.HUnit
import qualified EVM.Fetch as EVM

data Which = Pre | Post

Expand Down Expand Up @@ -175,11 +177,15 @@ ciProblematicTests = Map.fromList
, ("loopExp_d9g0v0_Cancun", ignoreTest)
]

zeroFetcher :: EVM.Fetch.Fetcher t m s
zeroFetcher q = withSolvers Z3 0 1 (Just 0) $ \s ->
EVM.oracle s Nothing q

runVMTest :: App m => Case -> m ()
runVMTest x = do
-- traceVsGeth fname name x
vm0 <- liftIO $ vmForCase x
result <- EVM.Stepper.interpret (EVM.Fetch.zero 0 (Just 0)) vm0 EVM.Stepper.runFully
result <- EVM.Stepper.interpret zeroFetcher vm0 EVM.Stepper.runFully
writeTrace result
maybeReason <- checkExpectation x result
liftIO $ forM_ maybeReason assertFailure
Expand All @@ -189,7 +195,7 @@ runVMTest x = do
traceVMTest :: App m => Case -> m [VMTrace]
traceVMTest x = do
vm0 <- liftIO $ vmForCase x
(_, (_, ts)) <- runStateT (interpretWithTrace (EVM.Fetch.zero 0 (Just 0)) EVM.Stepper.runFully) (vm0, [])
(_, (_, ts)) <- runStateT (interpretWithTrace zeroFetcher EVM.Stepper.runFully) (vm0, [])
pure ts

-- | given a path to a test file, a test case from within that file, and a trace from geth from running that test, compare the traces and show where we differ
Expand Down

0 comments on commit 16fea4f

Please sign in to comment.