Skip to content

Commit 3e47e38

Browse files
gumb0axic
andauthored
core/vm: Make INVALID a defined opcode (#24017)
* core/vm: Define 0xfe opcode as INVALID * core/vm: Remove opInvalid as opUndefined handles it Co-authored-by: Alex Beregszaszi <[email protected]>
1 parent 81ec6b1 commit 3e47e38

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

accounts/abi/bind/backends/simulated_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ func TestEstimateGas(t *testing.T) {
496496
GasPrice: big.NewInt(0),
497497
Value: nil,
498498
Data: common.Hex2Bytes("b9b046f9"),
499-
}, 0, errors.New("invalid opcode: opcode 0xfe not defined"), nil},
499+
}, 0, errors.New("invalid opcode: INVALID"), nil},
500500

501501
{"Valid", ethereum.CallMsg{
502502
From: addr,

core/vm/opcodes.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ const (
213213

214214
STATICCALL OpCode = 0xfa
215215
REVERT OpCode = 0xfd
216+
INVALID OpCode = 0xfe
216217
SELFDESTRUCT OpCode = 0xff
217218
)
218219

@@ -378,6 +379,7 @@ var opCodeToString = map[OpCode]string{
378379
CREATE2: "CREATE2",
379380
STATICCALL: "STATICCALL",
380381
REVERT: "REVERT",
382+
INVALID: "INVALID",
381383
SELFDESTRUCT: "SELFDESTRUCT",
382384
}
383385

@@ -532,6 +534,7 @@ var stringToOp = map[string]OpCode{
532534
"RETURN": RETURN,
533535
"CALLCODE": CALLCODE,
534536
"REVERT": REVERT,
537+
"INVALID": INVALID,
535538
"SELFDESTRUCT": SELFDESTRUCT,
536539
}
537540

eth/tracers/internal/tracetest/testdata/call_tracer/inner_throw_outer_revert.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"result": {
6060
"calls": [
6161
{
62-
"error": "invalid opcode: opcode 0xfe not defined",
62+
"error": "invalid opcode: INVALID",
6363
"from": "0x33056b5dcac09a9b4becad0e1dcf92c19bd0af76",
6464
"gas": "0x75fe3",
6565
"gasUsed": "0x75fe3",

eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_throw_outer_revert.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"result": {
6060
"calls": [
6161
{
62-
"error": "invalid opcode: opcode 0xfe not defined",
62+
"error": "invalid opcode: INVALID",
6363
"from": "0x33056b5dcac09a9b4becad0e1dcf92c19bd0af76",
6464
"gas": "0x75fe3",
6565
"gasUsed": "0x75fe3",

0 commit comments

Comments
 (0)