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
9331fe28
Unverified
Commit
9331fe28
authored
Dec 03, 2021
by
Paweł Bylica
Committed by
GitHub
Dec 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/vm: fill gaps in jump table with opUndefined (#24031)
parent
a0f77719
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
instructions.go
core/vm/instructions.go
+4
-0
interpreter.go
core/vm/interpreter.go
+0
-3
jump_table.go
core/vm/jump_table.go
+10
-1
No files found.
core/vm/instructions.go
View file @
9331fe28
...
...
@@ -801,6 +801,10 @@ func opRevert(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]b
return
ret
,
ErrExecutionReverted
}
func
opUndefined
(
pc
*
uint64
,
interpreter
*
EVMInterpreter
,
scope
*
ScopeContext
)
([]
byte
,
error
)
{
return
nil
,
&
ErrInvalidOpCode
{
opcode
:
OpCode
(
scope
.
Contract
.
Code
[
*
pc
])}
}
func
opStop
(
pc
*
uint64
,
interpreter
*
EVMInterpreter
,
scope
*
ScopeContext
)
([]
byte
,
error
)
{
return
nil
,
errStopToken
}
...
...
core/vm/interpreter.go
View file @
9331fe28
...
...
@@ -193,9 +193,6 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (
// enough stack items available to perform the operation.
op
=
contract
.
GetOp
(
pc
)
operation
:=
in
.
cfg
.
JumpTable
[
op
]
if
operation
==
nil
{
return
nil
,
&
ErrInvalidOpCode
{
opcode
:
op
}
}
// Validate stack
if
sLen
:=
stack
.
len
();
sLen
<
operation
.
minStack
{
return
nil
,
&
ErrStackUnderflow
{
stackLen
:
sLen
,
required
:
operation
.
minStack
}
...
...
core/vm/jump_table.go
View file @
9331fe28
...
...
@@ -200,7 +200,7 @@ func newHomesteadInstructionSet() JumpTable {
// newFrontierInstructionSet returns the frontier instructions
// that can be executed during the frontier phase.
func
newFrontierInstructionSet
()
JumpTable
{
return
JumpTable
{
tbl
:=
JumpTable
{
STOP
:
{
execute
:
opStop
,
constantGas
:
0
,
...
...
@@ -1002,4 +1002,13 @@ func newFrontierInstructionSet() JumpTable {
maxStack
:
maxStack
(
1
,
0
),
},
}
// Fill all unassigned slots with opUndefined.
for
i
,
entry
:=
range
tbl
{
if
entry
==
nil
{
tbl
[
i
]
=
&
operation
{
execute
:
opUndefined
,
maxStack
:
maxStack
(
0
,
0
)}
}
}
return
tbl
}
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