an intermediate symbolic execution engine for EVM bytecode
16

Configure Feed

Select the types of activity you want to include in your feed.

1 1 0

Clone this repository

https://git.vm.fail/vm.fail/symevm https://git.vm.fail/did:plc:el3c3nq7lt4vd7rgxl6m7wdn
ssh://git@knot.vm.fail:2222/vm.fail/symevm ssh://git@knot.vm.fail:2222/did:plc:el3c3nq7lt4vd7rgxl6m7wdn

For self-hosted knots, clone URLs may differ based on your setup.


README.md

symevm#

symbolic EVM implin Haskell for smart contract analysis/ equivalence checking and verification that tracks path constraints through JUMPI branches, maintains symbolic state (stack, memory, storage) and has constraint analysis of contract behavior

Usage#

import SymbolicExpression
import SymbolicState
import Executor
import qualified Data.ByteString as BS

let bytecode = BS.pack [0x33, 0x61, 0x12, 0x34, 0x14, 0x60, 0x0b, 0x57, ...]
let paths = explore bytecode (initState BS.empty) 1000

mapM_ analyzeConstraints paths

Single path execution:

run :: ByteString -> ExecState -> Int -> [ExecState]

Path exploration:

explore :: ByteString -> ExecState -> Int -> [ExecState]

Build#

cabal build
cabal run symevm

Example#

let code = BS.pack [
  0x60, 0x00, 
  0x35,        
  0x60, 0x64,  
  0x11,       
  0x60, 0x0a,  
  0x57,       
  0xfd,        
  0x5b,        
  0x00       
  ]

let paths = explore code (initState BS.empty) 50

Yields 2 paths:

Path 1: calldataload(0) > 100 → PC=10, halted Path 2: calldataload(0) <= 100 → reverted