2016-04-14 11:18:24 -05:00
|
|
|
// Copyright 2015 The go-ethereum Authors
|
|
|
|
// This file is part of the go-ethereum library.
|
|
|
|
//
|
|
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-08-30 03:19:10 -05:00
|
|
|
package vm
|
|
|
|
|
2016-10-20 06:36:29 -05:00
|
|
|
import (
|
2021-12-14 04:30:20 -06:00
|
|
|
"fmt"
|
|
|
|
|
2016-10-20 06:36:29 -05:00
|
|
|
"github.com/ethereum/go-ethereum/params"
|
|
|
|
)
|
2015-08-30 03:19:10 -05:00
|
|
|
|
2017-01-05 04:52:10 -06:00
|
|
|
type (
|
2021-03-25 04:13:14 -05:00
|
|
|
executionFunc func(pc *uint64, interpreter *EVMInterpreter, callContext *ScopeContext) ([]byte, error)
|
2019-08-05 03:01:02 -05:00
|
|
|
gasFunc func(*EVM, *Contract, *Stack, *Memory, uint64) (uint64, error) // last parameter is the requested memory size as a uint64
|
2019-03-12 04:40:05 -05:00
|
|
|
// memorySizeFunc returns the required size, and whether the operation overflowed a uint64
|
|
|
|
memorySizeFunc func(*Stack) (size uint64, overflow bool)
|
2017-01-05 04:52:10 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
type operation struct {
|
2018-05-29 06:22:00 -05:00
|
|
|
// execute is the operation function
|
2019-03-12 04:40:05 -05:00
|
|
|
execute executionFunc
|
|
|
|
constantGas uint64
|
|
|
|
dynamicGas gasFunc
|
|
|
|
// minStack tells how many stack items are required
|
|
|
|
minStack int
|
|
|
|
// maxStack specifies the max length the stack can have for this operation
|
|
|
|
// to not overflow the stack.
|
|
|
|
maxStack int
|
|
|
|
|
2017-01-05 04:52:10 -06:00
|
|
|
// memorySize returns the memory size required for the operation
|
|
|
|
memorySize memorySizeFunc
|
2015-08-30 03:19:10 -05:00
|
|
|
}
|
|
|
|
|
2017-02-01 15:36:51 -06:00
|
|
|
var (
|
2019-08-05 03:01:02 -05:00
|
|
|
frontierInstructionSet = newFrontierInstructionSet()
|
|
|
|
homesteadInstructionSet = newHomesteadInstructionSet()
|
|
|
|
tangerineWhistleInstructionSet = newTangerineWhistleInstructionSet()
|
|
|
|
spuriousDragonInstructionSet = newSpuriousDragonInstructionSet()
|
|
|
|
byzantiumInstructionSet = newByzantiumInstructionSet()
|
|
|
|
constantinopleInstructionSet = newConstantinopleInstructionSet()
|
2019-08-22 05:41:55 -05:00
|
|
|
istanbulInstructionSet = newIstanbulInstructionSet()
|
2021-02-25 01:10:30 -06:00
|
|
|
berlinInstructionSet = newBerlinInstructionSet()
|
2021-05-07 01:25:32 -05:00
|
|
|
londonInstructionSet = newLondonInstructionSet()
|
2022-01-10 01:44:21 -06:00
|
|
|
mergeInstructionSet = newMergeInstructionSet()
|
2023-01-11 03:05:47 -06:00
|
|
|
shanghaiInstructionSet = newShanghaiInstructionSet()
|
2023-06-05 08:43:25 -05:00
|
|
|
cancunInstructionSet = newCancunInstructionSet()
|
2017-02-01 15:36:51 -06:00
|
|
|
)
|
|
|
|
|
2019-08-08 04:07:23 -05:00
|
|
|
// JumpTable contains the EVM opcodes supported at a given fork.
|
2020-07-16 07:32:01 -05:00
|
|
|
type JumpTable [256]*operation
|
2019-08-08 04:07:23 -05:00
|
|
|
|
2021-12-14 04:30:20 -06:00
|
|
|
func validate(jt JumpTable) JumpTable {
|
|
|
|
for i, op := range jt {
|
|
|
|
if op == nil {
|
2022-07-04 03:03:32 -05:00
|
|
|
panic(fmt.Sprintf("op %#x is not set", i))
|
2021-12-14 04:30:20 -06:00
|
|
|
}
|
|
|
|
// The interpreter has an assumption that if the memorySize function is
|
|
|
|
// set, then the dynamicGas function is also set. This is a somewhat
|
|
|
|
// arbitrary assumption, and can be removed if we need to -- but it
|
|
|
|
// allows us to avoid a condition check. As long as we have that assumption
|
|
|
|
// in there, this little sanity check prevents us from merging in a
|
|
|
|
// change which violates it.
|
|
|
|
if op.memorySize != nil && op.dynamicGas == nil {
|
|
|
|
panic(fmt.Sprintf("op %v has dynamic memory but not dynamic gas", OpCode(i).String()))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return jt
|
|
|
|
}
|
|
|
|
|
2023-06-05 08:43:25 -05:00
|
|
|
func newCancunInstructionSet() JumpTable {
|
|
|
|
instructionSet := newShanghaiInstructionSet()
|
2023-10-02 04:49:29 -05:00
|
|
|
enable4844(&instructionSet) // EIP-4844 (BLOBHASH opcode)
|
|
|
|
enable7516(&instructionSet) // EIP-7516 (BLOBBASEFEE opcode)
|
2023-07-10 13:40:31 -05:00
|
|
|
enable1153(&instructionSet) // EIP-1153 "Transient Storage"
|
2023-07-11 02:55:34 -05:00
|
|
|
enable5656(&instructionSet) // EIP-5656 (MCOPY opcode)
|
2023-07-17 12:02:18 -05:00
|
|
|
enable6780(&instructionSet) // EIP-6780 SELFDESTRUCT only in same transaction
|
2023-06-05 08:43:25 -05:00
|
|
|
return validate(instructionSet)
|
|
|
|
}
|
|
|
|
|
2023-01-11 03:05:47 -06:00
|
|
|
func newShanghaiInstructionSet() JumpTable {
|
|
|
|
instructionSet := newMergeInstructionSet()
|
2023-01-12 04:00:08 -06:00
|
|
|
enable3855(&instructionSet) // PUSH0 instruction
|
|
|
|
enable3860(&instructionSet) // Limit and meter initcode
|
2023-07-17 12:02:18 -05:00
|
|
|
|
2023-01-11 03:05:47 -06:00
|
|
|
return validate(instructionSet)
|
|
|
|
}
|
|
|
|
|
2022-01-10 01:44:21 -06:00
|
|
|
func newMergeInstructionSet() JumpTable {
|
|
|
|
instructionSet := newLondonInstructionSet()
|
2022-09-07 06:09:52 -05:00
|
|
|
instructionSet[PREVRANDAO] = &operation{
|
2022-01-10 01:44:21 -06:00
|
|
|
execute: opRandom,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
|
|
|
}
|
|
|
|
return validate(instructionSet)
|
|
|
|
}
|
|
|
|
|
2021-05-07 01:25:32 -05:00
|
|
|
// newLondonInstructionSet returns the frontier, homestead, byzantium,
|
2023-03-13 02:30:32 -05:00
|
|
|
// constantinople, istanbul, petersburg, berlin and london instructions.
|
2021-05-07 01:25:32 -05:00
|
|
|
func newLondonInstructionSet() JumpTable {
|
|
|
|
instructionSet := newBerlinInstructionSet()
|
|
|
|
enable3529(&instructionSet) // EIP-3529: Reduction in refunds https://eips.ethereum.org/EIPS/eip-3529
|
2021-05-17 08:13:22 -05:00
|
|
|
enable3198(&instructionSet) // Base fee opcode https://eips.ethereum.org/EIPS/eip-3198
|
2021-12-14 04:30:20 -06:00
|
|
|
return validate(instructionSet)
|
2021-05-07 01:25:32 -05:00
|
|
|
}
|
|
|
|
|
2021-02-25 01:10:30 -06:00
|
|
|
// newBerlinInstructionSet returns the frontier, homestead, byzantium,
|
2023-03-13 02:30:32 -05:00
|
|
|
// constantinople, istanbul, petersburg and berlin instructions.
|
2021-02-25 01:10:30 -06:00
|
|
|
func newBerlinInstructionSet() JumpTable {
|
2020-06-03 04:05:15 -05:00
|
|
|
instructionSet := newIstanbulInstructionSet()
|
2024-01-23 08:17:42 -06:00
|
|
|
enable2929(&instructionSet) // Gas cost increases for state access opcodes https://eips.ethereum.org/EIPS/eip-2929
|
2021-12-14 04:30:20 -06:00
|
|
|
return validate(instructionSet)
|
2020-06-03 04:05:15 -05:00
|
|
|
}
|
|
|
|
|
2021-02-25 01:10:30 -06:00
|
|
|
// newIstanbulInstructionSet returns the frontier, homestead, byzantium,
|
2023-03-13 02:30:32 -05:00
|
|
|
// constantinople, istanbul and petersburg instructions.
|
2019-08-22 05:41:55 -05:00
|
|
|
func newIstanbulInstructionSet() JumpTable {
|
|
|
|
instructionSet := newConstantinopleInstructionSet()
|
|
|
|
|
|
|
|
enable1344(&instructionSet) // ChainID opcode - https://eips.ethereum.org/EIPS/eip-1344
|
|
|
|
enable1884(&instructionSet) // Reprice reader opcodes - https://eips.ethereum.org/EIPS/eip-1884
|
|
|
|
enable2200(&instructionSet) // Net metered SSTORE - https://eips.ethereum.org/EIPS/eip-2200
|
|
|
|
|
2021-12-14 04:30:20 -06:00
|
|
|
return validate(instructionSet)
|
2019-08-22 05:41:55 -05:00
|
|
|
}
|
|
|
|
|
2021-02-25 01:10:30 -06:00
|
|
|
// newConstantinopleInstructionSet returns the frontier, homestead,
|
2023-03-13 02:30:32 -05:00
|
|
|
// byzantium and constantinople instructions.
|
2019-08-08 04:07:23 -05:00
|
|
|
func newConstantinopleInstructionSet() JumpTable {
|
2018-06-26 07:56:25 -05:00
|
|
|
instructionSet := newByzantiumInstructionSet()
|
2020-07-16 07:32:01 -05:00
|
|
|
instructionSet[SHL] = &operation{
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opSHL,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2018-02-23 04:32:57 -06:00
|
|
|
}
|
2020-07-16 07:32:01 -05:00
|
|
|
instructionSet[SHR] = &operation{
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opSHR,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2018-02-23 04:32:57 -06:00
|
|
|
}
|
2020-07-16 07:32:01 -05:00
|
|
|
instructionSet[SAR] = &operation{
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opSAR,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2018-02-23 04:32:57 -06:00
|
|
|
}
|
2020-07-16 07:32:01 -05:00
|
|
|
instructionSet[EXTCODEHASH] = &operation{
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opExtCodeHash,
|
2019-08-08 04:07:23 -05:00
|
|
|
constantGas: params.ExtcodeHashGasConstantinople,
|
2019-08-05 03:01:02 -05:00
|
|
|
minStack: minStack(1, 1),
|
|
|
|
maxStack: maxStack(1, 1),
|
2018-07-24 10:06:40 -05:00
|
|
|
}
|
2020-07-16 07:32:01 -05:00
|
|
|
instructionSet[CREATE2] = &operation{
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opCreate2,
|
|
|
|
constantGas: params.Create2Gas,
|
|
|
|
dynamicGas: gasCreate2,
|
|
|
|
minStack: minStack(4, 1),
|
|
|
|
maxStack: maxStack(4, 1),
|
|
|
|
memorySize: memoryCreate2,
|
2018-07-24 09:22:03 -05:00
|
|
|
}
|
2021-12-14 04:30:20 -06:00
|
|
|
return validate(instructionSet)
|
2018-02-23 04:32:57 -06:00
|
|
|
}
|
|
|
|
|
2019-08-22 05:41:55 -05:00
|
|
|
// newByzantiumInstructionSet returns the frontier, homestead and
|
2017-09-14 02:07:31 -05:00
|
|
|
// byzantium instructions.
|
2019-08-08 04:07:23 -05:00
|
|
|
func newByzantiumInstructionSet() JumpTable {
|
2019-08-05 03:01:02 -05:00
|
|
|
instructionSet := newSpuriousDragonInstructionSet()
|
2020-07-16 07:32:01 -05:00
|
|
|
instructionSet[STATICCALL] = &operation{
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opStaticCall,
|
|
|
|
constantGas: params.CallGasEIP150,
|
|
|
|
dynamicGas: gasStaticCall,
|
|
|
|
minStack: minStack(6, 1),
|
|
|
|
maxStack: maxStack(6, 1),
|
|
|
|
memorySize: memoryStaticCall,
|
2017-08-15 03:23:23 -05:00
|
|
|
}
|
2020-07-16 07:32:01 -05:00
|
|
|
instructionSet[RETURNDATASIZE] = &operation{
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opReturnDataSize,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-08-16 05:07:33 -05:00
|
|
|
}
|
2020-07-16 07:32:01 -05:00
|
|
|
instructionSet[RETURNDATACOPY] = &operation{
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opReturnDataCopy,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
dynamicGas: gasReturnDataCopy,
|
|
|
|
minStack: minStack(3, 0),
|
|
|
|
maxStack: maxStack(3, 0),
|
|
|
|
memorySize: memoryReturnDataCopy,
|
2017-08-16 05:07:33 -05:00
|
|
|
}
|
2020-07-16 07:32:01 -05:00
|
|
|
instructionSet[REVERT] = &operation{
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opRevert,
|
|
|
|
dynamicGas: gasRevert,
|
|
|
|
minStack: minStack(2, 0),
|
|
|
|
maxStack: maxStack(2, 0),
|
|
|
|
memorySize: memoryRevert,
|
2017-08-16 07:32:59 -05:00
|
|
|
}
|
2021-12-14 04:30:20 -06:00
|
|
|
return validate(instructionSet)
|
2017-08-15 03:23:23 -05:00
|
|
|
}
|
|
|
|
|
2019-08-05 03:01:02 -05:00
|
|
|
// EIP 158 a.k.a Spurious Dragon
|
2019-08-08 04:07:23 -05:00
|
|
|
func newSpuriousDragonInstructionSet() JumpTable {
|
2019-08-05 03:01:02 -05:00
|
|
|
instructionSet := newTangerineWhistleInstructionSet()
|
|
|
|
instructionSet[EXP].dynamicGas = gasExpEIP158
|
2021-12-14 04:30:20 -06:00
|
|
|
return validate(instructionSet)
|
2019-08-05 03:01:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// EIP 150 a.k.a Tangerine Whistle
|
2019-08-08 04:07:23 -05:00
|
|
|
func newTangerineWhistleInstructionSet() JumpTable {
|
2019-08-05 03:01:02 -05:00
|
|
|
instructionSet := newHomesteadInstructionSet()
|
|
|
|
instructionSet[BALANCE].constantGas = params.BalanceGasEIP150
|
|
|
|
instructionSet[EXTCODESIZE].constantGas = params.ExtcodeSizeGasEIP150
|
|
|
|
instructionSet[SLOAD].constantGas = params.SloadGasEIP150
|
|
|
|
instructionSet[EXTCODECOPY].constantGas = params.ExtcodeCopyBaseEIP150
|
|
|
|
instructionSet[CALL].constantGas = params.CallGasEIP150
|
|
|
|
instructionSet[CALLCODE].constantGas = params.CallGasEIP150
|
|
|
|
instructionSet[DELEGATECALL].constantGas = params.CallGasEIP150
|
2021-12-14 04:30:20 -06:00
|
|
|
return validate(instructionSet)
|
2019-08-05 03:01:02 -05:00
|
|
|
}
|
|
|
|
|
2019-08-22 05:41:55 -05:00
|
|
|
// newHomesteadInstructionSet returns the frontier and homestead
|
2017-05-12 14:35:45 -05:00
|
|
|
// instructions that can be executed during the homestead phase.
|
2019-08-08 04:07:23 -05:00
|
|
|
func newHomesteadInstructionSet() JumpTable {
|
2018-06-26 07:56:25 -05:00
|
|
|
instructionSet := newFrontierInstructionSet()
|
2020-07-16 07:32:01 -05:00
|
|
|
instructionSet[DELEGATECALL] = &operation{
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opDelegateCall,
|
|
|
|
dynamicGas: gasDelegateCall,
|
|
|
|
constantGas: params.CallGasFrontier,
|
|
|
|
minStack: minStack(6, 1),
|
|
|
|
maxStack: maxStack(6, 1),
|
|
|
|
memorySize: memoryDelegateCall,
|
2017-02-01 15:36:51 -06:00
|
|
|
}
|
2021-12-14 04:30:20 -06:00
|
|
|
return validate(instructionSet)
|
2017-02-01 15:36:51 -06:00
|
|
|
}
|
2016-01-19 16:50:00 -06:00
|
|
|
|
2019-08-22 05:41:55 -05:00
|
|
|
// newFrontierInstructionSet returns the frontier instructions
|
2017-05-12 14:35:45 -05:00
|
|
|
// that can be executed during the frontier phase.
|
2019-08-08 04:07:23 -05:00
|
|
|
func newFrontierInstructionSet() JumpTable {
|
2021-12-03 04:04:54 -06:00
|
|
|
tbl := JumpTable{
|
2017-02-08 06:39:26 -06:00
|
|
|
STOP: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opStop,
|
|
|
|
constantGas: 0,
|
|
|
|
minStack: minStack(0, 0),
|
|
|
|
maxStack: maxStack(0, 0),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-02-08 06:39:26 -06:00
|
|
|
ADD: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opAdd,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
MUL: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opMul,
|
|
|
|
constantGas: GasFastStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SUB: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opSub,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DIV: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opDiv,
|
|
|
|
constantGas: GasFastStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
SDIV: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opSdiv,
|
|
|
|
constantGas: GasFastStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
MOD: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opMod,
|
|
|
|
constantGas: GasFastStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
SMOD: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opSmod,
|
|
|
|
constantGas: GasFastStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
ADDMOD: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opAddmod,
|
|
|
|
constantGas: GasMidStep,
|
|
|
|
minStack: minStack(3, 1),
|
|
|
|
maxStack: maxStack(3, 1),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
MULMOD: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opMulmod,
|
|
|
|
constantGas: GasMidStep,
|
|
|
|
minStack: minStack(3, 1),
|
|
|
|
maxStack: maxStack(3, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
EXP: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opExp,
|
2019-08-05 03:01:02 -05:00
|
|
|
dynamicGas: gasExpFrontier,
|
2019-03-12 04:40:05 -05:00
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
SIGNEXTEND: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opSignExtend,
|
|
|
|
constantGas: GasFastStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
LT: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opLt,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
GT: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opGt,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
SLT: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opSlt,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
SGT: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opSgt,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
EQ: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opEq,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
ISZERO: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opIszero,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(1, 1),
|
|
|
|
maxStack: maxStack(1, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
AND: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opAnd,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
XOR: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opXor,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
OR: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opOr,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-02-08 06:39:26 -06:00
|
|
|
NOT: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opNot,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(1, 1),
|
|
|
|
maxStack: maxStack(1, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
BYTE: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opByte,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2021-11-30 03:34:34 -06:00
|
|
|
KECCAK256: {
|
|
|
|
execute: opKeccak256,
|
|
|
|
constantGas: params.Keccak256Gas,
|
|
|
|
dynamicGas: gasKeccak256,
|
2019-08-05 03:01:02 -05:00
|
|
|
minStack: minStack(2, 1),
|
|
|
|
maxStack: maxStack(2, 1),
|
2021-11-30 03:34:34 -06:00
|
|
|
memorySize: memoryKeccak256,
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
ADDRESS: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opAddress,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
BALANCE: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opBalance,
|
|
|
|
constantGas: params.BalanceGasFrontier,
|
|
|
|
minStack: minStack(1, 1),
|
|
|
|
maxStack: maxStack(1, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
ORIGIN: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opOrigin,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
CALLER: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opCaller,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
CALLVALUE: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opCallValue,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
CALLDATALOAD: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opCallDataLoad,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(1, 1),
|
|
|
|
maxStack: maxStack(1, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
CALLDATASIZE: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opCallDataSize,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
CALLDATACOPY: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opCallDataCopy,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
dynamicGas: gasCallDataCopy,
|
|
|
|
minStack: minStack(3, 0),
|
|
|
|
maxStack: maxStack(3, 0),
|
|
|
|
memorySize: memoryCallDataCopy,
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
CODESIZE: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opCodeSize,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
CODECOPY: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opCodeCopy,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
dynamicGas: gasCodeCopy,
|
|
|
|
minStack: minStack(3, 0),
|
|
|
|
maxStack: maxStack(3, 0),
|
|
|
|
memorySize: memoryCodeCopy,
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
GASPRICE: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opGasprice,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-02-08 06:39:26 -06:00
|
|
|
EXTCODESIZE: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opExtCodeSize,
|
|
|
|
constantGas: params.ExtcodeSizeGasFrontier,
|
|
|
|
minStack: minStack(1, 1),
|
|
|
|
maxStack: maxStack(1, 1),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
EXTCODECOPY: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opExtCodeCopy,
|
|
|
|
constantGas: params.ExtcodeCopyBaseFrontier,
|
|
|
|
dynamicGas: gasExtCodeCopy,
|
|
|
|
minStack: minStack(4, 0),
|
|
|
|
maxStack: maxStack(4, 0),
|
|
|
|
memorySize: memoryExtCodeCopy,
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
BLOCKHASH: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opBlockhash,
|
|
|
|
constantGas: GasExtStep,
|
|
|
|
minStack: minStack(1, 1),
|
|
|
|
maxStack: maxStack(1, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
COINBASE: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opCoinbase,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
TIMESTAMP: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opTimestamp,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
NUMBER: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opNumber,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DIFFICULTY: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opDifficulty,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
GASLIMIT: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opGasLimit,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
POP: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opPop,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(1, 0),
|
|
|
|
maxStack: maxStack(1, 0),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
MLOAD: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opMload,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
dynamicGas: gasMLoad,
|
|
|
|
minStack: minStack(1, 1),
|
|
|
|
maxStack: maxStack(1, 1),
|
|
|
|
memorySize: memoryMLoad,
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
MSTORE: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opMstore,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
dynamicGas: gasMStore,
|
|
|
|
minStack: minStack(2, 0),
|
|
|
|
maxStack: maxStack(2, 0),
|
|
|
|
memorySize: memoryMStore,
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
MSTORE8: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opMstore8,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
dynamicGas: gasMStore8,
|
|
|
|
memorySize: memoryMStore8,
|
|
|
|
minStack: minStack(2, 0),
|
|
|
|
maxStack: maxStack(2, 0),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
SLOAD: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opSload,
|
|
|
|
constantGas: params.SloadGasFrontier,
|
|
|
|
minStack: minStack(1, 1),
|
|
|
|
maxStack: maxStack(1, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
SSTORE: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opSstore,
|
|
|
|
dynamicGas: gasSStore,
|
|
|
|
minStack: minStack(2, 0),
|
|
|
|
maxStack: maxStack(2, 0),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-02-08 06:39:26 -06:00
|
|
|
JUMP: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opJump,
|
|
|
|
constantGas: GasMidStep,
|
|
|
|
minStack: minStack(1, 0),
|
|
|
|
maxStack: maxStack(1, 0),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
JUMPI: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opJumpi,
|
|
|
|
constantGas: GasSlowStep,
|
|
|
|
minStack: minStack(2, 0),
|
|
|
|
maxStack: maxStack(2, 0),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PC: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opPc,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
MSIZE: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opMsize,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
GAS: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opGas,
|
|
|
|
constantGas: GasQuickStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-02-08 06:39:26 -06:00
|
|
|
JUMPDEST: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opJumpdest,
|
|
|
|
constantGas: params.JumpdestGas,
|
|
|
|
minStack: minStack(0, 0),
|
|
|
|
maxStack: maxStack(0, 0),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH1: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opPush1,
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH2: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(2, 2),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH3: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(3, 3),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH4: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(4, 4),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH5: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(5, 5),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH6: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(6, 6),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH7: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(7, 7),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH8: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(8, 8),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH9: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(9, 9),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH10: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(10, 10),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH11: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(11, 11),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH12: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(12, 12),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH13: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(13, 13),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH14: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(14, 14),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH15: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(15, 15),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH16: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(16, 16),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH17: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(17, 17),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH18: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(18, 18),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH19: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(19, 19),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH20: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(20, 20),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH21: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(21, 21),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH22: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(22, 22),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH23: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(23, 23),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH24: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(24, 24),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH25: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(25, 25),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH26: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(26, 26),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH27: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(27, 27),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH28: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(28, 28),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH29: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(29, 29),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH30: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(30, 30),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH31: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(31, 31),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
PUSH32: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makePush(32, 32),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minStack(0, 1),
|
|
|
|
maxStack: maxStack(0, 1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP1: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(1),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(1),
|
|
|
|
maxStack: maxDupStack(1),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP2: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(2),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(2),
|
|
|
|
maxStack: maxDupStack(2),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP3: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(3),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(3),
|
|
|
|
maxStack: maxDupStack(3),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP4: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(4),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(4),
|
|
|
|
maxStack: maxDupStack(4),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP5: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(5),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(5),
|
|
|
|
maxStack: maxDupStack(5),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP6: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(6),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(6),
|
|
|
|
maxStack: maxDupStack(6),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP7: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(7),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(7),
|
|
|
|
maxStack: maxDupStack(7),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP8: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(8),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(8),
|
|
|
|
maxStack: maxDupStack(8),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP9: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(9),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(9),
|
|
|
|
maxStack: maxDupStack(9),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP10: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(10),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(10),
|
|
|
|
maxStack: maxDupStack(10),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP11: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(11),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(11),
|
|
|
|
maxStack: maxDupStack(11),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP12: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(12),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(12),
|
|
|
|
maxStack: maxDupStack(12),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP13: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(13),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(13),
|
|
|
|
maxStack: maxDupStack(13),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP14: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(14),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(14),
|
|
|
|
maxStack: maxDupStack(14),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP15: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(15),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(15),
|
|
|
|
maxStack: maxDupStack(15),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2017-01-06 08:52:03 -06:00
|
|
|
DUP16: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeDup(16),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minDupStack(16),
|
|
|
|
maxStack: maxDupStack(16),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP1: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(1),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(2),
|
|
|
|
maxStack: maxSwapStack(2),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP2: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(2),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(3),
|
|
|
|
maxStack: maxSwapStack(3),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP3: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(3),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(4),
|
|
|
|
maxStack: maxSwapStack(4),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP4: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(4),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(5),
|
|
|
|
maxStack: maxSwapStack(5),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP5: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(5),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(6),
|
|
|
|
maxStack: maxSwapStack(6),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP6: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(6),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(7),
|
|
|
|
maxStack: maxSwapStack(7),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP7: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(7),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(8),
|
|
|
|
maxStack: maxSwapStack(8),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP8: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(8),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(9),
|
|
|
|
maxStack: maxSwapStack(9),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP9: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(9),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(10),
|
|
|
|
maxStack: maxSwapStack(10),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP10: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(10),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(11),
|
|
|
|
maxStack: maxSwapStack(11),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP11: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(11),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(12),
|
|
|
|
maxStack: maxSwapStack(12),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP12: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(12),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(13),
|
|
|
|
maxStack: maxSwapStack(13),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP13: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(13),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(14),
|
|
|
|
maxStack: maxSwapStack(14),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP14: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(14),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(15),
|
|
|
|
maxStack: maxSwapStack(15),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP15: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(15),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(16),
|
|
|
|
maxStack: maxSwapStack(16),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SWAP16: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeSwap(16),
|
|
|
|
constantGas: GasFastestStep,
|
|
|
|
minStack: minSwapStack(17),
|
|
|
|
maxStack: maxSwapStack(17),
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
LOG0: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeLog(0),
|
|
|
|
dynamicGas: makeGasLog(0),
|
|
|
|
minStack: minStack(2, 0),
|
|
|
|
maxStack: maxStack(2, 0),
|
|
|
|
memorySize: memoryLog,
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
LOG1: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeLog(1),
|
|
|
|
dynamicGas: makeGasLog(1),
|
|
|
|
minStack: minStack(3, 0),
|
|
|
|
maxStack: maxStack(3, 0),
|
|
|
|
memorySize: memoryLog,
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
LOG2: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeLog(2),
|
|
|
|
dynamicGas: makeGasLog(2),
|
|
|
|
minStack: minStack(4, 0),
|
|
|
|
maxStack: maxStack(4, 0),
|
|
|
|
memorySize: memoryLog,
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
LOG3: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeLog(3),
|
|
|
|
dynamicGas: makeGasLog(3),
|
|
|
|
minStack: minStack(5, 0),
|
|
|
|
maxStack: maxStack(5, 0),
|
|
|
|
memorySize: memoryLog,
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
LOG4: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: makeLog(4),
|
|
|
|
dynamicGas: makeGasLog(4),
|
|
|
|
minStack: minStack(6, 0),
|
|
|
|
maxStack: maxStack(6, 0),
|
|
|
|
memorySize: memoryLog,
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
CREATE: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opCreate,
|
|
|
|
constantGas: params.CreateGas,
|
|
|
|
dynamicGas: gasCreate,
|
|
|
|
minStack: minStack(3, 1),
|
|
|
|
maxStack: maxStack(3, 1),
|
|
|
|
memorySize: memoryCreate,
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
CALL: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opCall,
|
|
|
|
constantGas: params.CallGasFrontier,
|
|
|
|
dynamicGas: gasCall,
|
|
|
|
minStack: minStack(7, 1),
|
|
|
|
maxStack: maxStack(7, 1),
|
|
|
|
memorySize: memoryCall,
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
CALLCODE: {
|
2019-08-05 03:01:02 -05:00
|
|
|
execute: opCallCode,
|
|
|
|
constantGas: params.CallGasFrontier,
|
|
|
|
dynamicGas: gasCallCode,
|
|
|
|
minStack: minStack(7, 1),
|
|
|
|
maxStack: maxStack(7, 1),
|
|
|
|
memorySize: memoryCall,
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
RETURN: {
|
2019-03-12 04:40:05 -05:00
|
|
|
execute: opReturn,
|
|
|
|
dynamicGas: gasReturn,
|
|
|
|
minStack: minStack(2, 0),
|
|
|
|
maxStack: maxStack(2, 0),
|
|
|
|
memorySize: memoryReturn,
|
2017-02-08 06:39:26 -06:00
|
|
|
},
|
|
|
|
SELFDESTRUCT: {
|
2021-12-01 03:33:29 -06:00
|
|
|
execute: opSelfdestruct,
|
2019-08-05 03:01:02 -05:00
|
|
|
dynamicGas: gasSelfdestruct,
|
2019-03-12 04:40:05 -05:00
|
|
|
minStack: minStack(1, 0),
|
|
|
|
maxStack: maxStack(1, 0),
|
2017-01-05 04:52:10 -06:00
|
|
|
},
|
2016-01-19 16:50:00 -06:00
|
|
|
}
|
2021-12-03 04:04:54 -06:00
|
|
|
|
|
|
|
// Fill all unassigned slots with opUndefined.
|
|
|
|
for i, entry := range tbl {
|
|
|
|
if entry == nil {
|
|
|
|
tbl[i] = &operation{execute: opUndefined, maxStack: maxStack(0, 0)}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-14 04:30:20 -06:00
|
|
|
return validate(tbl)
|
2015-08-30 03:19:10 -05:00
|
|
|
}
|
2022-11-09 00:52:13 -06:00
|
|
|
|
|
|
|
func copyJumpTable(source *JumpTable) *JumpTable {
|
|
|
|
dest := *source
|
|
|
|
for i, op := range source {
|
|
|
|
if op != nil {
|
|
|
|
opCopy := *op
|
|
|
|
dest[i] = &opCopy
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &dest
|
|
|
|
}
|