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
895a68b2
Commit
895a68b2
authored
Apr 30, 2019
by
mdj33
Committed by
vipwzw
May 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix super manager approve bug
parent
25ef0c82
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
20 deletions
+30
-20
testcase.sh
plugin/dapp/paracross/cmd/build/testcase.sh
+16
-10
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+10
-6
superaccount_test.go
plugin/dapp/paracross/executor/superaccount_test.go
+4
-4
No files found.
plugin/dapp/paracross/cmd/build/testcase.sh
View file @
895a68b2
...
@@ -108,6 +108,7 @@ function para_transfer() {
...
@@ -108,6 +108,7 @@ function para_transfer() {
# para_create_manage_nodegroup
# para_create_manage_nodegroup
para_create_nodegroup
para_create_nodegroup
echo
"=========== # config token blacklist ============="
#token precreate
#token precreate
txhash
=
$(
para_configkey
"
${
PARA_CLI
}
"
"token-blacklist"
"BTY"
)
txhash
=
$(
para_configkey
"
${
PARA_CLI
}
"
"token-blacklist"
"BTY"
)
echo
"txhash=
$txhash
"
echo
"txhash=
$txhash
"
...
@@ -136,7 +137,8 @@ function para_create_nodegroup_test() {
...
@@ -136,7 +137,8 @@ function para_create_nodegroup_test() {
query_tx
"
${
PARA_CLI
}
"
"
${
txhash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
txhash
}
"
status
=
$(${
PARA_CLI
}
para nodegroup_status
-t
user.p.para. | jq
-r
".status"
)
status
=
$(${
PARA_CLI
}
para nodegroup_status
-t
user.p.para. | jq
-r
".status"
)
if
[
"
$status
"
!=
1
]
;
then
if
[
"
$status
"
!=
1
]
;
then
echo
"status not apply"
echo
"status not apply status=
$status
"
exit
1
fi
fi
balance
=
$(${
CLI
}
account balance
-a
1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
-e
paracross | jq
-r
".frozen"
)
balance
=
$(${
CLI
}
account balance
-a
1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
-e
paracross | jq
-r
".frozen"
)
if
[
"
$balance
"
!=
"
$PARA_COIN_FROZEN
"
]
;
then
if
[
"
$balance
"
!=
"
$PARA_COIN_FROZEN
"
]
;
then
...
@@ -144,13 +146,15 @@ function para_create_nodegroup_test() {
...
@@ -144,13 +146,15 @@ function para_create_nodegroup_test() {
exit
1
exit
1
fi
fi
echo
"=========== # para chain quit node group ============="
##quit
##quit
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
3
-a
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
-c
20
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
3
-a
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
-c
20
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
echo
"tx=
$txhash
"
echo
"tx=
$txhash
"
query_tx
"
${
PARA_CLI
}
"
"
${
txhash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
txhash
}
"
status
=
$(${
PARA_CLI
}
para nodegroup_status
-t
user.p.para. | jq
-r
".status"
)
status
=
$(${
PARA_CLI
}
para nodegroup_status
-t
user.p.para. | jq
-r
".status"
)
if
[
"
$status
"
!=
3
]
;
then
if
[
"
$status
"
!=
3
]
;
then
echo
"status not quit"
echo
"status not quit status=
$status
"
exit
1
fi
fi
balance
=
$(${
CLI
}
account balance
-a
1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
-e
paracross | jq
-r
".balance"
)
balance
=
$(${
CLI
}
account balance
-a
1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
-e
paracross | jq
-r
".balance"
)
if
[
"
$balance
"
!=
"
$PARA_COIN_FROZEN
"
]
;
then
if
[
"
$balance
"
!=
"
$PARA_COIN_FROZEN
"
]
;
then
...
@@ -163,15 +167,18 @@ function para_create_nodegroup_test() {
...
@@ -163,15 +167,18 @@ function para_create_nodegroup_test() {
function
para_create_nodegroup
()
{
function
para_create_nodegroup
()
{
para_create_nodegroup_test
para_create_nodegroup_test
echo
"=========== # para chain create node group again ============="
##apply
##apply
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
1
-a
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
-c
20
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
1
-a
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
-c
20
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
echo
"tx=
$txhash
"
echo
"tx=
$txhash
"
query_tx
"
${
PARA_CLI
}
"
"
${
txhash
}
"
query_tx
"
${
PARA_CLI
}
"
"
${
txhash
}
"
status
=
$(${
PARA_CLI
}
para nodegroup_status
-t
user.p.para. | jq
-r
".status"
)
status
=
$(${
PARA_CLI
}
para nodegroup_status
-t
user.p.para. | jq
-r
".status"
)
if
[
"
$status
"
!=
1
]
;
then
if
[
"
$status
"
!=
1
]
;
then
echo
"status not apply"
echo
"status not apply status=
$status
"
exit
1
fi
fi
echo
"=========== # para chain approve node group ============="
##approve
##approve
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
2
-a
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4, 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR, 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k, 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs,"
-k
0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc
)
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
2
-a
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4, 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR, 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k, 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs,"
-k
0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc
)
echo
"tx=
$txhash
"
echo
"tx=
$txhash
"
...
@@ -179,22 +186,21 @@ function para_create_nodegroup() {
...
@@ -179,22 +186,21 @@ function para_create_nodegroup() {
status
=
$(${
PARA_CLI
}
para nodegroup_status
-t
user.p.para. | jq
-r
".status"
)
status
=
$(${
PARA_CLI
}
para nodegroup_status
-t
user.p.para. | jq
-r
".status"
)
if
[
"
$status
"
!=
2
]
;
then
if
[
"
$status
"
!=
2
]
;
then
echo
"status not approve"
echo
"status not approve status=
$status
"
exit
1
fi
fi
addrs
=
$(${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para. | jq
-r
".value"
)
${
PARA_CLI
}
para nodegroup_addrs
-t
user.p.para.
if
[
"
$addrs
"
!=
"[1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs]"
]
;
then
echo
"para node group err"
fi
echo
"=========== # para chain quit node group fail ============="
##quit fail
##quit fail
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
3
-a
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
txhash
=
$(${
PARA_CLI
}
send para nodegroup
-o
3
-a
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
-k
0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
)
echo
"tx=
$txhash
"
echo
"tx=
$txhash
"
query_tx
"
${
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"
echo
"status quit not approve status=
$status
"
exit
1
fi
fi
balance
=
$(${
CLI
}
account balance
-a
1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
-e
paracross | jq
-r
".frozen"
)
balance
=
$(${
CLI
}
account balance
-a
1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
-e
paracross | jq
-r
".frozen"
)
if
[
"
$balance
"
!=
"
$PARA_COIN_FROZEN
"
]
;
then
if
[
"
$balance
"
!=
"
$PARA_COIN_FROZEN
"
]
;
then
...
...
plugin/dapp/paracross/executor/superaccount.go
View file @
895a68b2
...
@@ -313,7 +313,7 @@ func (a *action) superManagerVoteProc(title string) error {
...
@@ -313,7 +313,7 @@ func (a *action) superManagerVoteProc(title string) error {
confStopBlocks
:=
conf
.
GInt
(
"paraConsensusStopBlocks"
)
confStopBlocks
:=
conf
.
GInt
(
"paraConsensusStopBlocks"
)
data
,
err
:=
a
.
exec
.
paracrossGetHeight
(
title
)
data
,
err
:=
a
.
exec
.
paracrossGetHeight
(
title
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Info
(
"paracross.
nodeVote get consens height"
,
"err"
,
err
.
Error
())
clog
.
Info
(
"paracross.
superManagerVoteProc get consens height"
,
"title"
,
title
,
"err"
,
err
.
Error
())
return
err
return
err
}
}
var
consensMainHeight
int64
var
consensMainHeight
int64
...
@@ -322,15 +322,16 @@ func (a *action) superManagerVoteProc(title string) error {
...
@@ -322,15 +322,16 @@ func (a *action) superManagerVoteProc(title string) error {
if
consensHeight
==
-
1
{
if
consensHeight
==
-
1
{
consensMainHeight
=
status
.
MainHeight
consensMainHeight
=
status
.
MainHeight
}
else
{
}
else
{
stat
,
err
:=
a
.
exec
.
paracrossGetStateTitleHeight
(
title
,
consens
Main
Height
)
stat
,
err
:=
a
.
exec
.
paracrossGetStateTitleHeight
(
title
,
consensHeight
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Info
(
"paracross.superManagerVoteProc get consens title height"
,
"title"
,
title
,
"conesusHeight"
,
consensHeight
,
"err"
,
err
.
Error
())
return
err
return
err
}
}
consensMainHeight
=
stat
.
(
*
pt
.
ParacrossHeightStatus
)
.
MainHeight
consensMainHeight
=
stat
.
(
*
pt
.
ParacrossHeightStatus
)
.
MainHeight
}
}
//return err to stop tx pass to para chain
//return err to stop tx pass to para chain
if
a
.
exec
.
GetMainHeight
()
<=
consensMainHeight
+
confStopBlocks
*
int64
(
status
.
EmptyBlockInterval
)
{
if
a
.
exec
.
GetMainHeight
()
<=
consensMainHeight
+
confStopBlocks
*
int64
(
status
.
EmptyBlockInterval
)
{
clog
.
Error
(
"
paracross.nodeVote
, super manager height not reach"
,
"currHeight"
,
a
.
exec
.
GetMainHeight
(),
clog
.
Error
(
"
superManagerVoteProc
, super manager height not reach"
,
"currHeight"
,
a
.
exec
.
GetMainHeight
(),
"consensHeight"
,
consensHeight
,
"mainHeight"
,
consensMainHeight
,
"confHeight"
,
confStopBlocks
,
"interval"
,
status
.
EmptyBlockInterval
)
"consensHeight"
,
consensHeight
,
"mainHeight"
,
consensMainHeight
,
"confHeight"
,
confStopBlocks
,
"interval"
,
status
.
EmptyBlockInterval
)
return
pt
.
ErrParaConsensStopBlocksNotReach
return
pt
.
ErrParaConsensStopBlocksNotReach
}
}
...
@@ -623,7 +624,8 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt,
...
@@ -623,7 +624,8 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt,
Title
:
config
.
Title
,
Title
:
config
.
Title
,
ApplyAddr
:
strings
.
Join
(
addrs
,
","
),
ApplyAddr
:
strings
.
Join
(
addrs
,
","
),
CoinsFrozen
:
config
.
CoinsFrozen
,
CoinsFrozen
:
config
.
CoinsFrozen
,
MainHeight
:
a
.
exec
.
GetMainHeight
()}
MainHeight
:
a
.
exec
.
GetMainHeight
(),
EmptyBlockInterval
:
config
.
EmptyBlockInterval
}
saveNodeGroup
(
a
.
db
,
config
.
Title
,
stat
)
saveNodeGroup
(
a
.
db
,
config
.
Title
,
stat
)
r
:=
makeParaNodeGroupApplyReiceipt
(
config
.
Title
,
a
.
fromaddr
,
status
,
stat
,
pt
.
TyLogParaNodeGroupApply
)
r
:=
makeParaNodeGroupApplyReiceipt
(
config
.
Title
,
a
.
fromaddr
,
status
,
stat
,
pt
.
TyLogParaNodeGroupApply
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
...
@@ -662,7 +664,8 @@ func (a *action) nodeGroupQuit(config *pt.ParaNodeGroupConfig) (*types.Receipt,
...
@@ -662,7 +664,8 @@ func (a *action) nodeGroupQuit(config *pt.ParaNodeGroupConfig) (*types.Receipt,
Title
:
config
.
Title
,
Title
:
config
.
Title
,
ApplyAddr
:
status
.
ApplyAddr
,
ApplyAddr
:
status
.
ApplyAddr
,
CoinsFrozen
:
status
.
CoinsFrozen
,
CoinsFrozen
:
status
.
CoinsFrozen
,
MainHeight
:
a
.
exec
.
GetMainHeight
()}
MainHeight
:
a
.
exec
.
GetMainHeight
(),
EmptyBlockInterval
:
status
.
EmptyBlockInterval
}
saveNodeGroup
(
a
.
db
,
config
.
Title
,
stat
)
saveNodeGroup
(
a
.
db
,
config
.
Title
,
stat
)
r
:=
makeParaNodeGroupApplyReiceipt
(
config
.
Title
,
a
.
fromaddr
,
status
,
stat
,
pt
.
TyLogParaNodeGroupQuit
)
r
:=
makeParaNodeGroupApplyReiceipt
(
config
.
Title
,
a
.
fromaddr
,
status
,
stat
,
pt
.
TyLogParaNodeGroupQuit
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
...
@@ -736,7 +739,8 @@ func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receip
...
@@ -736,7 +739,8 @@ func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receip
Title
:
config
.
Title
,
Title
:
config
.
Title
,
ApplyAddr
:
status
.
ApplyAddr
,
ApplyAddr
:
status
.
ApplyAddr
,
CoinsFrozen
:
status
.
CoinsFrozen
,
CoinsFrozen
:
status
.
CoinsFrozen
,
MainHeight
:
a
.
exec
.
GetMainHeight
()}
MainHeight
:
a
.
exec
.
GetMainHeight
(),
EmptyBlockInterval
:
status
.
EmptyBlockInterval
}
saveNodeGroup
(
a
.
db
,
config
.
Title
,
stat
)
saveNodeGroup
(
a
.
db
,
config
.
Title
,
stat
)
r
=
makeParaNodeGroupApplyReiceipt
(
config
.
Title
,
a
.
fromaddr
,
status
,
stat
,
pt
.
TyLogParaNodeGroupApprove
)
r
=
makeParaNodeGroupApplyReiceipt
(
config
.
Title
,
a
.
fromaddr
,
status
,
stat
,
pt
.
TyLogParaNodeGroupApprove
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
...
...
plugin/dapp/paracross/executor/superaccount_test.go
View file @
895a68b2
...
@@ -212,7 +212,7 @@ func voteTest(suite *NodeManageTestSuite, addr string, join bool) {
...
@@ -212,7 +212,7 @@ func voteTest(suite *NodeManageTestSuite, addr string, join bool) {
}
}
func
(
suite
*
NodeManageTestSuite
)
testNodeGroupConfigQuit
()
{
func
(
suite
*
NodeManageTestSuite
)
testNodeGroupConfigQuit
()
{
config
:=
&
pt
.
ParaNodeGroup
Apply
{
config
:=
&
pt
.
ParaNodeGroup
Config
{
Addrs
:
applyAddrs
,
Addrs
:
applyAddrs
,
Op
:
pt
.
ParacrossNodeGroupApply
,
Op
:
pt
.
ParacrossNodeGroupApply
,
}
}
...
@@ -222,7 +222,7 @@ func (suite *NodeManageTestSuite) testNodeGroupConfigQuit() {
...
@@ -222,7 +222,7 @@ func (suite *NodeManageTestSuite) testNodeGroupConfigQuit() {
receipt
:=
nodeCommit
(
suite
,
PrivKeyB
,
tx
)
receipt
:=
nodeCommit
(
suite
,
PrivKeyB
,
tx
)
checkGroupApplyReceipt
(
suite
,
receipt
)
checkGroupApplyReceipt
(
suite
,
receipt
)
config
=
&
pt
.
ParaNodeGroup
Apply
{
config
=
&
pt
.
ParaNodeGroup
Config
{
Addrs
:
applyAddrs
,
Addrs
:
applyAddrs
,
Op
:
pt
.
ParacrossNodeGroupQuit
,
Op
:
pt
.
ParacrossNodeGroupQuit
,
}
}
...
@@ -237,7 +237,7 @@ func (suite *NodeManageTestSuite) testNodeGroupConfigQuit() {
...
@@ -237,7 +237,7 @@ func (suite *NodeManageTestSuite) testNodeGroupConfigQuit() {
func
(
suite
*
NodeManageTestSuite
)
testNodeGroupConfig
()
{
func
(
suite
*
NodeManageTestSuite
)
testNodeGroupConfig
()
{
suite
.
testNodeGroupConfigQuit
()
suite
.
testNodeGroupConfigQuit
()
config
:=
&
pt
.
ParaNodeGroup
Apply
{
config
:=
&
pt
.
ParaNodeGroup
Config
{
Addrs
:
applyAddrs
,
Addrs
:
applyAddrs
,
Op
:
pt
.
ParacrossNodeGroupApply
,
Op
:
pt
.
ParacrossNodeGroupApply
,
}
}
...
@@ -247,7 +247,7 @@ func (suite *NodeManageTestSuite) testNodeGroupConfig() {
...
@@ -247,7 +247,7 @@ func (suite *NodeManageTestSuite) testNodeGroupConfig() {
receipt
:=
nodeCommit
(
suite
,
PrivKeyB
,
tx
)
receipt
:=
nodeCommit
(
suite
,
PrivKeyB
,
tx
)
checkGroupApplyReceipt
(
suite
,
receipt
)
checkGroupApplyReceipt
(
suite
,
receipt
)
config
=
&
pt
.
ParaNodeGroup
Apply
{
config
=
&
pt
.
ParaNodeGroup
Config
{
Addrs
:
applyAddrs
,
Addrs
:
applyAddrs
,
Op
:
pt
.
ParacrossNodeGroupApprove
,
Op
:
pt
.
ParacrossNodeGroupApprove
,
}
}
...
...
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