Skip to content

Commit

Permalink
feat(pool-incentives): allow zero-weight distribution records (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeebster authored Oct 30, 2021
1 parent db509c4 commit 954bb5c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

* Allow zero-weight pool-incentive distribution records
* Fix bug in incentives epoch distribution events, used to use raw address, now uses bech32 addr
* Update peer ID of statesync-enabled node run by notional
* Created a pull request template
Expand Down
12 changes: 12 additions & 0 deletions x/pool-incentives/types/gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ func TestUpdatePoolIncentivesProposalMarshalUnmarshal(t *testing.T) {
},
},
},
{ // zero-weight record
proposal: &types.UpdatePoolIncentivesProposal{
Title: "title",
Description: "proposal to update pool incentives",
Records: []types.DistrRecord{
{
GaugeId: 1,
Weight: sdk.NewInt(0),
},
},
},
},
{ // two records
proposal: &types.UpdatePoolIncentivesProposal{
Title: "title",
Expand Down
2 changes: 1 addition & 1 deletion x/pool-incentives/types/record.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package types

func (r DistrRecord) ValidateBasic() error {
if !r.Weight.IsPositive() {
if r.Weight.IsNegative() {
return ErrDistrRecordNotPositiveWeight
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion x/pool-incentives/types/record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestDistrRecord(t *testing.T) {
Weight: sdk.NewInt(0),
}

require.Error(t, zeroWeight.ValidateBasic())
require.NoError(t, zeroWeight.ValidateBasic())

negativeWeight := types.DistrRecord{
GaugeId: 1,
Expand Down

0 comments on commit 954bb5c

Please sign in to comment.