Commit ec2de227 authored by liuyuhang's avatar liuyuhang Committed by 33cn

add rule project localdb test

parent 17a57671
......@@ -125,7 +125,7 @@ func (a *Autonomy) getProposalBoard(req *auty.ReqQueryProposalBoard) (types.Mess
if err != nil {
return nil, err
}
rep.ProBoards = append(rep.ProBoards, prop)
rep.PropBoards = append(rep.PropBoards, prop)
}
return &rep, nil
}
......
......@@ -194,11 +194,11 @@ func TestGetProposalBoard(t *testing.T) {
}
rsp, err := au.getProposalBoard(req)
require.NoError(t, err)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).ProBoards), len(testcase2))
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).PropBoards), len(testcase2))
k := 2
for _, tcase := range testcase2 {
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).ProBoards[k].Height, tcase.height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).ProBoards[k].Index, int32(tcase.index))
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[k].Height, tcase.height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[k].Index, int32(tcase.index))
k--
}
......@@ -211,10 +211,10 @@ func TestGetProposalBoard(t *testing.T) {
}
rsp, err = au.getProposalBoard(req)
require.NoError(t, err)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).ProBoards), len(testcase2))
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).PropBoards), len(testcase2))
for i, tcase := range testcase2 {
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).ProBoards[i].Height, tcase.height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).ProBoards[i].Index, int32(tcase.index))
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[i].Height, tcase.height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[i].Index, int32(tcase.index))
}
// 翻页查找
......@@ -226,9 +226,9 @@ func TestGetProposalBoard(t *testing.T) {
}
rsp, err = au.getProposalBoard(req)
require.NoError(t, err)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).ProBoards), 1)
height := rsp.(*auty.ReplyQueryProposalBoard).ProBoards[0].Height
index := rsp.(*auty.ReplyQueryProposalBoard).ProBoards[0].Index
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).PropBoards), 1)
height := rsp.(*auty.ReplyQueryProposalBoard).PropBoards[0].Height
index := rsp.(*auty.ReplyQueryProposalBoard).PropBoards[0].Index
require.Equal(t, height, testcase2[2].height)
require.Equal(t, index, int32(testcase2[2].index))
//
......@@ -240,9 +240,9 @@ func TestGetProposalBoard(t *testing.T) {
Index: Index,
}
rsp, err = au.getProposalBoard(req)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).ProBoards), 2)
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).ProBoards[0].Height, testcase2[1].height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).ProBoards[0].Index, int32(testcase2[1].index))
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).ProBoards[1].Height, testcase2[0].height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).ProBoards[1].Index, int32(testcase2[0].index))
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalBoard).PropBoards), 2)
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[0].Height, testcase2[1].height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[0].Index, int32(testcase2[1].index))
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[1].Height, testcase2[0].height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalBoard).PropBoards[1].Index, int32(testcase2[0].index))
}
\ No newline at end of file
......@@ -112,7 +112,7 @@ func (a *action) rvkPropBoard(rvkProb *auty.RevokeProposalBoard) (*types.Receipt
}
start := cur.GetPropBoard().StartBlockHeight
if a.height > start {
if a.height >= start {
err := auty.ErrRevokeProposalPeriod
alog.Error("rvkPropBoard ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
rvkProb.ProposalID, "err", err)
......@@ -156,7 +156,8 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
pre := copyAutonomyProposalBoard(cur)
// 检查当前状态
if cur.Status != auty.AutonomyStatusProposalBoard && cur.Status != auty.AutonomyStatusVotePropBoard {
if cur.Status == auty.AutonomyStatusRvkPropBoard ||
cur.Status == auty.AutonomyStatusTmintPropBoard {
err := auty.ErrProposalStatus
alog.Error("votePropBoard ", "addr", a.fromaddr, "status", cur.Status, "ProposalID",
voteProb.ProposalID, "err", err)
......@@ -166,7 +167,7 @@ func (a *action) votePropBoard(voteProb *auty.VoteProposalBoard) (*types.Receipt
start := cur.GetPropBoard().StartBlockHeight
end := cur.GetPropBoard().EndBlockHeight
real := cur.GetPropBoard().RealEndBlockHeight
if start < a.height || end < a.height || (real != 0 && real < a.height) {
if a.height < start || a.height > end || real != 0 {
err := auty.ErrVotePeriod
alog.Error("votePropBoard ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
voteProb.ProposalID, "err", err)
......@@ -259,7 +260,8 @@ func (a *action) tmintPropBoard(tmintProb *auty.TerminateProposalBoard) (*types.
pre := copyAutonomyProposalBoard(cur)
// 检查当前状态
if cur.Status == auty.AutonomyStatusTmintPropBoard {
if cur.Status == auty.AutonomyStatusTmintPropBoard ||
cur.Status == auty.AutonomyStatusRvkPropBoard {
err := auty.ErrProposalStatus
alog.Error("tmintPropBoard ", "addr", a.fromaddr, "status", cur.Status, "status is not match",
tmintProb.ProposalID, "err", err)
......
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package executor
import (
"testing"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/require"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/util"
)
func TestExecLocalProject(t *testing.T) {
au := &Autonomy{}
//TyLogPropProject
cur := &auty.AutonomyProposalProject{
PropProject: &auty.ProposalProject{},
CurRule: &auty.RuleConfig{},
Boards: []string{"111", "222", "333"},
BoardVoteRes: &auty.VoteResult{},
PubVote: &auty.PublicVote{},
Status: auty.AutonomyStatusProposalProject,
Address: "11111111111111",
Height: 1,
Index: 2,
}
receiptProject := &auty.ReceiptProposalProject{
Prev: nil,
Current: cur,
}
receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{
{Ty: auty.TyLogPropProject, Log:types.Encode(receiptProject)},
},
}
set, err := au.execLocalProject(receipt)
require.NoError(t, err)
require.NotNil(t, set)
require.Equal(t, set.KV[0].Key, calcProjectKey4StatusHeight(cur.Status,
dapp.HeightIndexStr(cur.Height, int64(cur.Index))))
// TyLogRvkPropProject
pre1 := copyAutonomyProposalProject(cur)
cur.Status = auty.AutonomyStatusRvkPropProject
cur.Height = 2
cur.Index = 3
receiptProject1 := &auty.ReceiptProposalProject{
Prev: pre1,
Current: cur,
}
set, err = au.execLocalProject(&types.ReceiptData{
Logs: []*types.ReceiptLog{
{Ty: auty.TyLogRvkPropProject, Log:types.Encode(receiptProject1)},
},
})
require.NoError(t, err)
require.NotNil(t, set)
require.Equal(t, set.KV[0].Key, calcProjectKey4StatusHeight(pre1.Status,
dapp.HeightIndexStr(pre1.Height, int64(pre1.Index))))
require.Equal(t, set.KV[0].Value, []byte(nil))
require.Equal(t, set.KV[1].Key, calcProjectKey4StatusHeight(cur.Status,
dapp.HeightIndexStr(cur.Height, int64(cur.Index))))
// TyLogVotePropProject
cur.Status = auty.AutonomyStatusProposalProject
cur.Height = 1
cur.Index = 2
pre2 := copyAutonomyProposalProject(cur)
cur.Status = auty.AutonomyStatusVotePropProject
cur.Height = 2
cur.Index = 3
receiptProject2 := &auty.ReceiptProposalProject{
Prev: pre2,
Current: cur,
}
set, err = au.execLocalProject(&types.ReceiptData{
Logs: []*types.ReceiptLog{
{Ty: auty.TyLogVotePropProject, Log:types.Encode(receiptProject2)},
},
})
require.NoError(t, err)
require.NotNil(t, set)
require.Equal(t, set.KV[0].Key, calcProjectKey4StatusHeight(pre2.Status,
dapp.HeightIndexStr(pre1.Height, int64(pre2.Index))))
require.Equal(t, set.KV[0].Value, []byte(nil))
require.Equal(t, set.KV[1].Key, calcProjectKey4StatusHeight(cur.Status,
dapp.HeightIndexStr(cur.Height, int64(cur.Index))))
}
func TestExecDelLocalProject(t *testing.T) {
au := &Autonomy{}
//TyLogPropProject
cur := &auty.AutonomyProposalProject{
PropProject: &auty.ProposalProject{},
CurRule: &auty.RuleConfig{},
Boards: []string{"111", "222", "333"},
BoardVoteRes: &auty.VoteResult{},
PubVote: &auty.PublicVote{},
Status: auty.AutonomyStatusProposalProject,
Address: "11111111111111",
Height: 1,
Index: 2,
}
receiptProject := &auty.ReceiptProposalProject{
Prev: nil,
Current: cur,
}
receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{
{Ty: auty.TyLogPropProject, Log:types.Encode(receiptProject)},
},
}
set, err := au.execDelLocalProject(receipt)
require.NoError(t, err)
require.NotNil(t, set)
require.Equal(t, set.KV[0].Key, calcProjectKey4StatusHeight(cur.Status,
dapp.HeightIndexStr(cur.Height, int64(cur.Index))))
require.Equal(t, set.KV[0].Value, []byte(nil))
// TyLogVotePropProject
pre1 := copyAutonomyProposalProject(cur)
cur.Status = auty.AutonomyStatusVotePropProject
cur.Height = 2
cur.Index = 3
receiptProject2 := &auty.ReceiptProposalProject{
Prev: pre1,
Current: cur,
}
set, err = au.execDelLocalProject(&types.ReceiptData{
Logs: []*types.ReceiptLog{
{Ty: auty.TyLogVotePropProject, Log:types.Encode(receiptProject2)},
},
})
require.NoError(t, err)
require.NotNil(t, set)
require.Equal(t, set.KV[0].Key, calcProjectKey4StatusHeight(cur.Status,
dapp.HeightIndexStr(cur.Height, int64(cur.Index))))
require.Equal(t, set.KV[0].Value, []byte(nil))
require.Equal(t, set.KV[1].Key, calcProjectKey4StatusHeight(pre1.Status,
dapp.HeightIndexStr(pre1.Height, int64(pre1.Index))))
require.NotNil(t, set.KV[1].Value)
}
func TestGetProposalProject(t *testing.T) {
au := &Autonomy{
dapp.DriverBase{},
}
_, _, kvdb := util.CreateTestDB()
au.SetLocalDB(kvdb)
type statu struct {
status int32
height int64
index int64
}
testcase1 := []statu{
{auty.AutonomyStatusRvkPropProject, 10, 2},
{auty.AutonomyStatusVotePropProject, 15, 1},
{auty.AutonomyStatusTmintPropProject, 20, 1},
}
testcase2 := []statu{
{auty.AutonomyStatusProposalProject, 10, 1},
{auty.AutonomyStatusProposalProject, 20, 2},
{auty.AutonomyStatusProposalProject, 20, 5},
}
var testcase []statu
testcase = append(testcase, testcase1...)
testcase = append(testcase, testcase2...)
cur := &auty.AutonomyProposalProject{
PropProject: &auty.ProposalProject{},
CurRule: &auty.RuleConfig{},
Boards: []string{"111", "222", "333"},
BoardVoteRes: &auty.VoteResult{},
PubVote: &auty.PublicVote{},
Status: auty.AutonomyStatusProposalProject,
Address: "11111111111111",
Height: 1,
Index: 2,
}
for _, tcase := range testcase {
key := calcProjectKey4StatusHeight(tcase.status,
dapp.HeightIndexStr(tcase.height, int64(tcase.index)))
cur.Status = tcase.status
cur.Height = tcase.height
cur.Index = int32(tcase.index)
value := types.Encode(cur)
kvdb.Set(key, value)
}
// 反向查找
req := &auty.ReqQueryProposalProject{
Status:auty.AutonomyStatusProposalProject,
Count:10,
Direction:0,
Index: -1,
}
rsp, err := au.getProposalProject(req)
require.NoError(t, err)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalProject).PropProjects), len(testcase2))
k := 2
for _, tcase := range testcase2 {
require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[k].Height, tcase.height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[k].Index, int32(tcase.index))
k--
}
// 正向查找
req = &auty.ReqQueryProposalProject{
Status:auty.AutonomyStatusProposalProject,
Count:10,
Direction:1,
Index: -1,
}
rsp, err = au.getProposalProject(req)
require.NoError(t, err)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalProject).PropProjects), len(testcase2))
for i, tcase := range testcase2 {
require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[i].Height, tcase.height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[i].Index, int32(tcase.index))
}
// 翻页查找
req = &auty.ReqQueryProposalProject{
Status:auty.AutonomyStatusProposalProject,
Count:1,
Direction:0,
Index: -1,
}
rsp, err = au.getProposalProject(req)
require.NoError(t, err)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalProject).PropProjects), 1)
height := rsp.(*auty.ReplyQueryProposalProject).PropProjects[0].Height
index := rsp.(*auty.ReplyQueryProposalProject).PropProjects[0].Index
require.Equal(t, height, testcase2[2].height)
require.Equal(t, index, int32(testcase2[2].index))
//
Index := height*types.MaxTxsPerBlock + int64(index)
req = &auty.ReqQueryProposalProject{
Status:auty.AutonomyStatusProposalProject,
Count:10,
Direction:0,
Index: Index,
}
rsp, err = au.getProposalProject(req)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalProject).PropProjects), 2)
require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[0].Height, testcase2[1].height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[0].Index, int32(testcase2[1].index))
require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[1].Height, testcase2[0].height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalProject).PropProjects[1].Index, int32(testcase2[0].index))
}
\ No newline at end of file
......@@ -88,7 +88,7 @@ func (a *action) rvkPropProject(rvkProb *auty.RevokeProposalProject) (*types.Rec
}
start := cur.GetPropProject().StartBlockHeight
if a.height > start {
if a.height >= start {
err := auty.ErrRevokeProposalPeriod
alog.Error("rvkPropProject ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
rvkProb.ProposalID, "err", err)
......@@ -132,7 +132,9 @@ func (a *action) votePropProject(voteProb *auty.VoteProposalProject) (*types.Rec
pre := copyAutonomyProposalProject(cur)
// 检查当前状态
if cur.Status != auty.AutonomyStatusProposalProject && cur.Status != auty.AutonomyStatusVotePropProject {
if cur.Status == auty.AutonomyStatusRvkPropProject ||
cur.Status == auty.AutonomyStatusPubVotePropProject ||
cur.Status == auty.AutonomyStatusTmintPropProject {
err := auty.ErrProposalStatus
alog.Error("votePropProject ", "addr", a.fromaddr, "status", cur.Status, "ProposalID",
voteProb.ProposalID, "err", err)
......@@ -259,9 +261,7 @@ func (a *action) pubVotePropProject(voteProb *auty.PubVoteProposalProject) (*typ
}
start := cur.GetPropProject().StartBlockHeight
end := cur.GetPropProject().EndBlockHeight
real := cur.GetPropProject().RealEndBlockHeight
if start < a.height || end < a.height || (real != 0 && real < a.height) {
if a.height < start {
err := auty.ErrVotePeriod
alog.Error("pubVotePropProject ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
voteProb.ProposalID, "err", err)
......@@ -333,7 +333,8 @@ func (a *action) tmintPropProject(tmintProb *auty.TerminateProposalProject) (*ty
pre := copyAutonomyProposalProject(cur)
// 检查当前状态
if cur.Status == auty.AutonomyStatusTmintPropProject {
if cur.Status == auty.AutonomyStatusTmintPropProject ||
cur.Status == auty.AutonomyStatusRvkPropProject {
err := auty.ErrProposalStatus
alog.Error("tmintPropProject ", "addr", a.fromaddr, "status", cur.Status, "status is not match",
tmintProb.ProposalID, "err", err)
......
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package executor
import (
"testing"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/stretchr/testify/require"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/util"
)
func TestExecLocalRule(t *testing.T) {
au := &Autonomy{}
//TyLogPropRule
cur := &auty.AutonomyProposalRule{
PropRule: &auty.ProposalRule{},
CurRule: &auty.RuleConfig{},
VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalRule,
Address: "11111111111111",
Height: 1,
Index: 2,
}
receiptRule := &auty.ReceiptProposalRule{
Prev: nil,
Current: cur,
}
receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{
{Ty: auty.TyLogPropRule, Log:types.Encode(receiptRule)},
},
}
set, err := au.execLocalRule(receipt)
require.NoError(t, err)
require.NotNil(t, set)
require.Equal(t, set.KV[0].Key, calcRuleKey4StatusHeight(cur.Status,
dapp.HeightIndexStr(cur.Height, int64(cur.Index))))
// TyLogRvkPropRule
pre1 := copyAutonomyProposalRule(cur)
cur.Status = auty.AutonomyStatusRvkPropRule
cur.Height = 2
cur.Index = 3
receiptRule1 := &auty.ReceiptProposalRule{
Prev: pre1,
Current: cur,
}
set, err = au.execLocalRule(&types.ReceiptData{
Logs: []*types.ReceiptLog{
{Ty: auty.TyLogRvkPropRule, Log:types.Encode(receiptRule1)},
},
})
require.NoError(t, err)
require.NotNil(t, set)
require.Equal(t, set.KV[0].Key, calcRuleKey4StatusHeight(pre1.Status,
dapp.HeightIndexStr(pre1.Height, int64(pre1.Index))))
require.Equal(t, set.KV[0].Value, []byte(nil))
require.Equal(t, set.KV[1].Key, calcRuleKey4StatusHeight(cur.Status,
dapp.HeightIndexStr(cur.Height, int64(cur.Index))))
// TyLogVotePropRule
cur.Status = auty.AutonomyStatusProposalRule
cur.Height = 1
cur.Index = 2
pre2 := copyAutonomyProposalRule(cur)
cur.Status = auty.AutonomyStatusVotePropRule
cur.Height = 2
cur.Index = 3
receiptRule2 := &auty.ReceiptProposalRule{
Prev: pre2,
Current: cur,
}
set, err = au.execLocalRule(&types.ReceiptData{
Logs: []*types.ReceiptLog{
{Ty: auty.TyLogVotePropRule, Log:types.Encode(receiptRule2)},
},
})
require.NoError(t, err)
require.NotNil(t, set)
require.Equal(t, set.KV[0].Key, calcRuleKey4StatusHeight(pre2.Status,
dapp.HeightIndexStr(pre1.Height, int64(pre2.Index))))
require.Equal(t, set.KV[0].Value, []byte(nil))
require.Equal(t, set.KV[1].Key, calcRuleKey4StatusHeight(cur.Status,
dapp.HeightIndexStr(cur.Height, int64(cur.Index))))
}
func TestExecDelLocalRule(t *testing.T) {
au := &Autonomy{}
//TyLogPropRule
cur := &auty.AutonomyProposalRule{
PropRule: &auty.ProposalRule{},
CurRule: &auty.RuleConfig{},
VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalRule,
Address: "11111111111111",
Height: 1,
Index: 2,
}
receiptRule := &auty.ReceiptProposalRule{
Prev: nil,
Current: cur,
}
receipt := &types.ReceiptData{
Logs: []*types.ReceiptLog{
{Ty: auty.TyLogPropRule, Log:types.Encode(receiptRule)},
},
}
set, err := au.execDelLocalRule(receipt)
require.NoError(t, err)
require.NotNil(t, set)
require.Equal(t, set.KV[0].Key, calcRuleKey4StatusHeight(cur.Status,
dapp.HeightIndexStr(cur.Height, int64(cur.Index))))
require.Equal(t, set.KV[0].Value, []byte(nil))
// TyLogVotePropRule
pre1 := copyAutonomyProposalRule(cur)
cur.Status = auty.AutonomyStatusVotePropRule
cur.Height = 2
cur.Index = 3
receiptRule2 := &auty.ReceiptProposalRule{
Prev: pre1,
Current: cur,
}
set, err = au.execDelLocalRule(&types.ReceiptData{
Logs: []*types.ReceiptLog{
{Ty: auty.TyLogVotePropRule, Log:types.Encode(receiptRule2)},
},
})
require.NoError(t, err)
require.NotNil(t, set)
require.Equal(t, set.KV[0].Key, calcRuleKey4StatusHeight(cur.Status,
dapp.HeightIndexStr(cur.Height, int64(cur.Index))))
require.Equal(t, set.KV[0].Value, []byte(nil))
require.Equal(t, set.KV[1].Key, calcRuleKey4StatusHeight(pre1.Status,
dapp.HeightIndexStr(pre1.Height, int64(pre1.Index))))
require.NotNil(t, set.KV[1].Value)
}
func TestGetProposalRule(t *testing.T) {
au := &Autonomy{
dapp.DriverBase{},
}
_, _, kvdb := util.CreateTestDB()
au.SetLocalDB(kvdb)
type statu struct {
status int32
height int64
index int64
}
testcase1 := []statu{
{auty.AutonomyStatusRvkPropRule, 10, 2},
{auty.AutonomyStatusVotePropRule, 15, 1},
{auty.AutonomyStatusTmintPropRule, 20, 1},
}
testcase2 := []statu{
{auty.AutonomyStatusProposalRule, 10, 1},
{auty.AutonomyStatusProposalRule, 20, 2},
{auty.AutonomyStatusProposalRule, 20, 5},
}
var testcase []statu
testcase = append(testcase, testcase1...)
testcase = append(testcase, testcase2...)
cur := &auty.AutonomyProposalRule{
PropRule: &auty.ProposalRule{},
CurRule: &auty.RuleConfig{},
VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalRule,
Address: "11111111111111",
Height: 1,
Index: 2,
}
for _, tcase := range testcase {
key := calcRuleKey4StatusHeight(tcase.status,
dapp.HeightIndexStr(tcase.height, int64(tcase.index)))
cur.Status = tcase.status
cur.Height = tcase.height
cur.Index = int32(tcase.index)
value := types.Encode(cur)
kvdb.Set(key, value)
}
// 反向查找
req := &auty.ReqQueryProposalRule{
Status:auty.AutonomyStatusProposalRule,
Count:10,
Direction:0,
Index: -1,
}
rsp, err := au.getProposalRule(req)
require.NoError(t, err)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalRule).PropRules), len(testcase2))
k := 2
for _, tcase := range testcase2 {
require.Equal(t, rsp.(*auty.ReplyQueryProposalRule).PropRules[k].Height, tcase.height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalRule).PropRules[k].Index, int32(tcase.index))
k--
}
// 正向查找
req = &auty.ReqQueryProposalRule{
Status:auty.AutonomyStatusProposalRule,
Count:10,
Direction:1,
Index: -1,
}
rsp, err = au.getProposalRule(req)
require.NoError(t, err)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalRule).PropRules), len(testcase2))
for i, tcase := range testcase2 {
require.Equal(t, rsp.(*auty.ReplyQueryProposalRule).PropRules[i].Height, tcase.height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalRule).PropRules[i].Index, int32(tcase.index))
}
// 翻页查找
req = &auty.ReqQueryProposalRule{
Status:auty.AutonomyStatusProposalRule,
Count:1,
Direction:0,
Index: -1,
}
rsp, err = au.getProposalRule(req)
require.NoError(t, err)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalRule).PropRules), 1)
height := rsp.(*auty.ReplyQueryProposalRule).PropRules[0].Height
index := rsp.(*auty.ReplyQueryProposalRule).PropRules[0].Index
require.Equal(t, height, testcase2[2].height)
require.Equal(t, index, int32(testcase2[2].index))
//
Index := height*types.MaxTxsPerBlock + int64(index)
req = &auty.ReqQueryProposalRule{
Status:auty.AutonomyStatusProposalRule,
Count:10,
Direction:0,
Index: Index,
}
rsp, err = au.getProposalRule(req)
require.Equal(t, len(rsp.(*auty.ReplyQueryProposalRule).PropRules), 2)
require.Equal(t, rsp.(*auty.ReplyQueryProposalRule).PropRules[0].Height, testcase2[1].height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalRule).PropRules[0].Index, int32(testcase2[1].index))
require.Equal(t, rsp.(*auty.ReplyQueryProposalRule).PropRules[1].Height, testcase2[0].height)
require.Equal(t, rsp.(*auty.ReplyQueryProposalRule).PropRules[1].Index, int32(testcase2[0].index))
}
\ No newline at end of file
......@@ -45,7 +45,7 @@ func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) {
cur := &auty.AutonomyProposalRule{
PropRule:prob,
Rule: rule,
CurRule: rule,
VoteResult: &auty.VoteResult{},
Status: auty.AutonomyStatusProposalRule,
Address: a.fromaddr,
......@@ -81,7 +81,7 @@ func (a *action) rvkPropRule(rvkProb *auty.RevokeProposalRule) (*types.Receipt,
}
start := cur.GetPropRule().StartBlockHeight
if a.height > start {
if a.height >= start {
err := auty.ErrRevokeProposalPeriod
alog.Error("rvkPropRule ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
rvkProb.ProposalID, "err", err)
......@@ -98,9 +98,9 @@ func (a *action) rvkPropRule(rvkProb *auty.RevokeProposalRule) (*types.Receipt,
var logs []*types.ReceiptLog
var kv []*types.KeyValue
receipt, err := a.coinsAccount.ExecActive(a.fromaddr, a.execaddr, cur.Rule.ProposalAmount)
receipt, err := a.coinsAccount.ExecActive(a.fromaddr, a.execaddr, cur.CurRule.ProposalAmount)
if err != nil {
alog.Error("rvkPropRule ", "addr", a.fromaddr, "execaddr", a.execaddr, "ExecActive amount", cur.Rule.ProposalAmount, "err", err)
alog.Error("rvkPropRule ", "addr", a.fromaddr, "execaddr", a.execaddr, "ExecActive amount", cur.CurRule.ProposalAmount, "err", err)
return nil, err
}
logs = append(logs, receipt.Logs...)
......@@ -125,7 +125,8 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
pre := copyAutonomyProposalRule(cur)
// 检查当前状态
if cur.Status != auty.AutonomyStatusProposalRule && cur.Status != auty.AutonomyStatusVotePropRule {
if cur.Status == auty.AutonomyStatusRvkPropRule ||
cur.Status == auty.AutonomyStatusTmintPropRule {
err := auty.ErrProposalStatus
alog.Error("votePropRule ", "addr", a.fromaddr, "status", cur.Status, "ProposalID",
voteProb.ProposalID, "err", err)
......@@ -135,7 +136,7 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
start := cur.GetPropRule().StartBlockHeight
end := cur.GetPropRule().EndBlockHeight
real := cur.GetPropRule().RealEndBlockHeight
if start < a.height || end < a.height || (real != 0 && real < a.height) {
if a.height < start || a.height > end || real != 0 {
err := auty.ErrVotePeriod
alog.Error("votePropRule ", "addr", a.fromaddr, "execaddr", a.execaddr, "ProposalID",
voteProb.ProposalID, "err", err)
......@@ -177,7 +178,7 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
// 首次进入投票期,即将提案金转入自治系统地址
if cur.Status == auty.AutonomyStatusProposalRule {
receipt, err := a.coinsAccount.ExecTransferFrozen(cur.Address, autonomyAddr, a.execaddr, cur.Rule.ProposalAmount)
receipt, err := a.coinsAccount.ExecTransferFrozen(cur.Address, autonomyAddr, a.execaddr, cur.CurRule.ProposalAmount)
if err != nil {
alog.Error("votePropRule ", "addr", cur.Address, "execaddr", a.execaddr, "ExecTransferFrozen amount fail", err)
return nil, err
......@@ -206,7 +207,7 @@ func (a *action) votePropRule(voteProb *auty.VoteProposalRule) (*types.Receipt,
// 更新系统规则
if cur.VoteResult.Pass {
upRule := upgradeRule(cur.Rule, cur.PropRule.RuleCfg)
upRule := upgradeRule(cur.CurRule, cur.PropRule.RuleCfg)
kv = append(kv, &types.KeyValue{Key: activeRuleID(), Value:types.Encode(upRule)})
}
......@@ -270,7 +271,7 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re
// 未进行投票情况下,符合提案关闭的也需要扣除提案费用
if cur.Status == auty.AutonomyStatusProposalRule {
receipt, err := a.coinsAccount.ExecTransferFrozen(cur.Address, autonomyAddr, a.execaddr, cur.Rule.ProposalAmount)
receipt, err := a.coinsAccount.ExecTransferFrozen(cur.Address, autonomyAddr, a.execaddr, cur.CurRule.ProposalAmount)
if err != nil {
alog.Error("votePropRule ", "addr", a.fromaddr, "execaddr", a.execaddr, "ExecTransferFrozen amount fail", err)
return nil, err
......@@ -286,7 +287,7 @@ func (a *action) tmintPropRule(tmintProb *auty.TerminateProposalRule) (*types.Re
// 更新系统规则
if cur.VoteResult.Pass {
upRule := upgradeRule(cur.Rule, cur.PropRule.RuleCfg)
upRule := upgradeRule(cur.CurRule, cur.PropRule.RuleCfg)
kv = append(kv, &types.KeyValue{Key: activeRuleID(), Value:types.Encode(upRule)})
}
......@@ -331,9 +332,9 @@ func copyAutonomyProposalRule(cur *auty.AutonomyProposalRule) *auty.AutonomyProp
newAut.PropRule.RuleCfg = &cfg
}
}
if cur.Rule != nil {
newRule := *cur.GetRule()
newAut.Rule = &newRule
if cur.CurRule != nil {
newRule := *cur.GetCurRule()
newAut.CurRule = &newRule
}
if cur.VoteResult != nil {
newRes := *cur.GetVoteResult()
......
......@@ -401,7 +401,7 @@ func TestCopyAutonomyProposalRule(t *testing.T) {
require.Nil(t, copyAutonomyProposalRule(nil))
cur := &auty.AutonomyProposalRule{
PropRule: &auty.ProposalRule{Year: 1900, Month: 1, RuleCfg:&auty.RuleConfig{BoardApproveRatio:80}},
Rule: &auty.RuleConfig{BoardApproveRatio:100},
CurRule: &auty.RuleConfig{BoardApproveRatio:100},
VoteResult: &auty.VoteResult{TotalVotes: 100},
Status: 2,
Address:"123",
......@@ -410,7 +410,7 @@ func TestCopyAutonomyProposalRule(t *testing.T) {
cur.PropRule.Year = 1800
cur.PropRule.Month = 2
cur.PropRule.RuleCfg.BoardApproveRatio = 90
cur.Rule.BoardApproveRatio = 90
cur.CurRule.BoardApproveRatio = 90
cur.VoteResult.TotalVotes = 50
cur.Address = "234"
cur.Status = 1
......@@ -421,7 +421,7 @@ func TestCopyAutonomyProposalRule(t *testing.T) {
require.Equal(t, "123", pre.Address)
require.Equal(t, 2, int(pre.Status))
require.Equal(t, 80, int(pre.PropRule.RuleCfg.BoardApproveRatio))
require.Equal(t, 100, int(pre.Rule.BoardApproveRatio))
require.Equal(t, 100, int(pre.CurRule.BoardApproveRatio))
}
func TestUpgradeRule(t *testing.T) {
......
......@@ -72,5 +72,5 @@ message ReqQueryProposalBoard {
}
message ReplyQueryProposalBoard {
repeated AutonomyProposalBoard proBoards = 1;
repeated AutonomyProposalBoard propBoards = 1;
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ package types;
message AutonomyProposalRule {
ProposalRule propRule = 1;
RuleConfig rule = 2;
RuleConfig curRule = 2;
// 全体持票人投票结果
VoteResult voteResult = 3;
// 状态
......
......@@ -295,7 +295,7 @@ func (m *ReqQueryProposalBoard) GetIndex() int64 {
}
type ReplyQueryProposalBoard struct {
ProBoards []*AutonomyProposalBoard `protobuf:"bytes,1,rep,name=proBoards" json:"proBoards,omitempty"`
PropBoards []*AutonomyProposalBoard `protobuf:"bytes,1,rep,name=propBoards" json:"propBoards,omitempty"`
}
func (m *ReplyQueryProposalBoard) Reset() { *m = ReplyQueryProposalBoard{} }
......@@ -303,9 +303,9 @@ func (m *ReplyQueryProposalBoard) String() string { return proto.Comp
func (*ReplyQueryProposalBoard) ProtoMessage() {}
func (*ReplyQueryProposalBoard) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} }
func (m *ReplyQueryProposalBoard) GetProBoards() []*AutonomyProposalBoard {
func (m *ReplyQueryProposalBoard) GetPropBoards() []*AutonomyProposalBoard {
if m != nil {
return m.ProBoards
return m.PropBoards
}
return nil
}
......@@ -325,38 +325,38 @@ func init() {
func init() { proto.RegisterFile("board.proto", fileDescriptor1) }
var fileDescriptor1 = []byte{
// 523 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x5d, 0x6f, 0xd3, 0x30,
0x14, 0x55, 0xda, 0xa6, 0x5d, 0xef, 0x34, 0xb4, 0x99, 0x6e, 0x44, 0xd3, 0x84, 0xaa, 0x3c, 0xa0,
0x0a, 0xa4, 0x0a, 0xc6, 0x87, 0x10, 0x6f, 0x14, 0x90, 0x40, 0x02, 0x09, 0xae, 0x80, 0x77, 0x2f,
0xb9, 0x5b, 0xa3, 0xa5, 0xb6, 0x71, 0x9c, 0x8a, 0xbc, 0xf1, 0xce, 0x0f, 0xe5, 0x6f, 0xa0, 0xdc,
0xb8, 0x6b, 0x33, 0x2a, 0x60, 0x6f, 0x39, 0x37, 0xe7, 0xd8, 0xf7, 0xda, 0xe7, 0x18, 0x76, 0xcf,
0xb4, 0xb4, 0xe9, 0xd4, 0x58, 0xed, 0xb4, 0x08, 0x5d, 0x65, 0xa8, 0x38, 0xde, 0xcb, 0x13, 0xbd,
0x58, 0x68, 0xd5, 0x54, 0xe3, 0x9f, 0x1d, 0x38, 0x7c, 0x59, 0x3a, 0xad, 0xf4, 0xa2, 0xfa, 0x68,
0xb5, 0xd1, 0x85, 0xcc, 0x67, 0xb5, 0x4a, 0x9c, 0xc2, 0xd0, 0x58, 0x6d, 0x18, 0x44, 0xc1, 0x38,
0x98, 0xec, 0x9e, 0x8e, 0xa6, 0xbc, 0xc6, 0x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, 0xfa, 0xfc, 0xf6, 0x3c, 0xfe, 0x1d, 0x00,
0x00, 0xff, 0xff, 0x86, 0xfa, 0x5a, 0x11, 0xa0, 0x04, 0x00, 0x00,
// 524 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4d, 0x6f, 0xd3, 0x40,
0x10, 0x95, 0x93, 0x6c, 0xd2, 0x4c, 0x55, 0xd4, 0x2e, 0x69, 0xb1, 0xaa, 0x0a, 0x45, 0x3e, 0x20,
0x0b, 0xa4, 0x08, 0xca, 0x87, 0x38, 0x70, 0x21, 0x80, 0x04, 0x12, 0x48, 0x30, 0x42, 0x70, 0xde,
0xda, 0xd3, 0xc6, 0xaa, 0xbd, 0xbb, 0xac, 0xd7, 0x11, 0xbe, 0x71, 0xe7, 0x87, 0xf2, 0x37, 0x90,
0xd7, 0x9b, 0x26, 0x2e, 0x11, 0xd0, 0x9b, 0xdf, 0xf8, 0xbd, 0xdd, 0x19, 0xcf, 0x7b, 0x86, 0xdd,
0x33, 0x25, 0x4c, 0x3a, 0xd3, 0x46, 0x59, 0xc5, 0x99, 0xad, 0x35, 0x95, 0xc7, 0x7b, 0x79, 0xa2,
0x8a, 0x42, 0xc9, 0xb6, 0x1a, 0xfd, 0xec, 0xc1, 0xe1, 0xcb, 0xca, 0x2a, 0xa9, 0x8a, 0xfa, 0xa3,
0x51, 0x5a, 0x95, 0x22, 0x9f, 0x37, 0x2a, 0x7e, 0x0a, 0x63, 0x6d, 0x94, 0x76, 0x20, 0x0c, 0xa6,
0x41, 0xbc, 0x7b, 0x3a, 0x99, 0xb9, 0x33, 0x66, 0x1d, 0x22, 0xae, 0x69, 0xfc, 0x01, 0x8c, 0x92,
0xca, 0x60, 0x95, 0x53, 0xd8, 0x73, 0x8a, 0x03, 0xaf, 0x68, 0x4a, 0xaf, 0x94, 0x3c, 0xcf, 0x2e,
0x70, 0xc5, 0xe0, 0x8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x1b, 0x89, 0xdc, 0x76, 0xb4,
0x36, 0x6a, 0xd9, 0xba, 0x62, 0x07, 0x57, 0x30, 0x7a, 0x0e, 0x47, 0x9f, 0xc9, 0x14, 0x99, 0x14,
0x37, 0x3c, 0x33, 0xfa, 0x11, 0xc0, 0x04, 0x29, 0xa1, 0x4c, 0xdb, 0xae, 0xf0, 0x21, 0x0c, 0xb4,
0xa1, 0xa5, 0x77, 0xec, 0x89, 0xf7, 0xd3, 0x56, 0x8b, 0xa3, 0x63, 0xf2, 0x67, 0xce, 0xb4, 0x86,
0xa4, 0xf5, 0xa6, 0xfd, 0xbb, 0x68, 0x45, 0x8e, 0xce, 0x81, 0xbf, 0x57, 0x89, 0xc8, 0xbb, 0xf7,
0x3f, 0x81, 0xa1, 0xcb, 0x43, 0xfa, 0x5f, 0x1d, 0x78, 0x2e, 0x3f, 0x86, 0x9d, 0x26, 0x96, 0x24,
0x6d, 0x19, 0xf6, 0x9c, 0x59, 0xae, 0x70, 0x54, 0xc3, 0x21, 0xd2, 0xb7, 0x4f, 0x15, 0x99, 0x6b,
0x09, 0x5d, 0xa7, 0x21, 0xe8, 0xa4, 0x61, 0x02, 0x2c, 0x51, 0x95, 0x1f, 0x87, 0x61, 0x0b, 0xf8,
0x09, 0x8c, 0xd3, 0xcc, 0x50, 0x62, 0x33, 0x25, 0xbd, 0x4b, 0xd7, 0x85, 0x75, 0x1e, 0x06, 0xce,
0x32, 0x3e, 0x0f, 0x5f, 0xe1, 0x0e, 0x92, 0xce, 0xeb, 0x2d, 0x97, 0xbf, 0x68, 0x17, 0x34, 0x6f,
0x0d, 0x1e, 0x4c, 0xfb, 0xff, 0x9c, 0x75, 0x83, 0x7f, 0x36, 0x74, 0x7f, 0x9f, 0xc7, 0xbf, 0x03,
0x00, 0x00, 0xff, 0xff, 0x6e, 0xdf, 0x6d, 0xe2, 0xa2, 0x04, 0x00, 0x00,
}
......@@ -14,7 +14,7 @@ var _ = math.Inf
type AutonomyProposalRule struct {
PropRule *ProposalRule `protobuf:"bytes,1,opt,name=propRule" json:"propRule,omitempty"`
Rule *RuleConfig `protobuf:"bytes,2,opt,name=rule" json:"rule,omitempty"`
CurRule *RuleConfig `protobuf:"bytes,2,opt,name=curRule" json:"curRule,omitempty"`
// 全体持票人投票结果
VoteResult *VoteResult `protobuf:"bytes,3,opt,name=voteResult" json:"voteResult,omitempty"`
// 状态
......@@ -36,9 +36,9 @@ func (m *AutonomyProposalRule) GetPropRule() *ProposalRule {
return nil
}
func (m *AutonomyProposalRule) GetRule() *RuleConfig {
func (m *AutonomyProposalRule) GetCurRule() *RuleConfig {
if m != nil {
return m.Rule
return m.CurRule
}
return nil
}
......@@ -323,38 +323,38 @@ func init() {
func init() { proto.RegisterFile("rule.proto", fileDescriptor4) }
var fileDescriptor4 = []byte{
// 519 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x5b, 0x6f, 0xd3, 0x30,
0x14, 0x56, 0xda, 0xba, 0x97, 0xc3, 0x45, 0x9d, 0x57, 0xa6, 0x68, 0x20, 0x54, 0x45, 0x02, 0x55,
0x20, 0x15, 0x71, 0xd3, 0xc4, 0x23, 0x0c, 0x24, 0x90, 0xf6, 0x00, 0x07, 0xc4, 0x7b, 0x48, 0xce,
0xda, 0x68, 0xa9, 0x6d, 0x1c, 0xa7, 0x5a, 0x1f, 0x78, 0xe0, 0x77, 0xf3, 0x82, 0xec, 0xb8, 0x4d,
0xb3, 0x56, 0x9b, 0xf6, 0x96, 0xef, 0xf8, 0x3b, 0x97, 0xcf, 0x3e, 0x5f, 0x00, 0x74, 0x99, 0xd3,
0x54, 0x69, 0x69, 0x24, 0x67, 0x66, 0xa5, 0xa8, 0x38, 0xbe, 0x97, 0x27, 0x72, 0xb1, 0x90, 0xa2,
0x8a, 0x46, 0x7f, 0x5b, 0x30, 0x7a, 0x5f, 0x1a, 0x29, 0xe4, 0x62, 0xf5, 0x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, 0x57, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x44, 0xd4,
0x39, 0xc2, 0xa7, 0x04, 0x00, 0x00,
}
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