Commit ca80cac4 authored by mdj33's avatar mdj33

fix ut

parent 4016e4d3
...@@ -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.AutonomyVoteOption_APPROVE:
cur.VoteResult.ApproveVotes += vtCouts cur.VoteResult.ApproveVotes += vtCouts
case auty.VoteOption_OPPOSE: case auty.AutonomyVoteOption_OPPOSE:
cur.VoteResult.OpposeVotes += vtCouts cur.VoteResult.OpposeVotes += vtCouts
case auty.VoteOption_QUIT: case auty.AutonomyVoteOption_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)
......
...@@ -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.AutonomyVoteOption_APPROVE:
cur.VoteResult.ApproveVotes++ cur.VoteResult.ApproveVotes++
case auty.VoteOption_OPPOSE: case auty.AutonomyVoteOption_OPPOSE:
cur.VoteResult.OpposeVotes++ cur.VoteResult.OpposeVotes++
case auty.VoteOption_QUIT: case auty.AutonomyVoteOption_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{})
......
...@@ -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.AutonomyVoteOption_APPROVE:
cur.BoardVoteRes.ApproveVotes++ cur.BoardVoteRes.ApproveVotes++
case auty.VoteOption_OPPOSE: case auty.AutonomyVoteOption_OPPOSE:
cur.BoardVoteRes.OpposeVotes++ cur.BoardVoteRes.OpposeVotes++
case auty.VoteOption_QUIT: case auty.AutonomyVoteOption_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)
......
...@@ -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.AutonomyVoteOption_APPROVE:
cur.VoteResult.ApproveVotes += vtCouts cur.VoteResult.ApproveVotes += vtCouts
case auty.VoteOption_OPPOSE: case auty.AutonomyVoteOption_OPPOSE:
cur.VoteResult.OpposeVotes += vtCouts cur.VoteResult.OpposeVotes += vtCouts
case auty.VoteOption_QUIT: case auty.AutonomyVoteOption_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)
......
...@@ -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; AutonomyVoteOption voteOption = 4;
} }
message TerminateProposalBoard { message TerminateProposalBoard {
......
...@@ -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; AutonomyVoteOption vote = 3;
} }
message TerminateProposalChange { message TerminateProposalChange {
......
...@@ -54,7 +54,7 @@ message RuleConfig { ...@@ -54,7 +54,7 @@ message RuleConfig {
} }
//三种投票选项 //三种投票选项
enum VoteOption { enum AutonomyVoteOption {
INVALID = 0; INVALID = 0;
//支持 //支持
APPROVE = 1; APPROVE = 1;
......
...@@ -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; AutonomyVoteOption vote = 3;
} }
message PubVoteProposalProject { message PubVoteProposalProject {
......
...@@ -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; AutonomyVoteOption vote = 4;
} }
message TerminateProposalRule { message TerminateProposalRule {
......
...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment