Skip to content

Commit 060e33f

Browse files
committed
core/vm: enable istanbul EIPs in the jump table
1 parent 46ec63b commit 060e33f

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

core/vm/interpreter.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter {
9393
if !cfg.JumpTable[STOP].valid {
9494
var jt JumpTable
9595
switch {
96+
case evm.chainRules.IsIstanbul:
97+
jt = istanbulInstructionSet
9698
case evm.chainRules.IsConstantinople:
9799
jt = constantinopleInstructionSet
98100
case evm.chainRules.IsByzantium:

core/vm/jump_table.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,27 @@ var (
6060
spuriousDragonInstructionSet = newSpuriousDragonInstructionSet()
6161
byzantiumInstructionSet = newByzantiumInstructionSet()
6262
constantinopleInstructionSet = newConstantinopleInstructionSet()
63+
istanbulInstructionSet = newIstanbulInstructionSet()
6364
)
6465

6566
// JumpTable contains the EVM opcodes supported at a given fork.
6667
type JumpTable [256]operation
6768

68-
// NewConstantinopleInstructionSet returns the frontier, homestead
69+
// newIstanbulInstructionSet returns the frontier, homestead
70+
// byzantium, contantinople and petersburg instructions.
71+
func newIstanbulInstructionSet() JumpTable {
72+
instructionSet := newConstantinopleInstructionSet()
73+
74+
enable1344(&instructionSet) // ChainID opcode - https://eips.ethereum.org/EIPS/eip-1344
75+
enable1884(&instructionSet) // Reprice reader opcodes - https://eips.ethereum.org/EIPS/eip-1884
76+
enable2200(&instructionSet) // Net metered SSTORE - https://eips.ethereum.org/EIPS/eip-2200
77+
78+
return instructionSet
79+
}
80+
81+
// newConstantinopleInstructionSet returns the frontier, homestead
6982
// byzantium and contantinople instructions.
7083
func newConstantinopleInstructionSet() JumpTable {
71-
// instructions that can be executed during the byzantium phase.
7284
instructionSet := newByzantiumInstructionSet()
7385
instructionSet[SHL] = operation{
7486
execute: opSHL,
@@ -112,10 +124,9 @@ func newConstantinopleInstructionSet() JumpTable {
112124
return instructionSet
113125
}
114126

115-
// NewByzantiumInstructionSet returns the frontier, homestead and
127+
// newByzantiumInstructionSet returns the frontier, homestead and
116128
// byzantium instructions.
117129
func newByzantiumInstructionSet() JumpTable {
118-
// instructions that can be executed during the homestead phase.
119130
instructionSet := newSpuriousDragonInstructionSet()
120131
instructionSet[STATICCALL] = operation{
121132
execute: opStaticCall,
@@ -177,7 +188,7 @@ func newTangerineWhistleInstructionSet() JumpTable {
177188
return instructionSet
178189
}
179190

180-
// NewHomesteadInstructionSet returns the frontier and homestead
191+
// newHomesteadInstructionSet returns the frontier and homestead
181192
// instructions that can be executed during the homestead phase.
182193
func newHomesteadInstructionSet() JumpTable {
183194
instructionSet := newFrontierInstructionSet()
@@ -194,7 +205,7 @@ func newHomesteadInstructionSet() JumpTable {
194205
return instructionSet
195206
}
196207

197-
// NewFrontierInstructionSet returns the frontier instructions
208+
// newFrontierInstructionSet returns the frontier instructions
198209
// that can be executed during the frontier phase.
199210
func newFrontierInstructionSet() JumpTable {
200211
return JumpTable{

0 commit comments

Comments
 (0)