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
cbbcbe21
Commit
cbbcbe21
authored
Jun 02, 2019
by
mdj33
Committed by
vipwzw
Jun 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ci pass
parent
d796f253
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
46 additions
and
54 deletions
+46
-54
testcase.sh
plugin/dapp/paracross/cmd/build/testcase.sh
+0
-0
paracross.go
plugin/dapp/paracross/commands/paracross.go
+0
-14
action.go
plugin/dapp/paracross/executor/action.go
+1
-1
kv.go
plugin/dapp/paracross/executor/kv.go
+14
-14
query.go
plugin/dapp/paracross/executor/query.go
+1
-1
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+21
-17
superaccount_test.go
plugin/dapp/paracross/executor/superaccount_test.go
+6
-6
paracross.go
plugin/dapp/paracross/types/paracross.go
+2
-0
type.go
plugin/dapp/paracross/types/type.go
+1
-1
No files found.
plugin/dapp/paracross/cmd/build/testcase.sh
View file @
cbbcbe21
This diff is collapsed.
Click to expand it.
plugin/dapp/paracross/commands/paracross.go
View file @
cbbcbe21
...
@@ -269,11 +269,6 @@ func createNodeTx(cmd *cobra.Command, args []string) {
...
@@ -269,11 +269,6 @@ func createNodeTx(cmd *cobra.Command, args []string) {
val
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"value"
)
val
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"value"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins_frozen"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins_frozen"
)
if
opAddr
==
""
{
fmt
.
Println
(
"addr parameter should not be null"
)
return
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Op
:
op
,
Id
:
id
,
Value
:
val
,
Addr
:
opAddr
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Op
:
op
,
Id
:
id
,
Value
:
val
,
Addr
:
opAddr
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pt
.
ParaX
),
Execer
:
types
.
ExecName
(
pt
.
ParaX
),
...
@@ -316,15 +311,6 @@ func nodeGroupApply(cmd *cobra.Command, args []string) {
...
@@ -316,15 +311,6 @@ func nodeGroupApply(cmd *cobra.Command, args []string) {
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins_frozen"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins_frozen"
)
if
op
==
0
||
op
>
3
{
fmt
.
Println
(
"operation should be one of 1:apply,2:approve,3:quit"
)
return
}
if
addrs
==
""
{
fmt
.
Println
(
"addrs should not be nil"
)
return
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Op
:
op
,
Id
:
id
,
Addrs
:
addrs
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Op
:
op
,
Id
:
id
,
Addrs
:
addrs
,
CoinsFrozen
:
int64
(
math
.
Trunc
((
coins
+
0.0000001
)
*
1e4
))
*
1e4
}
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pt
.
ParaX
),
Execer
:
types
.
ExecName
(
pt
.
ParaX
),
...
...
plugin/dapp/paracross/executor/action.go
View file @
cbbcbe21
...
@@ -419,7 +419,7 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
...
@@ -419,7 +419,7 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
}
}
haveCrossTxs
:=
len
(
commit
.
Status
.
CrossTxHashs
)
>
0
haveCrossTxs
:=
len
(
commit
.
Status
.
CrossTxHashs
)
>
0
if
types
.
IsDappFork
(
a
.
h
eight
,
pt
.
ParaX
,
pt
.
ForkCommitTx
)
&&
commit
.
Status
.
CrossTxHashs
[
0
]
==
nil
{
if
commit
.
Status
.
Height
>
0
&&
types
.
IsDappFork
(
commit
.
Status
.
MainBlockH
eight
,
pt
.
ParaX
,
pt
.
ForkCommitTx
)
&&
commit
.
Status
.
CrossTxHashs
[
0
]
==
nil
{
haveCrossTxs
=
false
haveCrossTxs
=
false
}
}
...
...
plugin/dapp/paracross/executor/kv.go
View file @
cbbcbe21
...
@@ -17,8 +17,8 @@ var (
...
@@ -17,8 +17,8 @@ var (
paraConfigNodes
string
//平行链自组织配置的nodes,最初是从manager同步过来
paraConfigNodes
string
//平行链自组织配置的nodes,最初是从manager同步过来
paraConfigNodeAddr
string
//平行链配置节点账户
paraConfigNodeAddr
string
//平行链配置节点账户
paraNodeGroupStatusAddrs
string
//正在申请的addrs
paraNodeGroupStatusAddrs
string
//正在申请的addrs
paraNodeI
d
string
paraNodeI
D
string
paraNodeGroupI
d
string
paraNodeGroupI
D
string
localTx
string
localTx
string
localTitle
string
localTitle
string
localTitleHeight
string
localTitleHeight
string
...
@@ -35,8 +35,8 @@ func setPrefix() {
...
@@ -35,8 +35,8 @@ func setPrefix() {
paraConfigNodes
=
"mavl-paracross-nodes-title-"
paraConfigNodes
=
"mavl-paracross-nodes-title-"
paraConfigNodeAddr
=
"mavl-paracross-nodes-titleAddr-"
paraConfigNodeAddr
=
"mavl-paracross-nodes-titleAddr-"
paraNodeGroupStatusAddrs
=
"mavl-paracross-nodegroup-apply-title-"
paraNodeGroupStatusAddrs
=
"mavl-paracross-nodegroup-apply-title-"
paraNodeI
d
=
"mavl-paracross-title-nodeid-"
paraNodeI
D
=
"mavl-paracross-title-nodeid-"
paraNodeGroupI
d
=
"mavl-paracross-title-nodegroupid-"
paraNodeGroupI
D
=
"mavl-paracross-title-nodegroupid-"
localTx
=
"LODB-paracross-titleHeightAddr-"
localTx
=
"LODB-paracross-titleHeightAddr-"
localTitle
=
"LODB-paracross-title-"
localTitle
=
"LODB-paracross-title-"
localTitleHeight
=
"LODB-paracross-titleHeight-"
localTitleHeight
=
"LODB-paracross-titleHeight-"
...
@@ -78,12 +78,12 @@ func calcParaNodeGroupStatusKey(title string) []byte {
...
@@ -78,12 +78,12 @@ func calcParaNodeGroupStatusKey(title string) []byte {
return
[]
byte
(
fmt
.
Sprintf
(
paraNodeGroupStatusAddrs
+
"%s"
,
title
))
return
[]
byte
(
fmt
.
Sprintf
(
paraNodeGroupStatusAddrs
+
"%s"
,
title
))
}
}
func
calcParaNodeI
d
Key
(
title
,
hash
string
)
string
{
func
calcParaNodeI
D
Key
(
title
,
hash
string
)
string
{
return
fmt
.
Sprintf
(
paraNodeI
d
+
"%s-%s"
,
title
,
hash
)
return
fmt
.
Sprintf
(
paraNodeI
D
+
"%s-%s"
,
title
,
hash
)
}
}
func
calcParaNodeGroupI
d
Key
(
title
,
hash
string
)
string
{
func
calcParaNodeGroupI
D
Key
(
title
,
hash
string
)
string
{
return
fmt
.
Sprintf
(
paraNodeGroupI
d
+
"%s-%s"
,
title
,
hash
)
return
fmt
.
Sprintf
(
paraNodeGroupI
D
+
"%s-%s"
,
title
,
hash
)
}
}
func
calcLocalTxKey
(
title
string
,
height
int64
,
addr
string
)
[]
byte
{
func
calcLocalTxKey
(
title
string
,
height
int64
,
addr
string
)
[]
byte
{
...
@@ -110,9 +110,9 @@ func calcLocalNodeStatusPrefix(title string, status int32) []byte {
...
@@ -110,9 +110,9 @@ func calcLocalNodeStatusPrefix(title string, status int32) []byte {
return
[]
byte
(
fmt
.
Sprintf
(
localNodeTitleStatus
+
"%s-%02d-"
,
title
,
status
))
return
[]
byte
(
fmt
.
Sprintf
(
localNodeTitleStatus
+
"%s-%02d-"
,
title
,
status
))
}
}
func
calcLocalNodeTitlePrefix
(
title
string
)
[]
byte
{
//
func calcLocalNodeTitlePrefix(title string) []byte {
return
[]
byte
(
fmt
.
Sprintf
(
localNodeTitleStatus
+
"%s-"
,
title
))
//
return []byte(fmt.Sprintf(localNodeTitleStatus+"%s-", title))
}
//
}
func
calcLocalNodeTitleDone
(
title
,
addr
string
)
[]
byte
{
func
calcLocalNodeTitleDone
(
title
,
addr
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localNodeTitleDone
+
"%s-%s"
,
title
,
addr
))
return
[]
byte
(
fmt
.
Sprintf
(
localNodeTitleDone
+
"%s-%s"
,
title
,
addr
))
...
@@ -126,6 +126,6 @@ func calcLocalNodeGroupStatusPrefix(status int32) []byte {
...
@@ -126,6 +126,6 @@ func calcLocalNodeGroupStatusPrefix(status int32) []byte {
return
[]
byte
(
fmt
.
Sprintf
(
localNodeGroupStatusTitle
+
"%02d-"
,
status
))
return
[]
byte
(
fmt
.
Sprintf
(
localNodeGroupStatusTitle
+
"%02d-"
,
status
))
}
}
func
calcLocalNodeGroupAllPrefix
()
[]
byte
{
//
func calcLocalNodeGroupAllPrefix() []byte {
return
[]
byte
(
fmt
.
Sprintf
(
localNodeGroupStatusTitle
))
//
return []byte(fmt.Sprintf(localNodeGroupStatusTitle))
}
//
}
plugin/dapp/paracross/executor/query.go
View file @
cbbcbe21
...
@@ -89,7 +89,7 @@ func (p *Paracross) Query_GetNodeAddrInfo(in *pt.ReqParacrossNodeInfo) (types.Me
...
@@ -89,7 +89,7 @@ func (p *Paracross) Query_GetNodeAddrInfo(in *pt.ReqParacrossNodeInfo) (types.Me
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
stat
,
err
:=
getNodeI
d
(
p
.
GetStateDB
(),
addrStat
.
ProposalId
)
stat
,
err
:=
getNodeI
D
(
p
.
GetStateDB
(),
addrStat
.
ProposalId
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
plugin/dapp/paracross/executor/superaccount.go
View file @
cbbcbe21
...
@@ -46,7 +46,7 @@ func getNodeAddr(db dbm.KV, title, addr string) (*pt.ParaNodeAddrIdStatus, error
...
@@ -46,7 +46,7 @@ func getNodeAddr(db dbm.KV, title, addr string) (*pt.ParaNodeAddrIdStatus, error
return
&
status
,
err
return
&
status
,
err
}
}
func
getNodeI
d
(
db
dbm
.
KV
,
id
string
)
(
*
pt
.
ParaNodeIdStatus
,
error
)
{
func
getNodeI
D
(
db
dbm
.
KV
,
id
string
)
(
*
pt
.
ParaNodeIdStatus
,
error
)
{
val
,
err
:=
getDb
(
db
,
[]
byte
(
id
))
val
,
err
:=
getDb
(
db
,
[]
byte
(
id
))
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -77,7 +77,7 @@ func getDb(db dbm.KV, key []byte) ([]byte, error) {
...
@@ -77,7 +77,7 @@ func getDb(db dbm.KV, key []byte) ([]byte, error) {
return
val
,
nil
return
val
,
nil
}
}
func
getNodeGroupI
d
(
db
dbm
.
KV
,
id
string
)
(
*
pt
.
ParaNodeGroupStatus
,
error
)
{
func
getNodeGroupI
D
(
db
dbm
.
KV
,
id
string
)
(
*
pt
.
ParaNodeGroupStatus
,
error
)
{
val
,
err
:=
getDb
(
db
,
[]
byte
(
id
))
val
,
err
:=
getDb
(
db
,
[]
byte
(
id
))
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -135,7 +135,7 @@ func makeNodeConfigReceipt(fromAddr string, config *pt.ParaNodeAddrConfig, prev,
...
@@ -135,7 +135,7 @@ func makeNodeConfigReceipt(fromAddr string, config *pt.ParaNodeAddrConfig, prev,
}
}
}
}
func
makeNodeGroupI
d
Receipt
(
addr
string
,
prev
,
current
*
pt
.
ParaNodeGroupStatus
)
*
types
.
Receipt
{
func
makeNodeGroupI
D
Receipt
(
addr
string
,
prev
,
current
*
pt
.
ParaNodeGroupStatus
)
*
types
.
Receipt
{
log
:=
&
pt
.
ReceiptParaNodeGroupConfig
{
log
:=
&
pt
.
ReceiptParaNodeGroupConfig
{
Addr
:
addr
,
Addr
:
addr
,
Prev
:
prev
,
Prev
:
prev
,
...
@@ -230,7 +230,7 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
...
@@ -230,7 +230,7 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
}
}
clog
.
Info
(
"first time add node addr"
,
"title"
,
config
.
Title
,
"addr"
,
config
.
Addr
)
clog
.
Info
(
"first time add node addr"
,
"title"
,
config
.
Title
,
"addr"
,
config
.
Addr
)
stat
:=
&
pt
.
ParaNodeIdStatus
{
stat
:=
&
pt
.
ParaNodeIdStatus
{
Id
:
calcParaNodeI
d
Key
(
config
.
Title
,
common
.
ToHex
(
a
.
txhash
)),
Id
:
calcParaNodeI
D
Key
(
config
.
Title
,
common
.
ToHex
(
a
.
txhash
)),
Status
:
pt
.
ParacrossNodeJoining
,
Status
:
pt
.
ParacrossNodeJoining
,
Title
:
config
.
Title
,
Title
:
config
.
Title
,
TargetAddr
:
config
.
Addr
,
TargetAddr
:
config
.
Addr
,
...
@@ -243,7 +243,11 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
...
@@ -243,7 +243,11 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
return
receipt
,
nil
return
receipt
,
nil
}
}
stat
,
err
:=
getNodeId
(
a
.
db
,
addrStat
.
ProposalId
)
stat
,
err
:=
getNodeID
(
a
.
db
,
addrStat
.
ProposalId
)
if
err
!=
nil
{
clog
.
Error
(
"nodeaccount.getNodeID fail"
,
"err"
,
err
.
Error
())
return
nil
,
err
}
var
copyStat
pt
.
ParaNodeIdStatus
var
copyStat
pt
.
ParaNodeIdStatus
err
=
deepCopy
(
&
copyStat
,
stat
)
err
=
deepCopy
(
&
copyStat
,
stat
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -252,7 +256,7 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
...
@@ -252,7 +256,7 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
}
}
if
stat
.
Status
==
pt
.
ParacrossNodeQuited
{
if
stat
.
Status
==
pt
.
ParacrossNodeQuited
{
stat
=
&
pt
.
ParaNodeIdStatus
{
stat
=
&
pt
.
ParaNodeIdStatus
{
Id
:
calcParaNodeI
d
Key
(
config
.
Title
,
common
.
ToHex
(
a
.
txhash
)),
Id
:
calcParaNodeI
D
Key
(
config
.
Title
,
common
.
ToHex
(
a
.
txhash
)),
Status
:
pt
.
ParacrossNodeJoining
,
Status
:
pt
.
ParacrossNodeJoining
,
Title
:
config
.
Title
,
Title
:
config
.
Title
,
TargetAddr
:
config
.
Addr
,
TargetAddr
:
config
.
Addr
,
...
@@ -271,7 +275,7 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
...
@@ -271,7 +275,7 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
}
}
func
(
a
*
action
)
nodeQuit
(
config
*
pt
.
ParaNodeAddrConfig
)
(
*
types
.
Receipt
,
error
)
{
func
(
a
*
action
)
nodeQuit
(
config
*
pt
.
ParaNodeAddrConfig
)
(
*
types
.
Receipt
,
error
)
{
stat
,
err
:=
getNodeI
d
(
a
.
db
,
config
.
Id
)
stat
,
err
:=
getNodeI
D
(
a
.
db
,
config
.
Id
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -404,7 +408,7 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
...
@@ -404,7 +408,7 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
return
nil
,
errors
.
Wrapf
(
pt
.
ErrNodeNotForTheTitle
,
"not validNode:%s"
,
a
.
fromaddr
)
return
nil
,
errors
.
Wrapf
(
pt
.
ErrNodeNotForTheTitle
,
"not validNode:%s"
,
a
.
fromaddr
)
}
}
stat
,
err
:=
getNodeI
d
(
a
.
db
,
config
.
Id
)
stat
,
err
:=
getNodeI
D
(
a
.
db
,
config
.
Id
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -657,7 +661,7 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt,
...
@@ -657,7 +661,7 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt,
}
}
stat
:=
&
pt
.
ParaNodeGroupStatus
{
stat
:=
&
pt
.
ParaNodeGroupStatus
{
Id
:
calcParaNodeGroupI
d
Key
(
config
.
Title
,
common
.
ToHex
(
a
.
txhash
)),
Id
:
calcParaNodeGroupI
D
Key
(
config
.
Title
,
common
.
ToHex
(
a
.
txhash
)),
Status
:
pt
.
ParacrossNodeGroupApply
,
Status
:
pt
.
ParacrossNodeGroupApply
,
Title
:
config
.
Title
,
Title
:
config
.
Title
,
TargetAddrs
:
strings
.
Join
(
addrs
,
","
),
TargetAddrs
:
strings
.
Join
(
addrs
,
","
),
...
@@ -665,7 +669,7 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt,
...
@@ -665,7 +669,7 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt,
MainHeight
:
a
.
exec
.
GetMainHeight
(),
MainHeight
:
a
.
exec
.
GetMainHeight
(),
EmptyBlockInterval
:
config
.
EmptyBlockInterval
,
EmptyBlockInterval
:
config
.
EmptyBlockInterval
,
FromAddr
:
a
.
fromaddr
}
FromAddr
:
a
.
fromaddr
}
r
:=
makeNodeGroupI
d
Receipt
(
a
.
fromaddr
,
nil
,
stat
)
r
:=
makeNodeGroupI
D
Receipt
(
a
.
fromaddr
,
nil
,
stat
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
...
@@ -675,13 +679,13 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt,
...
@@ -675,13 +679,13 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt,
func
(
a
*
action
)
nodeGroupModify
(
config
*
pt
.
ParaNodeGroupConfig
)
(
*
types
.
Receipt
,
error
)
{
func
(
a
*
action
)
nodeGroupModify
(
config
*
pt
.
ParaNodeGroupConfig
)
(
*
types
.
Receipt
,
error
)
{
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
stat
:=
&
pt
.
ParaNodeGroupStatus
{
stat
:=
&
pt
.
ParaNodeGroupStatus
{
Id
:
calcParaNodeGroupI
d
Key
(
config
.
Title
,
common
.
ToHex
(
a
.
txhash
)),
Id
:
calcParaNodeGroupI
D
Key
(
config
.
Title
,
common
.
ToHex
(
a
.
txhash
)),
Status
:
pt
.
ParacrossNodeGroupModify
,
Status
:
pt
.
ParacrossNodeGroupModify
,
Title
:
config
.
Title
,
Title
:
config
.
Title
,
CoinsFrozen
:
config
.
CoinsFrozen
,
CoinsFrozen
:
config
.
CoinsFrozen
,
MainHeight
:
a
.
exec
.
GetMainHeight
(),
MainHeight
:
a
.
exec
.
GetMainHeight
(),
EmptyBlockInterval
:
config
.
EmptyBlockInterval
}
EmptyBlockInterval
:
config
.
EmptyBlockInterval
}
r
:=
makeNodeGroupI
d
Receipt
(
a
.
fromaddr
,
nil
,
stat
)
r
:=
makeNodeGroupI
D
Receipt
(
a
.
fromaddr
,
nil
,
stat
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
...
@@ -689,7 +693,7 @@ func (a *action) nodeGroupModify(config *pt.ParaNodeGroupConfig) (*types.Receipt
...
@@ -689,7 +693,7 @@ func (a *action) nodeGroupModify(config *pt.ParaNodeGroupConfig) (*types.Receipt
}
}
func
(
a
*
action
)
nodeGroupQuit
(
config
*
pt
.
ParaNodeGroupConfig
)
(
*
types
.
Receipt
,
error
)
{
func
(
a
*
action
)
nodeGroupQuit
(
config
*
pt
.
ParaNodeGroupConfig
)
(
*
types
.
Receipt
,
error
)
{
status
,
err
:=
getNodeGroupI
d
(
a
.
db
,
config
.
Id
)
status
,
err
:=
getNodeGroupI
D
(
a
.
db
,
config
.
Id
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -720,7 +724,7 @@ func (a *action) nodeGroupQuit(config *pt.ParaNodeGroupConfig) (*types.Receipt,
...
@@ -720,7 +724,7 @@ func (a *action) nodeGroupQuit(config *pt.ParaNodeGroupConfig) (*types.Receipt,
copyStat
:=
*
status
copyStat
:=
*
status
status
.
Status
=
pt
.
ParacrossNodeGroupQuit
status
.
Status
=
pt
.
ParacrossNodeGroupQuit
r
:=
makeNodeGroupI
d
Receipt
(
a
.
fromaddr
,
&
copyStat
,
status
)
r
:=
makeNodeGroupI
D
Receipt
(
a
.
fromaddr
,
&
copyStat
,
status
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
...
@@ -743,7 +747,7 @@ func (a *action) nodeGroupApproveModify(config *pt.ParaNodeGroupConfig, modify *
...
@@ -743,7 +747,7 @@ func (a *action) nodeGroupApproveModify(config *pt.ParaNodeGroupConfig, modify *
copyModify
:=
*
modify
copyModify
:=
*
modify
modify
.
Status
=
pt
.
ParacrossNodeGroupApprove
modify
.
Status
=
pt
.
ParacrossNodeGroupApprove
r
:=
makeNodeGroupI
d
Receipt
(
a
.
fromaddr
,
&
copyModify
,
modify
)
r
:=
makeNodeGroupI
D
Receipt
(
a
.
fromaddr
,
&
copyModify
,
modify
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
...
@@ -784,7 +788,7 @@ func (a *action) nodeGroupApproveApply(config *pt.ParaNodeGroupConfig, apply *pt
...
@@ -784,7 +788,7 @@ func (a *action) nodeGroupApproveApply(config *pt.ParaNodeGroupConfig, apply *pt
apply
.
Status
=
pt
.
ParacrossNodeGroupApprove
apply
.
Status
=
pt
.
ParacrossNodeGroupApprove
apply
.
MainHeight
=
a
.
exec
.
GetMainHeight
()
apply
.
MainHeight
=
a
.
exec
.
GetMainHeight
()
r
=
makeNodeGroupI
d
Receipt
(
a
.
fromaddr
,
&
copyStat
,
apply
)
r
=
makeNodeGroupI
D
Receipt
(
a
.
fromaddr
,
&
copyStat
,
apply
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
receipt
.
Logs
=
append
(
receipt
.
Logs
,
r
.
Logs
...
)
...
@@ -803,7 +807,7 @@ func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receip
...
@@ -803,7 +807,7 @@ func (a *action) nodeGroupApprove(config *pt.ParaNodeGroupConfig) (*types.Receip
return
nil
,
types
.
ErrNotAllow
return
nil
,
types
.
ErrNotAllow
}
}
id
,
err
:=
getNodeGroupI
d
(
a
.
db
,
config
.
Id
)
id
,
err
:=
getNodeGroupI
D
(
a
.
db
,
config
.
Id
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
plugin/dapp/paracross/executor/superaccount_test.go
View file @
cbbcbe21
...
@@ -104,7 +104,7 @@ func checkGroupApplyReceipt(suite *NodeManageTestSuite, receipt *types.Receipt)
...
@@ -104,7 +104,7 @@ func checkGroupApplyReceipt(suite *NodeManageTestSuite, receipt *types.Receipt)
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
var
stat
pt
.
ParaNode
Addr
Status
var
stat
pt
.
ParaNode
Id
Status
err
:=
types
.
Decode
(
receipt
.
KV
[
0
]
.
Value
,
&
stat
)
err
:=
types
.
Decode
(
receipt
.
KV
[
0
]
.
Value
,
&
stat
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
//suite.T().Log("titleHeight", titleHeight)
//suite.T().Log("titleHeight", titleHeight)
...
@@ -120,7 +120,7 @@ func checkGroupApproveReceipt(suite *NodeManageTestSuite, receipt *types.Receipt
...
@@ -120,7 +120,7 @@ func checkGroupApproveReceipt(suite *NodeManageTestSuite, receipt *types.Receipt
len
:=
len
(
receipt
.
KV
)
len
:=
len
(
receipt
.
KV
)
var
stat
pt
.
ParaNode
Addr
Status
var
stat
pt
.
ParaNode
Id
Status
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"
)
//suite.T().Log("titleHeight", titleHeight)
//suite.T().Log("titleHeight", titleHeight)
...
@@ -134,7 +134,7 @@ func checkJoinReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) {
...
@@ -134,7 +134,7 @@ func checkJoinReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) {
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
var
stat
pt
.
ParaNode
Addr
Status
var
stat
pt
.
ParaNode
Id
Status
err
:=
types
.
Decode
(
receipt
.
KV
[
0
]
.
Value
,
&
stat
)
err
:=
types
.
Decode
(
receipt
.
KV
[
0
]
.
Value
,
&
stat
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
//suite.T().Log("titleHeight", titleHeight)
//suite.T().Log("titleHeight", titleHeight)
...
@@ -149,7 +149,7 @@ func checkQuitReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) {
...
@@ -149,7 +149,7 @@ func checkQuitReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) {
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
var
stat
pt
.
ParaNode
Addr
Status
var
stat
pt
.
ParaNode
Id
Status
err
:=
types
.
Decode
(
receipt
.
KV
[
0
]
.
Value
,
&
stat
)
err
:=
types
.
Decode
(
receipt
.
KV
[
0
]
.
Value
,
&
stat
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
//suite.T().Log("titleHeight", titleHeight)
//suite.T().Log("titleHeight", titleHeight)
...
@@ -164,7 +164,7 @@ func checkVoteReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, count
...
@@ -164,7 +164,7 @@ func checkVoteReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, count
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
var
stat
pt
.
ParaNode
Addr
Status
var
stat
pt
.
ParaNode
Id
Status
err
:=
types
.
Decode
(
receipt
.
KV
[
0
]
.
Value
,
&
stat
)
err
:=
types
.
Decode
(
receipt
.
KV
[
0
]
.
Value
,
&
stat
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
assert
.
Len
(
suite
.
T
(),
stat
.
Votes
.
Votes
,
count
)
assert
.
Len
(
suite
.
T
(),
stat
.
Votes
.
Votes
,
count
)
...
@@ -176,7 +176,7 @@ func checkVoteDoneReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, co
...
@@ -176,7 +176,7 @@ func checkVoteDoneReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, co
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
2
)
assert
.
Len
(
suite
.
T
(),
receipt
.
KV
,
2
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
3
)
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
3
)
var
stat
pt
.
ParaNode
Addr
Status
var
stat
pt
.
ParaNode
Id
Status
err
:=
types
.
Decode
(
receipt
.
KV
[
0
]
.
Value
,
&
stat
)
err
:=
types
.
Decode
(
receipt
.
KV
[
0
]
.
Value
,
&
stat
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
assert
.
Len
(
suite
.
T
(),
stat
.
Votes
.
Votes
,
count
)
assert
.
Len
(
suite
.
T
(),
stat
.
Votes
.
Votes
,
count
)
...
...
plugin/dapp/paracross/types/paracross.go
View file @
cbbcbe21
...
@@ -94,6 +94,7 @@ const (
...
@@ -94,6 +94,7 @@ const (
ParaNodeQuit
ParaNodeQuit
)
)
// node vote op
const
(
const
(
ParaNodeVoteInvalid
=
iota
ParaNodeVoteInvalid
=
iota
ParaNodeVoteYes
ParaNodeVoteYes
...
@@ -101,6 +102,7 @@ const (
...
@@ -101,6 +102,7 @@ const (
ParaNodeVoteEnd
ParaNodeVoteEnd
)
)
// ParaNodeVoteStr
var
ParaNodeVoteStr
=
[]
string
{
"invalid"
,
"yes"
,
"no"
}
var
ParaNodeVoteStr
=
[]
string
{
"invalid"
,
"yes"
,
"no"
}
const
(
const
(
...
...
plugin/dapp/paracross/types/type.go
View file @
cbbcbe21
...
@@ -64,7 +64,7 @@ func (p *ParacrossType) GetLogMap() map[int64]*types.LogInfo {
...
@@ -64,7 +64,7 @@ func (p *ParacrossType) GetLogMap() map[int64]*types.LogInfo {
TyLogParaNodeConfig
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeConfig
{}),
Name
:
"LogParaNodeConfig"
},
TyLogParaNodeConfig
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeConfig
{}),
Name
:
"LogParaNodeConfig"
},
TyLogParaNodeGroupAddrsUpdate
:
{
Ty
:
reflect
.
TypeOf
(
types
.
ReceiptConfig
{}),
Name
:
"LogParaNodeGroupAddrsUpdate"
},
TyLogParaNodeGroupAddrsUpdate
:
{
Ty
:
reflect
.
TypeOf
(
types
.
ReceiptConfig
{}),
Name
:
"LogParaNodeGroupAddrsUpdate"
},
TyLogParaNodeVoteDone
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeVoteDone
{}),
Name
:
"LogParaNodeVoteDone"
},
TyLogParaNodeVoteDone
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeVoteDone
{}),
Name
:
"LogParaNodeVoteDone"
},
TyLogParaNodeGroupConfig
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeGroupConfig
{}),
Name
:
"LogParaNodeGroup
Apply
"
},
TyLogParaNodeGroupConfig
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeGroupConfig
{}),
Name
:
"LogParaNodeGroup
Config
"
},
TyLogParaNodeGroupStatusUpdate
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeGroupConfig
{}),
Name
:
"LogParaNodeGroupStatusUpdate"
},
TyLogParaNodeGroupStatusUpdate
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeGroupConfig
{}),
Name
:
"LogParaNodeGroupStatusUpdate"
},
}
}
}
}
...
...
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