github.com/theQRL/go-zond@v0.2.1/core/vm/jump_table_export.go (about) 1 // Copyright 2023 The go-ethereum Authors 2 // This file is part of the go-ethereum library. 3 // 4 // The go-ethereum library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The go-ethereum library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. 16 17 package vm 18 19 import ( 20 "github.com/theQRL/go-zond/params" 21 ) 22 23 // LookupInstructionSet returns the instructionset for the fork configured by 24 // the rules. 25 func LookupInstructionSet(rules params.Rules) (JumpTable, error) { 26 return newShanghaiInstructionSet(), nil 27 } 28 29 // Stack returns the minimum and maximum stack requirements. 30 func (op *operation) Stack() (int, int) { 31 return op.minStack, op.maxStack 32 } 33 34 // HasCost returns true if the opcode has a cost. Opcodes which do _not_ have 35 // a cost assigned are one of two things: 36 // - undefined, a.k.a invalid opcodes, 37 // - the STOP opcode. 38 // This method can thus be used to check if an opcode is "Invalid (or STOP)". 39 func (op *operation) HasCost() bool { 40 // Ideally, we'd check this: 41 // return op.execute == opUndefined 42 // However, go-lang does now allow that. So we'll just check some other 43 // 'indicators' that this is an invalid op. Alas, STOP is impossible to 44 // filter out 45 return op.dynamicGas != nil || op.constantGas != 0 46 }