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
8dcb142c
Commit
8dcb142c
authored
Jan 30, 2019
by
kingwang
Committed by
33cn
Jan 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixbug: errenvapi
parent
fc9eec0c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
js.go
plugin/dapp/js/executor/js.go
+5
-2
No files found.
plugin/dapp/js/executor/js.go
View file @
8dcb142c
...
@@ -6,7 +6,6 @@ import (
...
@@ -6,7 +6,6 @@ import (
"sync"
"sync"
"sync/atomic"
"sync/atomic"
"github.com/33cn/chain33/client/api"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common"
drivers
"github.com/33cn/chain33/system/dapp"
drivers
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
...
@@ -14,6 +13,8 @@ import (
...
@@ -14,6 +13,8 @@ import (
"github.com/33cn/plugin/plugin/dapp/js/types/jsproto"
"github.com/33cn/plugin/plugin/dapp/js/types/jsproto"
lru
"github.com/hashicorp/golang-lru"
lru
"github.com/hashicorp/golang-lru"
"github.com/robertkrimen/otto"
"github.com/robertkrimen/otto"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
)
var
driverName
=
ptypes
.
JsX
var
driverName
=
ptypes
.
JsX
...
@@ -115,8 +116,10 @@ func (u *js) callVM(prefix string, payload *jsproto.Call, tx *types.Transaction,
...
@@ -115,8 +116,10 @@ func (u *js) callVM(prefix string, payload *jsproto.Call, tx *types.Transaction,
vm
.
Set
(
"args"
,
payload
.
Args
)
vm
.
Set
(
"args"
,
payload
.
Args
)
callfunc
:=
"callcode(context, f, args, loglist)"
callfunc
:=
"callcode(context, f, args, loglist)"
jsvalue
,
err
:=
vm
.
Run
(
callfunc
)
jsvalue
,
err
:=
vm
.
Run
(
callfunc
)
//除非你知道怎么做,不要返回这样的操作,这会引起整个区块执行失败,从而引起严重的安全问题。
//要保证不能人工的创造这样的条件,也就是调用接口的输入,不能用户可以任意修改的。
if
u
.
GetExecutorAPI
()
.
IsErr
()
{
if
u
.
GetExecutorAPI
()
.
IsErr
()
{
return
nil
,
api
.
ErrAPIEnv
return
nil
,
status
.
New
(
codes
.
Aborted
,
"jsvm operation is abort"
)
.
Err
()
}
}
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
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