diff --git a/x/foundation/foundation.go b/x/foundation/foundation.go index b1fc7829f6..ee0b9e579d 100644 --- a/x/foundation/foundation.go +++ b/x/foundation/foundation.go @@ -316,7 +316,7 @@ func (p PercentageDecisionPolicy) Allow(result TallyResult, totalWeight sdk.Dec, } totalCounts := result.TotalCounts() - undecided := notAbstaining.Sub(totalCounts) + undecided := totalWeight.Sub(totalCounts) maxYesCount := result.YesCount.Add(undecided) maxYesPercentage := maxYesCount.Quo(notAbstaining) if maxYesPercentage.LT(p.Percentage) { diff --git a/x/foundation/foundation_test.go b/x/foundation/foundation_test.go index 26eae0507a..f1046ec9d2 100644 --- a/x/foundation/foundation_test.go +++ b/x/foundation/foundation_test.go @@ -147,8 +147,8 @@ func TestThresholdDecisionPolicyAllow(t *testing.T) { }, "deny": { sinceSubmission: policy.Windows.MinExecutionPeriod, - totalWeight: policy.Threshold, - tally: foundation.NewTallyResult(sdk.ZeroDec(), sdk.ZeroDec(), sdk.OneDec(), sdk.ZeroDec()), + totalWeight: policy.Threshold.Add(sdk.OneDec()), + tally: foundation.NewTallyResult(sdk.ZeroDec(), sdk.OneDec(), sdk.OneDec(), sdk.ZeroDec()), valid: true, final: true, }, @@ -271,7 +271,7 @@ func TestPercentageDecisionPolicyAllow(t *testing.T) { }, "not final": { sinceSubmission: policy.Windows.MinExecutionPeriod, - tally: foundation.NewTallyResult(sdk.NewDec(4), sdk.ZeroDec(), sdk.NewDec(1), sdk.ZeroDec()), + tally: foundation.NewTallyResult(sdk.ZeroDec(), sdk.NewDec(5), sdk.NewDec(1), sdk.ZeroDec()), valid: true, }, "deny": {