evm_opcodes/
shanghai.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//! Instructions for ShangHai (上海).

use crate::{opcodes, Group, OpCode, Upgrade};

opcodes! {
    ShangHai,
    (0x00, STOP, 0, 0, 0, "Halts execution.", Frontier, StopArithmetic),
    (0x01, ADD, 3, 2, 1, "Addition operation.", Frontier, StopArithmetic),
    (0x02, MUL, 5, 2, 1, "Multiplication operation.", Frontier, StopArithmetic),
    (0x03, SUB, 3, 2, 1, "Subtraction operation.", Frontier, StopArithmetic),
    (0x04, DIV, 5, 2, 1, "Integer division operation.", Frontier, StopArithmetic),
    (0x05, SDIV, 5, 2, 1, "Signed integer division operation (truncated).", Frontier, StopArithmetic),
    (0x06, MOD, 5, 2, 1, "Modulo remainder operation.", Frontier, StopArithmetic),
    (0x07, SMOD, 5, 2, 1, "Signed modulo remainder operation.", Frontier, StopArithmetic),
    (0x08, ADDMOD, 8, 3, 1, "Modulo addition operation.", Frontier, StopArithmetic),
    (0x09, MULMOD, 8, 3, 1, "Modulo multiplication operation.", Frontier, StopArithmetic),
    (0x0a, EXP, 10, 2, 1, "Exponential operation.", Frontier, StopArithmetic),
    (0x0b, SIGNEXTEND, 5, 2, 1, "Extend length of two's complement signed integer.", Frontier, StopArithmetic),
    (0x10, LT, 3, 2, 1, "Less-than comparison.", Frontier, ComparisonBitwiseLogic),
    (0x11, GT, 3, 2, 1, "Greater-than comparison.", Frontier, ComparisonBitwiseLogic),
    (0x12, SLT, 3, 2, 1, "Signed less-than comparison.", Frontier, ComparisonBitwiseLogic),
    (0x13, SGT, 3, 2, 1, "Signed greater-than comparison.", Frontier, ComparisonBitwiseLogic),
    (0x14, EQ, 3, 2, 1, "Equality comparison.", Frontier, ComparisonBitwiseLogic),
    (0x15, ISZERO, 3, 1, 1, "Simple not operator.", Frontier, ComparisonBitwiseLogic),
    (0x16, AND, 3, 2, 1, "Bitwise AND operation.", Frontier, ComparisonBitwiseLogic),
    (0x17, OR, 3, 2, 1, "Bitwise OR operation.", Frontier, ComparisonBitwiseLogic),
    (0x18, XOR, 3, 2, 1, "Bitwise XOR operation.", Frontier, ComparisonBitwiseLogic),
    (0x19, NOT, 3, 1, 1, "Bitwise NOT operation.", Frontier, ComparisonBitwiseLogic),
    (0x1a, BYTE, 3, 2, 1, "Retrieve single byte from word.", Frontier, ComparisonBitwiseLogic),
    (0x1b, SHL, 3, 2, 1, "Left shift operation", Constantinople, ComparisonBitwiseLogic),
    (0x1c, SHR, 3, 2, 1, "Logical right shift operation", Constantinople, ComparisonBitwiseLogic),
    (0x1d, SAR, 3, 2, 1, "Arithmetic (signed) right shift operation", Constantinople, ComparisonBitwiseLogic),
    (0x20, KECCAK256, 30, 2, 1, "Compute Keccak-256 hash.", Frontier, StopArithmetic),
    (0x30, ADDRESS, 2, 0, 1, "Get address of currently executing account.", Frontier, EnvironmentalInformation),
    (0x31, BALANCE, 20, 1, 1, "Get balance of the given account.", Frontier, EnvironmentalInformation),
    (0x32, ORIGIN, 2, 0, 1, "Get execution origination address.", Frontier, EnvironmentalInformation),
    (0x33, CALLER, 2, 0, 1, "Get caller address.", Frontier, EnvironmentalInformation),
    (0x34, CALLVALUE, 2, 0, 1, "Get deposited value by the instruction/transaction responsible for this execution.", Frontier, EnvironmentalInformation),
    (0x35, CALLDATALOAD, 3, 1, 1, "Get input data of current environment.", Frontier, EnvironmentalInformation),
    (0x36, CALLDATASIZE, 2, 0, 1, "Get size of input data in current environment.", Frontier, EnvironmentalInformation),
    (0x37, CALLDATACOPY, 3, 3, 0, "Copy input data in current environment to memory.", Frontier, EnvironmentalInformation),
    (0x38, CODESIZE, 2, 0, 1, "Get size of code running in current environment.", Frontier, EnvironmentalInformation),
    (0x39, CODECOPY, 3, 3, 0, "Copy code running in current environment to memory.", Frontier, EnvironmentalInformation),
    (0x3a, GASPRICE, 2, 0, 1, "Get price of gas in current environment", Frontier, EnvironmentalInformation),
    (0x3b, EXTCODESIZE, 20, 1, 1, "Get size of an account's code.", Frontier, EnvironmentalInformation),
    (0x3c, EXTCODECOPY, 20, 4, 0, "Copy an account's code to memory.", Frontier, EnvironmentalInformation),
    (0x3d, RETURNDATASIZE, 2, 0, 1, "Get size of output data from the previous call from the current environment.", Byzantium, EnvironmentalInformation),
    (0x3e, RETURNDATACOPY, 3, 3, 0, "Copy output data from the previous call to memory.", Byzantium, EnvironmentalInformation),
    (0x40, BLOCKHASH, 20, 1, 1, "Get the hash of one of the 256 most recent complete blocks.", Frontier, BlockInformation),
    (0x41, COINBASE, 2, 0, 1, "Get the block's beneficiary address.", Frontier, BlockInformation),
    (0x42, TIMESTAMP, 2, 0, 1, "Get the block's timestamp.", Frontier, BlockInformation),
    (0x43, NUMBER, 2, 0, 1, "Get the block's number.", Frontier, BlockInformation),
    (0x44, DIFFICULTY, 2, 0, 1, "Get the block's difficulty.", Frontier, BlockInformation),
    (0x45, GASLIMIT, 2, 0, 1, "Get the block's gas limit.", Frontier, BlockInformation),
    (0x50, POP, 2, 1, 0, "Remove item from stack.", Frontier, StackMemoryStorageFlow),
    (0x51, MLOAD, 3, 1, 1, "Load word from memory.", Frontier, StackMemoryStorageFlow),
    (0x52, MSTORE, 3, 2, 0, "Save word to memory.", Frontier, StackMemoryStorageFlow),
    (0x53, MSTORE8, 3, 2, 0, "Save byte to memory.", Frontier, StackMemoryStorageFlow),
    (0x54, SLOAD, 50, 1, 1, "Load word from storage.", Frontier, StackMemoryStorageFlow),
    (0x55, SSTORE, 0, 2, 0, "Save word to storage.", Frontier, StackMemoryStorageFlow),
    (0x56, JUMP, 8, 1, 0, "Alter the program counter.", Frontier, StackMemoryStorageFlow),
    (0x57, JUMPI, 10, 2, 0, "Conditionally alter the program counter.", Frontier, StackMemoryStorageFlow),
    (0x58, PC, 2, 0, 1, "Get the value of the program counter prior to the increment corresponding to this instruction.", Frontier, StackMemoryStorageFlow),
    (0x59, MSIZE, 2, 0, 1, "Get the size of active memory in bytes.", Frontier, StackMemoryStorageFlow),
    (0x5a, GAS, 2, 0, 1, "Get the amount of available gas, including the corresponding reduction the amount of available gas.", Frontier, StackMemoryStorageFlow),
    (0x5b, JUMPDEST, 1, 0, 0, "Mark a valid destination for jumps.", Frontier, StackMemoryStorageFlow),
    (0x5f, PUSH0, 2, 0, 1, "Place 0 byte item on stack.", Frontier, Push),
    (0x60, PUSH1, 3, 0, 1, "Place 1 byte item on stack.", Frontier, Push),
    (0x61, PUSH2, 3, 0, 1, "Place 2-byte item on stack.", Frontier, Push),
    (0x62, PUSH3, 3, 0, 1, "Place 3-byte item on stack.", Frontier, Push),
    (0x63, PUSH4, 3, 0, 1, "Place 4-byte item on stack.", Frontier, Push),
    (0x64, PUSH5, 3, 0, 1, "Place 5-byte item on stack.", Frontier, Push),
    (0x65, PUSH6, 3, 0, 1, "Place 6-byte item on stack.", Frontier, Push),
    (0x66, PUSH7, 3, 0, 1, "Place 7-byte item on stack.", Frontier, Push),
    (0x67, PUSH8, 3, 0, 1, "Place 8-byte item on stack.", Frontier, Push),
    (0x68, PUSH9, 3, 0, 1, "Place 9-byte item on stack.", Frontier, Push),
    (0x69, PUSH10, 3, 0, 1, "Place 10-byte item on stack.", Frontier, Push),
    (0x6a, PUSH11, 3, 0, 1, "Place 11-byte item on stack.", Frontier, Push),
    (0x6b, PUSH12, 3, 0, 1, "Place 12-byte item on stack.", Frontier, Push),
    (0x6c, PUSH13, 3, 0, 1, "Place 13-byte item on stack.", Frontier, Push),
    (0x6d, PUSH14, 3, 0, 1, "Place 14-byte item on stack.", Frontier, Push),
    (0x6e, PUSH15, 3, 0, 1, "Place 15-byte item on stack.", Frontier, Push),
    (0x6f, PUSH16, 3, 0, 1, "Place 16-byte item on stack.", Frontier, Push),
    (0x70, PUSH17, 3, 0, 1, "Place 17-byte item on stack.", Frontier, Push),
    (0x71, PUSH18, 3, 0, 1, "Place 18-byte item on stack.", Frontier, Push),
    (0x72, PUSH19, 3, 0, 1, "Place 19-byte item on stack.", Frontier, Push),
    (0x73, PUSH20, 3, 0, 1, "Place 20-byte item on stack.", Frontier, Push),
    (0x74, PUSH21, 3, 0, 1, "Place 21-byte item on stack.", Frontier, Push),
    (0x75, PUSH22, 3, 0, 1, "Place 22-byte item on stack.", Frontier, Push),
    (0x76, PUSH23, 3, 0, 1, "Place 23-byte item on stack.", Frontier, Push),
    (0x77, PUSH24, 3, 0, 1, "Place 24-byte item on stack.", Frontier, Push),
    (0x78, PUSH25, 3, 0, 1, "Place 25-byte item on stack.", Frontier, Push),
    (0x79, PUSH26, 3, 0, 1, "Place 26-byte item on stack.", Frontier, Push),
    (0x7a, PUSH27, 3, 0, 1, "Place 27-byte item on stack.", Frontier, Push),
    (0x7b, PUSH28, 3, 0, 1, "Place 28-byte item on stack.", Frontier, Push),
    (0x7c, PUSH29, 3, 0, 1, "Place 29-byte item on stack.", Frontier, Push),
    (0x7d, PUSH30, 3, 0, 1, "Place 30-byte item on stack.", Frontier, Push),
    (0x7e, PUSH31, 3, 0, 1, "Place 31-byte item on stack.", Frontier, Push),
    (0x7f, PUSH32, 3, 0, 1, "Place 32-byte (full word) item on stack.", Frontier, Push),
    (0x80, DUP1, 3, 1, 2, "Duplicate 1st stack item.", Frontier, Duplication),
    (0x81, DUP2, 3, 2, 3, "Duplicate 2nd stack item.", Frontier, Duplication),
    (0x82, DUP3, 3, 3, 4, "Duplicate 3rd stack item.", Frontier, Duplication),
    (0x83, DUP4, 3, 4, 5, "Duplicate 4th stack item.", Frontier, Duplication),
    (0x84, DUP5, 3, 5, 6, "Duplicate 5th stack item.", Frontier, Duplication),
    (0x85, DUP6, 3, 6, 7, "Duplicate 6th stack item.", Frontier, Duplication),
    (0x86, DUP7, 3, 7, 8, "Duplicate 7th stack item.", Frontier, Duplication),
    (0x87, DUP8, 3, 8, 9, "Duplicate 8th stack item.", Frontier, Duplication),
    (0x88, DUP9, 3, 9, 10, "Duplicate 9th stack item.", Frontier, Duplication),
    (0x89, DUP10, 3, 10, 11, "Duplicate 10th stack item.", Frontier, Duplication),
    (0x8a, DUP11, 3, 11, 12, "Duplicate 11th stack item.", Frontier, Duplication),
    (0x8b, DUP12, 3, 12, 13, "Duplicate 12th stack item.", Frontier, Duplication),
    (0x8c, DUP13, 3, 13, 14, "Duplicate 13th stack item.", Frontier, Duplication),
    (0x8d, DUP14, 3, 14, 15, "Duplicate 14th stack item.", Frontier, Duplication),
    (0x8e, DUP15, 3, 15, 16, "Duplicate 15th stack item.", Frontier, Duplication),
    (0x8f, DUP16, 3, 16, 17, "Duplicate 16th stack item.", Frontier, Duplication),
    (0x90, SWAP1, 3, 2, 2, "Exchange 1st and 2nd stack items.", Frontier, Exchange),
    (0x91, SWAP2, 3, 3, 3, "Exchange 1st and 3rd stack items.", Frontier, Exchange),
    (0x92, SWAP3, 3, 4, 4, "Exchange 1st and 4th stack items.", Frontier, Exchange),
    (0x93, SWAP4, 3, 5, 5, "Exchange 1st and 5th stack items.", Frontier, Exchange),
    (0x94, SWAP5, 3, 6, 6, "Exchange 1st and 6th stack items.", Frontier, Exchange),
    (0x95, SWAP6, 3, 7, 7, "Exchange 1st and 7th stack items.", Frontier, Exchange),
    (0x96, SWAP7, 3, 8, 8, "Exchange 1st and 8th stack items.", Frontier, Exchange),
    (0x97, SWAP8, 3, 9, 9, "Exchange 1st and 9th stack items.", Frontier, Exchange),
    (0x98, SWAP9, 3, 10, 10, "Exchange 1st and 10th stack items.", Frontier, Exchange),
    (0x99, SWAP10, 3, 11, 11, "Exchange 1st and 11th stack items.", Frontier, Exchange),
    (0x9a, SWAP11, 3, 12, 12, "Exchange 1st and 12th stack items.", Frontier, Exchange),
    (0x9b, SWAP12, 3, 13, 13, "Exchange 1st and 13th stack items.", Frontier, Exchange),
    (0x9c, SWAP13, 3, 14, 14, "Exchange 1st and 14th stack items.", Frontier, Exchange),
    (0x9d, SWAP14, 3, 15, 15, "Exchange 1st and 15th stack items.", Frontier, Exchange),
    (0x9e, SWAP15, 3, 16, 16, "Exchange 1st and 16th stack items.", Frontier, Exchange),
    (0x9f, SWAP16, 3, 17, 17, "Exchange 1st and 17th stack items.", Frontier, Exchange),
    (0xa0, LOG0, 375, 2, 0, "Append log record with no topics.", Frontier, Logging),
    (0xa1, LOG1, 750, 3, 0, "Append log record with one topic.", Frontier, Logging),
    (0xa2, LOG2, 1125, 4, 0, "Append log record with two topics.", Frontier, Logging),
    (0xa3, LOG3, 1500, 5, 0, "Append log record with three topics.", Frontier, Logging),
    (0xa4, LOG4, 1875, 6, 0, "Append log record with four topics.", Frontier, Logging),
    (0xf0, CREATE, 32000, 3, 1, "Create a new account with associated", Frontier, System),
    (0xf1, CALL, 100, 7, 1, "Message-call into an account.", Frontier, System),
    (0xf2, CALLCODE, 100, 7, 1, "Message-call into this account with alternative account’s code.", Frontier, System),
    (0xf3, RETURN, 0, 2, 0, "Halt execution returning output data.", Frontier, System),
    (0xf4, DELEGATECALL, 40, 6, 1, "Message-call into this account with an alternative account’s code, but persisting into this account with an alternative account’s code, but persisting into this account’s storage and context.", Frontier, System),
    (0xf5, CREATE2, 32000, 4, 1, "Create a new account with associated code at a specified address.", Constantinople, System),
    (0xfa, STATICCALL, 40, 6, 1, "Static message-call into an account.", Byzantium, System),
    (0xfd, REVERT, 0, 2, 0, "Stop execution and revert state changes, without consuming all provided gas and providing a reason.", Byzantium, System),
    (0xfe, INVALID, 0, 0, 0, "Designated invalid instruction.", Frontier, System),
    (0xff, SELFDESTRUCT, 5000, 1, 0, "Halt execution and register account for later deletion.", Frontier, System)
}