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
aa8a0c88
Commit
aa8a0c88
authored
Jun 04, 2019
by
mdj33
Committed by
vipwzw
Jun 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added addr cancel operation
parent
cfa64635
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
20 deletions
+33
-20
paracross.go
plugin/dapp/paracross/commands/paracross.go
+3
-3
action.go
plugin/dapp/paracross/executor/action.go
+5
-5
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+0
-0
superaccount_test.go
plugin/dapp/paracross/executor/superaccount_test.go
+8
-9
paracross.proto
plugin/dapp/paracross/proto/paracross.proto
+10
-1
errors.go
plugin/dapp/paracross/types/errors.go
+2
-2
paracross.go
plugin/dapp/paracross/types/paracross.go
+4
-0
type.go
plugin/dapp/paracross/types/type.go
+1
-0
No files found.
plugin/dapp/paracross/commands/paracross.go
View file @
aa8a0c88
...
...
@@ -251,12 +251,12 @@ func CreateRawNodeManageCmd() *cobra.Command {
}
func
addNodeManageFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
Uint32P
(
"operation"
,
"o"
,
0
,
"operation:1:join,2:vote,3:quit"
)
cmd
.
Flags
()
.
Uint32P
(
"operation"
,
"o"
,
0
,
"operation:1:join,2:vote,3:quit
,4:cancel
"
)
cmd
.
MarkFlagRequired
(
"operation"
)
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"operating target addr"
)
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"operating target addr
[optional]
"
)
cmd
.
Flags
()
.
StringP
(
"id"
,
"i"
,
""
,
"operating target id"
)
cmd
.
Flags
()
.
StringP
(
"id"
,
"i"
,
""
,
"operating target id
[optional]
"
)
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"
)
...
...
plugin/dapp/paracross/executor/action.go
View file @
aa8a0c88
...
...
@@ -261,10 +261,10 @@ func (a *action) getNodesGroup(title string) (map[string]struct{}, error) {
}
//根据nodes过滤掉可能退出了的addrs
func
updateCommitAddrs
(
stat
*
pt
.
ParacrossHeightStatus
,
nodes
map
[
string
]
struct
{})
{
func
updateCommitAddrs
(
stat
*
pt
.
ParacrossHeightStatus
,
nodes
map
[
string
]
struct
{})
{
details
:=
&
pt
.
ParacrossStatusDetails
{}
for
i
,
addr
:=
range
stat
.
Details
.
Addrs
{
if
_
,
ok
:=
nodes
[
addr
];
ok
{
for
i
,
addr
:=
range
stat
.
Details
.
Addrs
{
if
_
,
ok
:=
nodes
[
addr
];
ok
{
details
.
Addrs
=
append
(
details
.
Addrs
,
addr
)
details
.
BlockHash
=
append
(
details
.
BlockHash
,
stat
.
Details
.
BlockHash
[
i
])
}
...
...
@@ -378,8 +378,8 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
receipt
=
makeCommitReceipt
(
a
.
fromaddr
,
commit
,
&
copyStat
,
stat
)
}
if
types
.
IsDappFork
(
commit
.
Status
.
MainBlockHeight
,
pt
.
ParaX
,
pt
.
ForkCommitTx
){
updateCommitAddrs
(
stat
,
nodes
)
if
types
.
IsDappFork
(
commit
.
Status
.
MainBlockHeight
,
pt
.
ParaX
,
pt
.
ForkCommitTx
)
{
updateCommitAddrs
(
stat
,
nodes
)
}
clog
.
Info
(
"paracross.Commit commit"
,
"stat.title"
,
stat
.
Title
,
"stat.height"
,
stat
.
Height
,
"notes"
,
len
(
nodes
))
...
...
plugin/dapp/paracross/executor/superaccount.go
View file @
aa8a0c88
This diff is collapsed.
Click to expand it.
plugin/dapp/paracross/executor/superaccount_test.go
View file @
aa8a0c88
...
...
@@ -353,17 +353,17 @@ func TestGetAddrGroup(t *testing.T) {
}
func
TestUpdateVotes
(
t
*
testing
.
T
){
func
TestUpdateVotes
(
t
*
testing
.
T
)
{
stat
:=
&
pt
.
ParaNodeIdStatus
{}
votes
:=
&
pt
.
ParaNodeVoteDetail
{
Addrs
:
[]
string
{
"AA"
,
"BB"
,
"CC"
},
Votes
:
[]
string
{
"yes"
,
"no"
,
"no"
}}
Addrs
:
[]
string
{
"AA"
,
"BB"
,
"CC"
},
Votes
:
[]
string
{
"yes"
,
"no"
,
"no"
}}
stat
.
Votes
=
votes
nodes
:=
make
(
map
[
string
]
struct
{})
nodes
[
"BB"
]
=
struct
{}{}
nodes
[
"BB"
]
=
struct
{}{}
nodes
[
"CC"
]
=
struct
{}{}
updateVotes
(
stat
,
nodes
)
assert
.
Equal
(
t
,[]
string
{
"BB"
,
"CC"
},
stat
.
Votes
.
Addrs
)
assert
.
Equal
(
t
,[]
string
{
"no"
,
"no"
},
stat
.
Votes
.
Votes
)
}
\ No newline at end of file
updateVotes
(
stat
,
nodes
)
assert
.
Equal
(
t
,
[]
string
{
"BB"
,
"CC"
},
stat
.
Votes
.
Addrs
)
assert
.
Equal
(
t
,
[]
string
{
"no"
,
"no"
},
stat
.
Votes
.
Votes
)
}
plugin/dapp/paracross/proto/paracross.proto
View file @
aa8a0c88
...
...
@@ -63,7 +63,11 @@ message ParaNodeVoteDetail {
}
message
ParaNodeAddrIdStatus
{
string
proposalId
=
1
;
string
addr
=
1
;
string
proposalId
=
2
;
string
quitId
=
3
;
int32
status
=
4
;
string
title
=
5
;
}
message
ParaNodeIdStatus
{
...
...
@@ -85,6 +89,11 @@ message ReceiptParaNodeConfig {
ParaNodeIdStatus
current
=
4
;
}
message
ReceiptParaNodeAddrStatUpdate
{
string
fromAddr
=
1
;
ParaNodeAddrIdStatus
prev
=
2
;
ParaNodeAddrIdStatus
current
=
3
;
}
message
ReceiptParaNodeVoteDone
{
string
id
=
1
;
...
...
plugin/dapp/paracross/types/errors.go
View file @
aa8a0c88
...
...
@@ -45,8 +45,8 @@ var (
ErrParaNodeVoteSelf
=
errors
.
New
(
"ErrParaNodeVoteSelf"
)
//ErrParaNodeGroupFrozenCoinsNotEnough node group coins in tx less than conf's minimum coins
ErrParaNodeGroupFrozenCoinsNotEnough
=
errors
.
New
(
"ErrParaNodeGroupFrozenCoinsNotEnough"
)
//ErrParaNode
GroupStatusWrong node group
process wrong status
ErrParaNode
GroupStatusWrong
=
errors
.
New
(
"ErrParaNodeGrou
pStatusWrong"
)
//ErrParaNode
OpStatusWrong node
process wrong status
ErrParaNode
OpStatusWrong
=
errors
.
New
(
"ErrParaNodeO
pStatusWrong"
)
//ErrParaConsensStopBlocksNotReach consensus stop blocks not reach
ErrParaConsensStopBlocksNotReach
=
errors
.
New
(
"ErrParaConsensStopBlocksNotReach"
)
)
plugin/dapp/paracross/types/paracross.go
View file @
aa8a0c88
...
...
@@ -41,6 +41,7 @@ const (
TyLogParaNodeVoteDone
=
658
TyLogParaNodeGroupAddrsUpdate
=
659
TyLogParaNodeGroupConfig
=
660
TyLogParaNodeStatusUpdate
=
661
TyLogParaNodeGroupStatusUpdate
=
664
)
...
...
@@ -92,6 +93,7 @@ const (
ParaNodeJoin
=
iota
+
1
ParaNodeVote
ParaNodeQuit
ParaNodeCancel
)
// node vote op
...
...
@@ -114,6 +116,8 @@ const (
ParacrossNodeQuiting
// ParacrossNodeQuited pass to quite by votes
ParacrossNodeQuited
// ParacrossNodeCanceled to cancel apply of joining or quiting
ParacrossNodeCanceled
)
const
(
...
...
plugin/dapp/paracross/types/type.go
View file @
aa8a0c88
...
...
@@ -62,6 +62,7 @@ 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"
},
TyLogParaNodeStatusUpdate
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeAddrStatUpdate
{}),
Name
:
"LogParaNodeAddrStatUpdate"
},
TyLogParaNodeGroupAddrsUpdate
:
{
Ty
:
reflect
.
TypeOf
(
types
.
ReceiptConfig
{}),
Name
:
"LogParaNodeGroupAddrsUpdate"
},
TyLogParaNodeVoteDone
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeVoteDone
{}),
Name
:
"LogParaNodeVoteDone"
},
TyLogParaNodeGroupConfig
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeGroupConfig
{}),
Name
:
"LogParaNodeGroupConfig"
},
...
...
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