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
ca80cac4
Commit
ca80cac4
authored
Jul 21, 2021
by
mdj33
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ut
parent
4016e4d3
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
20 additions
and
19 deletions
+20
-19
boardaction.go
plugin/dapp/autonomy/executor/boardaction.go
+4
-4
changeaction.go
plugin/dapp/autonomy/executor/changeaction.go
+4
-4
projectaction.go
plugin/dapp/autonomy/executor/projectaction.go
+3
-3
ruleaction.go
plugin/dapp/autonomy/executor/ruleaction.go
+3
-3
board.proto
plugin/dapp/autonomy/proto/board.proto
+1
-1
change.proto
plugin/dapp/autonomy/proto/change.proto
+1
-1
lcommon.proto
plugin/dapp/autonomy/proto/lcommon.proto
+1
-1
project.proto
plugin/dapp/autonomy/proto/project.proto
+1
-1
rule.proto
plugin/dapp/autonomy/proto/rule.proto
+1
-1
rpc_test.go
plugin/dapp/ticket/rpc/rpc_test.go
+1
-0
No files found.
plugin/dapp/autonomy/executor/boardaction.go
View file @
ca80cac4
...
@@ -92,7 +92,7 @@ func filterPropBoard(boards []string) (map[string]struct{}, error) {
...
@@ -92,7 +92,7 @@ func filterPropBoard(boards []string) (map[string]struct{}, error) {
mpBd
:=
make
(
map
[
string
]
struct
{})
mpBd
:=
make
(
map
[
string
]
struct
{})
for
_
,
board
:=
range
boards
{
for
_
,
board
:=
range
boards
{
if
err
:=
address
.
CheckAddress
(
board
);
err
!=
nil
{
if
err
:=
address
.
CheckAddress
(
board
);
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidAddress
,
"addr"
,
board
)
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidAddress
,
"addr
=%s
"
,
board
)
}
}
// 提案board重复地址去重复
// 提案board重复地址去重复
if
_
,
ok
:=
mpBd
[
board
];
ok
{
if
_
,
ok
:=
mpBd
[
board
];
ok
{
...
@@ -302,11 +302,11 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
...
@@ -302,11 +302,11 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
//fork之后增加了弃权选项
//fork之后增加了弃权选项
if
cfg
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
if
cfg
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
switch
voteProb
.
VoteOption
{
switch
voteProb
.
VoteOption
{
case
auty
.
VoteOption_APPROVE
:
case
auty
.
Autonomy
VoteOption_APPROVE
:
cur
.
VoteResult
.
ApproveVotes
+=
vtCouts
cur
.
VoteResult
.
ApproveVotes
+=
vtCouts
case
auty
.
VoteOption_OPPOSE
:
case
auty
.
Autonomy
VoteOption_OPPOSE
:
cur
.
VoteResult
.
OpposeVotes
+=
vtCouts
cur
.
VoteResult
.
OpposeVotes
+=
vtCouts
case
auty
.
VoteOption_QUIT
:
case
auty
.
Autonomy
VoteOption_QUIT
:
cur
.
VoteResult
.
QuitVotes
+=
vtCouts
cur
.
VoteResult
.
QuitVotes
+=
vtCouts
default
:
default
:
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"vote option=%d"
,
voteProb
.
VoteOption
)
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"vote option=%d"
,
voteProb
.
VoteOption
)
...
...
plugin/dapp/autonomy/executor/changeaction.go
View file @
ca80cac4
...
@@ -217,11 +217,11 @@ func (a *action) votePropChange(voteProb *auty.VoteProposalChange) (*types.Recei
...
@@ -217,11 +217,11 @@ func (a *action) votePropChange(voteProb *auty.VoteProposalChange) (*types.Recei
if
cfg
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
if
cfg
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
switch
voteProb
.
Vote
{
switch
voteProb
.
Vote
{
case
auty
.
VoteOption_APPROVE
:
case
auty
.
Autonomy
VoteOption_APPROVE
:
cur
.
VoteResult
.
ApproveVotes
++
cur
.
VoteResult
.
ApproveVotes
++
case
auty
.
VoteOption_OPPOSE
:
case
auty
.
Autonomy
VoteOption_OPPOSE
:
cur
.
VoteResult
.
OpposeVotes
++
cur
.
VoteResult
.
OpposeVotes
++
case
auty
.
VoteOption_QUIT
:
case
auty
.
Autonomy
VoteOption_QUIT
:
cur
.
VoteResult
.
QuitVotes
++
cur
.
VoteResult
.
QuitVotes
++
default
:
default
:
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"vote option=%d"
,
voteProb
.
Vote
)
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"vote option=%d"
,
voteProb
.
Vote
)
...
@@ -365,7 +365,7 @@ func (a *action) replaceBoard(act *auty.ActiveBoard, change []*auty.Change) (*au
...
@@ -365,7 +365,7 @@ func (a *action) replaceBoard(act *auty.ActiveBoard, change []*auty.Change) (*au
//只允许替换,不允许恢复操作
//只允许替换,不允许恢复操作
if
!
change
[
0
]
.
Cancel
||
len
(
change
[
0
]
.
Addr
)
<=
0
{
if
!
change
[
0
]
.
Cancel
||
len
(
change
[
0
]
.
Addr
)
<=
0
{
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"cancel=
%d not allow to addr=%s"
,
change
[
0
]
.
Cancel
,
change
[
0
]
.
Addr
)
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"cancel=
false not allow to addr=%s"
,
change
[
0
]
.
Addr
)
}
}
mpBd
:=
make
(
map
[
string
]
struct
{})
mpBd
:=
make
(
map
[
string
]
struct
{})
...
...
plugin/dapp/autonomy/executor/projectaction.go
View file @
ca80cac4
...
@@ -222,11 +222,11 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec
...
@@ -222,11 +222,11 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec
// 更新投票结果
// 更新投票结果
if
a
.
api
.
GetConfig
()
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
if
a
.
api
.
GetConfig
()
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
switch
voteProb
.
Vote
{
switch
voteProb
.
Vote
{
case
auty
.
VoteOption_APPROVE
:
case
auty
.
Autonomy
VoteOption_APPROVE
:
cur
.
BoardVoteRes
.
ApproveVotes
++
cur
.
BoardVoteRes
.
ApproveVotes
++
case
auty
.
VoteOption_OPPOSE
:
case
auty
.
Autonomy
VoteOption_OPPOSE
:
cur
.
BoardVoteRes
.
OpposeVotes
++
cur
.
BoardVoteRes
.
OpposeVotes
++
case
auty
.
VoteOption_QUIT
:
case
auty
.
Autonomy
VoteOption_QUIT
:
cur
.
BoardVoteRes
.
QuitVotes
++
cur
.
BoardVoteRes
.
QuitVotes
++
default
:
default
:
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"vote option=%d"
,
voteProb
.
Vote
)
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"vote option=%d"
,
voteProb
.
Vote
)
...
...
plugin/dapp/autonomy/executor/ruleaction.go
View file @
ca80cac4
...
@@ -256,11 +256,11 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
...
@@ -256,11 +256,11 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
cfg
:=
a
.
api
.
GetConfig
()
cfg
:=
a
.
api
.
GetConfig
()
if
cfg
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
if
cfg
.
IsDappFork
(
a
.
height
,
auty
.
AutonomyX
,
auty
.
ForkAutonomyDelRule
)
{
switch
voteProb
.
Vote
{
switch
voteProb
.
Vote
{
case
auty
.
VoteOption_APPROVE
:
case
auty
.
Autonomy
VoteOption_APPROVE
:
cur
.
VoteResult
.
ApproveVotes
+=
vtCouts
cur
.
VoteResult
.
ApproveVotes
+=
vtCouts
case
auty
.
VoteOption_OPPOSE
:
case
auty
.
Autonomy
VoteOption_OPPOSE
:
cur
.
VoteResult
.
OpposeVotes
+=
vtCouts
cur
.
VoteResult
.
OpposeVotes
+=
vtCouts
case
auty
.
VoteOption_QUIT
:
case
auty
.
Autonomy
VoteOption_QUIT
:
cur
.
VoteResult
.
QuitVotes
+=
vtCouts
cur
.
VoteResult
.
QuitVotes
+=
vtCouts
default
:
default
:
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"wrong vote value=%d"
,
voteProb
.
Vote
)
return
nil
,
errors
.
Wrapf
(
types
.
ErrInvalidParam
,
"wrong vote value=%d"
,
voteProb
.
Vote
)
...
...
plugin/dapp/autonomy/proto/board.proto
View file @
ca80cac4
...
@@ -67,7 +67,7 @@ message VoteProposalBoard {
...
@@ -67,7 +67,7 @@ message VoteProposalBoard {
//真正投票地址
//真正投票地址
repeated
string
originAddr
=
3
;
repeated
string
originAddr
=
3
;
//代替approve,并增加了弃权选项
//代替approve,并增加了弃权选项
VoteOption
voteOption
=
4
;
Autonomy
VoteOption
voteOption
=
4
;
}
}
message
TerminateProposalBoard
{
message
TerminateProposalBoard
{
...
...
plugin/dapp/autonomy/proto/change.proto
View file @
ca80cac4
...
@@ -54,7 +54,7 @@ message RevokeProposalChange {
...
@@ -54,7 +54,7 @@ message RevokeProposalChange {
message
VoteProposalChange
{
message
VoteProposalChange
{
string
proposalID
=
1
;
string
proposalID
=
1
;
bool
approve
=
2
;
bool
approve
=
2
;
VoteOption
vote
=
3
;
Autonomy
VoteOption
vote
=
3
;
}
}
message
TerminateProposalChange
{
message
TerminateProposalChange
{
...
...
plugin/dapp/autonomy/proto/lcommon.proto
View file @
ca80cac4
...
@@ -54,7 +54,7 @@ message RuleConfig {
...
@@ -54,7 +54,7 @@ message RuleConfig {
}
}
//三种投票选项
//三种投票选项
enum
VoteOption
{
enum
Autonomy
VoteOption
{
INVALID
=
0
;
INVALID
=
0
;
//支持
//支持
APPROVE
=
1
;
APPROVE
=
1
;
...
...
plugin/dapp/autonomy/proto/project.proto
View file @
ca80cac4
...
@@ -59,7 +59,7 @@ message RevokeProposalProject {
...
@@ -59,7 +59,7 @@ message RevokeProposalProject {
message
VoteProposalProject
{
message
VoteProposalProject
{
string
proposalID
=
1
;
string
proposalID
=
1
;
bool
approve
=
2
;
bool
approve
=
2
;
VoteOption
vote
=
3
;
Autonomy
VoteOption
vote
=
3
;
}
}
message
PubVoteProposalProject
{
message
PubVoteProposalProject
{
...
...
plugin/dapp/autonomy/proto/rule.proto
View file @
ca80cac4
...
@@ -44,7 +44,7 @@ message VoteProposalRule {
...
@@ -44,7 +44,7 @@ message VoteProposalRule {
string
proposalID
=
1
;
string
proposalID
=
1
;
bool
approve
=
2
;
bool
approve
=
2
;
repeated
string
originAddr
=
3
;
repeated
string
originAddr
=
3
;
VoteOption
vote
=
4
;
Autonomy
VoteOption
vote
=
4
;
}
}
message
TerminateProposalRule
{
message
TerminateProposalRule
{
...
...
plugin/dapp/ticket/rpc/rpc_test.go
View file @
ca80cac4
...
@@ -396,6 +396,7 @@ ForkUnfreezeIDX= 0
...
@@ -396,6 +396,7 @@ ForkUnfreezeIDX= 0
[fork.sub.autonomy]
[fork.sub.autonomy]
Enable=0
Enable=0
ForkAutonomyDelRule=0
[fork.sub.jsvm]
[fork.sub.jsvm]
Enable=0
Enable=0
...
...
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