Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
163f1665
Unverified
Commit
163f1665
authored
Nov 30, 2021
by
Andrei Maiboroda
Committed by
GitHub
Nov 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/vm: don't copy JumpTable when no EIP mods are needed (#23977)
parent
a69d4b27
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
interpreter.go
core/vm/interpreter.go
+15
-17
No files found.
core/vm/interpreter.go
View file @
163f1665
...
...
@@ -33,7 +33,7 @@ type Config struct {
NoBaseFee
bool
// Forces the EIP-1559 baseFee to 0 (needed for 0 price calls)
EnablePreimageRecording
bool
// Enables recording of SHA3/keccak preimages
JumpTable
JumpTable
// EVM instruction table, automatically populated if unset
JumpTable
*
JumpTable
// EVM instruction table, automatically populated if unset
ExtraEips
[]
int
// Additional EIPS that are to be enabled
}
...
...
@@ -68,39 +68,37 @@ type EVMInterpreter struct {
// NewEVMInterpreter returns a new instance of the Interpreter.
func
NewEVMInterpreter
(
evm
*
EVM
,
cfg
Config
)
*
EVMInterpreter
{
// We use the STOP instruction whether to see
// the jump table was initialised. If it was not
// we'll set the default jump table.
if
cfg
.
JumpTable
[
STOP
]
==
nil
{
var
jt
JumpTable
// If jump table was not initialised we set the default one.
if
cfg
.
JumpTable
==
nil
{
switch
{
case
evm
.
chainRules
.
IsLondon
:
jt
=
londonInstructionSet
cfg
.
JumpTable
=
&
londonInstructionSet
case
evm
.
chainRules
.
IsBerlin
:
jt
=
berlinInstructionSet
cfg
.
JumpTable
=
&
berlinInstructionSet
case
evm
.
chainRules
.
IsIstanbul
:
jt
=
istanbulInstructionSet
cfg
.
JumpTable
=
&
istanbulInstructionSet
case
evm
.
chainRules
.
IsConstantinople
:
jt
=
constantinopleInstructionSet
cfg
.
JumpTable
=
&
constantinopleInstructionSet
case
evm
.
chainRules
.
IsByzantium
:
jt
=
byzantiumInstructionSet
cfg
.
JumpTable
=
&
byzantiumInstructionSet
case
evm
.
chainRules
.
IsEIP158
:
jt
=
spuriousDragonInstructionSet
cfg
.
JumpTable
=
&
spuriousDragonInstructionSet
case
evm
.
chainRules
.
IsEIP150
:
jt
=
tangerineWhistleInstructionSet
cfg
.
JumpTable
=
&
tangerineWhistleInstructionSet
case
evm
.
chainRules
.
IsHomestead
:
jt
=
homesteadInstructionSet
cfg
.
JumpTable
=
&
homesteadInstructionSet
default
:
jt
=
frontierInstructionSet
cfg
.
JumpTable
=
&
frontierInstructionSet
}
for
i
,
eip
:=
range
cfg
.
ExtraEips
{
if
err
:=
EnableEIP
(
eip
,
&
jt
);
err
!=
nil
{
copy
:=
*
cfg
.
JumpTable
if
err
:=
EnableEIP
(
eip
,
&
copy
);
err
!=
nil
{
// Disable it, so caller can check if it's activated or not
cfg
.
ExtraEips
=
append
(
cfg
.
ExtraEips
[
:
i
],
cfg
.
ExtraEips
[
i
+
1
:
]
...
)
log
.
Error
(
"EIP activation failed"
,
"eip"
,
eip
,
"error"
,
err
)
}
cfg
.
JumpTable
=
&
copy
}
cfg
.
JumpTable
=
jt
}
return
&
EVMInterpreter
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment