Commit 999ab02c authored by QM's avatar QM Committed by vipwzw

autonomy propEndBlockPeriod

parent 54d03741
......@@ -31,6 +31,7 @@ const (
pubApproveRatio int32 = 66 // 全体持票人赞成率,以%计
pubOpposeRatio int32 = 33 // 全体持票人否决率,以%计
startEndBlockPeriod = 720 // 提案开始结束最小周期
propEndBlockPeriod = 1000000 // 提案高度 结束高度最大周期 100W
)
type action struct {
......@@ -110,6 +111,14 @@ func (a *action) propBoard(prob *auty.ProposalBoard) (*types.Receipt, error) {
prob.EndBlockHeight, "height", a.height)
return nil, auty.ErrSetBlockHeight
}
if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
if prob.EndBlockHeight > a.height+propEndBlockPeriod {
alog.Error("propBoard height invaild", "EndBlockHeight", prob.EndBlockHeight, "height", a.height)
return nil, auty.ErrSetBlockHeight
}
}
if len(prob.Boards) == 0 {
alog.Error("propBoard ", "proposal boards number is zero", len(prob.Boards))
return nil, auty.ErrBoardNumber
......
......@@ -27,6 +27,13 @@ func (a *action) propChange(prob *auty.ProposalChange) (*types.Receipt, error) {
return nil, auty.ErrSetBlockHeight
}
if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
if prob.EndBlockHeight > a.height+propEndBlockPeriod {
alog.Error("propBoard height invaild", "EndBlockHeight", prob.EndBlockHeight, "height", a.height)
return nil, auty.ErrSetBlockHeight
}
}
act, err := a.getActiveBoard()
if err != nil {
alog.Error("propChange ", "addr", a.fromaddr, "execaddr", a.execaddr, "getActiveBoard failed", err)
......
......@@ -31,6 +31,13 @@ func (a *action) propProject(prob *auty.ProposalProject) (*types.Receipt, error)
return nil, auty.ErrSetBlockHeight
}
if a.api.GetConfig().IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
if prob.EndBlockHeight > a.height+propEndBlockPeriod {
alog.Error("propBoard height invaild", "EndBlockHeight", prob.EndBlockHeight, "height", a.height)
return nil, auty.ErrSetBlockHeight
}
}
if prob.Amount <= 0 {
err := types.ErrInvalidParam
alog.Error("propProject amount invaild", "amount", prob.Amount, "error", err)
......
......@@ -80,6 +80,11 @@ func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) {
alog.Error("propRule RuleCfg invaild", "PubAttendRatio", prob.RuleCfg.PubAttendRatio, "PubApproveRatio", prob.RuleCfg.PubApproveRatio)
return nil, types.ErrInvalidParam
}
if prob.EndBlockHeight > a.height+propEndBlockPeriod {
alog.Error("propBoard height invaild", "EndBlockHeight", prob.EndBlockHeight, "height", a.height)
return nil, auty.ErrSetBlockHeight
}
}
if prob.StartBlockHeight < a.height || prob.EndBlockHeight < a.height ||
......
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