Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Error
- data VMResult
- data VM = VM {}
- data Trace = Trace {}
- data TraceData
- data ExecMode
- data Query where
- type EVM a = State VM a
- data Cache = Cache {}
- data VMOpts = VMOpts {
- vmoptCode :: ByteString
- vmoptCalldata :: ByteString
- vmoptValue :: W256
- vmoptAddress :: Addr
- vmoptCaller :: Addr
- vmoptOrigin :: Addr
- vmoptGas :: W256
- vmoptNumber :: W256
- vmoptTimestamp :: W256
- vmoptCoinbase :: Addr
- vmoptDifficulty :: W256
- vmoptGaslimit :: W256
- vmoptGasprice :: W256
- vmoptSchedule :: FeeSchedule Word
- data Log = Log Addr Blob [Word]
- data Frame = Frame {}
- data FrameContext
- data FrameState = FrameState {}
- data TxState = TxState {
- _selfdestructs :: [Addr]
- _refunds :: [(Addr, Word)]
- data Contract = Contract {}
- data Env = Env {
- _contracts :: Map Addr Contract
- _sha3Crack :: Map Word Blob
- _origin :: Addr
- data Block = Block {
- _coinbase :: Addr
- _timestamp :: Word
- _number :: Word
- _difficulty :: Word
- _gaslimit :: Word
- _gasprice :: Word
- _schedule :: FeeSchedule Word
- blankState :: FrameState
- static :: Lens' FrameState Bool
- stack :: Lens' FrameState [Word]
- returndata :: Lens' FrameState Blob
- pc :: Lens' FrameState Int
- memorySize :: Lens' FrameState Int
- memory :: Lens' FrameState Memory
- gas :: Lens' FrameState Word
- contract :: Lens' FrameState Addr
- codeContract :: Lens' FrameState Addr
- code :: Lens' FrameState ByteString
- callvalue :: Lens' FrameState Word
- caller :: Lens' FrameState Addr
- calldata :: Lens' FrameState Blob
- frameState :: Lens' Frame FrameState
- frameContext :: Lens' Frame FrameContext
- timestamp :: Lens' Block Word
- schedule :: Lens' Block (FeeSchedule Word)
- number :: Lens' Block Word
- gasprice :: Lens' Block Word
- gaslimit :: Lens' Block Word
- difficulty :: Lens' Block Word
- coinbase :: Lens' Block Addr
- selfdestructs :: Lens' TxState [Addr]
- refunds :: Lens' TxState [(Addr, Word)]
- storage :: Lens' Contract (Map Word Word)
- opIxMap :: Lens' Contract (Vector Int)
- nonce :: Lens' Contract Word
- external :: Lens' Contract Bool
- codesize :: Lens' Contract Int
- codehash :: Lens' Contract W256
- codeOps :: Lens' Contract (Vector (Int, Op))
- bytecode :: Lens' Contract ByteString
- balance :: Lens' Contract Word
- sha3Crack :: Lens' Env (Map Word Blob)
- origin :: Lens' Env Addr
- contracts :: Lens' Env (Map Addr Contract)
- fetched :: Iso' Cache (Map Addr Contract)
- traceOpIx :: Lens' Trace Int
- traceData :: Lens' Trace TraceData
- traceCodehash :: Lens' Trace W256
- tx :: Lens' VM TxState
- traces :: Lens' VM (TreePos Empty Trace)
- state :: Lens' VM FrameState
- result :: Lens' VM (Maybe VMResult)
- logs :: Lens' VM (Seq Log)
- frames :: Lens' VM [Frame]
- execMode :: Lens' VM ExecMode
- env :: Lens' VM Env
- cache :: Lens' VM Cache
- burned :: Lens' VM Word
- block :: Lens' VM Block
- currentContract :: VM -> Maybe Contract
- makeVm :: VMOpts -> VM
- initialContract :: ByteString -> Contract
- next :: (?op :: Word8) => EVM ()
- exec1 :: EVM ()
- precompiledContract :: (?op :: Word8) => EVM ()
- noop :: Monad m => m ()
- pushTo :: MonadState s m => ASetter s s [a] [a] -> a -> m ()
- pushToSequence :: MonadState s m => ASetter s s (Seq a) (Seq a) -> a -> m ()
- touchAccount :: Addr -> (Contract -> EVM ()) -> EVM ()
- accessStorage :: Addr -> Word -> (Word -> EVM ()) -> EVM ()
- replaceCodeOfSelf :: ByteString -> EVM ()
- resetState :: EVM ()
- finalize :: EVM ()
- loadContract :: Addr -> EVM ()
- limitStack :: Int -> EVM () -> EVM ()
- notStatic :: EVM () -> EVM ()
- burn :: Word -> EVM () -> EVM ()
- refund :: Word -> EVM ()
- cheatCode :: Addr
- cheat :: (?op :: Word8) => (Word, Word) -> (Word, Word) -> EVM ()
- type CheatAction = ([AbiType], [AbiValue] -> EVM (Maybe AbiValue))
- cheatActions :: Map Word32 CheatAction
- delegateCall :: (?op :: Word8) => FeeSchedule Word -> Word -> Addr -> Word -> Word -> Word -> Word -> [Word] -> EVM () -> EVM ()
- underrun :: EVM ()
- vmError :: Error -> EVM ()
- accessMemoryRange :: FeeSchedule Word -> Word -> Word -> EVM () -> EVM ()
- accessMemoryWord :: FeeSchedule Word -> Word -> EVM () -> EVM ()
- copyBytesToMemory :: Blob -> Word -> Word -> Word -> EVM ()
- readMemory :: Word -> Word -> VM -> Blob
- word256At :: Functor f => Word -> (Word -> f Word) -> Memory -> f Memory
- withTraceLocation :: MonadState VM m => TraceData -> m Trace
- pushTrace :: TraceData -> EVM ()
- insertTrace :: TraceData -> EVM ()
- popTrace :: EVM ()
- zipperRootForest :: TreePos Empty a -> Forest a
- traceForest :: VM -> Forest Trace
- traceLog :: MonadState VM m => Log -> m ()
- push :: Word -> EVM ()
- stackOp1 :: (?op :: Word8) => (Word -> Word) -> (Word -> Word) -> EVM ()
- stackOp2 :: (?op :: Word8) => ((Word, Word) -> Word) -> ((Word, Word) -> Word) -> EVM ()
- stackOp3 :: (?op :: Word8) => ((Word, Word, Word) -> Word) -> ((Word, Word, Word) -> Word) -> EVM ()
- checkJump :: Integral n => n -> [Word] -> EVM ()
- insidePushData :: Int -> EVM Bool
- opSize :: Word8 -> Int
- mkOpIxMap :: ByteString -> Vector Int
- vmOp :: VM -> Maybe Op
- vmOpIx :: VM -> Maybe Int
- opParams :: VM -> Map String Word
- readOp :: Word8 -> ByteString -> Op
- mkCodeOps :: ByteString -> Vector (Int, Op)
- costOfCall :: FeeSchedule Word -> Maybe a -> Word -> Word -> Word -> (Word, Word)
- memoryCost :: FeeSchedule Word -> Word -> Word
- ceilDiv :: (Num a, Integral a) => a -> a -> a
- allButOne64th :: (Num a, Integral a) => a -> a
- log2 :: FiniteBits b => b -> Int
Data types
The possible result states of a VM
The state of a stepwise EVM execution
Trace | |
|
The cache is data that can be persisted for efficiency: any expensive query that is constant at least within a block.
A way to specify an initial VM state
VMOpts | |
|
An entry in the VM's "call/create stack"
The state that spans a whole transaction
The state of a contract
Various environmental data
Data about the block
Data accessors
Data constructors
initialContract :: ByteString -> Contract Source #
Opcode dispatch (exec1)
precompiledContract :: (?op :: Word8) => EVM () Source #
Opcode helper actions
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 #
replaceCodeOfSelf :: ByteString -> EVM () Source #
Replace current contract's code, like when CREATE returns from the constructor code.
resetState :: EVM () Source #
loadContract :: Addr -> EVM () Source #
Cheat codes
General call implementation ("delegateCall")
delegateCall :: (?op :: Word8) => FeeSchedule Word -> Word -> Addr -> Word -> Word -> Word -> Word -> [Word] -> EVM () -> EVM () Source #
VM error implementation
Memory helpers
accessMemoryRange :: FeeSchedule Word -> Word -> Word -> EVM () -> EVM () Source #
accessMemoryWord :: FeeSchedule Word -> Word -> EVM () -> EVM () Source #
Tracing
withTraceLocation :: MonadState VM m => TraceData -> m Trace Source #
insertTrace :: TraceData -> EVM () Source #
Stack manipulation
stackOp3 :: (?op :: Word8) => ((Word, Word, Word) -> Word) -> ((Word, Word, Word) -> Word) -> EVM () Source #
Bytecode data functions
Gas cost calculation helpers
memoryCost :: FeeSchedule Word -> Word -> Word Source #
Arithmetic
allButOne64th :: (Num a, Integral a) => a -> a Source #
log2 :: FiniteBits b => b -> Int Source #