Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
- Data types
- Data accessors
- Data constructors
- Opcode dispatch (exec1)
- Opcode helper actions
- How to finalize a transaction
- Substate manipulation
- Cheat codes
- General call implementation ("delegateCall")
- VM error implementation
- Memory helpers
- Tracing
- Stack manipulation
- Bytecode data functions
- Gas cost calculation helpers
- Arithmetic
Synopsis
- data Error
- = BalanceTooLow W256 W256
- | UnrecognizedOpcode Word8
- | SelfDestruction
- | StackUnderrun
- | BadJumpDestination
- | Revert (Expr Buf)
- | OutOfGas Word64 Word64
- | BadCheatCode FunctionSelector
- | StackLimitExceeded
- | IllegalOverflow
- | Query Query
- | Choose Choose
- | StateChangeWhileStatic
- | InvalidMemoryAccess
- | CallDepthLimitReached
- | MaxCodeSizeExceeded W256 W256
- | InvalidFormat
- | PrecompileFailure
- | forall a. UnexpectedSymbolicArg Int String [Expr a]
- | DeadPath
- | NotUnique (Expr EWord)
- | SMTTimeout
- | FFI [AbiValue]
- | ReturnDataOutOfBounds
- | NonceOverflow
- data VMResult
- data VM = VM {}
- data Trace = Trace {}
- data TraceData
- = EventTrace (Expr EWord) (Expr Buf) [Expr EWord]
- | FrameTrace FrameContext
- | QueryTrace Query
- | ErrorTrace Error
- | EntryTrace Text
- | ReturnTrace (Expr Buf) FrameContext
- data Query where
- PleaseFetchContract :: Addr -> (Contract -> EVM ()) -> Query
- PleaseFetchSlot :: Addr -> W256 -> (W256 -> EVM ()) -> Query
- PleaseAskSMT :: Expr EWord -> [Prop] -> (BranchCondition -> EVM ()) -> Query
- PleaseDoFFI :: [String] -> (ByteString -> EVM ()) -> Query
- data Choose where
- type EVM a = State VM a
- type CodeLocation = (Addr, Int)
- data BranchCondition
- = Case Bool
- | Unknown
- | Inconsistent
- data IsUnique a
- = Unique a
- | Multiple
- | InconsistentU
- | TimeoutU
- data Cache = Cache {
- fetchedContracts :: Map Addr Contract
- fetchedStorage :: Map W256 (Map W256 W256)
- path :: Map (CodeLocation, Int) Bool
- data VMOpts = VMOpts {
- contract :: Contract
- calldata :: (Expr Buf, [Prop])
- initialStorage :: Expr Storage
- value :: Expr EWord
- priorityFee :: W256
- address :: Addr
- caller :: Expr EWord
- origin :: Addr
- gas :: Word64
- gaslimit :: Word64
- number :: W256
- timestamp :: Expr EWord
- coinbase :: Addr
- prevRandao :: W256
- maxCodeSize :: W256
- blockGaslimit :: Word64
- gasprice :: W256
- baseFee :: W256
- schedule :: FeeSchedule Word64
- chainId :: W256
- create :: Bool
- txAccessList :: Map Addr [W256]
- allowFFI :: Bool
- data Frame = Frame {}
- data FrameContext
- = CreationContext { }
- | CallContext { }
- data FrameState = FrameState {}
- data TxState = TxState {}
- data SubState = SubState {
- selfdestructs :: [Addr]
- touchedAccounts :: [Addr]
- accessedAddresses :: Set Addr
- accessedStorageKeys :: Set (Addr, W256)
- refunds :: [(Addr, Word64)]
- data ContractCode
- data RuntimeCode
- data Contract = Contract {}
- data Env = Env {}
- data Block = Block {}
- blankState :: FrameState
- bytecode :: Getter Contract (Expr Buf)
- unifyCachedStorage :: Map W256 W256 -> Map W256 W256 -> Map W256 W256
- unifyCachedContract :: Contract -> Contract -> Contract
- currentContract :: VM -> Maybe Contract
- makeVm :: VMOpts -> VM
- initialContract :: ContractCode -> Contract
- next :: (?op :: Word8) => EVM ()
- exec1 :: EVM ()
- transfer :: Addr -> Addr -> W256 -> EVM ()
- callChecks :: (?op :: Word8) => Contract -> Word64 -> Addr -> Addr -> W256 -> W256 -> W256 -> W256 -> W256 -> [Expr EWord] -> (Word64 -> EVM ()) -> EVM ()
- precompiledContract :: (?op :: Word8) => Contract -> Word64 -> Addr -> Addr -> W256 -> W256 -> W256 -> W256 -> W256 -> [Expr EWord] -> EVM ()
- executePrecompile :: (?op :: Word8) => Addr -> Word64 -> W256 -> W256 -> W256 -> W256 -> [Expr EWord] -> EVM ()
- truncpadlit :: Int -> ByteString -> ByteString
- lazySlice :: W256 -> W256 -> ByteString -> ByteString
- parseModexpLength :: ByteString -> (W256, W256, W256)
- isZero :: W256 -> W256 -> ByteString -> Bool
- asInteger :: ByteString -> Integer
- noop :: Monad m => m ()
- pushTo :: MonadState s m => Lens s s [a] [a] -> a -> m ()
- pushToSequence :: MonadState s m => Setter s s (Seq a) (Seq a) -> a -> m ()
- getCodeLocation :: VM -> CodeLocation
- branch :: CodeLocation -> Expr EWord -> (Bool -> EVM ()) -> EVM ()
- fetchAccount :: Addr -> (Contract -> EVM ()) -> EVM ()
- accessStorage :: Addr -> Expr EWord -> (Expr EWord -> EVM ()) -> EVM ()
- accountExists :: Addr -> VM -> Bool
- accountEmpty :: Contract -> Bool
- finalize :: EVM ()
- loadContract :: Addr -> EVM ()
- limitStack :: Int -> EVM () -> EVM ()
- notStatic :: EVM () -> EVM ()
- burn :: Word64 -> EVM () -> EVM ()
- forceConcrete :: Expr EWord -> String -> (W256 -> EVM ()) -> EVM ()
- forceConcrete2 :: (Expr EWord, Expr EWord) -> String -> ((W256, W256) -> EVM ()) -> EVM ()
- forceConcrete3 :: (Expr EWord, Expr EWord, Expr EWord) -> String -> ((W256, W256, W256) -> EVM ()) -> EVM ()
- forceConcrete4 :: (Expr EWord, Expr EWord, Expr EWord, Expr EWord) -> String -> ((W256, W256, W256, W256) -> EVM ()) -> EVM ()
- forceConcrete5 :: (Expr EWord, Expr EWord, Expr EWord, Expr EWord, Expr EWord) -> String -> ((W256, W256, W256, W256, W256) -> EVM ()) -> EVM ()
- forceConcrete6 :: (Expr EWord, Expr EWord, Expr EWord, Expr EWord, Expr EWord, Expr EWord) -> String -> ((W256, W256, W256, W256, W256, W256) -> EVM ()) -> EVM ()
- forceConcreteBuf :: Expr Buf -> String -> (ByteString -> EVM ()) -> EVM ()
- refund :: Word64 -> EVM ()
- unRefund :: Word64 -> EVM ()
- touchAccount :: Addr -> EVM ()
- selfdestruct :: Addr -> EVM ()
- accessAndBurn :: Addr -> EVM () -> EVM ()
- accessAccountForGas :: Addr -> EVM Bool
- accessStorageForGas :: Addr -> Expr EWord -> EVM Bool
- cheatCode :: Addr
- cheat :: (?op :: Word8) => (W256, W256) -> (W256, W256) -> EVM ()
- type CheatAction = Expr EWord -> Expr EWord -> Expr Buf -> EVM ()
- cheatActions :: Map FunctionSelector CheatAction
- delegateCall :: (?op :: Word8) => Contract -> Word64 -> Expr EWord -> Expr EWord -> W256 -> W256 -> W256 -> W256 -> W256 -> [Expr EWord] -> (Addr -> EVM ()) -> EVM ()
- collision :: Maybe Contract -> Bool
- create :: (?op :: Word8) => Addr -> Contract -> Word64 -> W256 -> [Expr EWord] -> Addr -> Expr Buf -> EVM ()
- replaceCode :: Addr -> ContractCode -> EVM ()
- replaceCodeOfSelf :: ContractCode -> EVM ()
- resetState :: EVM ()
- vmError :: Error -> EVM ()
- underrun :: EVM ()
- data FrameResult
- = FrameReturned (Expr Buf)
- | FrameReverted (Expr Buf)
- | FrameErrored Error
- finishFrame :: FrameResult -> EVM ()
- accessUnboundedMemoryRange :: Word64 -> Word64 -> EVM () -> EVM ()
- accessMemoryRange :: W256 -> W256 -> EVM () -> EVM ()
- accessMemoryWord :: W256 -> EVM () -> EVM ()
- copyBytesToMemory :: Expr Buf -> Expr EWord -> Expr EWord -> Expr EWord -> EVM ()
- copyCallBytesToMemory :: Expr Buf -> Expr EWord -> Expr EWord -> Expr EWord -> EVM ()
- readMemory :: Expr EWord -> Expr EWord -> VM -> Expr Buf
- withTraceLocation :: TraceData -> EVM Trace
- pushTrace :: TraceData -> EVM ()
- insertTrace :: TraceData -> EVM ()
- popTrace :: EVM ()
- zipperRootForest :: TreePos Empty a -> Forest a
- traceForest :: VM -> Forest Trace
- traceTopLog :: [Expr Log] -> EVM ()
- push :: W256 -> EVM ()
- pushSym :: Expr EWord -> EVM ()
- stackOp1 :: (?op :: Word8) => Word64 -> (Expr EWord -> Expr EWord) -> EVM ()
- stackOp2 :: (?op :: Word8) => Word64 -> ((Expr EWord, Expr EWord) -> Expr EWord) -> EVM ()
- stackOp3 :: (?op :: Word8) => Word64 -> ((Expr EWord, Expr EWord, Expr EWord) -> Expr EWord) -> EVM ()
- use' :: (VM -> a) -> EVM a
- checkJump :: Int -> [Expr EWord] -> EVM ()
- opSize :: Word8 -> Int
- mkOpIxMap :: ContractCode -> Vector Int
- vmOp :: VM -> Maybe Op
- vmOpIx :: VM -> Maybe Int
- mkCodeOps :: ContractCode -> Vector (Int, Op)
- costOfCall :: FeeSchedule Word64 -> Bool -> W256 -> Word64 -> Word64 -> Addr -> EVM (Word64, Word64)
- costOfCreate :: FeeSchedule Word64 -> Word64 -> W256 -> (Word64, Word64)
- concreteModexpGasFee :: ByteString -> Word64
- costOfPrecompile :: FeeSchedule Word64 -> Addr -> Expr Buf -> Word64
- memoryCost :: FeeSchedule Word64 -> Word64 -> Word64
- hashcode :: ContractCode -> Expr EWord
- opslen :: ContractCode -> Int
- codelen :: ContractCode -> Expr EWord
- toBuf :: ContractCode -> Expr Buf
- codeloc :: EVM CodeLocation
- ceilDiv :: (Num a, Integral a) => a -> a -> a
- allButOne64th :: (Num a, Integral a) => a -> a
- log2 :: FiniteBits b => b -> Int
Data types
EVM failure modes
The possible result states of a VM
The state of a stepwise EVM execution
VM | |
|
Instances
Instances
Generic Trace Source # | |
Show Trace Source # | |
(k ~ A_Lens, a ~ Contract, b ~ Contract) => LabelOptic "contract" k Trace Trace a b Source # | |
(k ~ A_Lens, a ~ Int, b ~ Int) => LabelOptic "opIx" k Trace Trace a b Source # | |
(k ~ A_Lens, a ~ TraceData, b ~ TraceData) => LabelOptic "tracedata" k Trace Trace a b Source # | |
type Rep Trace Source # | |
Defined in EVM type Rep Trace = D1 ('MetaData "Trace" "EVM" "hevm-0.50.5-inplace" 'False) (C1 ('MetaCons "Trace" 'PrefixI 'True) (S1 ('MetaSel ('Just "opIx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "contract") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Contract) :*: S1 ('MetaSel ('Just "tracedata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TraceData)))) |
EventTrace (Expr EWord) (Expr Buf) [Expr EWord] | |
FrameTrace FrameContext | |
QueryTrace Query | |
ErrorTrace Error | |
EntryTrace Text | |
ReturnTrace (Expr Buf) FrameContext |
Instances
Queries halt execution until resolved through RPC calls or SMT queries
PleaseFetchContract :: Addr -> (Contract -> EVM ()) -> Query | |
PleaseFetchSlot :: Addr -> W256 -> (W256 -> EVM ()) -> Query | |
PleaseAskSMT :: Expr EWord -> [Prop] -> (BranchCondition -> EVM ()) -> Query | |
PleaseDoFFI :: [String] -> (ByteString -> EVM ()) -> Query |
type CodeLocation = (Addr, Int) Source #
data BranchCondition Source #
The possible return values of a SMT query
Instances
Show BranchCondition Source # | |
Defined in EVM showsPrec :: Int -> BranchCondition -> ShowS # show :: BranchCondition -> String # showList :: [BranchCondition] -> ShowS # |
The possible return values of a `is unique` SMT query
The cache is data that can be persisted for efficiency: any expensive query that is constant at least within a block.
Cache | |
|
Instances
A way to specify an initial VM state
VMOpts | |
|
Instances
An entry in the VM's "call/create stack"
Frame | |
|
Instances
Show Frame Source # | |
(k ~ A_Lens, a ~ FrameContext, b ~ FrameContext) => LabelOptic "context" k Frame Frame a b Source # | |
(k ~ A_Lens, a ~ FrameState, b ~ FrameState) => LabelOptic "state" k Frame Frame a b Source # | |
data FrameContext Source #
Call/create info
Instances
data FrameState Source #
The "registers" of the VM along with memory and data stack
Instances
The state that spans a whole transaction
Instances
Show TxState Source # | |
(k ~ A_Lens, a ~ Word64, b ~ Word64) => LabelOptic "gaslimit" k TxState TxState a b Source # | |
(k ~ A_Lens, a ~ W256, b ~ W256) => LabelOptic "gasprice" k TxState TxState a b Source # | |
(k ~ A_Lens, a ~ Bool, b ~ Bool) => LabelOptic "isCreate" k TxState TxState a b Source # | |
(k ~ A_Lens, a ~ Addr, b ~ Addr) => LabelOptic "origin" k TxState TxState a b Source # | |
(k ~ A_Lens, a ~ W256, b ~ W256) => LabelOptic "priorityFee" k TxState TxState a b Source # | |
(k ~ A_Lens, a ~ SubState, b ~ SubState) => LabelOptic "substate" k TxState TxState a b Source # | |
(k ~ A_Lens, a ~ Addr, b ~ Addr) => LabelOptic "toAddr" k TxState TxState a b Source # | |
(k ~ A_Lens, a ~ Map Addr Contract, b ~ Map Addr Contract) => LabelOptic "txReversion" k TxState TxState a b Source # | |
(k ~ A_Lens, a ~ Expr 'EWord, b ~ Expr 'EWord) => LabelOptic "value" k TxState TxState a b Source # | |
The "accrued substate" across a transaction
SubState | |
|
Instances
Show SubState Source # | |
(k ~ A_Lens, a ~ Set Addr, b ~ Set Addr) => LabelOptic "accessedAddresses" k SubState SubState a b Source # | |
(k ~ A_Lens, a ~ Set (Addr, W256), b ~ Set (Addr, W256)) => LabelOptic "accessedStorageKeys" k SubState SubState a b Source # | |
(k ~ A_Lens, a ~ [(Addr, Word64)], b ~ [(Addr, Word64)]) => LabelOptic "refunds" k SubState SubState a b Source # | |
(k ~ A_Lens, a ~ [Addr], b ~ [Addr]) => LabelOptic "selfdestructs" k SubState SubState a b Source # | |
(k ~ A_Lens, a ~ [Addr], b ~ [Addr]) => LabelOptic "touchedAccounts" k SubState SubState a b Source # | |
data ContractCode Source #
A contract is either in creation (running its "constructor") or
post-creation, and code in these two modes is treated differently
by instructions like EXTCODEHASH
, so we distinguish these two
code types.
The definition follows the structure of code output by solc. We need to use some heuristics here to deal with symbolic data regions that may be present in the bytecode since the fully abstract case is impractical:
- initcode has concrete code, followed by an abstract data "section"
- runtimecode has a fixed length, but may contain fixed size symbolic regions (due to immutable)
hopefully we do not have to deal with dynamic immutable before we get a real data section...
InitCode ByteString (Expr Buf) | Constructor code, during contract creation |
RuntimeCode RuntimeCode | Instance code, after contract creation |
Instances
Show ContractCode Source # | |
Defined in EVM showsPrec :: Int -> ContractCode -> ShowS # show :: ContractCode -> String # showList :: [ContractCode] -> ShowS # | |
Eq ContractCode Source # | |
Defined in EVM (==) :: ContractCode -> ContractCode -> Bool # (/=) :: ContractCode -> ContractCode -> Bool # | |
Ord ContractCode Source # | |
Defined in EVM compare :: ContractCode -> ContractCode -> Ordering # (<) :: ContractCode -> ContractCode -> Bool # (<=) :: ContractCode -> ContractCode -> Bool # (>) :: ContractCode -> ContractCode -> Bool # (>=) :: ContractCode -> ContractCode -> Bool # max :: ContractCode -> ContractCode -> ContractCode # min :: ContractCode -> ContractCode -> ContractCode # |
data RuntimeCode Source #
We have two variants here to optimize the fully concrete case. ConcreteRuntimeCode just wraps a ByteString SymbolicRuntimeCode is a fixed length vector of potentially symbolic bytes, which lets us handle symbolic pushdata (e.g. from immutable variables in solidity).
Instances
Show RuntimeCode Source # | |
Defined in EVM showsPrec :: Int -> RuntimeCode -> ShowS # show :: RuntimeCode -> String # showList :: [RuntimeCode] -> ShowS # | |
Eq RuntimeCode Source # | |
Defined in EVM (==) :: RuntimeCode -> RuntimeCode -> Bool # (/=) :: RuntimeCode -> RuntimeCode -> Bool # | |
Ord RuntimeCode Source # | |
Defined in EVM compare :: RuntimeCode -> RuntimeCode -> Ordering # (<) :: RuntimeCode -> RuntimeCode -> Bool # (<=) :: RuntimeCode -> RuntimeCode -> Bool # (>) :: RuntimeCode -> RuntimeCode -> Bool # (>=) :: RuntimeCode -> RuntimeCode -> Bool # max :: RuntimeCode -> RuntimeCode -> RuntimeCode # min :: RuntimeCode -> RuntimeCode -> RuntimeCode # |
The state of a contract
Instances
Show Contract Source # | |
(k ~ A_Lens, a ~ W256, b ~ W256) => LabelOptic "balance" k Contract Contract a b Source # | |
(k ~ A_Lens, a ~ Vector (Int, Op), b ~ Vector (Int, Op)) => LabelOptic "codeOps" k Contract Contract a b Source # | |
(k ~ A_Lens, a ~ Expr 'EWord, b ~ Expr 'EWord) => LabelOptic "codehash" k Contract Contract a b Source # | |
(k ~ A_Lens, a ~ ContractCode, b ~ ContractCode) => LabelOptic "contractcode" k Contract Contract a b Source # | |
(k ~ A_Lens, a ~ Bool, b ~ Bool) => LabelOptic "external" k Contract Contract a b Source # | |
(k ~ A_Lens, a ~ W256, b ~ W256) => LabelOptic "nonce" k Contract Contract a b Source # | |
(k ~ A_Lens, a ~ Vector Int, b ~ Vector Int) => LabelOptic "opIxMap" k Contract Contract a b Source # | |
Various environmental data
Instances
Data about the block
Instances
bytecode :: Getter Contract (Expr Buf) Source #
An "external" view of a contract's bytecode, appropriate for
e.g. EXTCODEHASH
.
Data accessors
Data constructors
initialContract :: ContractCode -> Contract Source #
Initialize empty contract with given code
Opcode dispatch (exec1)
callChecks :: (?op :: Word8) => Contract -> Word64 -> Addr -> Addr -> W256 -> W256 -> W256 -> W256 -> W256 -> [Expr EWord] -> (Word64 -> EVM ()) -> EVM () Source #
Checks a *CALL for failure; OOG, too many callframes, memory access etc.
precompiledContract :: (?op :: Word8) => Contract -> Word64 -> Addr -> Addr -> W256 -> W256 -> W256 -> W256 -> W256 -> [Expr EWord] -> EVM () Source #
executePrecompile :: (?op :: Word8) => Addr -> Word64 -> W256 -> W256 -> W256 -> W256 -> [Expr EWord] -> EVM () Source #
truncpadlit :: Int -> ByteString -> ByteString Source #
lazySlice :: W256 -> W256 -> ByteString -> ByteString Source #
parseModexpLength :: ByteString -> (W256, W256, W256) Source #
asInteger :: ByteString -> Integer Source #
Opcode helper actions
pushTo :: MonadState s m => Lens s s [a] [a] -> a -> m () Source #
pushToSequence :: MonadState s m => Setter s s (Seq a) (Seq a) -> a -> m () Source #
getCodeLocation :: VM -> CodeLocation Source #
fetchAccount :: Addr -> (Contract -> EVM ()) -> EVM () Source #
Construct RPC Query and halt execution until resolved
accountEmpty :: Contract -> Bool Source #
How to finalize a transaction
loadContract :: Addr -> EVM () Source #
Loads the selected contract as the current contract to execute
forceConcrete3 :: (Expr EWord, Expr EWord, Expr EWord) -> String -> ((W256, W256, W256) -> EVM ()) -> EVM () Source #
forceConcrete4 :: (Expr EWord, Expr EWord, Expr EWord, Expr EWord) -> String -> ((W256, W256, W256, W256) -> EVM ()) -> EVM () Source #
forceConcrete5 :: (Expr EWord, Expr EWord, Expr EWord, Expr EWord, Expr EWord) -> String -> ((W256, W256, W256, W256, W256) -> EVM ()) -> EVM () Source #
forceConcrete6 :: (Expr EWord, Expr EWord, Expr EWord, Expr EWord, Expr EWord, Expr EWord) -> String -> ((W256, W256, W256, W256, W256, W256) -> EVM ()) -> EVM () Source #
forceConcreteBuf :: Expr Buf -> String -> (ByteString -> EVM ()) -> EVM () Source #
Substate manipulation
touchAccount :: Addr -> EVM () Source #
selfdestruct :: Addr -> EVM () Source #
accessAccountForGas :: Addr -> EVM Bool Source #
returns a wrapped boolean- if true, this address has been touched before in the txn (warm gas cost as in EIP 2929) otherwise cold
accessStorageForGas :: Addr -> Expr EWord -> EVM Bool Source #
returns a wrapped boolean- if true, this slot has been touched before in the txn (warm gas cost as in EIP 2929) otherwise cold
Cheat codes
General call implementation ("delegateCall")
delegateCall :: (?op :: Word8) => Contract -> Word64 -> Expr EWord -> Expr EWord -> W256 -> W256 -> W256 -> W256 -> W256 -> [Expr EWord] -> (Addr -> EVM ()) -> EVM () Source #
create :: (?op :: Word8) => Addr -> Contract -> Word64 -> W256 -> [Expr EWord] -> Addr -> Expr Buf -> EVM () Source #
replaceCode :: Addr -> ContractCode -> EVM () Source #
Replace a contract's code, like when CREATE returns from the constructor code.
replaceCodeOfSelf :: ContractCode -> EVM () Source #
resetState :: EVM () Source #
VM error implementation
data FrameResult Source #
A stack frame can be popped in three ways.
FrameReturned (Expr Buf) | STOP, RETURN, or no more code |
FrameReverted (Expr Buf) | REVERT |
FrameErrored Error | Any other error |
Instances
Show FrameResult Source # | |
Defined in EVM showsPrec :: Int -> FrameResult -> ShowS # show :: FrameResult -> String # showList :: [FrameResult] -> ShowS # |
finishFrame :: FrameResult -> EVM () Source #
This function defines how to pop the current stack frame in either of
the ways specified by FrameResult
.
It also handles the case when the current stack frame is the only one;
in this case, we set the final _result
of the VM execution.
Memory helpers
Tracing
insertTrace :: TraceData -> EVM () Source #
Stack manipulation
stackOp3 :: (?op :: Word8) => Word64 -> ((Expr EWord, Expr EWord, Expr EWord) -> Expr EWord) -> EVM () Source #
Bytecode data functions
Gas cost calculation helpers
costOfCall :: FeeSchedule Word64 -> Bool -> W256 -> Word64 -> Word64 -> Addr -> EVM (Word64, Word64) Source #
costOfCreate :: FeeSchedule Word64 -> Word64 -> W256 -> (Word64, Word64) Source #
costOfPrecompile :: FeeSchedule Word64 -> Addr -> Expr Buf -> Word64 Source #
memoryCost :: FeeSchedule Word64 -> Word64 -> Word64 Source #
opslen :: ContractCode -> Int Source #
The length of the code ignoring any constructor args. This represents the region that can contain executable opcodes
codelen :: ContractCode -> Expr EWord Source #
The length of the code including any constructor args. This can return an abstract value
Arithmetic
allButOne64th :: (Num a, Integral a) => a -> a Source #
log2 :: FiniteBits b => b -> Int Source #