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
363fb6f3
Commit
363fb6f3
authored
Jun 05, 2019
by
mdj33
Committed by
vipwzw
Jun 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ci
parent
5867e799
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
258 additions
and
153 deletions
+258
-153
testcase.sh
plugin/dapp/paracross/cmd/build/testcase.sh
+187
-123
paracross.go
plugin/dapp/paracross/commands/paracross.go
+38
-5
query.go
plugin/dapp/paracross/executor/query.go
+2
-6
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+10
-2
superaccount_test.go
plugin/dapp/paracross/executor/superaccount_test.go
+1
-1
rpc.go
plugin/dapp/paracross/rpc/rpc.go
+19
-15
paracross.go
plugin/dapp/paracross/types/paracross.go
+1
-1
No files found.
plugin/dapp/paracross/cmd/build/testcase.sh
View file @
363fb6f3
...
@@ -498,7 +498,7 @@ function para_create_nodegroup() {
...
@@ -498,7 +498,7 @@ function para_create_nodegroup() {
##quit fail
##quit fail
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
3
-i
"
$id
"
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
3
-i
"
$id
"
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
echo
"tx=
$txhash
"
echo
"tx=
$txhash
"
query_tx
"
${
PARA_
CLI
}
"
"
${
txhash
}
"
query_tx
"
${
CLI
}
"
"
${
txhash
}
"
status
=
$(${
CLI
}
para nodegroup_status
-t
user.p.para. | jq
-r
".status"
)
status
=
$(${
CLI
}
para nodegroup_status
-t
user.p.para. | jq
-r
".status"
)
if
[
"
$status
"
!=
2
]
;
then
if
[
"
$status
"
!=
2
]
;
then
echo
"status quit not approve status=
$status
"
echo
"status quit not approve status=
$status
"
...
@@ -518,12 +518,6 @@ function para_create_nodegroup() {
...
@@ -518,12 +518,6 @@ function para_create_nodegroup() {
if
[
-z
"
$modifyid
"
]
;
then
if
[
-z
"
$modifyid
"
]
;
then
echo
"query modify error "
echo
"query modify error "
${
PARA_CLI
}
para nodegroup_list
-s
4
${
PARA_CLI
}
para nodegroup_list
-s
4
modifyid
=
$(${
PARA_CLI
}
tx query
-s
"
${
txhash
}
"
| jq
-r
".receipt.logs[0].log.current.id"
)
if
[
-z
"
$modifyid
"
]
;
then
${
PARA_CLI
}
tx query
-s
"
${
txhash
}
"
echo
"group id not getted"
exit
1
fi
fi
fi
##approve
##approve
...
@@ -545,19 +539,14 @@ function para_create_nodegroup() {
...
@@ -545,19 +539,14 @@ function para_create_nodegroup() {
fi
fi
}
}
function
para_nodegroup_behalf_quit_test
()
{
function
para_nodegroup_behalf_quit_test
()
{
echo
"=========== # para chain behalf node quit ============="
echo
"=========== # para chain behalf node quit ============="
id
=
$(${
PARA_CLI
}
para node_status
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-t
user.p.para. | jq
-r
".id"
)
status
=
$(${
PARA_CLI
}
para node_addr_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq
-r
".status"
)
if
[
-z
"
${
id
}
"
]
;
then
if
[
"
${
status
}
"
!=
"10"
]
;
then
echo
"wrong id "
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit
1
fi
status
=
$(${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"2"
]
;
then
echo
"wrong 1E5 status"
echo
"wrong 1E5 status"
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
${
PARA_CLI
}
para node_
addr_
status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit
1
exit
1
fi
fi
...
@@ -565,6 +554,12 @@ function para_nodegroup_behalf_quit_test() {
...
@@ -565,6 +554,12 @@ function para_nodegroup_behalf_quit_test() {
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
id
=
$(${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
| jq
-r
".receipt.logs[0].log.current.id"
)
if
[
-z
"
${
id
}
"
]
;
then
echo
"wrong id "
${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
exit
1
fi
${
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
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
0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
...
@@ -573,10 +568,10 @@ function para_nodegroup_behalf_quit_test() {
...
@@ -573,10 +568,10 @@ function para_nodegroup_behalf_quit_test() {
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
status
=
$(${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq
-r
".status"
)
status
=
$(${
PARA_CLI
}
para node_
addr_
status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"
4
"
]
;
then
if
[
"
${
status
}
"
!=
"
11
"
]
;
then
echo
"wrong vote status"
echo
"wrong vote status"
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
${
PARA_CLI
}
para node_
addr_
status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit
1
exit
1
fi
fi
...
@@ -595,7 +590,9 @@ function para_nodegroup_behalf_quit_test() {
...
@@ -595,7 +590,9 @@ function para_nodegroup_behalf_quit_test() {
}
}
function
para_nodemanage_node_join
()
{
function
para_nodemanage_cancel_test
()
{
echo
"================# para node manage test ================="
echo
"================# para node manage test ================="
balance
=
$(${
CLI
}
account balance
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-e
paracross | jq
-r
".balance"
)
balance
=
$(${
CLI
}
account balance
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-e
paracross | jq
-r
".balance"
)
if
[
"
$balance
"
!=
"
$PARA_COIN_FROZEN
"
]
;
then
if
[
"
$balance
"
!=
"
$PARA_COIN_FROZEN
"
]
;
then
...
@@ -614,174 +611,192 @@ function para_nodemanage_node_join() {
...
@@ -614,174 +611,192 @@ function para_nodemanage_node_join() {
exit
1
exit
1
fi
fi
}
echo
"=========== # para chain node quit ============="
id
=
$(${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
| jq
-r
".receipt.logs[0].log.current.id"
)
function
para_nodemanage_node_behalf_join
()
{
if
[
-z
"
$id
"
]
;
then
echo
"=========== # para chain new node join 1 ============="
echo
"id not found"
hash
=
$(${
PARA_CLI
}
send para node
-o
1
-c
8
-a
1Luh4AziYyaC5zP3hUXtXFZS873xAxm6rH
-k
0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5
)
${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
exit
1
fi
hash
=
$(${
PARA_CLI
}
send para node
-o
4
-i
"
$id
"
-k
0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588
)
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
balance
=
$(${
CLI
}
account balance
-a
1
Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj
-e
paracross | jq
-r
".frozen"
)
balance
=
$(${
CLI
}
account balance
-a
1
E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-e
paracross | jq
-r
".frozen"
)
if
[
"
$balance
"
!=
"32.0000
"
]
;
then
if
[
"
$balance
"
==
"
$PARA_COIN_FROZEN
"
]
;
then
echo
"
1Ka
frozen coinfrozen error balance=
$balance
"
echo
"
un
frozen coinfrozen error balance=
$balance
"
exit
1
exit
1
fi
fi
balance
=
$(${
CLI
}
account balance
-a
1Luh4AziYyaC5zP3hUXtXFZS873xAxm6rH
-e
paracross | jq
-r
".frozen"
)
}
if
[
"
$balance
"
==
"
$PARA_COIN_FROZEN
"
]
;
then
echo
"1LU frozen coinfrozen error balance=
$balance
"
function
para_nodemanage_test
()
{
echo
"================# para node manage test ================="
balance
=
$(${
CLI
}
account balance
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-e
paracross | jq
-r
".balance"
)
if
[
"
$balance
"
!=
"
$PARA_COIN_FROZEN
"
]
;
then
echo
"balance coinfrozen error balance=
$balance
"
exit
1
exit
1
fi
fi
echo
"=========== # para chain new node join
2
============="
echo
"=========== # para chain new node join
reject
============="
hash
=
$(${
PARA_CLI
}
send para node
-o
1
-c
9
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB
-k
0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5
)
hash
=
$(${
PARA_CLI
}
send para node
-o
1
-c
5
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-k
0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588
)
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
balance
=
$(${
CLI
}
account balance
-a
1
Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj
-e
paracross | jq
-r
".frozen"
)
balance
=
$(${
CLI
}
account balance
-a
1
E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-e
paracross | jq
-r
".frozen"
)
if
[
"
$balance
"
!=
"
41.0000
"
]
;
then
if
[
"
$balance
"
!=
"
$PARA_COIN_FROZEN
"
]
;
then
echo
"frozen coinfrozen error balance=
$balance
"
echo
"frozen coinfrozen error balance=
$balance
"
exit
1
exit
1
fi
fi
echo
"=========== # para chain node 1 quit ============="
id
=
$(${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
| jq
-r
".receipt.logs[0].log.current.id"
)
id
=
$(${
PARA_CLI
}
para node_status
-a
1Luh4AziYyaC5zP3hUXtXFZS873xAxm6rH
-t
user.p.para. | jq
-r
".id"
)
if
[
-z
"
$id
"
]
;
then
if
[
-z
"
${
id
}
"
]
;
then
echo
"id not found"
echo
"wrong id "
${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1Luh4AziYyaC5zP3hUXtXFZS873xAxm6rH
exit
1
exit
1
fi
fi
hash
=
$(${
PARA_CLI
}
send para node
-o
4
-i
"
$id
"
-k
0xfdf2bbff853ecff2e7b86b2a8b45726c6538ca7d1403dc94e50131ef379bdca0
)
echo
"=========== # para chain node vote ============="
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
2
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
2
-k
0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
hash
=
$(${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
2
-k
0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115
)
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
balance
=
$(${
CLI
}
account balance
-a
1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj
-e
paracross | jq
-r
".frozen"
)
status
=
$(${
PARA_CLI
}
para node_addr_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq
-r
".status"
)
if
[
"
$balance
"
!=
"33.0000"
]
;
then
if
[
"
${
status
}
"
==
"10"
]
;
then
echo
"unfrozen coinfrozen error balance=
$balance
"
echo
"wrong vote status"
${
PARA_CLI
}
para node_addr_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit
1
exit
1
fi
fi
}
status
=
$(${
PARA_CLI
}
para node_id_status
-t
user.p.para.
-i
"
$id
"
| jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"3"
]
;
then
function
para_nodemanage_quit_test
()
{
echo
"wrong cancel status"
para_nodemanage_node_join
${
PARA_CLI
}
para node_id_status
-t
user.p.para.
-i
"
$id
"
echo
"=========== # para chain node quit ============="
id
=
$(${
PARA_CLI
}
para node_status
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-t
user.p.para. | jq
-r
".id"
)
if
[
-z
"
${
id
}
"
]
;
then
echo
"wrong id "
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit
1
exit
1
fi
fi
hash
=
$(${
PARA_CLI
}
send para node
-o
3
-i
"
$id
"
-k
0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588
)
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
balance
=
$(${
CLI
}
account balance
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-e
paracross | jq
-r
".frozen"
)
node
=
$(${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para. | jq
-r
'.value|contains("1E5")'
)
if
[
"
$balance
"
==
"
$PARA_COIN_FROZEN
"
]
;
then
if
[
"
${
node
}
"
==
"true"
]
;
then
echo
"unfrozen coinfrozen error balance=
$balance
"
echo
"wrong node group addr"
${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para.
exit
1
exit
1
fi
fi
status
=
$(${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq
-r
".status"
)
balance
=
$(${
CLI
}
account balance
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-e
paracross | jq
-r
".frozen"
)
if
[
"
${
status
}
"
!=
"4"
]
;
then
if
[
"
$balance
"
!=
"0.0000"
]
;
then
echo
"wrong vote status"
echo
"unfrozen coinfrozen error balance=
$balance
"
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit
1
exit
1
fi
fi
echo
"=========== # para chain node quit reject ============="
txhash
=
$(${
PARA_CLI
}
send para node
-o
3
-a
1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
-k
0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588
)
echo
"
${
txhash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
txhash
}
"
}
function
para_nodemanage_test
()
{
para_nodemanage_quit_test
para_nodemanage_node_join
echo
"=========== # para chain node vote ============="
id
=
$(${
PARA_CLI
}
tx query
-s
"
${
txhash
}
"
| jq
-r
".receipt.logs[0].log.current.id"
)
id
=
$(${
PARA_CLI
}
para node_status
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-t
user.p.para. | jq
-r
".id"
)
if
[
-z
"
$id
"
]
;
then
if
[
-z
"
${
id
}
"
]
;
then
echo
"id not found"
echo
"wrong id "
${
PARA_CLI
}
tx query
-s
"
${
txhash
}
"
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit
1
exit
1
fi
fi
${
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
echo
"=========== # para chain node vote quit ============="
hash
=
$(${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115
)
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
2
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
2
-k
0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
hash
=
$(${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
2
-k
0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115
)
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
status
=
$(${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"2"
]
;
then
status
=
$(${
PARA_CLI
}
para node_addr_status
-t
user.p.para.
-a
1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 | jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"10"
]
;
then
echo
"wrong vote status"
echo
"wrong vote status"
${
PARA_CLI
}
para node_
status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
${
PARA_CLI
}
para node_
addr_status
-t
user.p.para.
-a
1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
exit
1
exit
1
fi
fi
node
=
$(${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para. | jq
-r
'.value|contains("1E5")'
)
status
=
$(${
PARA_CLI
}
para node_id_status
-t
user.p.para.
-i
"
$id
"
| jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"3"
]
;
then
echo
"wrong close status"
${
PARA_CLI
}
para node_id_status
-t
user.p.para.
-i
"
$id
"
exit
1
fi
node
=
$(${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para. | jq
-r
'.value|contains("1KS")'
)
if
[
"
${
node
}
"
!=
"true"
]
;
then
if
[
"
${
node
}
"
!=
"true"
]
;
then
echo
"wrong node group addr"
echo
"wrong node group addr"
${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para.
${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para.
exit
1
exit
1
fi
fi
echo
"=========== # para chain node quit ============="
}
hash
=
$(${
PARA_CLI
}
send para node
-o
3
-i
"
$id
"
-k
0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588
)
function
para_nodemanage_node_behalf_join
()
{
echo
"=========== # para chain behalf node vote test ============="
echo
"=========== # para chain new node join 1 ============="
hash
=
$(${
PARA_CLI
}
send para node
-o
1
-c
8
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB
-k
0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5
)
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
status
=
$(${
PARA_CLI
}
para node_list
-t
user.p.para.
-s
3 | jq
-r
".ids[0].targetAddr"
)
balance
=
$(${
CLI
}
account balance
-a
1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj
-e
paracross | jq
-r
".frozen"
)
if
[
"
${
status
}
"
!=
"1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY"
]
;
then
if
[
"
$balance
"
!=
"32.0000"
]
;
then
echo
"wrong join status"
echo
"1Ka frozen coinfrozen error balance=
$balance
"
${
PARA_CLI
}
para node_list
-t
user.p.para.
-s
3
exit
1
exit
1
fi
fi
echo
"=========== # para chain node vote quit ============="
balance
=
$(${
CLI
}
account balance
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB
-e
paracross | jq
-r
".frozen"
)
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
if
[
"
$balance
"
==
"
$PARA_COIN_FROZEN
"
]
;
then
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
echo
"1LU frozen coinfrozen error balance=
$balance
"
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588
hash
=
$(${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115
)
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
balance
=
$(${
CLI
}
account balance
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
-e
paracross | jq
-r
".frozen"
)
if
[
"
$balance
"
!=
"0.0000"
]
;
then
echo
"unfrozen coinfrozen error balance=
$balance
"
exit
1
exit
1
fi
fi
status
=
$(${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq
-r
".status
"
)
node1_id
=
$(${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
| jq
-r
".receipt.logs[0].log.current.id
"
)
if
[
"
${
status
}
"
!=
"4
"
]
;
then
if
[
-z
"
$node1_id
"
]
;
then
echo
"
wrong vote status
"
echo
"
id not found
"
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
exit
1
exit
1
fi
fi
node
=
$(${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para. | jq
-r
'.value|contains("1E5")'
)
if
[
"
${
node
}
"
==
"true"
]
;
then
echo
"wrong node group addr"
echo
"=========== # para chain new node join 2============="
${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para.
hash
=
$(${
PARA_CLI
}
send para node
-o
1
-c
9
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB
-k
0xd165c84ed37c2a427fea487470ee671b7a0495d68d82607cafbc6348bf23bec5
)
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
balance
=
$(${
CLI
}
account balance
-a
1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj
-e
paracross | jq
-r
".frozen"
)
if
[
"
$balance
"
!=
"41.0000"
]
;
then
echo
"frozen coinfrozen error balance=
$balance
"
exit
1
exit
1
fi
fi
echo
"=========== # para chain behalf node vote test ============="
id
=
$(${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
| jq
-r
".receipt.logs[0].log.current.id"
)
para_nodemanage_node_behalf_join
if
[
-z
"
$id
"
]
;
then
id
=
$(${
PARA_CLI
}
para node_status
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB
-t
user.p.para. | jq
-r
".id"
)
echo
"id not found"
if
[
-z
"
${
id
}
"
]
;
then
${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
echo
"wrong id "
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB
exit
1
exit
1
fi
fi
${
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
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
0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
hash
=
$(${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115
)
hash
=
$(${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115
)
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
status
=
$(${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB | jq
-r
".status"
)
status
=
$(${
PARA_CLI
}
para node_
addr_
status
-t
user.p.para.
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB | jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"
2
"
]
;
then
if
[
"
${
status
}
"
!=
"
10
"
]
;
then
echo
"wrong vote status"
echo
"wrong vote status"
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
${
PARA_CLI
}
para node_addr_status
-t
user.p.para.
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB
exit
1
fi
status
=
$(${
PARA_CLI
}
para node_id_status
-t
user.p.para.
-i
"
$id
"
| jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"3"
]
;
then
echo
"wrong close status"
${
PARA_CLI
}
para node_id_status
-t
user.p.para.
-i
"
$id
"
exit
1
exit
1
fi
fi
...
@@ -792,12 +807,51 @@ function para_nodemanage_test() {
...
@@ -792,12 +807,51 @@ function para_nodemanage_test() {
exit
1
exit
1
fi
fi
echo
"=========== # para chain node quit ============="
hash
=
$(${
PARA_CLI
}
send para node
-o
3
-i
"
$id
"
-k
0x794443611e7369a57b078881445b93b754cbc9b9b8f526535ab9c6d21d29203d
)
echo
"=========== # para chain same node vote again fail ============="
${
PARA_CLI
}
send para node
-o
2
-i
"
$node1_id
"
-v
1
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
${
PARA_CLI
}
send para node
-o
2
-i
"
$node1_id
"
-v
1
-k
0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
hash
=
$(${
PARA_CLI
}
send para node
-o
2
-i
"
$node1_id
"
-v
1
-k
0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115
)
echo
"
${
hash
}
"
query_tx
"
${
CLI
}
"
"
${
hash
}
"
status
=
$(${
CLI
}
para node_id_status
-t
user.p.para.
-i
"
$node1_id
"
| jq
-r
".status"
)
if
[
"
${
status
}
"
==
"3"
]
;
then
echo
"wrong vote status"
${
CLI
}
para node_id_status
-t
user.p.para.
-i
"
$node1_id
"
exit
1
fi
echo
"=========== # para chain node 1 cancel ============="
hash
=
$(${
PARA_CLI
}
send para node
-o
4
-i
"
$node1_id
"
-k
0xfdf2bbff853ecff2e7b86b2a8b45726c6538ca7d1403dc94e50131ef379bdca0
)
echo
"
${
hash
}
"
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
echo
"=========== # para chain node vote quit ============="
balance
=
$(${
CLI
}
account balance
-a
1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj
-e
paracross | jq
-r
".frozen"
)
if
[
"
$balance
"
!=
"32.0000"
]
;
then
echo
"unfrozen coinfrozen error balance=
$balance
"
exit
1
fi
status
=
$(${
PARA_CLI
}
para node_id_status
-t
user.p.para.
-i
"
$node1_id
"
| jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"4"
]
;
then
echo
"wrong cancel status"
${
PARA_CLI
}
para node_id_status
-t
user.p.para.
-i
"
$node1_id
"
exit
1
fi
echo
"=========== # para chain node 2 quit ============="
hash
=
$(${
PARA_CLI
}
send para node
-o
3
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB
-k
0x794443611e7369a57b078881445b93b754cbc9b9b8f526535ab9c6d21d29203d
)
echo
"
${
hash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
hash
}
"
id
=
$(${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
| jq
-r
".receipt.logs[0].log.current.id"
)
if
[
-z
"
$id
"
]
;
then
echo
"id not found"
${
PARA_CLI
}
tx query
-s
"
${
hash
}
"
exit
1
fi
echo
"=========== # para chain node2 vote quit ============="
${
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
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
0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x794443611e7369a57b078881445b93b754cbc9b9b8f526535ab9c6d21d29203d
${
PARA_CLI
}
send para node
-o
2
-i
"
$id
"
-v
1
-k
0x794443611e7369a57b078881445b93b754cbc9b9b8f526535ab9c6d21d29203d
...
@@ -811,26 +865,36 @@ function para_nodemanage_test() {
...
@@ -811,26 +865,36 @@ function para_nodemanage_test() {
exit
1
exit
1
fi
fi
status
=
$(${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB | jq
-r
".status"
)
status
=
$(${
PARA_CLI
}
para node_
addr_
status
-t
user.p.para.
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB | jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"
4
"
]
;
then
if
[
"
${
status
}
"
!=
"
11
"
]
;
then
echo
"wrong vote status"
echo
"wrong vote status"
${
PARA_CLI
}
para node_status
-t
user.p.para.
-a
1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
${
PARA_CLI
}
para node_addr_status
-t
user.p.para.
-a
1NNaYHkscJaLJ2wUrFNeh6cQXBS4TrFYeB
exit
1
fi
status
=
$(${
PARA_CLI
}
para node_id_status
-t
user.p.para.
-i
"
$id
"
| jq
-r
".status"
)
if
[
"
${
status
}
"
!=
"3"
]
;
then
echo
"wrong cancel status"
${
PARA_CLI
}
para node_id_status
-t
user.p.para.
-i
"
$id
"
exit
1
exit
1
fi
fi
node
=
$(${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para. | jq
-r
'.value|contains("1NNa")'
)
node
=
$(${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para. | jq
-r
'.value|contains("1NNa")'
)
if
[
"
${
node
}
"
==
"true"
]
;
then
if
[
"
${
node
}
"
==
"true"
]
;
then
echo
"wrong node group addr"
echo
"wrong node group addr"
${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para.
${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para.
exit
1
exit
1
fi
fi
}
}
function
para_test
()
{
function
para_test
()
{
echo
"=========== # para chain test ============="
echo
"=========== # para chain test ============="
para_create_nodegroup
para_create_nodegroup
para_nodegroup_behalf_quit_test
para_nodegroup_behalf_quit_test
para_nodemanage_cancel_test
para_nodemanage_test
para_nodemanage_test
para_nodemanage_node_behalf_join
token_create
"
${
PARA_CLI
}
"
token_create
"
${
PARA_CLI
}
"
token_transfer
"
${
PARA_CLI
}
"
token_transfer
"
${
PARA_CLI
}
"
para_cross_transfer_withdraw
para_cross_transfer_withdraw
...
...
plugin/dapp/paracross/commands/paracross.go
View file @
363fb6f3
...
@@ -38,6 +38,7 @@ func ParcCmd() *cobra.Command {
...
@@ -38,6 +38,7 @@ func ParcCmd() *cobra.Command {
GetParaListCmd
(),
GetParaListCmd
(),
GetNodeGroupCmd
(),
GetNodeGroupCmd
(),
GetNodeInfoCmd
(),
GetNodeInfoCmd
(),
GetNodeIdInfoCmd
(),
GetNodeListCmd
(),
GetNodeListCmd
(),
NodeGroupStatusCmd
(),
NodeGroupStatusCmd
(),
NodeGroupListCmd
(),
NodeGroupListCmd
(),
...
@@ -455,8 +456,8 @@ func paraList(cmd *cobra.Command, args []string) {
...
@@ -455,8 +456,8 @@ func paraList(cmd *cobra.Command, args []string) {
// GetNodeInfoCmd get node current status
// GetNodeInfoCmd get node current status
func
GetNodeInfoCmd
()
*
cobra
.
Command
{
func
GetNodeInfoCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"node_status"
,
Use
:
"node_
addr_
status"
,
Short
:
"Get node current
vote status
"
,
Short
:
"Get node current
status:10:joined,11:quited from nodegroup
"
,
Run
:
nodeInfo
,
Run
:
nodeInfo
,
}
}
addNodeBodyCmdFlags
(
cmd
)
addNodeBodyCmdFlags
(
cmd
)
...
@@ -468,7 +469,7 @@ func addNodeBodyCmdFlags(cmd *cobra.Command) {
...
@@ -468,7 +469,7 @@ func addNodeBodyCmdFlags(cmd *cobra.Command) {
cmd
.
MarkFlagRequired
(
"title"
)
cmd
.
MarkFlagRequired
(
"title"
)
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"addr apply for super user"
)
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"addr apply for super user"
)
cmd
.
Flags
()
.
StringP
(
"id"
,
"i"
,
""
,
"id apply for super use
r"
)
cmd
.
MarkFlagRequired
(
"add
r"
)
}
}
...
@@ -476,15 +477,47 @@ func nodeInfo(cmd *cobra.Command, args []string) {
...
@@ -476,15 +477,47 @@ func nodeInfo(cmd *cobra.Command, args []string) {
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
addr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
addr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
params
:=
pt
.
ReqParacrossNodeInfo
{
params
:=
pt
.
ReqParacrossNodeInfo
{
Title
:
title
,
Title
:
title
,
Addr
:
addr
,
Addr
:
addr
,
}
var
res
pt
.
ParaNodeAddrIdStatus
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"paracross.GetNodeAddrStatus"
,
params
,
&
res
)
ctx
.
Run
()
}
// GetNodeInfoCmd get node current status
func
GetNodeIdInfoCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"node_id_status"
,
Short
:
"Get node id current vote status:0:all,1:joining,2:quiting,3:closed,4:canceld"
,
Run
:
nodeIdInfo
,
}
addNodeIdBodyCmdFlags
(
cmd
)
return
cmd
}
func
addNodeIdBodyCmdFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"title"
,
"t"
,
""
,
"parallel chain's title"
)
cmd
.
MarkFlagRequired
(
"title"
)
cmd
.
Flags
()
.
StringP
(
"id"
,
"i"
,
""
,
"id apply for super user"
)
cmd
.
MarkFlagRequired
(
"id"
)
}
func
nodeIdInfo
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
params
:=
pt
.
ReqParacrossNodeInfo
{
Title
:
title
,
Id
:
id
,
Id
:
id
,
}
}
var
res
pt
.
ParaNodeIdStatus
var
res
pt
.
ParaNodeIdStatus
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"paracross.GetNodeStatus"
,
params
,
&
res
)
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"paracross.GetNode
ID
Status"
,
params
,
&
res
)
ctx
.
Run
()
ctx
.
Run
()
}
}
...
...
plugin/dapp/paracross/executor/query.go
View file @
363fb6f3
...
@@ -85,11 +85,7 @@ func (p *Paracross) Query_GetNodeAddrInfo(in *pt.ReqParacrossNodeInfo) (types.Me
...
@@ -85,11 +85,7 @@ func (p *Paracross) Query_GetNodeAddrInfo(in *pt.ReqParacrossNodeInfo) (types.Me
if
in
==
nil
||
in
.
Title
==
""
||
in
.
Addr
==
""
{
if
in
==
nil
||
in
.
Title
==
""
||
in
.
Addr
==
""
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
addrStat
,
err
:=
getNodeAddr
(
p
.
GetStateDB
(),
in
.
Title
,
in
.
Addr
)
stat
,
err
:=
getNodeAddr
(
p
.
GetStateDB
(),
in
.
Title
,
in
.
Addr
)
if
err
!=
nil
{
return
nil
,
err
}
stat
,
err
:=
getNodeID
(
p
.
GetStateDB
(),
addrStat
.
ProposalId
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -97,7 +93,7 @@ func (p *Paracross) Query_GetNodeAddrInfo(in *pt.ReqParacrossNodeInfo) (types.Me
...
@@ -97,7 +93,7 @@ func (p *Paracross) Query_GetNodeAddrInfo(in *pt.ReqParacrossNodeInfo) (types.Me
}
}
//Query_GetNodeIdInfo get specific node addr info
//Query_GetNodeIdInfo get specific node addr info
func
(
p
*
Paracross
)
Query_GetNodeI
d
Info
(
in
*
pt
.
ReqParacrossNodeInfo
)
(
types
.
Message
,
error
)
{
func
(
p
*
Paracross
)
Query_GetNodeI
D
Info
(
in
*
pt
.
ReqParacrossNodeInfo
)
(
types
.
Message
,
error
)
{
if
in
==
nil
||
in
.
Title
==
""
||
in
.
Id
==
""
{
if
in
==
nil
||
in
.
Title
==
""
||
in
.
Id
==
""
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
...
...
plugin/dapp/paracross/executor/superaccount.go
View file @
363fb6f3
...
@@ -444,6 +444,7 @@ func updateVotes(stat *pt.ParaNodeIdStatus, nodes map[string]struct{}) {
...
@@ -444,6 +444,7 @@ func updateVotes(stat *pt.ParaNodeIdStatus, nodes map[string]struct{}) {
stat
.
Votes
=
votes
stat
.
Votes
=
votes
}
}
func
(
a
*
action
)
updateNodeAddrStatus
(
stat
*
pt
.
ParaNodeIdStatus
)
(
*
types
.
Receipt
,
error
)
{
func
(
a
*
action
)
updateNodeAddrStatus
(
stat
*
pt
.
ParaNodeIdStatus
)
(
*
types
.
Receipt
,
error
)
{
addrStat
,
err
:=
getNodeAddr
(
a
.
db
,
stat
.
Title
,
stat
.
TargetAddr
)
addrStat
,
err
:=
getNodeAddr
(
a
.
db
,
stat
.
Title
,
stat
.
TargetAddr
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -503,14 +504,21 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
...
@@ -503,14 +504,21 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
config
.
Title
!=
stat
.
Title
{
if
config
.
Title
!=
stat
.
Title
{
return
nil
,
errors
.
Wrapf
(
pt
.
ErrNodeNotForTheTitle
,
"config title:%s,id title:%s"
,
config
.
Title
,
stat
.
Title
)
return
nil
,
errors
.
Wrapf
(
pt
.
ErrNodeNotForTheTitle
,
"config title:%s,id title:%s"
,
config
.
Title
,
stat
.
Title
)
}
}
if
stat
.
Status
!=
pt
.
ParacrossNodeJoining
&&
stat
.
Status
!=
pt
.
ParacrossNodeQuiting
{
if
stat
.
Status
!=
pt
.
ParacrossNodeJoining
&&
stat
.
Status
!=
pt
.
ParacrossNodeQuiting
{
return
nil
,
errors
.
Wrapf
(
pt
.
ErrParaNodeOpStatusWrong
,
"config id:%s,status:%d"
,
config
.
Id
,
stat
.
Status
)
return
nil
,
errors
.
Wrapf
(
pt
.
ErrParaNodeOpStatusWrong
,
"config id:%s,status:%d"
,
config
.
Id
,
stat
.
Status
)
}
}
//已经被其他id pass 场景
if
stat
.
Status
==
pt
.
ParacrossNodeJoining
&&
validNode
(
stat
.
TargetAddr
,
nodes
){
return
nil
,
errors
.
Wrapf
(
pt
.
ErrParaNodeAddrExisted
,
"config id:%s,addr:%s"
,
config
.
Id
,
stat
.
TargetAddr
)
}
if
stat
.
Status
==
pt
.
ParacrossNodeQuiting
&&
!
validNode
(
stat
.
TargetAddr
,
nodes
){
return
nil
,
errors
.
Wrapf
(
pt
.
ErrParaNodeAddrNotExisted
,
"config id:%s,addr:%s"
,
config
.
Id
,
stat
.
TargetAddr
)
}
var
copyStat
pt
.
ParaNodeIdStatus
var
copyStat
pt
.
ParaNodeIdStatus
err
=
deepCopy
(
&
copyStat
,
stat
)
err
=
deepCopy
(
&
copyStat
,
stat
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
plugin/dapp/paracross/executor/superaccount_test.go
View file @
363fb6f3
...
@@ -120,7 +120,7 @@ func checkGroupApplyReceipt(suite *NodeManageTestSuite, receipt *types.Receipt)
...
@@ -120,7 +120,7 @@ func checkGroupApplyReceipt(suite *NodeManageTestSuite, receipt *types.Receipt)
func
checkGroupApproveReceipt
(
suite
*
NodeManageTestSuite
,
receipt
*
types
.
Receipt
)
{
func
checkGroupApproveReceipt
(
suite
*
NodeManageTestSuite
,
receipt
*
types
.
Receipt
)
{
assert
.
Equal
(
suite
.
T
(),
receipt
.
Ty
,
int32
(
types
.
ExecOk
))
assert
.
Equal
(
suite
.
T
(),
receipt
.
Ty
,
int32
(
types
.
ExecOk
))
len
:=
len
(
receipt
.
Logs
)
var
stat
pt
.
ParaNodeIdStatus
var
stat
pt
.
ParaNodeIdStatus
err
:=
types
.
Decode
(
receipt
.
KV
[
len
-
1
]
.
Value
,
&
stat
)
err
:=
types
.
Decode
(
receipt
.
KV
[
len
-
1
]
.
Value
,
&
stat
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
...
...
plugin/dapp/paracross/rpc/rpc.go
View file @
363fb6f3
...
@@ -179,23 +179,23 @@ func (c *Jrpc) GetBlock2MainInfo(req *types.ReqBlocks, result *interface{}) erro
...
@@ -179,23 +179,23 @@ func (c *Jrpc) GetBlock2MainInfo(req *types.ReqBlocks, result *interface{}) erro
return
err
return
err
}
}
// GetNodeStatus get super node status
// GetNode
Addr
Status get super node status
func
(
c
*
channelClient
)
GetNode
Status
(
ctx
context
.
Context
,
req
*
pt
.
ReqParacrossNodeInfo
)
(
*
pt
.
ParaNode
IdStatus
,
error
)
{
func
(
c
*
channelClient
)
GetNode
AddrStatus
(
ctx
context
.
Context
,
req
*
pt
.
ReqParacrossNodeInfo
)
(
*
pt
.
ParaNodeAddr
IdStatus
,
error
)
{
r
:=
*
req
r
:=
*
req
data
,
err
:=
c
.
Query
(
pt
.
GetExecName
(),
"GetNodeAddrInfo"
,
&
r
)
data
,
err
:=
c
.
Query
(
pt
.
GetExecName
(),
"GetNodeAddrInfo"
,
&
r
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
resp
,
ok
:=
data
.
(
*
pt
.
ParaNodeIdStatus
);
ok
{
if
resp
,
ok
:=
data
.
(
*
pt
.
ParaNode
Addr
IdStatus
);
ok
{
return
resp
,
nil
return
resp
,
nil
}
}
return
nil
,
types
.
ErrDecode
return
nil
,
types
.
ErrDecode
}
}
// GetNodeStatus get super node status
// GetNode
ID
Status get super node status
func
(
c
*
channelClient
)
GetNodeIDStatus
(
ctx
context
.
Context
,
req
*
pt
.
ReqParacrossNodeInfo
)
(
*
pt
.
ParaNodeIdStatus
,
error
)
{
func
(
c
*
channelClient
)
GetNodeIDStatus
(
ctx
context
.
Context
,
req
*
pt
.
ReqParacrossNodeInfo
)
(
*
pt
.
ParaNodeIdStatus
,
error
)
{
r
:=
*
req
r
:=
*
req
data
,
err
:=
c
.
Query
(
pt
.
GetExecName
(),
"GetNodeI
d
Info"
,
&
r
)
data
,
err
:=
c
.
Query
(
pt
.
GetExecName
(),
"GetNodeI
D
Info"
,
&
r
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -205,22 +205,26 @@ func (c *channelClient) GetNodeIDStatus(ctx context.Context, req *pt.ReqParacros
...
@@ -205,22 +205,26 @@ func (c *channelClient) GetNodeIDStatus(ctx context.Context, req *pt.ReqParacros
return
nil
,
types
.
ErrDecode
return
nil
,
types
.
ErrDecode
}
}
// GetNodeStatus get super node status
// GetNode
Addr
Status get super node status
func
(
c
*
Jrpc
)
GetNodeStatus
(
req
*
pt
.
ReqParacrossNodeInfo
,
result
*
interface
{})
error
{
func
(
c
*
Jrpc
)
GetNode
Addr
Status
(
req
*
pt
.
ReqParacrossNodeInfo
,
result
*
interface
{})
error
{
if
req
==
nil
||
(
req
.
Addr
==
""
&&
req
.
Id
==
""
)
{
if
req
==
nil
||
req
.
Addr
==
""
{
return
types
.
ErrInvalidParam
return
types
.
ErrInvalidParam
}
}
var
data
*
pt
.
ParaNodeIdStatus
data
,
err
:=
c
.
cli
.
GetNodeAddrStatus
(
context
.
Background
(),
req
)
var
err
error
if
req
.
Addr
!=
""
{
*
result
=
data
data
,
err
=
c
.
cli
.
GetNodeStatus
(
context
.
Background
(),
req
)
return
err
}
}
if
req
.
Id
!=
""
{
// GetNodeIdStatus get super node status
data
,
err
=
c
.
cli
.
GetNodeIDStatus
(
context
.
Background
(),
req
)
func
(
c
*
Jrpc
)
GetNodeIDStatus
(
req
*
pt
.
ReqParacrossNodeInfo
,
result
*
interface
{})
error
{
if
req
==
nil
||
req
.
Id
==
""
{
return
types
.
ErrInvalidParam
}
}
data
,
err
:=
c
.
cli
.
GetNodeIDStatus
(
context
.
Background
(),
req
)
*
result
=
data
*
result
=
data
return
err
return
err
}
}
...
...
plugin/dapp/paracross/types/paracross.go
View file @
363fb6f3
...
@@ -117,7 +117,7 @@ const (
...
@@ -117,7 +117,7 @@ const (
//voting status
//voting status
const
(
const
(
// ParacrossNodeIDJoining apply for join group
// ParacrossNodeIDJoining apply for join group
ParacrossNodeJoining
=
iota
ParacrossNodeJoining
=
iota
+
1
// ParacrossNodeIDQuiting apply for quiting group
// ParacrossNodeIDQuiting apply for quiting group
ParacrossNodeQuiting
ParacrossNodeQuiting
// ParacrossNodeIDClosed id voting closed
// ParacrossNodeIDClosed id voting closed
...
...
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