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
83a7a649
Commit
83a7a649
authored
Jan 14, 2020
by
mdj33
Committed by
vipwzw
Feb 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add game para chain
parent
40bb46f6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
38 deletions
+78
-38
docker-compose-paracross.yml
plugin/dapp/paracross/cmd/build/docker-compose-paracross.yml
+5
-0
testcase.sh
plugin/dapp/paracross/cmd/build/testcase.sh
+0
-0
action.go
plugin/dapp/paracross/executor/action.go
+41
-7
asset.go
plugin/dapp/paracross/executor/asset.go
+30
-29
exec.go
plugin/dapp/paracross/executor/exec.go
+1
-1
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+1
-1
No files found.
plugin/dapp/paracross/cmd/build/docker-compose-paracross.yml
View file @
83a7a649
...
@@ -25,12 +25,17 @@ services:
...
@@ -25,12 +25,17 @@ services:
expose
:
expose
:
-
"
8802"
-
"
8802"
chain29
:
entrypoint
:
/root/entrypoint.sh
environment
:
PARAFILE
:
"
/root/chain33.para29.toml"
nginx
:
nginx
:
image
:
nginx:latest
image
:
nginx:latest
depends_on
:
depends_on
:
-
chain33
-
chain33
-
chain30
-
chain30
-
chain29
volumes
:
volumes
:
-
./nginx.conf:/etc/nginx/nginx.conf
-
./nginx.conf:/etc/nginx/nginx.conf
expose
:
expose
:
...
...
plugin/dapp/paracross/cmd/build/testcase.sh
View file @
83a7a649
This diff is collapsed.
Click to expand it.
plugin/dapp/paracross/executor/action.go
View file @
83a7a649
...
@@ -1009,10 +1009,18 @@ func (a *action) execCrossTxs(status *pt.ParacrossNodeStatus) (*types.Receipt, e
...
@@ -1009,10 +1009,18 @@ func (a *action) execCrossTxs(status *pt.ParacrossNodeStatus) (*types.Receipt, e
func
(
a
*
action
)
AssetTransfer
(
transfer
*
types
.
AssetsTransfer
)
(
*
types
.
Receipt
,
error
)
{
func
(
a
*
action
)
AssetTransfer
(
transfer
*
types
.
AssetsTransfer
)
(
*
types
.
Receipt
,
error
)
{
clog
.
Debug
(
"Paracross.Exec"
,
"AssetTransfer"
,
transfer
.
Cointoken
,
"transfer"
,
""
)
clog
.
Debug
(
"Paracross.Exec"
,
"AssetTransfer"
,
transfer
.
Cointoken
,
"transfer"
,
""
)
//rbk fork后 如果没有nodegroup conf,也不允许跨链
if
a
.
api
.
GetConfig
()
.
IsDappFork
(
a
.
height
,
pt
.
ParaX
,
pt
.
ForkParaAssetTransferRbk
)
{
err
:=
a
.
isAllowTransfer
()
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"AssetTransfer not allow"
)
}
}
receipt
,
err
:=
a
.
assetTransfer
(
transfer
)
receipt
,
err
:=
a
.
assetTransfer
(
transfer
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Error
(
"AssetTransfer failed"
,
"err"
,
err
)
return
nil
,
errors
.
Wrap
(
err
,
"AssetTransfer failed"
)
return
nil
,
errors
.
Cause
(
err
)
}
}
return
receipt
,
nil
return
receipt
,
nil
}
}
...
@@ -1026,6 +1034,14 @@ func (a *action) AssetWithdraw(withdraw *types.AssetsWithdraw) (*types.Receipt,
...
@@ -1026,6 +1034,14 @@ func (a *action) AssetWithdraw(withdraw *types.AssetsWithdraw) (*types.Receipt,
}
}
}
}
//rbk fork后 如果没有nodegroup conf,也不允许跨链
if
cfg
.
IsDappFork
(
a
.
height
,
pt
.
ParaX
,
pt
.
ForkParaAssetTransferRbk
)
{
err
:=
a
.
isAllowTransfer
()
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"AssetTransfer not allow"
)
}
}
isPara
:=
cfg
.
IsPara
()
isPara
:=
cfg
.
IsPara
()
if
!
isPara
{
if
!
isPara
{
// 需要平行链先执行, 达成共识时,继续执行
// 需要平行链先执行, 达成共识时,继续执行
...
@@ -1035,8 +1051,7 @@ func (a *action) AssetWithdraw(withdraw *types.AssetsWithdraw) (*types.Receipt,
...
@@ -1035,8 +1051,7 @@ func (a *action) AssetWithdraw(withdraw *types.AssetsWithdraw) (*types.Receipt,
"txHash"
,
common
.
ToHex
(
a
.
tx
.
Hash
()),
"token name"
,
withdraw
.
Cointoken
)
"txHash"
,
common
.
ToHex
(
a
.
tx
.
Hash
()),
"token name"
,
withdraw
.
Cointoken
)
receipt
,
err
:=
a
.
assetWithdraw
(
withdraw
,
a
.
tx
)
receipt
,
err
:=
a
.
assetWithdraw
(
withdraw
,
a
.
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Error
(
"AssetWithdraw failed"
,
"err"
,
err
)
return
nil
,
errors
.
Wrap
(
err
,
"AssetWithdraw failed"
)
return
nil
,
errors
.
Cause
(
err
)
}
}
return
receipt
,
nil
return
receipt
,
nil
}
}
...
@@ -1046,9 +1061,14 @@ func (a *action) CrossAssetTransfer(transfer *pt.CrossAssetTransfer) (*types.Rec
...
@@ -1046,9 +1061,14 @@ func (a *action) CrossAssetTransfer(transfer *pt.CrossAssetTransfer) (*types.Rec
cfg
:=
a
.
api
.
GetConfig
()
cfg
:=
a
.
api
.
GetConfig
()
isPara
:=
cfg
.
IsPara
()
isPara
:=
cfg
.
IsPara
()
err
:=
a
.
isAllowTransfer
()
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"CrossAssetTransfer not Allow"
)
}
act
,
err
:=
getCrossAction
(
transfer
,
string
(
a
.
tx
.
Execer
))
act
,
err
:=
getCrossAction
(
transfer
,
string
(
a
.
tx
.
Execer
))
if
act
==
pt
.
ParacrossNoneTransfer
{
if
act
==
pt
.
ParacrossNoneTransfer
{
return
nil
,
err
return
nil
,
err
ors
.
Wrap
(
err
,
"CrossAssetTransfer non action"
)
}
}
// 需要平行链先执行, 达成共识时,继续执行
// 需要平行链先执行, 达成共识时,继续执行
if
!
isPara
&&
(
act
==
pt
.
ParacrossMainWithdraw
||
act
==
pt
.
ParacrossParaTransfer
)
{
if
!
isPara
&&
(
act
==
pt
.
ParacrossMainWithdraw
||
act
==
pt
.
ParacrossParaTransfer
)
{
...
@@ -1056,8 +1076,7 @@ func (a *action) CrossAssetTransfer(transfer *pt.CrossAssetTransfer) (*types.Rec
...
@@ -1056,8 +1076,7 @@ func (a *action) CrossAssetTransfer(transfer *pt.CrossAssetTransfer) (*types.Rec
}
}
receipt
,
err
:=
a
.
crossAssetTransfer
(
transfer
,
act
,
a
.
tx
)
receipt
,
err
:=
a
.
crossAssetTransfer
(
transfer
,
act
,
a
.
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Error
(
"CrossAssetTransfer failed"
,
"err"
,
err
)
return
nil
,
errors
.
Wrap
(
err
,
"CrossAssetTransfer failed"
)
return
nil
,
err
}
}
return
receipt
,
nil
return
receipt
,
nil
}
}
...
@@ -1129,6 +1148,21 @@ func getTitleFrom(exec []byte) ([]byte, error) {
...
@@ -1129,6 +1148,21 @@ func getTitleFrom(exec []byte) ([]byte, error) {
return
exec
[
:
last
+
1
],
nil
return
exec
[
:
last
+
1
],
nil
}
}
func
(
a
*
action
)
isAllowTransfer
()
error
{
tit
,
err
:=
getTitleFrom
(
a
.
tx
.
Execer
)
if
err
!=
nil
{
return
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"CrossAssetTransfer, not para chain exec=%s"
,
string
(
a
.
tx
.
Execer
))
}
nodes
,
err
:=
a
.
getNodesGroup
(
string
(
tit
))
if
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"CrossAssetTransfer get nodegroup err,title=%s"
,
tit
)
}
if
len
(
nodes
)
==
0
{
return
errors
.
Wrapf
(
err
,
"CrossAssetTransfer nodegroup not create,title=%s"
,
tit
)
}
return
nil
}
/*
/*
func (a *Paracross) CrossLimits(tx *types.Transaction, index int) bool {
func (a *Paracross) CrossLimits(tx *types.Transaction, index int) bool {
if tx.GroupCount < 2 {
if tx.GroupCount < 2 {
...
...
plugin/dapp/paracross/executor/asset.go
View file @
83a7a649
This diff is collapsed.
Click to expand it.
plugin/dapp/paracross/executor/exec.go
View file @
83a7a649
...
@@ -67,7 +67,7 @@ func (e *Paracross) Exec_CrossAssetTransfer(payload *pt.CrossAssetTransfer, tx *
...
@@ -67,7 +67,7 @@ func (e *Paracross) Exec_CrossAssetTransfer(payload *pt.CrossAssetTransfer, tx *
receipt
,
err
:=
a
.
CrossAssetTransfer
(
payload
)
receipt
,
err
:=
a
.
CrossAssetTransfer
(
payload
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Error
(
"Paracross CrossAssetTransfer failed"
,
"error"
,
err
,
"hash"
,
hex
.
EncodeToString
(
tx
.
Hash
()))
clog
.
Error
(
"Paracross CrossAssetTransfer failed"
,
"error"
,
err
,
"hash"
,
hex
.
EncodeToString
(
tx
.
Hash
()))
return
nil
,
err
ors
.
Cause
(
err
)
return
nil
,
err
}
}
return
receipt
,
nil
return
receipt
,
nil
}
}
...
...
plugin/dapp/paracross/executor/superaccount.go
View file @
83a7a649
...
@@ -701,7 +701,7 @@ func (a *action) nodeGroupCoinsFrozen(createAddr string, configCoinsFrozen int64
...
@@ -701,7 +701,7 @@ func (a *action) nodeGroupCoinsFrozen(createAddr string, configCoinsFrozen int64
conf
:=
types
.
ConfSub
(
cfg
,
pt
.
ParaX
)
conf
:=
types
.
ConfSub
(
cfg
,
pt
.
ParaX
)
confCoins
:=
conf
.
GInt
(
"nodeGroupFrozenCoins"
)
confCoins
:=
conf
.
GInt
(
"nodeGroupFrozenCoins"
)
if
configCoinsFrozen
<
confCoins
{
if
configCoinsFrozen
<
confCoins
{
return
nil
,
pt
.
ErrParaNodeGroupFrozenCoinsNotEnough
return
nil
,
errors
.
Wrapf
(
pt
.
ErrParaNodeGroupFrozenCoinsNotEnough
,
"nodeGroupCoinsFrozen apply=%d,conf=%d"
,
configCoinsFrozen
,
confCoins
)
}
}
if
configCoinsFrozen
==
0
{
if
configCoinsFrozen
==
0
{
clog
.
Info
(
"node group apply configCoinsFrozen is 0"
)
clog
.
Info
(
"node group apply configCoinsFrozen is 0"
)
...
...
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