Commit c1811b63 authored by QM's avatar QM Committed by mdj33

add autonomy fork

parent e059219f
......@@ -69,13 +69,19 @@ func (a *action) propRule(prob *auty.ProposalRule) (*types.Receipt, error) {
checkParaInvalid(int64(prob.RuleCfg.PubOpposeRatio), minPubOpposeRatio, maxPubOpposeRatio) ||
checkParaInvalid(int64(prob.RuleCfg.PublicPeriod), int64(minPublicPeriod), int64(maxPublicPeriod)) ||
checkParaInvalid(prob.RuleCfg.LargeProjectAmount, minLargeProjectAmount*cfg.GetCoinPrecision(), maxLargeProjectAmount*cfg.GetCoinPrecision()) ||
checkParaInvalid(prob.RuleCfg.ProposalAmount, minProposalAmount*cfg.GetCoinPrecision(), maxProposalAmount*cfg.GetCoinPrecision()) ||
checkParaInvalid(int64(prob.RuleCfg.PubAttendRatio), minPubAttendRatio, maxPubAttendRatio) ||
checkParaInvalid(int64(prob.RuleCfg.PubApproveRatio), minPubApproveRatio, maxPubApproveRatio) {
checkParaInvalid(prob.RuleCfg.ProposalAmount, minProposalAmount*cfg.GetCoinPrecision(), maxProposalAmount*cfg.GetCoinPrecision()) {
alog.Error("propRule RuleCfg invaild", "ruleCfg", prob.RuleCfg)
return nil, types.ErrInvalidParam
}
if cfg.IsDappFork(a.height, auty.AutonomyX, auty.ForkAutonomyDelRule) {
if checkParaInvalid(int64(prob.RuleCfg.PubAttendRatio), minPubAttendRatio, maxPubAttendRatio) ||
checkParaInvalid(int64(prob.RuleCfg.PubApproveRatio), minPubApproveRatio, maxPubApproveRatio) {
alog.Error("propRule RuleCfg invaild", "PubAttendRatio", prob.RuleCfg.PubAttendRatio, "PubApproveRatio", prob.RuleCfg.PubApproveRatio)
return nil, types.ErrInvalidParam
}
}
if prob.StartBlockHeight < a.height || prob.EndBlockHeight < a.height ||
prob.StartBlockHeight+startEndBlockPeriod > prob.EndBlockHeight {
alog.Error("propRule height invaild", "StartBlockHeight", prob.StartBlockHeight, "EndBlockHeight",
......
......@@ -552,6 +552,8 @@ func TestUpgradeRule(t *testing.T) {
ProposalAmount: 4,
LargeProjectAmount: 5,
PublicPeriod: 6,
PubAttendRatio: 7,
PubApproveRatio: 8,
}
modify := &auty.RuleConfig{
BoardApproveRatio: -1,
......@@ -559,6 +561,8 @@ func TestUpgradeRule(t *testing.T) {
ProposalAmount: -1,
LargeProjectAmount: 0,
PublicPeriod: 0,
PubAttendRatio: -1,
PubApproveRatio: 0,
}
newRule = upgradeRule(cur, modify)
assert.NotNil(t, newRule)
......@@ -567,6 +571,8 @@ func TestUpgradeRule(t *testing.T) {
assert.Equal(t, newRule.ProposalAmount, cur.ProposalAmount)
assert.Equal(t, newRule.LargeProjectAmount, cur.LargeProjectAmount)
assert.Equal(t, newRule.PublicPeriod, cur.PublicPeriod)
assert.Equal(t, newRule.PubAttendRatio, cur.PubAttendRatio)
assert.Equal(t, newRule.PubApproveRatio, cur.PubApproveRatio)
modify = &auty.RuleConfig{
BoardApproveRatio: 20,
......@@ -574,6 +580,8 @@ func TestUpgradeRule(t *testing.T) {
ProposalAmount: 40,
LargeProjectAmount: 50,
PublicPeriod: 60,
PubAttendRatio: 70,
PubApproveRatio: 80,
}
newRule = upgradeRule(cur, modify)
assert.NotNil(t, newRule)
......@@ -582,6 +590,8 @@ func TestUpgradeRule(t *testing.T) {
assert.Equal(t, newRule.ProposalAmount, modify.ProposalAmount)
assert.Equal(t, newRule.LargeProjectAmount, modify.LargeProjectAmount)
assert.Equal(t, newRule.PublicPeriod, modify.PublicPeriod)
assert.Equal(t, newRule.PubAttendRatio, modify.PubAttendRatio)
assert.Equal(t, newRule.PubApproveRatio, modify.PubApproveRatio)
}
func TestTransfer(t *testing.T) {
......
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