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
c0d55ff9
Commit
c0d55ff9
authored
Sep 11, 2020
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uodata
parent
a16cf9ab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
31 deletions
+40
-31
supervisionaccount.go
plugin/dapp/paracross/executor/supervisionaccount.go
+24
-3
supervisionaccount_test.go
plugin/dapp/paracross/executor/supervisionaccount_test.go
+15
-28
paracross.go
plugin/dapp/paracross/types/paracross.go
+1
-0
No files found.
plugin/dapp/paracross/executor/supervisionaccount.go
View file @
c0d55ff9
...
...
@@ -363,6 +363,27 @@ func (a *action) supervisionNodeGroupApprove(config *pt.ParaNodeAddrConfig) (*ty
return
a
.
supervisionNodeGroupApproveApply
(
config
,
id
)
}
func
makeParaSupervisionNodeGroupStatusReceipt
(
title
string
,
addr
string
,
prev
,
current
*
pt
.
ParaNodeGroupStatus
)
*
types
.
Receipt
{
key
:=
calcParaSupervisionNodeGroupStatusKey
(
title
)
log
:=
&
pt
.
ReceiptParaNodeGroupConfig
{
Addr
:
addr
,
Prev
:
prev
,
Current
:
current
,
}
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
[]
*
types
.
KeyValue
{
{
Key
:
key
,
Value
:
types
.
Encode
(
current
)},
},
Logs
:
[]
*
types
.
ReceiptLog
{
{
Ty
:
pt
.
TyLogParaSupervisionNodeGroupStatusUpdate
,
Log
:
types
.
Encode
(
log
),
},
},
}
}
func
(
a
*
action
)
supervisionNodeGroupApproveApply
(
config
*
pt
.
ParaNodeAddrConfig
,
apply
*
pt
.
ParaNodeGroupStatus
)
(
*
types
.
Receipt
,
error
)
{
err
:=
a
.
checkSupervisionNodeGroupExist
(
config
.
Title
)
if
err
!=
nil
{
...
...
@@ -383,14 +404,14 @@ func (a *action) supervisionNodeGroupApproveApply(config *pt.ParaNodeAddrConfig,
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
copyStat
:=
*
apply
apply
.
Status
=
pt
.
Paracross
NodeGroup
Approve
apply
.
Status
=
pt
.
Paracross
SupervisionNode
Approve
apply
.
Height
=
a
.
height
r
=
makeNodeGroupIDReceipt
(
a
.
fromaddr
,
&
copyStat
,
apply
)
r
=
make
Supervision
NodeGroupIDReceipt
(
a
.
fromaddr
,
&
copyStat
,
apply
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
r
=
makeParaNodeGroupStatusReceipt
(
config
.
Title
,
a
.
fromaddr
,
nil
,
apply
)
r
=
makePara
Supervision
NodeGroupStatusReceipt
(
config
.
Title
,
a
.
fromaddr
,
nil
,
apply
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
cfg
:=
a
.
api
.
GetConfig
()
...
...
plugin/dapp/paracross/executor/supervisionaccount_test.go
View file @
c0d55ff9
...
...
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/33cn/chain33/types"
pt
"github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/stretchr/testify/assert"
)
// createRawSupervisionNodeConfigTx create raw tx for node config
...
...
@@ -20,7 +21,7 @@ func createRawSupervisionNodeConfigTx(config *pt.ParaNodeAddrConfig) (*types.Tra
}
func
(
suite
*
NodeManageTestSuite
)
TestSupervisionExec
()
{
//
suite.testSupervisionNodeConfigQuit()
suite
.
testSupervisionNodeConfigQuit
()
suite
.
testSupervisionNodeConfigApprove
()
}
...
...
@@ -34,16 +35,8 @@ func (suite *NodeManageTestSuite) testSupervisionNodeConfigQuit() {
suite
.
Nil
(
err
)
receipt
:=
nodeCommit
(
suite
,
PrivKey14K
,
tx
)
fmt
.
Println
(
receipt
)
fmt
.
Println
(
receipt
.
Ty
,
int32
(
types
.
ExecOk
))
fmt
.
Println
(
receipt
.
KV
,
1
)
fmt
.
Println
(
receipt
.
Logs
,
1
)
fmt
.
Println
(
int32
(
pt
.
TyLogParaNodeGroupConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
checkSupervisionGroupApplyReceipt
(
suite
,
receipt
)
//assert.Equal(suite.T(), int32(pt.TyLogParaNodeGroupConfig), receipt.Logs[0].Ty)
//checkGroupApplyReceipt(suite, receipt)
//suite.Equal(int32(pt.TyLogParaNodeGroupConfig), receipt.Logs[0].Ty)
var
g
pt
.
ReceiptParaNodeGroupConfig
err
=
types
.
Decode
(
receipt
.
Logs
[
0
]
.
Log
,
&
g
)
suite
.
Nil
(
err
)
...
...
@@ -56,7 +49,9 @@ func (suite *NodeManageTestSuite) testSupervisionNodeConfigQuit() {
tx
,
err
=
createRawSupervisionNodeConfigTx
(
config
)
suite
.
Nil
(
err
)
nodeCommit
(
suite
,
PrivKey14K
,
tx
)
receipt
=
nodeCommit
(
suite
,
PrivKey14K
,
tx
)
fmt
.
Println
(
"***"
,
receipt
)
fmt
.
Println
(
"***"
,
receipt
.
Logs
[
0
]
.
Ty
)
}
func
(
suite
*
NodeManageTestSuite
)
testSupervisionNodeConfigApprove
()
{
...
...
@@ -69,16 +64,8 @@ func (suite *NodeManageTestSuite) testSupervisionNodeConfigApprove() {
suite
.
Nil
(
err
)
receipt
:=
nodeCommit
(
suite
,
PrivKey14K
,
tx
)
fmt
.
Println
(
receipt
)
fmt
.
Println
(
receipt
.
Ty
,
int32
(
types
.
ExecOk
))
fmt
.
Println
(
receipt
.
KV
,
1
)
fmt
.
Println
(
receipt
.
Logs
,
1
)
fmt
.
Println
(
int32
(
pt
.
TyLogParaNodeGroupConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
//assert.Equal(suite.T(), int32(pt.TyLogParaNodeGroupConfig), receipt.Logs[0].Ty)
//checkGroupApplyReceipt(suite, receipt)
checkSupervisionGroupApplyReceipt
(
suite
,
receipt
)
//suite.Equal(int32(pt.TyLogParaNodeGroupConfig), receipt.Logs[0].Ty)
var
g
pt
.
ReceiptParaNodeGroupConfig
err
=
types
.
Decode
(
receipt
.
Logs
[
0
]
.
Log
,
&
g
)
suite
.
Nil
(
err
)
...
...
@@ -91,13 +78,13 @@ func (suite *NodeManageTestSuite) testSupervisionNodeConfigApprove() {
tx
,
err
=
createRawSupervisionNodeConfigTx
(
config
)
suite
.
Nil
(
err
)
receipt
=
nodeCommit
(
suite
,
Account14K
,
tx
)
fmt
.
Println
(
receipt
)
fmt
.
Println
(
receipt
.
Ty
,
int32
(
types
.
ExecOk
))
fmt
.
Println
(
receipt
.
KV
,
1
)
fmt
.
Println
(
receipt
.
Logs
,
1
)
receipt
=
nodeCommit
(
suite
,
PrivKey14K
,
tx
)
assert
.
Equal
(
suite
.
T
(),
receipt
.
Ty
,
int32
(
types
.
ExecOk
))
}
fmt
.
Println
(
int32
(
pt
.
TyLogParaNodeGroupConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
checkGroupApproveReceipt
(
suite
,
receipt
)
func
checkSupervisionGroupApplyReceipt
(
suite
*
NodeManageTestSuite
,
receipt
*
types
.
Receipt
)
{
assert
.
Equal
(
suite
.
T
(),
receipt
.
Ty
,
int32
(
types
.
ExecOk
))
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
TyLogParaSupervisionNodeGroupConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
}
plugin/dapp/paracross/types/paracross.go
View file @
c0d55ff9
...
...
@@ -55,6 +55,7 @@ const (
TyLogParaSupervisionNodeConfig
TyLogParaSupervisionNodeStatusUpdate
TyLogParaStageSupervisionGroupUpdate
TyLogParaSupervisionNodeGroupStatusUpdate
)
// action type
...
...
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