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
09f609fb
Commit
09f609fb
authored
Jun 02, 2019
by
mdj33
Committed by
vipwzw
Jun 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify nodegroup and node
parent
dd78db9e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
84 additions
and
67 deletions
+84
-67
paracross.go
plugin/dapp/paracross/commands/paracross.go
+15
-19
action.go
plugin/dapp/paracross/executor/action.go
+6
-1
exec_del_local.go
plugin/dapp/paracross/executor/exec_del_local.go
+5
-6
exec_local.go
plugin/dapp/paracross/executor/exec_local.go
+5
-6
kv.go
plugin/dapp/paracross/executor/kv.go
+14
-6
query.go
plugin/dapp/paracross/executor/query.go
+6
-2
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+0
-0
superaccount_test.go
plugin/dapp/paracross/executor/superaccount_test.go
+2
-2
paracross.proto
plugin/dapp/paracross/proto/paracross.proto
+14
-10
rpc.go
plugin/dapp/paracross/rpc/rpc.go
+2
-2
paracross.go
plugin/dapp/paracross/types/paracross.go
+14
-9
type.go
plugin/dapp/paracross/types/type.go
+1
-4
No files found.
plugin/dapp/paracross/commands/paracross.go
View file @
09f609fb
...
...
@@ -251,36 +251,30 @@ func CreateRawNodeManageCmd() *cobra.Command {
}
func
addNodeManageFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"operation"
,
"o"
,
""
,
"operation:join,quit,vote
"
)
cmd
.
Flags
()
.
Uint32P
(
"operation"
,
"o"
,
0
,
"operation:1:join,2:vote,3:quit
"
)
cmd
.
MarkFlagRequired
(
"operation"
)
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"operating target addr"
)
cmd
.
MarkFlagRequired
(
"addrs"
)
cmd
.
Flags
()
.
StringP
(
"value"
,
"v"
,
""
,
"vote value: yes,no"
)
cmd
.
Flags
()
.
Float64P
(
"coins_frozen"
,
"c"
,
0
,
"join to frozen coins amount, not less config"
)
cmd
.
Flags
()
.
StringP
(
"id"
,
"i"
,
""
,
"operating target id"
)
cmd
.
Flags
()
.
Uint32P
(
"value"
,
"v"
,
1
,
"vote value: 1:yes,2:no"
)
cmd
.
Flags
()
.
Float64P
(
"coins_frozen"
,
"c"
,
0
,
"frozen coins amount, should not less nodegroup's"
)
}
func
createNodeTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
op
,
_
:=
cmd
.
Flags
()
.
Get
String
(
"operation"
)
op
,
_
:=
cmd
.
Flags
()
.
Get
Uint32
(
"operation"
)
opAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
val
,
_
:=
cmd
.
Flags
()
.
GetString
(
"value"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
val
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"value"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins_frozen"
)
if
op
!=
"vote"
&&
op
!=
"quit"
&&
op
!=
"join"
{
fmt
.
Println
(
"operation should be one of join,quit,vote"
)
return
}
if
opAddr
==
""
{
fmt
.
Println
(
"addr parameter should not be null"
)
return
}
if
op
==
"vote"
&&
(
val
!=
"yes"
&&
val
!=
"no"
)
{
fmt
.
Println
(
"vote operation value parameter require yes or no value"
)
return
}
payload
:=
&
pt
.
ParaNodeAddrConfig
{
Op
:
op
,
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
{
Execer
:
types
.
ExecName
(
pt
.
ParaX
),
ActionName
:
"NodeConfig"
,
...
...
@@ -305,11 +299,12 @@ func CreateNodeGroupApplyCmd() *cobra.Command {
}
func
addNodeGroupApplyCmdFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
Uint32P
(
"operation"
,
"o"
,
0
,
"operation:1:apply,2:approve,3:quit"
)
cmd
.
Flags
()
.
Uint32P
(
"operation"
,
"o"
,
0
,
"operation:1:apply,2:approve,3:quit
,4:modify
"
)
cmd
.
MarkFlagRequired
(
"operation"
)
cmd
.
Flags
()
.
StringP
(
"id"
,
"i"
,
""
,
"apply id for nodegroup "
)
cmd
.
Flags
()
.
StringP
(
"addrs"
,
"a"
,
""
,
"addrs apply for super node,split by ',' "
)
cmd
.
MarkFlagRequired
(
"addrs"
)
cmd
.
Flags
()
.
Float64P
(
"coins_frozen"
,
"c"
,
0
,
"coins amount to frozen, not less config"
)
...
...
@@ -318,6 +313,7 @@ func addNodeGroupApplyCmdFlags(cmd *cobra.Command) {
func
nodeGroupApply
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
op
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"operation"
)
addrs
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addrs"
)
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
coins
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"coins_frozen"
)
if
op
==
0
||
op
>
3
{
...
...
@@ -329,7 +325,7 @@ func nodeGroupApply(cmd *cobra.Command, args []string) {
return
}
payload
:=
&
pt
.
ParaNodeGroupConfig
{
Op
:
op
,
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
{
Execer
:
types
.
ExecName
(
pt
.
ParaX
),
ActionName
:
"NodeGroupConfig"
,
...
...
@@ -499,7 +495,7 @@ func nodeInfo(cmd *cobra.Command, args []string) {
Title
:
title
,
Addr
:
addr
,
}
var
res
pt
.
ParaNode
Addr
Status
var
res
pt
.
ParaNode
Id
Status
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"paracross.GetNodeStatus"
,
params
,
&
res
)
ctx
.
Run
()
}
...
...
plugin/dapp/paracross/executor/action.go
View file @
09f609fb
...
...
@@ -418,7 +418,12 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
return
receipt
,
nil
}
if
enableParacrossTransfer
&&
commit
.
Status
.
Height
>
0
&&
len
(
commit
.
Status
.
CrossTxHashs
)
>
0
{
haveCrossTxs
:=
len
(
commit
.
Status
.
CrossTxHashs
)
>
0
if
types
.
IsDappFork
(
a
.
height
,
pt
.
ParaX
,
pt
.
ForkCommitTx
)
&&
commit
.
Status
.
CrossTxHashs
[
0
]
==
nil
{
haveCrossTxs
=
false
}
if
enableParacrossTransfer
&&
commit
.
Status
.
Height
>
0
&&
haveCrossTxs
{
clog
.
Debug
(
"paracross.Commit commitDone"
,
"do cross"
,
""
)
crossTxReceipt
,
err
:=
a
.
execCrossTxs
(
commit
)
if
err
!=
nil
{
...
...
plugin/dapp/paracross/executor/exec_del_local.go
View file @
09f609fb
...
...
@@ -64,11 +64,11 @@ func (e *Paracross) ExecDelLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx *
}
if
g
.
Prev
!=
nil
{
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeTitleStatus
(
g
.
Current
.
Title
,
g
.
Current
.
ApplyAddr
,
g
.
Prev
.
Status
),
Value
:
types
.
Encode
(
g
.
Prev
)})
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
.
ApplyAddr
,
g
.
Current
.
Status
),
Value
:
nil
})
Key
:
calcLocalNodeTitleStatus
(
g
.
Current
.
Title
,
g
.
Current
.
Status
,
g
.
Current
.
Id
),
Value
:
nil
})
}
else
if
log
.
Ty
==
pt
.
TyLogParaNodeVoteDone
{
var
g
pt
.
ReceiptParaNodeVoteDone
err
:=
types
.
Decode
(
log
.
Log
,
&
g
)
...
...
@@ -86,8 +86,7 @@ func (e *Paracross) ExecDelLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx *
func
(
e
*
Paracross
)
ExecDelLocal_NodeGroupConfig
(
payload
*
pt
.
ParaNodeGroupConfig
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
var
set
types
.
LocalDBSet
for
_
,
log
:=
range
receiptData
.
Logs
{
if
log
.
Ty
==
pt
.
TyLogParaNodeGroupApply
||
log
.
Ty
==
pt
.
TyLogParaNodeGroupApprove
||
log
.
Ty
==
pt
.
TyLogParaNodeGroupQuit
{
if
log
.
Ty
==
pt
.
TyLogParaNodeGroupConfig
{
var
g
pt
.
ReceiptParaNodeGroupConfig
err
:=
types
.
Decode
(
log
.
Log
,
&
g
)
if
err
!=
nil
{
...
...
@@ -95,11 +94,11 @@ func (e *Paracross) ExecDelLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig
}
if
g
.
Prev
!=
nil
{
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeGroupStatusTitle
(
g
.
Prev
.
Status
,
g
.
Current
.
Title
),
Value
:
types
.
Encode
(
g
.
Prev
)})
Key
:
calcLocalNodeGroupStatusTitle
(
g
.
Prev
.
Status
,
g
.
Current
.
Title
,
g
.
Current
.
Id
),
Value
:
types
.
Encode
(
g
.
Prev
)})
}
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeGroupStatusTitle
(
g
.
Current
.
Status
,
g
.
Current
.
Title
),
Value
:
nil
})
Key
:
calcLocalNodeGroupStatusTitle
(
g
.
Current
.
Status
,
g
.
Current
.
Title
,
g
.
Current
.
Id
),
Value
:
nil
})
}
}
return
&
set
,
nil
...
...
plugin/dapp/paracross/executor/exec_local.go
View file @
09f609fb
...
...
@@ -67,11 +67,11 @@ func (e *Paracross) ExecLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx *typ
}
if
g
.
Prev
!=
nil
{
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeTitleStatus
(
g
.
Current
.
Title
,
g
.
Current
.
ApplyAddr
,
g
.
Prev
.
Status
),
Value
:
nil
})
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
.
ApplyAddr
,
g
.
Current
.
Status
),
Key
:
calcLocalNodeTitleStatus
(
g
.
Current
.
Title
,
g
.
Current
.
Status
,
g
.
Current
.
Id
),
Value
:
types
.
Encode
(
g
.
Current
)})
}
else
if
log
.
Ty
==
pt
.
TyLogParaNodeVoteDone
{
var
g
pt
.
ReceiptParaNodeVoteDone
...
...
@@ -90,8 +90,7 @@ func (e *Paracross) ExecLocal_NodeConfig(payload *pt.ParaNodeAddrConfig, tx *typ
func
(
e
*
Paracross
)
ExecLocal_NodeGroupConfig
(
payload
*
pt
.
ParaNodeGroupConfig
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
var
set
types
.
LocalDBSet
for
_
,
log
:=
range
receiptData
.
Logs
{
if
log
.
Ty
==
pt
.
TyLogParaNodeGroupApply
||
log
.
Ty
==
pt
.
TyLogParaNodeGroupApprove
||
log
.
Ty
==
pt
.
TyLogParaNodeGroupQuit
||
log
.
Ty
==
pt
.
TyLogParaNodeGroupModify
{
if
log
.
Ty
==
pt
.
TyLogParaNodeGroupConfig
{
var
g
pt
.
ReceiptParaNodeGroupConfig
err
:=
types
.
Decode
(
log
.
Log
,
&
g
)
if
err
!=
nil
{
...
...
@@ -99,11 +98,11 @@ func (e *Paracross) ExecLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig, t
}
if
g
.
Prev
!=
nil
{
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeGroupStatusTitle
(
g
.
Prev
.
Status
,
g
.
Current
.
Title
),
Value
:
nil
})
Key
:
calcLocalNodeGroupStatusTitle
(
g
.
Prev
.
Status
,
g
.
Current
.
Title
,
g
.
Current
.
Id
),
Value
:
nil
})
}
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
calcLocalNodeGroupStatusTitle
(
g
.
Current
.
Status
,
g
.
Current
.
Title
),
Value
:
types
.
Encode
(
g
.
Current
)})
Key
:
calcLocalNodeGroupStatusTitle
(
g
.
Current
.
Status
,
g
.
Current
.
Title
,
g
.
Current
.
Id
),
Value
:
types
.
Encode
(
g
.
Current
)})
}
}
return
&
set
,
nil
...
...
plugin/dapp/paracross/executor/kv.go
View file @
09f609fb
...
...
@@ -102,22 +102,30 @@ func calcLocalAssetKey(hash []byte) []byte {
return
[]
byte
(
fmt
.
Sprintf
(
localAssetKey
+
"%s"
,
hash
))
}
func
calcLocalNodeTitleStatus
(
title
,
addr
string
,
status
int32
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localNodeTitleStatus
+
"%s-%02d-%s"
,
title
,
status
,
addr
))
func
calcLocalNodeTitleStatus
(
title
string
,
status
int32
,
id
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localNodeTitleStatus
+
"%s-%02d-%s"
,
title
,
status
,
id
))
}
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
{
return
[]
byte
(
fmt
.
Sprintf
(
localNodeTitleStatus
+
"%s-"
,
title
))
}
func
calcLocalNodeTitleDone
(
title
,
addr
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localNodeTitleDone
+
"%s-%s"
,
title
,
addr
))
}
func
calcLocalNodeGroupStatusTitle
(
status
int32
,
title
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localNodeGroupStatusTitle
+
"%02d-%s
"
,
status
,
title
))
func
calcLocalNodeGroupStatusTitle
(
status
int32
,
title
,
id
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localNodeGroupStatusTitle
+
"%02d-%s
-%s"
,
status
,
title
,
id
))
}
func
calcLocalNodeGroupStatusPrefix
(
status
int32
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localNodeGroupStatusTitle
+
"%02d"
,
status
))
return
[]
byte
(
fmt
.
Sprintf
(
localNodeGroupStatusTitle
+
"%02d-"
,
status
))
}
func
calcLocalNodeGroupAllPrefix
()
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localNodeGroupStatusTitle
))
}
plugin/dapp/paracross/executor/query.go
View file @
09f609fb
...
...
@@ -85,7 +85,11 @@ func (p *Paracross) Query_GetNodeAddrInfo(in *pt.ReqParacrossNodeInfo) (types.Me
if
in
==
nil
||
in
.
Title
==
""
||
in
.
Addr
==
""
{
return
nil
,
types
.
ErrInvalidParam
}
stat
,
err
:=
getNodeAddr
(
p
.
GetStateDB
(),
in
.
Title
,
in
.
Addr
)
addrStat
,
err
:=
getNodeAddr
(
p
.
GetStateDB
(),
in
.
Title
,
in
.
Addr
)
if
err
!=
nil
{
return
nil
,
err
}
stat
,
err
:=
getNodeId
(
p
.
GetStateDB
(),
addrStat
.
ProposalId
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -230,7 +234,7 @@ func listNodeStatus(db dbm.KVDB, prefix []byte) (types.Message, error) {
var
resp
pt
.
RespParacrossNodeAddrs
for
_
,
r
:=
range
res
{
var
st
pt
.
ParaNode
Addr
Status
var
st
pt
.
ParaNode
Id
Status
err
=
types
.
Decode
(
r
,
&
st
)
if
err
!=
nil
{
panic
(
err
)
...
...
plugin/dapp/paracross/executor/superaccount.go
View file @
09f609fb
This diff is collapsed.
Click to expand it.
plugin/dapp/paracross/executor/superaccount_test.go
View file @
09f609fb
...
...
@@ -108,7 +108,7 @@ func checkGroupApplyReceipt(suite *NodeManageTestSuite, receipt *types.Receipt)
err
:=
types
.
Decode
(
receipt
.
KV
[
0
]
.
Value
,
&
stat
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
//suite.T().Log("titleHeight", titleHeight)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
TyLogParaNodeGroup
Apply
),
receipt
.
Logs
[
0
]
.
Ty
)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
TyLogParaNodeGroup
Config
),
receipt
.
Logs
[
0
]
.
Ty
)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
ParacrossNodeGroupApply
),
stat
.
Status
)
}
...
...
@@ -124,7 +124,7 @@ func checkGroupApproveReceipt(suite *NodeManageTestSuite, receipt *types.Receipt
err
:=
types
.
Decode
(
receipt
.
KV
[
len
-
1
]
.
Value
,
&
stat
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
//suite.T().Log("titleHeight", titleHeight)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
TyLogParaNodeGroup
Approve
),
receipt
.
Logs
[
len
-
1
]
.
Ty
)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
TyLogParaNodeGroup
Config
),
receipt
.
Logs
[
len
-
1
]
.
Ty
)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
ParacrossNodeGroupApprove
),
stat
.
Status
)
}
...
...
plugin/dapp/paracross/proto/paracross.proto
View file @
09f609fb
...
...
@@ -47,26 +47,30 @@ message ParacrossConsensusStatus {
string
consensBlockHash
=
4
;
}
message
ParaNodeAddrConfig
{
message
ParaNodeAddrConfig
{
string
title
=
1
;
string
op
=
2
;
uint32
op
=
2
;
string
id
=
3
;
string
addr
=
4
;
string
value
=
5
;
uint32
value
=
5
;
int64
coinsFrozen
=
6
;
}
message
ParaNodeVoteDetail
{
message
ParaNodeVoteDetail
{
repeated
string
addrs
=
1
;
repeated
string
votes
=
2
;
}
message
ParaNodeAddrStatus
{
message
ParaNodeAddrIdStatus
{
string
proposalId
=
1
;
}
message
ParaNodeIdStatus
{
string
id
=
1
;
int32
status
=
2
;
string
title
=
3
;
string
applyAddr
=
4
;
string
targetAddr
=
4
;
int64
coinsFrozen
=
5
;
ParaNodeVoteDetail
votes
=
6
;
string
fromAddr
=
7
;
...
...
@@ -76,8 +80,8 @@ message ParaNodeAddrStatus{
message
ReceiptParaNodeConfig
{
string
addr
=
1
;
ParaNodeAddrConfig
config
=
2
;
ParaNode
AddrStatus
prev
=
3
;
ParaNode
AddrStatus
current
=
4
;
ParaNode
IdStatus
prev
=
3
;
ParaNode
IdStatus
current
=
4
;
}
...
...
@@ -107,7 +111,7 @@ message ParaNodeGroupStatus {
string
id
=
1
;
int32
status
=
2
;
string
title
=
3
;
string
applyAddrs
=
4
;
string
targetAddrs
=
4
;
int64
coinsFrozen
=
5
;
uint32
emptyBlockInterval
=
6
;
int64
mainHeight
=
7
;
...
...
@@ -130,7 +134,7 @@ message ReqParacrossNodeInfo {
}
message
RespParacrossNodeAddrs
{
repeated
ParaNode
Addr
Status
addrs
=
1
;
repeated
ParaNode
Id
Status
addrs
=
1
;
}
message
RespParacrossNodeGroups
{
...
...
plugin/dapp/paracross/rpc/rpc.go
View file @
09f609fb
...
...
@@ -180,13 +180,13 @@ func (c *Jrpc) GetBlock2MainInfo(req *types.ReqBlocks, result *interface{}) erro
}
// GetNodeStatus get super node status
func
(
c
*
channelClient
)
GetNodeStatus
(
ctx
context
.
Context
,
req
*
pt
.
ReqParacrossNodeInfo
)
(
*
pt
.
ParaNode
Addr
Status
,
error
)
{
func
(
c
*
channelClient
)
GetNodeStatus
(
ctx
context
.
Context
,
req
*
pt
.
ReqParacrossNodeInfo
)
(
*
pt
.
ParaNode
Id
Status
,
error
)
{
r
:=
*
req
data
,
err
:=
c
.
Query
(
pt
.
GetExecName
(),
"GetNodeAddrInfo"
,
&
r
)
if
err
!=
nil
{
return
nil
,
err
}
if
resp
,
ok
:=
data
.
(
*
pt
.
ParaNode
Addr
Status
);
ok
{
if
resp
,
ok
:=
data
.
(
*
pt
.
ParaNode
Id
Status
);
ok
{
return
resp
,
nil
}
return
nil
,
types
.
ErrDecode
...
...
plugin/dapp/paracross/types/paracross.go
View file @
09f609fb
...
...
@@ -40,10 +40,7 @@ const (
TyLogParaNodeConfig
=
657
TyLogParaNodeVoteDone
=
658
TyLogParaNodeGroupAddrsUpdate
=
659
TyLogParaNodeGroupApply
=
660
TyLogParaNodeGroupApprove
=
661
TyLogParaNodeGroupQuit
=
662
TyLogParaNodeGroupModify
=
663
TyLogParaNodeGroupConfig
=
660
TyLogParaNodeGroupStatusUpdate
=
664
)
...
...
@@ -92,14 +89,20 @@ const (
// node config op
const
(
ParaNodeJoin
=
"join"
ParaNodeQuit
=
"quit"
ParaNodeVote
=
"vote"
ParaNodeJoin
=
iota
+
1
ParaNodeVote
ParaNodeQuit
)
ParaNodeVoteYes
=
"yes"
ParaNodeVoteNo
=
"no"
const
(
ParaNodeVoteInvalid
=
iota
ParaNodeVoteYes
ParaNodeVoteNo
ParaNodeVoteEnd
)
var
ParaNodeVoteStr
=
[]
string
{
"invalid"
,
"yes"
,
"no"
}
const
(
// ParacrossNodeJoining apply for adding group
ParacrossNodeJoining
=
iota
+
1
...
...
@@ -183,6 +186,7 @@ func createRawCommitTx(status *ParacrossNodeStatus, name string, fee int64) (*ty
func
CreateRawNodeConfigTx
(
config
*
ParaNodeAddrConfig
)
(
*
types
.
Transaction
,
error
)
{
config
.
Title
=
types
.
GetTitle
()
config
.
Addr
=
strings
.
Trim
(
config
.
Addr
,
" "
)
config
.
Id
=
strings
.
Trim
(
config
.
Id
,
" "
)
action
:=
&
ParacrossAction
{
Ty
:
ParacrossActionNodeConfig
,
...
...
@@ -199,6 +203,7 @@ func CreateRawNodeConfigTx(config *ParaNodeAddrConfig) (*types.Transaction, erro
func
CreateRawNodeGroupApplyTx
(
apply
*
ParaNodeGroupConfig
)
(
*
types
.
Transaction
,
error
)
{
apply
.
Title
=
types
.
GetTitle
()
apply
.
EmptyBlockInterval
=
4
apply
.
Id
=
strings
.
Trim
(
apply
.
Id
,
" "
)
interval
:=
types
.
Conf
(
"config.consensus.sub.para"
)
.
GInt
(
"emptyBlockInterval"
)
if
interval
>
0
{
apply
.
EmptyBlockInterval
=
uint32
(
interval
)
...
...
plugin/dapp/paracross/types/type.go
View file @
09f609fb
...
...
@@ -64,10 +64,7 @@ func (p *ParacrossType) GetLogMap() map[int64]*types.LogInfo {
TyLogParaNodeConfig
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeConfig
{}),
Name
:
"LogParaNodeConfig"
},
TyLogParaNodeGroupAddrsUpdate
:
{
Ty
:
reflect
.
TypeOf
(
types
.
ReceiptConfig
{}),
Name
:
"LogParaNodeGroupAddrsUpdate"
},
TyLogParaNodeVoteDone
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeVoteDone
{}),
Name
:
"LogParaNodeVoteDone"
},
TyLogParaNodeGroupApply
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeGroupConfig
{}),
Name
:
"LogParaNodeGroupApply"
},
TyLogParaNodeGroupApprove
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeGroupConfig
{}),
Name
:
"LogParaNodeGroupApprove"
},
TyLogParaNodeGroupQuit
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeGroupConfig
{}),
Name
:
"LogParaNodeGroupQuit"
},
TyLogParaNodeGroupModify
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeGroupConfig
{}),
Name
:
"LogParaNodeGroupModify"
},
TyLogParaNodeGroupConfig
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeGroupConfig
{}),
Name
:
"LogParaNodeGroupApply"
},
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