hevm-0.17: Ethereum virtual machine evaluator

Safe HaskellNone
LanguageHaskell2010

EVM

Contents

Synopsis

Data types

data VMResult Source #

The possible result states of a VM

Constructors

VMFailure Error

An operation failed

VMSuccess Blob

Reached STOP, RETURN, or end-of-code

Instances
Show VMResult Source # 
Instance details

Defined in EVM

SDisplay VMResult Source # 
Instance details

Defined in EVM.Emacs

data VM Source #

The state of a stepwise EVM execution

Instances
SDisplay VM Source # 
Instance details

Defined in EVM.Emacs

Methods

sexp :: VM -> SExpr Text Source #

data Trace Source #

Constructors

Trace 

data Query where Source #

Constructors

PleaseFetchContract :: Addr -> (Contract -> EVM ()) -> Query 
PleaseFetchSlot :: Addr -> Word -> (Word -> EVM ()) -> Query 
Instances
Show Query Source # 
Instance details

Defined in EVM

Methods

showsPrec :: Int -> Query -> ShowS #

show :: Query -> String #

showList :: [Query] -> ShowS #

type EVM a = State VM a Source #

Alias for the type of e.g. exec1.

data Cache Source #

The cache is data that can be persisted for efficiency: any expensive query that is constant at least within a block.

Constructors

Cache 
Instances
Semigroup Cache Source # 
Instance details

Defined in EVM

Methods

(<>) :: Cache -> Cache -> Cache #

sconcat :: NonEmpty Cache -> Cache #

stimes :: Integral b => b -> Cache -> Cache #

Monoid Cache Source # 
Instance details

Defined in EVM

Methods

mempty :: Cache #

mappend :: Cache -> Cache -> Cache #

mconcat :: [Cache] -> Cache #

data VMOpts Source #

A way to specify an initial VM state

Instances
Show VMOpts Source # 
Instance details

Defined in EVM

data Log Source #

A log entry

Constructors

Log Addr Blob [Word] 

data Frame Source #

An entry in the VM's "call/create stack"

Instances
SDisplay Frame Source # 
Instance details

Defined in EVM.Emacs

Methods

sexp :: Frame -> SExpr Text Source #

data FrameState Source #

The "registers" of the VM along with memory and data stack

Instances
SDisplay FrameState Source # 
Instance details

Defined in EVM.Emacs

data TxState Source #

The state that spans a whole transaction

Constructors

TxState 

Fields

data Contract Source #

The state of a contract

Instances
Eq Contract Source # 
Instance details

Defined in EVM

Show Contract Source # 
Instance details

Defined in EVM

SDisplay Contract Source # 
Instance details

Defined in EVM.Emacs

data Env Source #

Various environmental data

Constructors

Env 

data Block Source #

Data about the block

Data accessors

Data constructors

Opcode dispatch (exec1)

next :: (?op :: Word8) => EVM () Source #

Opcode helper actions

noop :: Monad m => m () Source #

pushTo :: MonadState s m => ASetter s s [a] [a] -> a -> m () Source #

pushToSequence :: MonadState s m => ASetter s s (Seq a) (Seq a) -> a -> m () Source #

touchAccount :: Addr -> (Contract -> EVM ()) -> EVM () Source #

accessStorage Source #

Arguments

:: Addr

Contract address

-> Word

Storage slot key

-> (Word -> EVM ())

Continuation

-> EVM () 

replaceCodeOfSelf :: ByteString -> EVM () Source #

Replace current contract's code, like when CREATE returns from the constructor code.

limitStack :: Int -> EVM () -> EVM () Source #

notStatic :: EVM () -> EVM () Source #

burn :: Word -> EVM () -> EVM () Source #

Cheat codes

cheat :: (?op :: Word8) => (Word, Word) -> (Word, Word) -> EVM () Source #

General call implementation ("delegateCall")

delegateCall :: (?op :: Word8) => FeeSchedule Word -> Word -> Addr -> Word -> Word -> Word -> Word -> [Word] -> EVM () -> EVM () Source #

VM error implementation

Memory helpers

word256At :: Functor f => Word -> (Word -> f Word) -> Memory -> f Memory Source #

Tracing

traceLog :: MonadState VM m => Log -> m () Source #

Stack manipulation

push :: Word -> EVM () Source #

stackOp1 :: (?op :: Word8) => (Word -> Word) -> (Word -> Word) -> EVM () Source #

stackOp2 :: (?op :: Word8) => ((Word, Word) -> Word) -> ((Word, Word) -> Word) -> EVM () Source #

stackOp3 :: (?op :: Word8) => ((Word, Word, Word) -> Word) -> ((Word, Word, Word) -> Word) -> EVM () Source #

Bytecode data functions

checkJump :: Integral n => n -> [Word] -> EVM () Source #

Gas cost calculation helpers

Arithmetic

ceilDiv :: (Num a, Integral a) => a -> a -> a Source #

allButOne64th :: (Num a, Integral a) => a -> a Source #

log2 :: FiniteBits b => b -> Int Source #

Emacs setup