@@ -322,20 +322,20 @@ freezeVM vm = do
322322 m@ (SymbolicMemory _) -> pure m
323323
324324data InterpTask m = InterpTask
325- { fetcher :: Fetch. Fetcher Symbolic m RealWorld
325+ { fetcher :: Fetch. Fetcher Symbolic m
326326 , iterConf :: IterConfig
327- , vm :: VM Symbolic RealWorld
327+ , vm :: VM Symbolic
328328 , taskq :: Chan (InterpTask m )
329329 , numTasks :: TVar Natural
330- , stepper :: Stepper Symbolic RealWorld (Expr End )
330+ , stepper :: Stepper Symbolic (Expr End )
331331 }
332332newtype InterpreterInstance = InterpreterInstance { instanceId :: Int }
333333
334334interpret :: forall m . App m
335- => Fetch. Fetcher Symbolic m RealWorld
335+ => Fetch. Fetcher Symbolic m
336336 -> IterConfig
337- -> VM Symbolic RealWorld
338- -> Stepper Symbolic RealWorld (Expr End )
337+ -> VM Symbolic
338+ -> Stepper Symbolic (Expr End )
339339 -> m [Expr End ]
340340interpret fetcher iterConf vm stepper = do
341341 conf <- readConfig
@@ -442,18 +442,9 @@ interpretInternal t@InterpTask{..} res = eval (Operational.view stepper)
442442 let newDepth = vm. exploreDepth+ 1
443443 runOne frozen newDepth vals
444444 where
445- <<<<<<< HEAD
446- runOne :: App m => VM 'Symbolic RealWorld -> Int -> [Expr EWord ] -> m (Expr End )
445+ runOne :: App m => VM 'Symbolic -> Int -> [Expr EWord ] -> m (Expr End )
447446 runOne frozen newDepth [v] = do
448447 conf <- readConfig
449- =======
450- goITE :: [(Expr EWord , Expr End )] -> Expr End
451- goITE [] = internalError " goITE: empty list"
452- goITE [(_, end)] = end
453- goITE ((val,end): ps) = ITE (Eq expr val) end (goITE ps)
454- runOne :: App m => VM 'Symbolic -> Int -> Expr EWord -> m (Expr 'End)
455- runOne frozen newDepth v = do
456- >>>>>>> main
457448 (ra, vma) <- liftIO $ stToIO $ runStateT (continue v) frozen { result = Nothing , exploreDepth = newDepth }
458449 when (conf. debug) $ liftIO $ putStrLn $ " Running last task for ForkMany at depth " <> show newDepth
459450 flip interpretInternal res t { vm = vma, stepper = (k ra) }
@@ -668,15 +659,9 @@ verifyContract :: forall m . App m
668659 -> Maybe Sig
669660 -> [String ]
670661 -> VeriOpts
671- <<<<<<< HEAD
672- -> Maybe (Precondition RealWorld )
673- -> Postcondition RealWorld
674- -> m ([Expr End ], [VerifyResult ])
675- =======
676662 -> Maybe Precondition
677663 -> Postcondition
678- -> m (Expr End , [VerifyResult ])
679- >>>>>>> main
664+ -> m ([Expr End ], [VerifyResult ])
680665verifyContract solvers theCode signature' concreteArgs opts maybepre post = do
681666 calldata <- mkCalldata signature' concreteArgs
682667 preState <- liftIO $ stToIO $ abstractVM calldata theCode maybepre False
@@ -690,13 +675,8 @@ exploreContract :: forall m . App m
690675 -> Maybe Sig
691676 -> [String ]
692677 -> VeriOpts
693- <<<<<<< HEAD
694- -> Maybe (Precondition RealWorld )
695- -> m [Expr End ]
696- =======
697678 -> Maybe Precondition
698- -> m (Expr End )
699- >>>>>>> main
679+ -> m [Expr End ]
700680exploreContract solvers theCode signature' concreteArgs opts maybepre = do
701681 calldata <- mkCalldata signature' concreteArgs
702682 preState <- liftIO $ stToIO $ abstractVM calldata theCode maybepre False
@@ -766,11 +746,7 @@ getPartials = mapMaybe go
766746
767747
768748-- | Symbolically execute the VM and return the representention of the execution
769- <<<<<<< HEAD
770- executeVM :: forall m . App m => Fetch. Fetcher Symbolic m RealWorld -> IterConfig -> VM Symbolic RealWorld -> m [Expr End ]
771- =======
772- executeVM :: forall m . App m => Fetch. Fetcher Symbolic m -> IterConfig -> VM Symbolic -> m (Expr End )
773- >>>>>>> main
749+ executeVM :: forall m . App m => Fetch. Fetcher Symbolic m -> IterConfig -> VM Symbolic -> m [Expr End ]
774750executeVM fetcher iterConfig preState = interpret fetcher iterConfig preState runExpr
775751
776752-- | Symbolically execute the VM and check all endstates against the
@@ -779,27 +755,16 @@ verify :: App m
779755 => SolverGroup
780756 -> Fetch. Fetcher Symbolic m
781757 -> VeriOpts
782- <<<<<<< HEAD
783- -> VM Symbolic RealWorld
784- -> Postcondition RealWorld
785- -> m ([Expr End ], [VerifyResult ])
786- =======
787758 -> VM Symbolic
788759 -> Postcondition
789- -> m (Expr End , [VerifyResult ])
790- >>>>>>> main
760+ -> m ([Expr End ], [VerifyResult ])
791761verify solvers fetcher opts preState post = do
792762 (ends1, partials) <- verifyInputs solvers opts fetcher preState post
793763 let (ends2, results) = verifyResults preState ends1
794764 pure (ends2 <> fmap snd partials, filter (not . isQed) results)
795765
796- <<<<<<< HEAD
797- verifyResults :: VM Symbolic RealWorld -> [(SMTResult , Expr End )] -> ([Expr End ], [VerifyResult ])
766+ verifyResults :: VM Symbolic -> [(SMTResult , Expr End )] -> ([Expr End ], [VerifyResult ])
798767verifyResults preState res = (map snd res, fmap toVRes res)
799- =======
800- verifyResults :: VM Symbolic -> Expr End -> [(SMTResult , Expr End )] -> (Expr End , [VerifyResult ])
801- verifyResults preState expr cexs = if null cexs then (expr, [Qed ]) else (expr, fmap toVRes cexs)
802- >>>>>>> main
803768 where
804769 toVRes :: (SMTResult , Expr End ) -> VerifyResult
805770 toVRes (res2, leaf) = case res2 of
@@ -814,17 +779,10 @@ verifyInputs
814779 :: App m
815780 => SolverGroup
816781 -> VeriOpts
817- <<<<<<< HEAD
818- -> Fetch. Fetcher Symbolic m RealWorld
819- -> VM Symbolic RealWorld
820- -> Postcondition RealWorld
821- -> m ([(SMTResult , Expr End )], [(PartialExec , Expr End )])
822- =======
823782 -> Fetch. Fetcher Symbolic m
824783 -> VM Symbolic
825784 -> Postcondition
826- -> m (Expr End , [(SMTResult , Expr End )], [(PartialExec , Expr End )])
827- >>>>>>> main
785+ -> m ([(SMTResult , Expr End )], [(PartialExec , Expr End )])
828786verifyInputs solvers opts fetcher preState post = do
829787 conf <- readConfig
830788 let call = mconcat [" prefix 0x" , getCallPrefix preState. state. calldata]
@@ -932,33 +890,16 @@ equivalenceCheck solvers sess bytecodeA bytecodeB opts calldata create = do
932890 let branchesA = rewriteFresh " A-" branchesAorig
933891 branchesB = rewriteFresh " B-" branchesBorig
934892 let partialIssues = EqIssues mempty (filter isPartial branchesA <> filter isPartial branchesB)
935- <<<<<<< HEAD
936- issues <- equivalenceCheck' solvers branchesA branchesB create
937- pure $ filterQeds (issues <> partialIssues)
938- =======
939893 issues <- equivalenceCheck' solvers sess branchesA branchesB create
940- pure $ oneQedOrNoQed issues <> partialIssues
941- >>>>>>> main
894+ pure $ filterQeds (issues <> partialIssues)
942895 where
943896 -- decompiles the given bytecode into a list of branches
944897 getBranches :: App m => ByteString -> m [Expr End ]
945898 getBranches bs = do
946899 let bytecode = if BS. null bs then BS. pack [0 ] else bs
947900 prestate <- liftIO $ stToIO $ abstractVM calldata bytecode Nothing create
948- <<<<<<< HEAD
949- interpret (Fetch. oracle solvers Nothing mempty ) opts. iterConf prestate runExpr
901+ interpret (Fetch. oracle solvers sess Fetch. noRpc) opts. iterConf prestate runExpr
950902 filterQeds (EqIssues res partials) = EqIssues (filter (\ (r, _) -> not . isQed $ r) res) partials
951- =======
952- expr <- interpret (Fetch. oracle solvers sess Fetch. noRpc) opts. iterConf prestate runExpr
953- let simpl = if conf. simp then Expr. simplify expr else expr
954- pure $ flattenExpr simpl
955- oneQedOrNoQed :: EqIssues -> EqIssues
956- oneQedOrNoQed (EqIssues res partials) =
957- let allQed = all (\ (r, _) -> isQed r) res
958- in if allQed then EqIssues [(Qed , " " )] partials
959- else EqIssues (filter (\ (r, _) -> not $ isQed r) res) partials
960- >>>>>>> main
961-
962903
963904rewriteFresh :: Text -> [Expr a ] -> [Expr a ]
964905rewriteFresh prefix exprs = fmap (mapExpr mymap) exprs
0 commit comments