Skip to content

Commit

Permalink
Revert "core/vm: order opcodes properly (ethereum#27113)"
Browse files Browse the repository at this point in the history
This reverts commit bc7f528.
  • Loading branch information
devopsbo3 authored Nov 10, 2023
1 parent 3d21d87 commit 0a38f77
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions core/vm/opcodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,6 @@ const (
LOG4
)

// 0xb0 range.
const (
TLOAD OpCode = 0xb3
TSTORE OpCode = 0xb4
)

// 0xf0 range - closures.
const (
CREATE OpCode = 0xf0
Expand All @@ -225,6 +219,12 @@ const (
SELFDESTRUCT OpCode = 0xff
)

// 0xb0 range.
const (
TLOAD OpCode = 0xb3
TSTORE OpCode = 0xb4
)

// Since the opcodes aren't all in order we can't use a regular slice.
var opCodeToString = map[OpCode]string{
// 0x0 range - arithmetic ops.
Expand Down Expand Up @@ -290,7 +290,9 @@ var opCodeToString = map[OpCode]string{
BASEFEE: "BASEFEE",

// 0x50 range - 'storage' and execution.
POP: "POP",
POP: "POP",
//DUP: "DUP",
//SWAP: "SWAP",
MLOAD: "MLOAD",
MSTORE: "MSTORE",
MSTORE8: "MSTORE8",
Expand All @@ -304,7 +306,7 @@ var opCodeToString = map[OpCode]string{
JUMPDEST: "JUMPDEST",
PUSH0: "PUSH0",

// 0x60 range - pushes.
// 0x60 range - push.
PUSH1: "PUSH1",
PUSH2: "PUSH2",
PUSH3: "PUSH3",
Expand Down Expand Up @@ -338,7 +340,6 @@ var opCodeToString = map[OpCode]string{
PUSH31: "PUSH31",
PUSH32: "PUSH32",

// 0x80 - dups.
DUP1: "DUP1",
DUP2: "DUP2",
DUP3: "DUP3",
Expand All @@ -356,7 +357,6 @@ var opCodeToString = map[OpCode]string{
DUP15: "DUP15",
DUP16: "DUP16",

// 0x90 - swaps.
SWAP1: "SWAP1",
SWAP2: "SWAP2",
SWAP3: "SWAP3",
Expand All @@ -373,19 +373,17 @@ var opCodeToString = map[OpCode]string{
SWAP14: "SWAP14",
SWAP15: "SWAP15",
SWAP16: "SWAP16",

// 0xa0 range - logging ops.
LOG0: "LOG0",
LOG1: "LOG1",
LOG2: "LOG2",
LOG3: "LOG3",
LOG4: "LOG4",
LOG0: "LOG0",
LOG1: "LOG1",
LOG2: "LOG2",
LOG3: "LOG3",
LOG4: "LOG4",

// 0xb0 range.
TLOAD: "TLOAD",
TSTORE: "TSTORE",

// 0xf0 range - closures.
// 0xf0 range.
CREATE: "CREATE",
CALL: "CALL",
RETURN: "RETURN",
Expand Down Expand Up @@ -475,6 +473,8 @@ var stringToOp = map[string]OpCode{
"GAS": GAS,
"JUMPDEST": JUMPDEST,
"PUSH0": PUSH0,
"TLOAD": TLOAD,
"TSTORE": TSTORE,
"PUSH1": PUSH1,
"PUSH2": PUSH2,
"PUSH3": PUSH3,
Expand Down Expand Up @@ -544,8 +544,6 @@ var stringToOp = map[string]OpCode{
"LOG2": LOG2,
"LOG3": LOG3,
"LOG4": LOG4,
"TLOAD": TLOAD,
"TSTORE": TSTORE,
"CREATE": CREATE,
"CREATE2": CREATE2,
"CALL": CALL,
Expand Down

0 comments on commit 0a38f77

Please sign in to comment.