core/vm: enable istanbul EIPs in the jump table
This commit is contained in:
parent
46ec63b849
commit
060e33fb4c
@ -93,6 +93,8 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter {
|
|||||||
if !cfg.JumpTable[STOP].valid {
|
if !cfg.JumpTable[STOP].valid {
|
||||||
var jt JumpTable
|
var jt JumpTable
|
||||||
switch {
|
switch {
|
||||||
|
case evm.chainRules.IsIstanbul:
|
||||||
|
jt = istanbulInstructionSet
|
||||||
case evm.chainRules.IsConstantinople:
|
case evm.chainRules.IsConstantinople:
|
||||||
jt = constantinopleInstructionSet
|
jt = constantinopleInstructionSet
|
||||||
case evm.chainRules.IsByzantium:
|
case evm.chainRules.IsByzantium:
|
||||||
|
@ -60,15 +60,27 @@ var (
|
|||||||
spuriousDragonInstructionSet = newSpuriousDragonInstructionSet()
|
spuriousDragonInstructionSet = newSpuriousDragonInstructionSet()
|
||||||
byzantiumInstructionSet = newByzantiumInstructionSet()
|
byzantiumInstructionSet = newByzantiumInstructionSet()
|
||||||
constantinopleInstructionSet = newConstantinopleInstructionSet()
|
constantinopleInstructionSet = newConstantinopleInstructionSet()
|
||||||
|
istanbulInstructionSet = newIstanbulInstructionSet()
|
||||||
)
|
)
|
||||||
|
|
||||||
// JumpTable contains the EVM opcodes supported at a given fork.
|
// JumpTable contains the EVM opcodes supported at a given fork.
|
||||||
type JumpTable [256]operation
|
type JumpTable [256]operation
|
||||||
|
|
||||||
// NewConstantinopleInstructionSet returns the frontier, homestead
|
// newIstanbulInstructionSet returns the frontier, homestead
|
||||||
|
// byzantium, contantinople and petersburg instructions.
|
||||||
|
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
|
||||||
|
|
||||||
|
return instructionSet
|
||||||
|
}
|
||||||
|
|
||||||
|
// newConstantinopleInstructionSet returns the frontier, homestead
|
||||||
// byzantium and contantinople instructions.
|
// byzantium and contantinople instructions.
|
||||||
func newConstantinopleInstructionSet() JumpTable {
|
func newConstantinopleInstructionSet() JumpTable {
|
||||||
// instructions that can be executed during the byzantium phase.
|
|
||||||
instructionSet := newByzantiumInstructionSet()
|
instructionSet := newByzantiumInstructionSet()
|
||||||
instructionSet[SHL] = operation{
|
instructionSet[SHL] = operation{
|
||||||
execute: opSHL,
|
execute: opSHL,
|
||||||
@ -112,10 +124,9 @@ func newConstantinopleInstructionSet() JumpTable {
|
|||||||
return instructionSet
|
return instructionSet
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewByzantiumInstructionSet returns the frontier, homestead and
|
// newByzantiumInstructionSet returns the frontier, homestead and
|
||||||
// byzantium instructions.
|
// byzantium instructions.
|
||||||
func newByzantiumInstructionSet() JumpTable {
|
func newByzantiumInstructionSet() JumpTable {
|
||||||
// instructions that can be executed during the homestead phase.
|
|
||||||
instructionSet := newSpuriousDragonInstructionSet()
|
instructionSet := newSpuriousDragonInstructionSet()
|
||||||
instructionSet[STATICCALL] = operation{
|
instructionSet[STATICCALL] = operation{
|
||||||
execute: opStaticCall,
|
execute: opStaticCall,
|
||||||
@ -177,7 +188,7 @@ func newTangerineWhistleInstructionSet() JumpTable {
|
|||||||
return instructionSet
|
return instructionSet
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHomesteadInstructionSet returns the frontier and homestead
|
// newHomesteadInstructionSet returns the frontier and homestead
|
||||||
// instructions that can be executed during the homestead phase.
|
// instructions that can be executed during the homestead phase.
|
||||||
func newHomesteadInstructionSet() JumpTable {
|
func newHomesteadInstructionSet() JumpTable {
|
||||||
instructionSet := newFrontierInstructionSet()
|
instructionSet := newFrontierInstructionSet()
|
||||||
@ -194,7 +205,7 @@ func newHomesteadInstructionSet() JumpTable {
|
|||||||
return instructionSet
|
return instructionSet
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFrontierInstructionSet returns the frontier instructions
|
// newFrontierInstructionSet returns the frontier instructions
|
||||||
// that can be executed during the frontier phase.
|
// that can be executed during the frontier phase.
|
||||||
func newFrontierInstructionSet() JumpTable {
|
func newFrontierInstructionSet() JumpTable {
|
||||||
return JumpTable{
|
return JumpTable{
|
||||||
|
Loading…
Reference in New Issue
Block a user