Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
link33
plugin
Commits
71f4916a
Commit
71f4916a
authored
Nov 20, 2018
by
Litian
Committed by
33cn
Nov 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ineffassign
parent
f1e49e77
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
16 deletions
+11
-16
exec.go
plugin/dapp/evm/executor/exec.go
+4
-4
query.go
plugin/dapp/evm/executor/query.go
+2
-2
evm.go
plugin/dapp/evm/executor/vm/runtime/evm.go
+5
-10
No files found.
plugin/dapp/evm/executor/exec.go
View file @
71f4916a
...
...
@@ -34,12 +34,12 @@ func (evm *EVMExecutor) Exec(tx *types.Transaction, index int) (*types.Receipt,
env
:=
runtime
.
NewEVM
(
context
,
evm
.
mStateDB
,
*
evm
.
vmCfg
)
isCreate
:=
strings
.
Compare
(
msg
.
To
()
.
String
(),
EvmAddress
)
==
0
var
(
ret
=
[]
byte
(
""
)
ret
[]
byte
vmerr
error
leftOverGas
=
uint64
(
0
)
leftOverGas
uint64
contractAddr
common
.
Address
snapshot
=
-
1
execName
=
""
snapshot
int
execName
string
)
// 为了方便计费,即使合约为新生成,也将地址的初始化放到外面操作
...
...
plugin/dapp/evm/executor/query.go
View file @
71f4916a
...
...
@@ -80,9 +80,9 @@ func (evm *EVMExecutor) Query_EstimateGas(in *evmtypes.EstimateEVMGasReq) (types
var
(
vmerr
error
leftOverGas
=
uint64
(
0
)
leftOverGas
uint64
contractAddr
common
.
Address
execName
=
"estimateGas"
execName
string
)
if
isCreate
{
...
...
plugin/dapp/evm/executor/vm/runtime/evm.go
View file @
71f4916a
...
...
@@ -169,8 +169,7 @@ func (evm *EVM) preCheck(caller ContractRef, recipient common.Address, value uin
// 根据合约地址调用已经存在的合约,input为合约调用参数
// 合约调用逻辑支持在合约调用的同时进行向合约转账的操作
func
(
evm
*
EVM
)
Call
(
caller
ContractRef
,
addr
common
.
Address
,
input
[]
byte
,
gas
uint64
,
value
uint64
)
(
ret
[]
byte
,
snapshot
int
,
leftOverGas
uint64
,
err
error
)
{
pass
:=
false
pass
,
err
=
evm
.
preCheck
(
caller
,
addr
,
value
)
pass
,
err
:=
evm
.
preCheck
(
caller
,
addr
,
value
)
if
!
pass
{
return
nil
,
-
1
,
gas
,
err
}
...
...
@@ -243,8 +242,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
// 执行逻辑同Call方法,但是有以下几点不同:
// 在创建合约对象时,合约对象的上下文地址(合约对象的self属性)被设置为caller的地址
func
(
evm
*
EVM
)
CallCode
(
caller
ContractRef
,
addr
common
.
Address
,
input
[]
byte
,
gas
uint64
,
value
uint64
)
(
ret
[]
byte
,
leftOverGas
uint64
,
err
error
)
{
pass
:=
false
pass
,
err
=
evm
.
preCheck
(
caller
,
addr
,
value
)
pass
,
err
:=
evm
.
preCheck
(
caller
,
addr
,
value
)
if
!
pass
{
return
nil
,
gas
,
err
}
...
...
@@ -278,8 +276,7 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
// 不支持向合约转账
// 和CallCode不同的是,它会把合约的外部调用地址设置成caller的caller
func
(
evm
*
EVM
)
DelegateCall
(
caller
ContractRef
,
addr
common
.
Address
,
input
[]
byte
,
gas
uint64
)
(
ret
[]
byte
,
leftOverGas
uint64
,
err
error
)
{
pass
:=
false
pass
,
err
=
evm
.
preCheck
(
caller
,
addr
,
0
)
pass
,
err
:=
evm
.
preCheck
(
caller
,
addr
,
0
)
if
!
pass
{
return
nil
,
gas
,
err
}
...
...
@@ -314,8 +311,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
// 不支持向合约转账
// 在合约逻辑中,可以指定其它的合约地址以及输入参数进行合约调用,但是,这种情况下禁止修改MemoryStateDB中的任何数据,否则执行会出错
func
(
evm
*
EVM
)
StaticCall
(
caller
ContractRef
,
addr
common
.
Address
,
input
[]
byte
,
gas
uint64
)
(
ret
[]
byte
,
leftOverGas
uint64
,
err
error
)
{
pass
:=
false
pass
,
err
=
evm
.
preCheck
(
caller
,
addr
,
0
)
pass
,
err
:=
evm
.
preCheck
(
caller
,
addr
,
0
)
if
!
pass
{
return
nil
,
gas
,
err
}
...
...
@@ -361,8 +357,7 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
// 目前chain33为了保证账户安全,不允许合约中涉及到外部账户的转账操作,
// 所以,本步骤不接收转账金额参数
func
(
evm
*
EVM
)
Create
(
caller
ContractRef
,
contractAddr
common
.
Address
,
code
[]
byte
,
gas
uint64
,
execName
,
alias
string
)
(
ret
[]
byte
,
snapshot
int
,
leftOverGas
uint64
,
err
error
)
{
pass
:=
false
pass
,
err
=
evm
.
preCheck
(
caller
,
contractAddr
,
0
)
pass
,
err
:=
evm
.
preCheck
(
caller
,
contractAddr
,
0
)
if
!
pass
{
return
nil
,
-
1
,
gas
,
err
}
...
...
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