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
f11abc5b
Commit
f11abc5b
authored
Jun 01, 2019
by
mdj33
Committed by
vipwzw
Jun 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add group id op
parent
7ce3ee2b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
69 additions
and
53 deletions
+69
-53
action.go
plugin/dapp/paracross/executor/action.go
+1
-1
exec_local.go
plugin/dapp/paracross/executor/exec_local.go
+1
-1
kv.go
plugin/dapp/paracross/executor/kv.go
+17
-5
query.go
plugin/dapp/paracross/executor/query.go
+1
-1
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+0
-0
superaccount_test.go
plugin/dapp/paracross/executor/superaccount_test.go
+6
-6
paracross.proto
plugin/dapp/paracross/proto/paracross.proto
+31
-31
errors.go
plugin/dapp/paracross/types/errors.go
+0
-2
paracross.go
plugin/dapp/paracross/types/paracross.go
+9
-5
type.go
plugin/dapp/paracross/types/type.go
+3
-1
No files found.
plugin/dapp/paracross/executor/action.go
View file @
f11abc5b
...
...
@@ -77,7 +77,7 @@ func getConfigManageNodes(db dbm.KV, title string) (map[string]struct{}, []strin
}
func
getParacrossNodes
(
db
dbm
.
KV
,
title
string
)
(
map
[
string
]
struct
{},
[]
string
,
error
)
{
key
:=
calcParaNodeGroupKey
(
title
)
key
:=
calcParaNodeGroup
Addrs
Key
(
title
)
return
getNodes
(
db
,
key
)
}
...
...
plugin/dapp/paracross/executor/exec_local.go
View file @
f11abc5b
...
...
@@ -91,7 +91,7 @@ func (e *Paracross) ExecLocal_NodeGroupConfig(payload *pt.ParaNodeGroupConfig, t
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
.
TyLogParaNodeGroupQuit
||
log
.
Ty
==
pt
.
TyLogParaNodeGroupModify
{
var
g
pt
.
ReceiptParaNodeGroupConfig
err
:=
types
.
Decode
(
log
.
Log
,
&
g
)
if
err
!=
nil
{
...
...
plugin/dapp/paracross/executor/kv.go
View file @
f11abc5b
...
...
@@ -16,7 +16,9 @@ var (
managerConfigNodes
string
//manager 合约配置的nodes
paraConfigNodes
string
//平行链自组织配置的nodes,最初是从manager同步过来
paraConfigNodeAddr
string
//平行链配置节点账户
paraNodeGroupApplyAddrs
string
paraNodeGroupStatusAddrs
string
//正在申请的addrs
paraNodeId
string
paraNodeGroupId
string
localTx
string
localTitle
string
localTitleHeight
string
...
...
@@ -32,7 +34,9 @@ func setPrefix() {
managerConfigNodes
=
"paracross-nodes-"
paraConfigNodes
=
"mavl-paracross-nodes-title-"
paraConfigNodeAddr
=
"mavl-paracross-nodes-titleAddr-"
paraNodeGroupApplyAddrs
=
"mavl-paracross-nodegroup-apply-title-"
paraNodeGroupStatusAddrs
=
"mavl-paracross-nodegroup-apply-title-"
paraNodeId
=
"mavl-paracross-title-nodeid-"
paraNodeGroupId
=
"mavl-paracross-title-nodegroupid-"
localTx
=
"LODB-paracross-titleHeightAddr-"
localTitle
=
"LODB-paracross-title-"
localTitleHeight
=
"LODB-paracross-titleHeight-"
...
...
@@ -62,7 +66,7 @@ func calcManageConfigNodesKey(title string) []byte {
return
[]
byte
(
types
.
ManageKey
(
key
))
}
func
calcParaNodeGroupKey
(
title
string
)
[]
byte
{
func
calcParaNodeGroup
Addrs
Key
(
title
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
paraConfigNodes
+
"%s"
,
title
))
}
...
...
@@ -70,8 +74,16 @@ func calcParaNodeAddrKey(title string, addr string) []byte {
return
[]
byte
(
fmt
.
Sprintf
(
paraConfigNodeAddr
+
"%s-%s"
,
title
,
addr
))
}
func
calcParaNodeGroupApplyKey
(
title
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
paraNodeGroupApplyAddrs
+
"%s"
,
title
))
func
calcParaNodeGroupStatusKey
(
title
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
paraNodeGroupStatusAddrs
+
"%s"
,
title
))
}
func
calcParaNodeIdKey
(
title
,
hash
string
)
string
{
return
fmt
.
Sprintf
(
paraNodeId
+
"%s-%s"
,
title
,
hash
)
}
func
calcParaNodeGroupIdKey
(
title
,
hash
string
)
string
{
return
fmt
.
Sprintf
(
paraNodeGroupId
+
"%s-%s"
,
title
,
hash
)
}
func
calcLocalTxKey
(
title
string
,
height
int64
,
addr
string
)
[]
byte
{
...
...
plugin/dapp/paracross/executor/query.go
View file @
f11abc5b
...
...
@@ -75,7 +75,7 @@ func (p *Paracross) Query_GetNodeGroupAddrs(in *pt.ReqParacrossNodeInfo) (types.
nodes
=
append
(
nodes
,
k
)
}
var
reply
types
.
ReplyConfig
reply
.
Key
=
string
(
calcParaNodeGroupKey
(
in
.
GetTitle
()))
reply
.
Key
=
string
(
calcParaNodeGroup
Addrs
Key
(
in
.
GetTitle
()))
reply
.
Value
=
fmt
.
Sprint
(
nodes
)
return
&
reply
,
nil
}
...
...
plugin/dapp/paracross/executor/superaccount.go
View file @
f11abc5b
This diff is collapsed.
Click to expand it.
plugin/dapp/paracross/executor/superaccount_test.go
View file @
f11abc5b
...
...
@@ -74,7 +74,7 @@ func (suite *NodeManageTestSuite) SetupSuite() {
}
func
(
suite
*
NodeManageTestSuite
)
TestSetup
()
{
nodeConfigKey
:=
calcParaNodeGroupKey
(
Title
)
nodeConfigKey
:=
calcParaNodeGroup
Addrs
Key
(
Title
)
suite
.
T
()
.
Log
(
string
(
nodeConfigKey
))
_
,
err
:=
suite
.
stateDB
.
Get
(
nodeConfigKey
)
if
err
!=
nil
{
...
...
@@ -139,7 +139,7 @@ func checkJoinReceipt(suite *NodeManageTestSuite, receipt *types.Receipt) {
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
//suite.T().Log("titleHeight", titleHeight)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
TyLogParaNodeConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
ParacrossNode
Add
ing
),
stat
.
Status
)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
ParacrossNode
Join
ing
),
stat
.
Status
)
assert
.
NotNil
(
suite
.
T
(),
stat
.
Votes
)
}
...
...
@@ -310,22 +310,22 @@ func (suite *NodeManageTestSuite) TearDownSuite() {
func
TestGetAddrGroup
(
t
*
testing
.
T
)
{
addrs
:=
" 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4, 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR, 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k, ,,, 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs , "
retAddrs
:=
get
AddrGroup
(
addrs
)
retAddrs
:=
get
ConfigAddrs
(
addrs
)
expectAddrs
:=
[]
string
{
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
,
"1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR"
,
"1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"
,
"1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
}
assert
.
Equal
(
t
,
expectAddrs
,
retAddrs
)
addrs
=
" 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 , , "
retAddrs
=
get
AddrGroup
(
addrs
)
retAddrs
=
get
ConfigAddrs
(
addrs
)
expectAddrs
=
[]
string
{
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
}
assert
.
Equal
(
t
,
expectAddrs
,
retAddrs
)
addrs
=
" , "
ret
:=
get
AddrGroup
(
addrs
)
ret
:=
get
ConfigAddrs
(
addrs
)
assert
.
Equal
(
t
,
[]
string
(
nil
),
ret
)
assert
.
Equal
(
t
,
0
,
len
(
ret
))
addrs
=
" "
ret
=
get
AddrGroup
(
addrs
)
ret
=
get
ConfigAddrs
(
addrs
)
assert
.
Equal
(
t
,
[]
string
(
nil
),
ret
)
assert
.
Equal
(
t
,
0
,
len
(
ret
))
...
...
plugin/dapp/paracross/proto/paracross.proto
View file @
f11abc5b
...
...
@@ -50,9 +50,10 @@ message ParacrossConsensusStatus {
message
ParaNodeAddrConfig
{
string
title
=
1
;
string
op
=
2
;
string
addr
=
3
;
string
value
=
4
;
int64
coinsFrozen
=
5
;
string
id
=
3
;
string
addr
=
4
;
string
value
=
5
;
int64
coinsFrozen
=
6
;
}
...
...
@@ -62,12 +63,13 @@ message ParaNodeVoteDetail{
}
message
ParaNodeAddrStatus
{
int32
status
=
1
;
string
title
=
2
;
string
applyAddr
=
3
;
int64
coinsFrozen
=
4
;
ParaNodeVoteDetail
votes
=
5
;
string
fromAddr
=
6
;
string
id
=
1
;
int32
status
=
2
;
string
title
=
3
;
string
applyAddr
=
4
;
int64
coinsFrozen
=
5
;
ParaNodeVoteDetail
votes
=
6
;
string
fromAddr
=
7
;
}
...
...
@@ -78,40 +80,38 @@ message ReceiptParaNodeConfig {
ParaNodeAddrStatus
current
=
4
;
}
message
ReceiptParaNodeVoteRecord
{
string
fromAddr
=
1
;
string
voteAddr
=
2
;
int32
value
=
3
;
}
message
ReceiptParaNodeVoteDone
{
string
title
=
1
;
string
targetAddr
=
2
;
int32
totalNodes
=
3
;
int32
totalVote
=
4
;
int32
mostVote
=
5
;
string
voteRst
=
6
;
int32
doneStatus
=
7
;
string
id
=
1
;
string
title
=
2
;
string
targetAddr
=
3
;
int32
totalNodes
=
4
;
int32
totalVote
=
5
;
int32
mostVote
=
6
;
string
voteRst
=
7
;
int32
doneStatus
=
8
;
}
message
ParaNodeGroupConfig
{
string
title
=
1
;
uint32
op
=
2
;
string
addrs
=
3
;
int64
coinsFrozen
=
4
;
uint32
emptyBlockInterval
=
5
;
string
id
=
3
;
string
addrs
=
4
;
int64
coinsFrozen
=
5
;
uint32
emptyBlockInterval
=
6
;
}
message
ParaNodeGroupStatus
{
int32
status
=
1
;
string
title
=
2
;
string
applyAddr
=
3
;
int64
coinsFrozen
=
4
;
uint32
emptyBlockInterval
=
5
;
int64
mainHeight
=
6
;
string
fromAddr
=
7
;
string
id
=
1
;
int32
status
=
2
;
string
title
=
3
;
string
applyAddrs
=
4
;
int64
coinsFrozen
=
5
;
uint32
emptyBlockInterval
=
6
;
int64
mainHeight
=
7
;
string
fromAddr
=
8
;
}
message
ReceiptParaNodeGroupConfig
{
...
...
plugin/dapp/paracross/types/errors.go
View file @
f11abc5b
...
...
@@ -47,8 +47,6 @@ var (
ErrParaNodeGroupFrozenCoinsNotEnough
=
errors
.
New
(
"ErrParaNodeGroupFrozenCoinsNotEnough"
)
//ErrParaNodeGroupStatusWrong node group process wrong status
ErrParaNodeGroupStatusWrong
=
errors
.
New
(
"ErrParaNodeGroupStatusWrong"
)
//ErrParaNodeGroupAddrNotMatch group addrs not match with apply
ErrParaNodeGroupAddrNotMatch
=
errors
.
New
(
"ErrParaNodeGroupAddrNotMatch"
)
//ErrParaConsensStopBlocksNotReach consensus stop blocks not reach
ErrParaConsensStopBlocksNotReach
=
errors
.
New
(
"ErrParaConsensStopBlocksNotReach"
)
)
plugin/dapp/paracross/types/paracross.go
View file @
f11abc5b
...
...
@@ -39,10 +39,12 @@ const (
// TyLogParaNodeConfig config super node log key
TyLogParaNodeConfig
=
657
TyLogParaNodeVoteDone
=
658
TyLogParaNodeGroupUpdate
=
659
TyLogParaNodeGroup
Addrs
Update
=
659
TyLogParaNodeGroupApply
=
660
TyLogParaNodeGroupApprove
=
661
TyLogParaNodeGroupQuit
=
662
TyLogParaNodeGroupModify
=
663
TyLogParaNodeGroupStatusUpdate
=
664
)
type
paracrossCommitTx
struct
{
...
...
@@ -99,10 +101,10 @@ const (
)
const
(
// ParacrossNode
Add
ing apply for adding group
ParacrossNode
Add
ing
=
iota
+
1
// ParacrossNode
Add
ed pass to add by votes
ParacrossNode
Add
ed
// ParacrossNode
Join
ing apply for adding group
ParacrossNode
Join
ing
=
iota
+
1
// ParacrossNode
Join
ed pass to add by votes
ParacrossNode
Join
ed
// ParacrossNodeQuiting apply for quiting
ParacrossNodeQuiting
// ParacrossNodeQuited pass to quite by votes
...
...
@@ -116,6 +118,8 @@ const (
ParacrossNodeGroupApprove
//ParacrossNodeGroupQuit applyer quit the apply when not be approved
ParacrossNodeGroupQuit
//ParacrossNodeGroupModify applyer modify some parameters
ParacrossNodeGroupModify
)
var
(
...
...
plugin/dapp/paracross/types/type.go
View file @
f11abc5b
...
...
@@ -62,11 +62,13 @@ func (p *ParacrossType) GetLogMap() map[int64]*types.LogInfo {
TyLogParaAssetDeposit
:
{
Ty
:
reflect
.
TypeOf
(
types
.
ReceiptAccountTransfer
{}),
Name
:
"LogParaAssetDeposit"
},
TyLogParacrossMiner
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParacrossMiner
{}),
Name
:
"LogParacrossMiner"
},
TyLogParaNodeConfig
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeConfig
{}),
Name
:
"LogParaNodeConfig"
},
TyLogParaNodeGroup
Update
:
{
Ty
:
reflect
.
TypeOf
(
types
.
ReceiptConfig
{}),
Name
:
"LogParaNodeGroup
Update"
},
TyLogParaNodeGroup
AddrsUpdate
:
{
Ty
:
reflect
.
TypeOf
(
types
.
ReceiptConfig
{}),
Name
:
"LogParaNodeGroupAddrs
Update"
},
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"
},
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