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
5867e799
Commit
5867e799
authored
Jun 04, 2019
by
mdj33
Committed by
vipwzw
Jun 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added addr cancel operation
parent
c6625029
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
40 deletions
+81
-40
testcase.sh
plugin/dapp/paracross/cmd/build/testcase.sh
+10
-9
exec_del_local.go
plugin/dapp/paracross/executor/exec_del_local.go
+14
-0
exec_local.go
plugin/dapp/paracross/executor/exec_local.go
+15
-0
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+23
-17
superaccount_test.go
plugin/dapp/paracross/executor/superaccount_test.go
+8
-9
paracross.go
plugin/dapp/paracross/types/paracross.go
+11
-5
No files found.
plugin/dapp/paracross/cmd/build/testcase.sh
View file @
5867e799
...
...
@@ -498,7 +498,7 @@ function para_create_nodegroup() {
##quit fail
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
3
-i
"
$id
"
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
echo
"tx=
$txhash
"
query_tx
"
${
CLI
}
"
"
${
txhash
}
"
query_tx
"
${
PARA_
CLI
}
"
"
${
txhash
}
"
status
=
$(${
CLI
}
para nodegroup_status
-t
user.p.para. | jq
-r
".status"
)
if
[
"
$status
"
!=
2
]
;
then
echo
"status quit not approve status=
$status
"
...
...
@@ -513,7 +513,7 @@ function para_create_nodegroup() {
echo
"=========== # para chain modify node group coin=5 ============="
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
4
-c
5
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
echo
"tx=
$txhash
"
query_tx
"
${
CLI
}
"
"
${
txhash
}
"
query_tx
"
${
PARA_
CLI
}
"
"
${
txhash
}
"
modifyid
=
$(${
PARA_CLI
}
para nodegroup_list
-s
4 | jq
-r
".ids[0].id"
)
if
[
-z
"
$modifyid
"
]
;
then
echo
"query modify error "
...
...
@@ -554,17 +554,18 @@ function para_nodegroup_behalf_quit_test() {
exit
1
fi
hash
=
$(${
PARA_CLI
}
send para node
-o
3
-i
"
$id
"
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
status
=
$(${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"
3
"
]
;
then
echo
"wrong
vote
status"
if
[
"
${
status
}
"
!=
"
2
"
]
;
then
echo
"wrong
1E5
status"
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit
1
fi
hash
=
$(${
PARA_CLI
}
send para node
-o
3
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588
...
...
@@ -651,7 +652,7 @@ function para_nodemanage_node_behalf_join() {
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1Luh4AziYyaC5zP3hUXtXFZS873xAxm6rH
exit
1
fi
hash
=
$(${
PARA_CLI
}
send para node
-o
3
-i
"
$id
"
-k
0xfdf2bbff853ecff2e7b86b2a8b45726c6538ca7d1403dc94e50131ef379bdca0
)
hash
=
$(${
PARA_CLI
}
send para node
-o
4
-i
"
$id
"
-k
0xfdf2bbff853ecff2e7b86b2a8b45726c6538ca7d1403dc94e50131ef379bdca0
)
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
...
...
plugin/dapp/paracross/executor/exec_del_local.go
View file @
5867e799
...
...
@@ -100,6 +100,20 @@ func (e *Paracross) ExecDelLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeGroupStatusTitle
(
g
.
Current
.
Status
,
g
.
Current
.
Title
,
g
.
Current
.
Id
),
Value
:
nil
})
}
if
log
.
Ty
==
pt
.
TyLogParaNodeConfig
{
var
g
pt
.
ReceiptParaNodeConfig
err
:=
types
.
Decode
(
log
.
Log
,
&
g
)
if
err
!=
nil
{
return
nil
,
err
}
if
g
.
Prev
!=
nil
{
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeTitleStatus
(
g
.
Current
.
Title
,
g
.
Prev
.
Status
,
g
.
Prev
.
Id
),
Value
:
types
.
Encode
(
g
.
Prev
)})
}
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeTitleStatus
(
g
.
Current
.
Title
,
g
.
Current
.
Status
,
g
.
Current
.
Id
),
Value
:
nil
})
}
}
return
&
set
,
nil
}
...
...
plugin/dapp/paracross/executor/exec_local.go
View file @
5867e799
...
...
@@ -104,6 +104,21 @@ func (e *Paracross) ExecLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig, t
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeGroupStatusTitle
(
g
.
Current
.
Status
,
g
.
Current
.
Title
,
g
.
Current
.
Id
),
Value
:
types
.
Encode
(
g
.
Current
)})
}
if
log
.
Ty
==
pt
.
TyLogParaNodeConfig
{
var
g
pt
.
ReceiptParaNodeConfig
err
:=
types
.
Decode
(
log
.
Log
,
&
g
)
if
err
!=
nil
{
return
nil
,
err
}
if
g
.
Prev
!=
nil
{
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeTitleStatus
(
g
.
Current
.
Title
,
g
.
Prev
.
Status
,
g
.
Current
.
Id
),
Value
:
nil
})
}
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeTitleStatus
(
g
.
Current
.
Title
,
g
.
Current
.
Status
,
g
.
Current
.
Id
),
Value
:
types
.
Encode
(
g
.
Current
)})
}
}
return
&
set
,
nil
}
...
...
plugin/dapp/paracross/executor/superaccount.go
View file @
5867e799
...
...
@@ -450,9 +450,6 @@ func (a *action) updateNodeAddrStatus(stat *pt.ParaNodeIdStatus) (*types.Receipt
if
!
isNotFound
(
err
)
{
return
nil
,
errors
.
Wrapf
(
err
,
"nodeAddr:%s get error"
,
stat
.
TargetAddr
)
}
if
stat
.
Status
!=
pt
.
ParacrossNodeJoined
{
return
nil
,
errors
.
Wrapf
(
pt
.
ErrParaNodeOpStatusWrong
,
"nodeAddr:%s int get wrong status"
,
stat
.
TargetAddr
,
stat
.
Status
)
}
addrStat
=
&
pt
.
ParaNodeAddrIdStatus
{}
addrStat
.
Title
=
stat
.
Title
addrStat
.
Addr
=
stat
.
TargetAddr
...
...
@@ -463,14 +460,14 @@ func (a *action) updateNodeAddrStatus(stat *pt.ParaNodeIdStatus) (*types.Receipt
}
preStat
:=
*
addrStat
if
stat
.
Status
==
pt
.
ParacrossNodeJoin
ed
{
if
stat
.
Status
==
pt
.
ParacrossNodeJoin
ing
{
addrStat
.
Status
=
pt
.
ParacrossNodeJoined
addrStat
.
ProposalId
=
stat
.
Id
addrStat
.
QuitId
=
""
return
makeParaNodeStatusReceipt
(
a
.
fromaddr
,
&
preStat
,
addrStat
),
nil
}
if
stat
.
Status
==
pt
.
ParacrossNodeQuit
ed
{
if
stat
.
Status
==
pt
.
ParacrossNodeQuit
ing
{
proposalStat
,
err
:=
getNodeID
(
a
.
db
,
addrStat
.
ProposalId
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"nodeAddr:%s quiting wrong proposeid:%s"
,
stat
.
TargetAddr
,
addrStat
.
ProposalId
)
...
...
@@ -559,7 +556,7 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
if
vote
==
pt
.
ParaNodeVoteNo
{
if
stat
.
Status
==
pt
.
ParacrossNodeJoining
{
stat
.
Status
=
pt
.
ParacrossNodeC
ancel
ed
stat
.
Status
=
pt
.
ParacrossNodeC
los
ed
stat
.
Height
=
a
.
height
//active coins
if
!
types
.
IsPara
()
{
...
...
@@ -570,7 +567,7 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
receipt
=
mergeReceipt
(
receipt
,
r
)
}
}
else
if
stat
.
Status
==
pt
.
ParacrossNodeQuiting
{
stat
.
Status
=
pt
.
ParacrossNodeC
ancel
ed
stat
.
Status
=
pt
.
ParacrossNodeC
los
ed
stat
.
Height
=
a
.
height
}
...
...
@@ -580,8 +577,6 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
if
err
!=
nil
{
return
nil
,
err
}
stat
.
Status
=
pt
.
ParacrossNodeJoined
stat
.
Height
=
a
.
height
receipt
=
mergeReceipt
(
receipt
,
r
)
r
,
err
=
a
.
updateNodeAddrStatus
(
stat
)
...
...
@@ -589,13 +584,14 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
return
nil
,
err
}
receipt
=
mergeReceipt
(
receipt
,
r
)
stat
.
Status
=
pt
.
ParacrossNodeClosed
stat
.
Height
=
a
.
height
}
else
if
stat
.
Status
==
pt
.
ParacrossNodeQuiting
{
r
,
err
:=
unpdateNodeGroup
(
a
.
db
,
config
.
Title
,
stat
.
TargetAddr
,
false
)
if
err
!=
nil
{
return
nil
,
err
}
stat
.
Status
=
pt
.
ParacrossNodeQuited
stat
.
Height
=
a
.
height
receipt
=
mergeReceipt
(
receipt
,
r
)
r
,
err
=
a
.
updateNodeAddrStatus
(
stat
)
...
...
@@ -604,6 +600,8 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
}
receipt
=
mergeReceipt
(
receipt
,
r
)
stat
.
Status
=
pt
.
ParacrossNodeClosed
stat
.
Height
=
a
.
height
}
}
r
:=
makeNodeConfigReceipt
(
a
.
fromaddr
,
config
,
&
copyStat
,
stat
)
...
...
@@ -887,7 +885,10 @@ func (a *action) nodeGroupApproveApply(config *pt.ParaNodeGroupConfig, apply *pt
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
//create the node group
r
:=
a
.
nodeGroupCreate
(
apply
)
r
,
err
:=
a
.
nodeGroupCreate
(
apply
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"nodegroup create:title:%s,addrs:%s"
,
config
.
Title
,
apply
.
TargetAddrs
)
}
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
...
...
@@ -935,7 +936,7 @@ func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receip
}
func
(
a
*
action
)
nodeGroupCreate
(
status
*
pt
.
ParaNodeGroupStatus
)
*
types
.
Receipt
{
func
(
a
*
action
)
nodeGroupCreate
(
status
*
pt
.
ParaNodeGroupStatus
)
(
*
types
.
Receipt
,
error
)
{
nodes
:=
strings
.
Split
(
status
.
TargetAddrs
,
","
)
var
item
types
.
ConfigItem
...
...
@@ -953,7 +954,7 @@ func (a *action) nodeGroupCreate(status *pt.ParaNodeGroupStatus) *types.Receipt
for
i
,
addr
:=
range
nodes
{
stat
:=
&
pt
.
ParaNodeIdStatus
{
Id
:
status
.
Id
+
"-"
+
strconv
.
Itoa
(
i
),
Status
:
pt
.
ParacrossNode
Join
ed
,
Status
:
pt
.
ParacrossNode
Clos
ed
,
Title
:
status
.
Title
,
TargetAddr
:
addr
,
Votes
:
&
pt
.
ParaNodeVoteDetail
{
Addrs
:
[]
string
{
a
.
fromaddr
},
Votes
:
[]
string
{
"yes"
}},
...
...
@@ -962,10 +963,15 @@ func (a *action) nodeGroupCreate(status *pt.ParaNodeGroupStatus) *types.Receipt
Height
:
a
.
height
}
r
:=
makeNodeConfigReceipt
(
a
.
fromaddr
,
nil
,
nil
,
stat
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
receipt
=
mergeReceipt
(
receipt
,
r
)
r
,
err
:=
a
.
updateNodeAddrStatus
(
stat
)
if
err
!=
nil
{
return
nil
,
err
}
receipt
=
mergeReceipt
(
receipt
,
r
)
}
return
receipt
return
receipt
,
nil
}
//NodeGroupConfig support super node group config
...
...
plugin/dapp/paracross/executor/superaccount_test.go
View file @
5867e799
...
...
@@ -120,23 +120,18 @@ func checkGroupApplyReceipt(suite *NodeManageTestSuite, receipt *types.Receipt)
func
checkGroupApproveReceipt
(
suite
*
NodeManageTestSuite
,
receipt
*
types
.
Receipt
)
{
assert
.
Equal
(
suite
.
T
(),
receipt
.
Ty
,
int32
(
types
.
ExecOk
))
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
11
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
7
)
len
:=
len
(
receipt
.
KV
)
var
stat
pt
.
ParaNodeIdStatus
err
:=
types
.
Decode
(
receipt
.
KV
[
len
-
1
]
.
Value
,
&
stat
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
//suite.T().Log("ty len-1", receipt.Logs[lenLogs-1].Ty,"len",lenLogs)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
TyLogParaNodeGroupStatusUpdate
),
receipt
.
Logs
[
7
-
1
]
.
Ty
)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
ParacrossNodeGroupApprove
),
stat
.
Status
)
}
func
checkJoinReceipt
(
suite
*
NodeManageTestSuite
,
receipt
*
types
.
Receipt
)
{
assert
.
Equal
(
suite
.
T
(),
receipt
.
Ty
,
int32
(
types
.
ExecOk
))
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
2
)
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
var
stat
pt
.
ParaNodeIdStatus
...
...
@@ -151,7 +146,7 @@ func checkJoinReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) {
func
checkQuitReceipt
(
suite
*
NodeManageTestSuite
,
receipt
*
types
.
Receipt
)
{
assert
.
Equal
(
suite
.
T
(),
receipt
.
Ty
,
int32
(
types
.
ExecOk
))
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
2
)
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
var
stat
pt
.
ParaNodeIdStatus
...
...
@@ -299,13 +294,17 @@ func (suite *NodeManageTestSuite) testNodeConfig() {
//Quit test
config
=
&
pt
.
ParaNodeAddrConfig
{
Op
:
pt
.
ParaNodeQuit
,
Id
:
g
.
Current
.
Id
,
Addr
:
Account14K
,
}
tx
,
err
=
pt
.
CreateRawNodeConfigTx
(
config
)
suite
.
Nil
(
err
)
receipt
=
nodeCommit
(
suite
,
PrivKeyD
,
tx
)
checkQuitReceipt
(
suite
,
receipt
)
suite
.
Equal
(
int32
(
pt
.
TyLogParaNodeConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
err
=
types
.
Decode
(
receipt
.
Logs
[
0
]
.
Log
,
&
g
)
suite
.
Nil
(
err
)
//vote test
voteTest
(
suite
,
g
.
Current
.
Id
,
false
)
}
...
...
plugin/dapp/paracross/types/paracross.go
View file @
5867e799
...
...
@@ -108,14 +108,20 @@ const (
var
ParaNodeVoteStr
=
[]
string
{
"invalid"
,
"yes"
,
"no"
}
const
(
// ParacrossNodeJoining apply for adding group
ParacrossNodeJoining
=
iota
+
1
// ParacrossNodeJoined pass to add by votes
ParacrossNodeJoined
// ParacrossNodeQuiting apply for quiting
ParacrossNodeQuiting
ParacrossNodeJoined
=
iota
+
10
// ParacrossNodeQuited pass to quite by votes
ParacrossNodeQuited
)
//voting status
const
(
// ParacrossNodeIDJoining apply for join group
ParacrossNodeJoining
=
iota
// ParacrossNodeIDQuiting apply for quiting group
ParacrossNodeQuiting
// ParacrossNodeIDClosed id voting closed
ParacrossNodeClosed
// ParacrossNodeCanceled to cancel apply of joining or quiting
ParacrossNodeCanceled
)
...
...
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