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
4e0fea4d
Unverified
Commit
4e0fea4d
authored
Aug 16, 2017
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/vm: polish RETURNDATA, add missing returns to CALL*
parent
9bd6068f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
72 deletions
+75
-72
evm.go
core/vm/evm.go
+3
-3
gas_table.go
core/vm/gas_table.go
+1
-1
instructions.go
core/vm/instructions.go
+38
-35
interpreter.go
core/vm/interpreter.go
+4
-5
jump_table.go
core/vm/jump_table.go
+28
-26
memory.go
core/vm/memory.go
+0
-1
memory_table.go
core/vm/memory_table.go
+1
-1
No files found.
core/vm/evm.go
View file @
4e0fea4d
...
@@ -261,9 +261,9 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
...
@@ -261,9 +261,9 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
// Make sure the readonly is only set if we aren't in readonly yet
// Make sure the readonly is only set if we aren't in readonly yet
// this makes also sure that the readonly flag isn't removed for
// this makes also sure that the readonly flag isn't removed for
// child calls.
// child calls.
if
!
evm
.
interpreter
.
read
o
nly
{
if
!
evm
.
interpreter
.
read
O
nly
{
evm
.
interpreter
.
read
o
nly
=
true
evm
.
interpreter
.
read
O
nly
=
true
defer
func
()
{
evm
.
interpreter
.
read
o
nly
=
false
}()
defer
func
()
{
evm
.
interpreter
.
read
O
nly
=
false
}()
}
}
var
(
var
(
...
...
core/vm/gas_table.go
View file @
4e0fea4d
...
@@ -65,7 +65,7 @@ func constGasFunc(gas uint64) gasFunc {
...
@@ -65,7 +65,7 @@ func constGasFunc(gas uint64) gasFunc {
}
}
}
}
func
gasCall
d
ataCopy
(
gt
params
.
GasTable
,
evm
*
EVM
,
contract
*
Contract
,
stack
*
Stack
,
mem
*
Memory
,
memorySize
uint64
)
(
uint64
,
error
)
{
func
gasCall
D
ataCopy
(
gt
params
.
GasTable
,
evm
*
EVM
,
contract
*
Contract
,
stack
*
Stack
,
mem
*
Memory
,
memorySize
uint64
)
(
uint64
,
error
)
{
gas
,
err
:=
memoryGasCost
(
mem
,
memorySize
)
gas
,
err
:=
memoryGasCost
(
mem
,
memorySize
)
if
err
!=
nil
{
if
err
!=
nil
{
return
0
,
err
return
0
,
err
...
...
core/vm/instructions.go
View file @
4e0fea4d
...
@@ -29,9 +29,9 @@ import (
...
@@ -29,9 +29,9 @@ import (
)
)
var
(
var
(
bigZero
=
new
(
big
.
Int
)
bigZero
=
new
(
big
.
Int
)
errWriteProtection
=
errors
.
New
(
"evm: write protection"
)
errWriteProtection
=
errors
.
New
(
"evm: write protection"
)
errRe
adOutOfBound
=
errors
.
New
(
"evm: read out of bound
"
)
errRe
turnDataOutOfBounds
=
errors
.
New
(
"evm: return data out of bounds
"
)
)
)
func
opAdd
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opAdd
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
...
@@ -243,6 +243,7 @@ func opAnd(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stac
...
@@ -243,6 +243,7 @@ func opAnd(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stac
evm
.
interpreter
.
intPool
.
put
(
y
)
evm
.
interpreter
.
intPool
.
put
(
y
)
return
nil
,
nil
return
nil
,
nil
}
}
func
opOr
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opOr
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
x
,
y
:=
stack
.
pop
(),
stack
.
pop
()
x
,
y
:=
stack
.
pop
(),
stack
.
pop
()
stack
.
push
(
x
.
Or
(
x
,
y
))
stack
.
push
(
x
.
Or
(
x
,
y
))
...
@@ -250,6 +251,7 @@ func opOr(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack
...
@@ -250,6 +251,7 @@ func opOr(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack
evm
.
interpreter
.
intPool
.
put
(
y
)
evm
.
interpreter
.
intPool
.
put
(
y
)
return
nil
,
nil
return
nil
,
nil
}
}
func
opXor
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opXor
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
x
,
y
:=
stack
.
pop
(),
stack
.
pop
()
x
,
y
:=
stack
.
pop
(),
stack
.
pop
()
stack
.
push
(
x
.
Xor
(
x
,
y
))
stack
.
push
(
x
.
Xor
(
x
,
y
))
...
@@ -269,6 +271,7 @@ func opByte(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Sta
...
@@ -269,6 +271,7 @@ func opByte(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Sta
evm
.
interpreter
.
intPool
.
put
(
th
)
evm
.
interpreter
.
intPool
.
put
(
th
)
return
nil
,
nil
return
nil
,
nil
}
}
func
opAddmod
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opAddmod
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
x
,
y
,
z
:=
stack
.
pop
(),
stack
.
pop
(),
stack
.
pop
()
x
,
y
,
z
:=
stack
.
pop
(),
stack
.
pop
(),
stack
.
pop
()
if
z
.
Cmp
(
bigZero
)
>
0
{
if
z
.
Cmp
(
bigZero
)
>
0
{
...
@@ -282,6 +285,7 @@ func opAddmod(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *S
...
@@ -282,6 +285,7 @@ func opAddmod(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *S
evm
.
interpreter
.
intPool
.
put
(
y
,
z
)
evm
.
interpreter
.
intPool
.
put
(
y
,
z
)
return
nil
,
nil
return
nil
,
nil
}
}
func
opMulmod
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opMulmod
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
x
,
y
,
z
:=
stack
.
pop
(),
stack
.
pop
(),
stack
.
pop
()
x
,
y
,
z
:=
stack
.
pop
(),
stack
.
pop
(),
stack
.
pop
()
if
z
.
Cmp
(
bigZero
)
>
0
{
if
z
.
Cmp
(
bigZero
)
>
0
{
...
@@ -339,25 +343,25 @@ func opCallValue(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack
...
@@ -339,25 +343,25 @@ func opCallValue(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack
return
nil
,
nil
return
nil
,
nil
}
}
func
opCall
d
ataLoad
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opCall
D
ataLoad
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
stack
.
push
(
new
(
big
.
Int
)
.
SetBytes
(
getDataBig
(
contract
.
Input
,
stack
.
pop
(),
big32
)))
stack
.
push
(
new
(
big
.
Int
)
.
SetBytes
(
getDataBig
(
contract
.
Input
,
stack
.
pop
(),
big32
)))
return
nil
,
nil
return
nil
,
nil
}
}
func
opCall
d
ataSize
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opCall
D
ataSize
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
stack
.
push
(
evm
.
interpreter
.
intPool
.
get
()
.
SetInt64
(
int64
(
len
(
contract
.
Input
))))
stack
.
push
(
evm
.
interpreter
.
intPool
.
get
()
.
SetInt64
(
int64
(
len
(
contract
.
Input
))))
return
nil
,
nil
return
nil
,
nil
}
}
func
opCall
d
ataCopy
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opCall
D
ataCopy
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
var
(
var
(
m
Off
=
stack
.
pop
()
m
emOffset
=
stack
.
pop
()
cOff
=
stack
.
pop
()
dataOffset
=
stack
.
pop
()
l
=
stack
.
pop
()
l
ength
=
stack
.
pop
()
)
)
memory
.
Set
(
m
Off
.
Uint64
(),
l
.
Uint64
(),
getDataBig
(
contract
.
Input
,
cOff
,
l
))
memory
.
Set
(
m
emOffset
.
Uint64
(),
length
.
Uint64
(),
getDataBig
(
contract
.
Input
,
dataOffset
,
length
))
evm
.
interpreter
.
intPool
.
put
(
m
Off
,
cOff
,
l
)
evm
.
interpreter
.
intPool
.
put
(
m
emOffset
,
dataOffset
,
length
)
return
nil
,
nil
return
nil
,
nil
}
}
...
@@ -368,17 +372,17 @@ func opReturnDataSize(pc *uint64, evm *EVM, contract *Contract, memory *Memory,
...
@@ -368,17 +372,17 @@ func opReturnDataSize(pc *uint64, evm *EVM, contract *Contract, memory *Memory,
func
opReturnDataCopy
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opReturnDataCopy
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
var
(
var
(
m
Off
=
stack
.
pop
()
m
emOffset
=
stack
.
pop
()
cOff
=
stack
.
pop
()
dataOffset
=
stack
.
pop
()
l
=
stack
.
pop
()
l
ength
=
stack
.
pop
()
)
)
defer
evm
.
interpreter
.
intPool
.
put
(
m
Off
,
cOff
,
l
)
defer
evm
.
interpreter
.
intPool
.
put
(
m
emOffset
,
dataOffset
,
length
)
cEnd
:=
new
(
big
.
Int
)
.
Add
(
cOff
,
l
)
end
:=
new
(
big
.
Int
)
.
Add
(
dataOffset
,
length
)
if
cEnd
.
BitLen
()
>
64
||
uint64
(
len
(
evm
.
interpreter
.
returnData
))
<
cE
nd
.
Uint64
()
{
if
end
.
BitLen
()
>
64
||
uint64
(
len
(
evm
.
interpreter
.
returnData
))
<
e
nd
.
Uint64
()
{
return
nil
,
errRe
adOutOfBound
return
nil
,
errRe
turnDataOutOfBounds
}
}
memory
.
Set
(
m
Off
.
Uint64
(),
l
.
Uint64
(),
evm
.
interpreter
.
returnData
[
cOff
.
Uint64
()
:
cE
nd
.
Uint64
()])
memory
.
Set
(
m
emOffset
.
Uint64
(),
length
.
Uint64
(),
evm
.
interpreter
.
returnData
[
dataOffset
.
Uint64
()
:
e
nd
.
Uint64
()])
return
nil
,
nil
return
nil
,
nil
}
}
...
@@ -401,31 +405,28 @@ func opCodeSize(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack
...
@@ -401,31 +405,28 @@ func opCodeSize(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack
func
opCodeCopy
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opCodeCopy
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
var
(
var
(
m
Off
=
stack
.
pop
()
m
emOffset
=
stack
.
pop
()
c
Off
=
stack
.
pop
()
c
odeOffset
=
stack
.
pop
()
l
=
stack
.
pop
()
l
ength
=
stack
.
pop
()
)
)
codeCopy
:=
getDataBig
(
contract
.
Code
,
cOff
,
l
)
codeCopy
:=
getDataBig
(
contract
.
Code
,
codeOffset
,
length
)
memory
.
Set
(
memOffset
.
Uint64
(),
length
.
Uint64
(),
codeCopy
)
memory
.
Set
(
mOff
.
Uint64
(),
l
.
Uint64
(),
codeCopy
)
evm
.
interpreter
.
intPool
.
put
(
m
Off
,
cOff
,
l
)
evm
.
interpreter
.
intPool
.
put
(
m
emOffset
,
codeOffset
,
length
)
return
nil
,
nil
return
nil
,
nil
}
}
func
opExtCodeCopy
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opExtCodeCopy
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
var
(
var
(
addr
=
common
.
BigToAddress
(
stack
.
pop
())
addr
=
common
.
BigToAddress
(
stack
.
pop
())
m
Off
=
stack
.
pop
()
m
emOffset
=
stack
.
pop
()
c
Off
=
stack
.
pop
()
c
odeOffset
=
stack
.
pop
()
l
=
stack
.
pop
()
l
ength
=
stack
.
pop
()
)
)
codeCopy
:=
getDataBig
(
evm
.
StateDB
.
GetCode
(
addr
),
cOff
,
l
)
codeCopy
:=
getDataBig
(
evm
.
StateDB
.
GetCode
(
addr
),
codeOffset
,
length
)
memory
.
Set
(
memOffset
.
Uint64
(),
length
.
Uint64
(),
codeCopy
)
memory
.
Set
(
mOff
.
Uint64
(),
l
.
Uint64
(),
codeCopy
)
evm
.
interpreter
.
intPool
.
put
(
mOff
,
cOff
,
l
)
evm
.
interpreter
.
intPool
.
put
(
memOffset
,
codeOffset
,
length
)
return
nil
,
nil
return
nil
,
nil
}
}
...
@@ -530,6 +531,7 @@ func opJump(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Sta
...
@@ -530,6 +531,7 @@ func opJump(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Sta
evm
.
interpreter
.
intPool
.
put
(
pos
)
evm
.
interpreter
.
intPool
.
put
(
pos
)
return
nil
,
nil
return
nil
,
nil
}
}
func
opJumpi
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opJumpi
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
pos
,
cond
:=
stack
.
pop
(),
stack
.
pop
()
pos
,
cond
:=
stack
.
pop
(),
stack
.
pop
()
if
cond
.
Sign
()
!=
0
{
if
cond
.
Sign
()
!=
0
{
...
@@ -545,6 +547,7 @@ func opJumpi(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *St
...
@@ -545,6 +547,7 @@ func opJumpi(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *St
evm
.
interpreter
.
intPool
.
put
(
pos
,
cond
)
evm
.
interpreter
.
intPool
.
put
(
pos
,
cond
)
return
nil
,
nil
return
nil
,
nil
}
}
func
opJumpdest
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
func
opJumpdest
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
)
{
return
nil
,
nil
return
nil
,
nil
}
}
...
...
core/vm/interpreter.go
View file @
4e0fea4d
...
@@ -59,9 +59,8 @@ type Interpreter struct {
...
@@ -59,9 +59,8 @@ type Interpreter struct {
gasTable
params
.
GasTable
gasTable
params
.
GasTable
intPool
*
intPool
intPool
*
intPool
readonly
bool
readOnly
bool
// Whether to throw on stateful modifications
// returnData contains the last call's return data
returnData
[]
byte
// Last CALL's return data for subsequent reuse
returnData
[]
byte
}
}
// NewInterpreter returns a new instance of the Interpreter.
// NewInterpreter returns a new instance of the Interpreter.
...
@@ -90,7 +89,7 @@ func NewInterpreter(evm *EVM, cfg Config) *Interpreter {
...
@@ -90,7 +89,7 @@ func NewInterpreter(evm *EVM, cfg Config) *Interpreter {
func
(
in
*
Interpreter
)
enforceRestrictions
(
op
OpCode
,
operation
operation
,
stack
*
Stack
)
error
{
func
(
in
*
Interpreter
)
enforceRestrictions
(
op
OpCode
,
operation
operation
,
stack
*
Stack
)
error
{
if
in
.
evm
.
chainRules
.
IsMetropolis
{
if
in
.
evm
.
chainRules
.
IsMetropolis
{
if
in
.
read
o
nly
{
if
in
.
read
O
nly
{
// If the interpreter is operating in readonly mode, make sure no
// If the interpreter is operating in readonly mode, make sure no
// state-modifying operation is performed. The 3rd stack item
// state-modifying operation is performed. The 3rd stack item
// for a call operation is the value. Transfering value from one
// for a call operation is the value. Transfering value from one
...
@@ -221,7 +220,7 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret
...
@@ -221,7 +220,7 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret
}
}
// if the operation clears the return data (e.g. it has returning data)
// if the operation clears the return data (e.g. it has returning data)
// set the last return to the result of the operation.
// set the last return to the result of the operation.
if
operation
.
clearsReturndata
{
if
operation
.
returns
{
in
.
returnData
=
res
in
.
returnData
=
res
}
}
}
}
...
...
core/vm/jump_table.go
View file @
4e0fea4d
...
@@ -53,8 +53,8 @@ type operation struct {
...
@@ -53,8 +53,8 @@ type operation struct {
valid
bool
valid
bool
// reverts determined whether the operation reverts state
// reverts determined whether the operation reverts state
reverts
bool
reverts
bool
//
clearsReturndata determines whether the opertions clear
s the return data
//
returns determines whether the opertions set
s the return data
clearsReturndata
bool
returns
bool
}
}
var
(
var
(
...
@@ -74,6 +74,7 @@ func NewMetropolisInstructionSet() [256]operation {
...
@@ -74,6 +74,7 @@ func NewMetropolisInstructionSet() [256]operation {
validateStack
:
makeStackFunc
(
6
,
1
),
validateStack
:
makeStackFunc
(
6
,
1
),
memorySize
:
memoryStaticCall
,
memorySize
:
memoryStaticCall
,
valid
:
true
,
valid
:
true
,
returns
:
true
,
}
}
instructionSet
[
RETURNDATASIZE
]
=
operation
{
instructionSet
[
RETURNDATASIZE
]
=
operation
{
execute
:
opReturnDataSize
,
execute
:
opReturnDataSize
,
...
@@ -101,6 +102,7 @@ func NewHomesteadInstructionSet() [256]operation {
...
@@ -101,6 +102,7 @@ func NewHomesteadInstructionSet() [256]operation {
validateStack
:
makeStackFunc
(
6
,
1
),
validateStack
:
makeStackFunc
(
6
,
1
),
memorySize
:
memoryDelegateCall
,
memorySize
:
memoryDelegateCall
,
valid
:
true
,
valid
:
true
,
returns
:
true
,
}
}
return
instructionSet
return
instructionSet
}
}
...
@@ -286,22 +288,22 @@ func NewFrontierInstructionSet() [256]operation {
...
@@ -286,22 +288,22 @@ func NewFrontierInstructionSet() [256]operation {
valid
:
true
,
valid
:
true
,
},
},
CALLDATALOAD
:
{
CALLDATALOAD
:
{
execute
:
opCall
d
ataLoad
,
execute
:
opCall
D
ataLoad
,
gasCost
:
constGasFunc
(
GasFastestStep
),
gasCost
:
constGasFunc
(
GasFastestStep
),
validateStack
:
makeStackFunc
(
1
,
1
),
validateStack
:
makeStackFunc
(
1
,
1
),
valid
:
true
,
valid
:
true
,
},
},
CALLDATASIZE
:
{
CALLDATASIZE
:
{
execute
:
opCall
d
ataSize
,
execute
:
opCall
D
ataSize
,
gasCost
:
constGasFunc
(
GasQuickStep
),
gasCost
:
constGasFunc
(
GasQuickStep
),
validateStack
:
makeStackFunc
(
0
,
1
),
validateStack
:
makeStackFunc
(
0
,
1
),
valid
:
true
,
valid
:
true
,
},
},
CALLDATACOPY
:
{
CALLDATACOPY
:
{
execute
:
opCall
d
ataCopy
,
execute
:
opCall
D
ataCopy
,
gasCost
:
gasCall
d
ataCopy
,
gasCost
:
gasCall
D
ataCopy
,
validateStack
:
makeStackFunc
(
3
,
0
),
validateStack
:
makeStackFunc
(
3
,
0
),
memorySize
:
memoryCall
d
ataCopy
,
memorySize
:
memoryCall
D
ataCopy
,
valid
:
true
,
valid
:
true
,
},
},
CODESIZE
:
{
CODESIZE
:
{
...
@@ -876,29 +878,29 @@ func NewFrontierInstructionSet() [256]operation {
...
@@ -876,29 +878,29 @@ func NewFrontierInstructionSet() [256]operation {
writes
:
true
,
writes
:
true
,
},
},
CREATE
:
{
CREATE
:
{
execute
:
opCreate
,
execute
:
opCreate
,
gasCost
:
gasCreate
,
gasCost
:
gasCreate
,
validateStack
:
makeStackFunc
(
3
,
1
),
validateStack
:
makeStackFunc
(
3
,
1
),
memorySize
:
memoryCreate
,
memorySize
:
memoryCreate
,
valid
:
true
,
valid
:
true
,
writes
:
true
,
writes
:
true
,
clearsReturndata
:
true
,
returns
:
true
,
},
},
CALL
:
{
CALL
:
{
execute
:
opCall
,
execute
:
opCall
,
gasCost
:
gasCall
,
gasCost
:
gasCall
,
validateStack
:
makeStackFunc
(
7
,
1
),
validateStack
:
makeStackFunc
(
7
,
1
),
memorySize
:
memoryCall
,
memorySize
:
memoryCall
,
valid
:
true
,
valid
:
true
,
clearsReturndata
:
true
,
returns
:
true
,
},
},
CALLCODE
:
{
CALLCODE
:
{
execute
:
opCallCode
,
execute
:
opCallCode
,
gasCost
:
gasCallCode
,
gasCost
:
gasCallCode
,
validateStack
:
makeStackFunc
(
7
,
1
),
validateStack
:
makeStackFunc
(
7
,
1
),
memorySize
:
memoryCall
,
memorySize
:
memoryCall
,
valid
:
true
,
valid
:
true
,
clearsReturndata
:
true
,
returns
:
true
,
},
},
RETURN
:
{
RETURN
:
{
execute
:
opReturn
,
execute
:
opReturn
,
...
...
core/vm/memory.go
View file @
4e0fea4d
...
@@ -22,7 +22,6 @@ import "fmt"
...
@@ -22,7 +22,6 @@ import "fmt"
type
Memory
struct
{
type
Memory
struct
{
store
[]
byte
store
[]
byte
lastGasCost
uint64
lastGasCost
uint64
lastReturn
[]
byte
}
}
func
NewMemory
()
*
Memory
{
func
NewMemory
()
*
Memory
{
...
...
core/vm/memory_table.go
View file @
4e0fea4d
...
@@ -26,7 +26,7 @@ func memorySha3(stack *Stack) *big.Int {
...
@@ -26,7 +26,7 @@ func memorySha3(stack *Stack) *big.Int {
return
calcMemSize
(
stack
.
Back
(
0
),
stack
.
Back
(
1
))
return
calcMemSize
(
stack
.
Back
(
0
),
stack
.
Back
(
1
))
}
}
func
memoryCall
d
ataCopy
(
stack
*
Stack
)
*
big
.
Int
{
func
memoryCall
D
ataCopy
(
stack
*
Stack
)
*
big
.
Int
{
return
calcMemSize
(
stack
.
Back
(
0
),
stack
.
Back
(
2
))
return
calcMemSize
(
stack
.
Back
(
0
),
stack
.
Back
(
2
))
}
}
...
...
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