Enum evm::Instruction
source · [−]#[repr(u8)]
pub enum Instruction {
Show 145 variants
STOP,
ADD,
MUL,
SUB,
DIV,
SDIV,
MOD,
SMOD,
ADDMOD,
MULMOD,
EXP,
SIGNEXTEND,
LT,
GT,
SLT,
SGT,
EQ,
ISZERO,
AND,
OR,
XOR,
NOT,
BYTE,
SHL,
SHR,
SAR,
SHA3,
ADDRESS,
BALANCE,
ORIGIN,
CALLER,
CALLVALUE,
CALLDATALOAD,
CALLDATASIZE,
CALLDATACOPY,
CODESIZE,
CODECOPY,
GASPRICE,
EXTCODESIZE,
EXTCODECOPY,
RETURNDATASIZE,
RETURNDATACOPY,
EXTCODEHASH,
BLOCKHASH,
COINBASE,
TIMESTAMP,
NUMBER,
DIFFICULTY,
GASLIMIT,
CHAINID,
SELFBALANCE,
BASEFEE,
POP,
MLOAD,
MSTORE,
MSTORE8,
SLOAD,
SSTORE,
JUMP,
JUMPI,
PC,
MSIZE,
GAS,
JUMPDEST,
PUSH1,
PUSH2,
PUSH3,
PUSH4,
PUSH5,
PUSH6,
PUSH7,
PUSH8,
PUSH9,
PUSH10,
PUSH11,
PUSH12,
PUSH13,
PUSH14,
PUSH15,
PUSH16,
PUSH17,
PUSH18,
PUSH19,
PUSH20,
PUSH21,
PUSH22,
PUSH23,
PUSH24,
PUSH25,
PUSH26,
PUSH27,
PUSH28,
PUSH29,
PUSH30,
PUSH31,
PUSH32,
DUP1,
DUP2,
DUP3,
DUP4,
DUP5,
DUP6,
DUP7,
DUP8,
DUP9,
DUP10,
DUP11,
DUP12,
DUP13,
DUP14,
DUP15,
DUP16,
SWAP1,
SWAP2,
SWAP3,
SWAP4,
SWAP5,
SWAP6,
SWAP7,
SWAP8,
SWAP9,
SWAP10,
SWAP11,
SWAP12,
SWAP13,
SWAP14,
SWAP15,
SWAP16,
LOG0,
LOG1,
LOG2,
LOG3,
LOG4,
BEGINSUB,
RETURNSUB,
JUMPSUB,
CREATE,
CALL,
CALLCODE,
RETURN,
DELEGATECALL,
CREATE2,
REVERT,
STATICCALL,
SUICIDE,
}
Expand description
Virtual machine bytecode instruction.
Variants
STOP
halts execution
ADD
addition operation
MUL
mulitplication operation
SUB
subtraction operation
DIV
integer division operation
SDIV
signed integer division operation
MOD
modulo remainder operation
SMOD
signed modulo remainder operation
ADDMOD
unsigned modular addition
MULMOD
unsigned modular multiplication
EXP
exponential operation
SIGNEXTEND
extend length of signed integer
LT
less-than comparision
GT
greater-than comparision
SLT
signed less-than comparision
SGT
signed greater-than comparision
EQ
equality comparision
ISZERO
simple not operator
AND
bitwise AND operation
OR
bitwise OR operation
XOR
bitwise XOR operation
NOT
bitwise NOT opertation
BYTE
retrieve single byte from word
SHL
shift left operation
SHR
logical shift right operation
SAR
arithmetic shift right operation
SHA3
compute SHA3-256 hash
ADDRESS
get address of currently executing account
BALANCE
get balance of the given account
ORIGIN
get execution origination address
CALLER
get caller address
CALLVALUE
get deposited value by the instruction/transaction responsible for this execution
CALLDATALOAD
get input data of current environment
CALLDATASIZE
get size of input data in current environment
CALLDATACOPY
copy input data in current environment to memory
CODESIZE
get size of code running in current environment
CODECOPY
copy code running in current environment to memory
GASPRICE
get price of gas in current environment
EXTCODESIZE
get external code size (from another contract)
EXTCODECOPY
copy external code (from another contract)
RETURNDATASIZE
get the size of the return data buffer for the last call
RETURNDATACOPY
copy return data buffer to memory
EXTCODEHASH
return the keccak256 hash of contract code
BLOCKHASH
get hash of most recent complete block
COINBASE
get the block’s coinbase address
TIMESTAMP
get the block’s timestamp
NUMBER
get the block’s number
DIFFICULTY
get the block’s difficulty
GASLIMIT
get the block’s gas limit
CHAINID
get chain ID
SELFBALANCE
get balance of own account
BASEFEE
get the block’s base fee
POP
remove item from stack
MLOAD
load word from memory
MSTORE
save word to memory
MSTORE8
save byte to memory
SLOAD
load word from storage
SSTORE
save word to storage
JUMP
alter the program counter
JUMPI
conditionally alter the program counter
PC
get the program counter
MSIZE
get the size of active memory
GAS
get the amount of available gas
JUMPDEST
set a potential jump destination
PUSH1
place 1 byte item on stack
PUSH2
place 2 byte item on stack
PUSH3
place 3 byte item on stack
PUSH4
place 4 byte item on stack
PUSH5
place 5 byte item on stack
PUSH6
place 6 byte item on stack
PUSH7
place 7 byte item on stack
PUSH8
place 8 byte item on stack
PUSH9
place 9 byte item on stack
PUSH10
place 10 byte item on stack
PUSH11
place 11 byte item on stack
PUSH12
place 12 byte item on stack
PUSH13
place 13 byte item on stack
PUSH14
place 14 byte item on stack
PUSH15
place 15 byte item on stack
PUSH16
place 16 byte item on stack
PUSH17
place 17 byte item on stack
PUSH18
place 18 byte item on stack
PUSH19
place 19 byte item on stack
PUSH20
place 20 byte item on stack
PUSH21
place 21 byte item on stack
PUSH22
place 22 byte item on stack
PUSH23
place 23 byte item on stack
PUSH24
place 24 byte item on stack
PUSH25
place 25 byte item on stack
PUSH26
place 26 byte item on stack
PUSH27
place 27 byte item on stack
PUSH28
place 28 byte item on stack
PUSH29
place 29 byte item on stack
PUSH30
place 30 byte item on stack
PUSH31
place 31 byte item on stack
PUSH32
place 32 byte item on stack
DUP1
copies the highest item in the stack to the top of the stack
DUP2
copies the second highest item in the stack to the top of the stack
DUP3
copies the third highest item in the stack to the top of the stack
DUP4
copies the 4th highest item in the stack to the top of the stack
DUP5
copies the 5th highest item in the stack to the top of the stack
DUP6
copies the 6th highest item in the stack to the top of the stack
DUP7
copies the 7th highest item in the stack to the top of the stack
DUP8
copies the 8th highest item in the stack to the top of the stack
DUP9
copies the 9th highest item in the stack to the top of the stack
DUP10
copies the 10th highest item in the stack to the top of the stack
DUP11
copies the 11th highest item in the stack to the top of the stack
DUP12
copies the 12th highest item in the stack to the top of the stack
DUP13
copies the 13th highest item in the stack to the top of the stack
DUP14
copies the 14th highest item in the stack to the top of the stack
DUP15
copies the 15th highest item in the stack to the top of the stack
DUP16
copies the 16th highest item in the stack to the top of the stack
SWAP1
swaps the highest and second highest value on the stack
SWAP2
swaps the highest and third highest value on the stack
SWAP3
swaps the highest and 4th highest value on the stack
SWAP4
swaps the highest and 5th highest value on the stack
SWAP5
swaps the highest and 6th highest value on the stack
SWAP6
swaps the highest and 7th highest value on the stack
SWAP7
swaps the highest and 8th highest value on the stack
SWAP8
swaps the highest and 9th highest value on the stack
SWAP9
swaps the highest and 10th highest value on the stack
SWAP10
swaps the highest and 11th highest value on the stack
SWAP11
swaps the highest and 12th highest value on the stack
SWAP12
swaps the highest and 13th highest value on the stack
SWAP13
swaps the highest and 14th highest value on the stack
SWAP14
swaps the highest and 15th highest value on the stack
SWAP15
swaps the highest and 16th highest value on the stack
SWAP16
swaps the highest and 17th highest value on the stack
LOG0
Makes a log entry, no topics.
LOG1
Makes a log entry, 1 topic.
LOG2
Makes a log entry, 2 topics.
LOG3
Makes a log entry, 3 topics.
LOG4
Makes a log entry, 4 topics.
BEGINSUB
Marks the entry point to a subroutine.
RETURNSUB
Returns from a subroutine.
JUMPSUB
Jumps to a defined BEGINSUB subroutine.
CREATE
create a new account with associated code
CALL
message-call into an account
CALLCODE
message-call with another account’s code only
RETURN
halt execution returning output data
DELEGATECALL
like CALLCODE but keeps caller’s value and sender
CREATE2
create a new account and set creation address to sha3(sender + sha3(init code)) % 2**160
REVERT
stop execution and revert state changes. Return output data.
STATICCALL
like CALL but it does not take value, nor modify the state
SUICIDE
halt execution and register account for later deletion
Implementations
sourceimpl Instruction
impl Instruction
sourceimpl Instruction
impl Instruction
sourcepub fn push_bytes(&self) -> Option<usize>
pub fn push_bytes(&self) -> Option<usize>
Returns number of bytes to read for PUSHN
instruction
PUSH1 -> 1
sourcepub fn dup_position(&self) -> Option<usize>
pub fn dup_position(&self) -> Option<usize>
Returns stack position of item to duplicate DUP1 -> 0
sourcepub fn swap_position(&self) -> Option<usize>
pub fn swap_position(&self) -> Option<usize>
Returns stack position of item to SWAP top with SWAP1 -> 1
sourcepub fn log_topics(&self) -> Option<usize>
pub fn log_topics(&self) -> Option<usize>
Returns number of topics to take from stack LOG0 -> 0
sourcepub fn info(&self) -> &'static InstructionInfo
pub fn info(&self) -> &'static InstructionInfo
Returns the instruction info.
Trait Implementations
sourceimpl Clone for Instruction
impl Clone for Instruction
sourcefn clone(&self) -> Instruction
fn clone(&self) -> Instruction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Instruction
impl Debug for Instruction
sourceimpl Hash for Instruction
impl Hash for Instruction
sourceimpl Ord for Instruction
impl Ord for Instruction
sourceimpl PartialEq<Instruction> for Instruction
impl PartialEq<Instruction> for Instruction
sourceimpl PartialOrd<Instruction> for Instruction
impl PartialOrd<Instruction> for Instruction
sourcefn partial_cmp(&self, other: &Instruction) -> Option<Ordering>
fn partial_cmp(&self, other: &Instruction) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Instruction
impl Eq for Instruction
impl StructuralEq for Instruction
impl StructuralPartialEq for Instruction
Auto Trait Implementations
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more