From 55a588e87492123c18187ca0ae3c5804e40fa620 Mon Sep 17 00:00:00 2001 From: Valentin Staykov Date: Wed, 28 Aug 2024 15:39:32 +0000 Subject: [PATCH] remove sendall opcode and use it on selfdestruct only --- core/vm/eips_zkevm.go | 1 - core/vm/interpreter_zkevm.go | 2 -- core/vm/jump_table_zkevm.go | 9 +-------- core/vm/opcodes_zkevm.go | 7 ++----- core/vm/zk_counters.go | 1 - 5 files changed, 3 insertions(+), 17 deletions(-) diff --git a/core/vm/eips_zkevm.go b/core/vm/eips_zkevm.go index 1eb2a7ffb49..898e0f9d1f3 100644 --- a/core/vm/eips_zkevm.go +++ b/core/vm/eips_zkevm.go @@ -44,7 +44,6 @@ func enable2929_zkevm(jt *JumpTable) { // factor here jt[SELFDESTRUCT].constantGas = params.SelfdestructGasEIP150 jt[SELFDESTRUCT].dynamicGas = gasSelfdestructEIP2929_zkevm - jt[SENDALL].dynamicGas = gasSelfdestructEIP2929_zkevm } func enable3529_zkevm(jt *JumpTable) { diff --git a/core/vm/interpreter_zkevm.go b/core/vm/interpreter_zkevm.go index e369222ced3..5d8aba50704 100644 --- a/core/vm/interpreter_zkevm.go +++ b/core/vm/interpreter_zkevm.go @@ -66,8 +66,6 @@ func shouldExecuteLastOpCode(op OpCode) bool { fallthrough case CREATE2: fallthrough - case SENDALL: - fallthrough case SLOAD: fallthrough case SSTORE: diff --git a/core/vm/jump_table_zkevm.go b/core/vm/jump_table_zkevm.go index 5b79b59e7b3..f71f3aba710 100644 --- a/core/vm/jump_table_zkevm.go +++ b/core/vm/jump_table_zkevm.go @@ -38,15 +38,8 @@ func newForkID4InstructionSet() JumpTable { instructionSet[EXTCODEHASH].execute = opExtCodeHash_zkevm - instructionSet[SENDALL] = &operation{ - execute: opSendAll_zkevm, - dynamicGas: gasSelfdestruct_zkevm, - numPop: 1, - numPush: 0, - } - // SELFDESTRUCT is replaces by SENDALL - instructionSet[SELFDESTRUCT] = instructionSet[SENDALL] + instructionSet[SELFDESTRUCT].execute = opSendAll_zkevm validateAndFillMaxStack(&instructionSet) return instructionSet diff --git a/core/vm/opcodes_zkevm.go b/core/vm/opcodes_zkevm.go index f1b22c90174..ee0808e46aa 100644 --- a/core/vm/opcodes_zkevm.go +++ b/core/vm/opcodes_zkevm.go @@ -1,12 +1,9 @@ package vm -const ( - SENDALL OpCode = 0xfb -) +const () // adding extra opcodes dynamically to keep separate from the main codebase // that simplifies rebasing new versions of Erigon func init() { - opCodeToString[SENDALL] = "SENDALL" - stringToOp["SENDALL"] = SENDALL + } diff --git a/core/vm/zk_counters.go b/core/vm/zk_counters.go index 953e0b109fd..783e1b14645 100644 --- a/core/vm/zk_counters.go +++ b/core/vm/zk_counters.go @@ -347,7 +347,6 @@ func SimpleCounterOperations(cc *CounterCollector) *[256]executionFunc { CREATE2: cc.opCreate2, RETURN: cc.opReturn, REVERT: cc.opRevert, - SENDALL: cc.opSendAll, SELFDESTRUCT: cc.opSendAll, INVALID: cc.opInvalid, ADDRESS: cc.opAddress,