Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not allow empty plan name #160

Merged
merged 21 commits into from
Oct 14, 2021
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
de14948
test: add TestPlanI
hallazzang Oct 6, 2021
c71a16d
test: add TestBasePlanValidate
hallazzang Oct 6, 2021
da2faef
test: add TestIsPlanActiveAt
hallazzang Oct 6, 2021
eb23dad
fix: fix proposal validation logic
hallazzang Oct 6, 2021
9f46f50
test: add TestValidateStakingCoinTotalWeights
hallazzang Oct 6, 2021
6f1e367
test: add tests for proposal validation
hallazzang Oct 6, 2021
8d42bbe
test: change expected error messages
hallazzang Oct 6, 2021
7c0ec91
fix!: forbid empty plan name and allow empty weights
hallazzang Oct 6, 2021
c27e6a0
fix: allow empty plan name in UpdateRequestProposal
hallazzang Oct 6, 2021
5b42607
fix: EpochAmount/EpochRatio fields can be both empty
hallazzang Oct 6, 2021
390219c
fix: more strict validation and allow optional addrs
hallazzang Oct 7, 2021
6ff5d2e
fix: allow optional fields in UpdateRequestProposal
hallazzang Oct 7, 2021
4995232
test: update proposal handler tests
hallazzang Oct 7, 2021
9de3523
chore: Merge branch 'master' of github.com:tendermint/farming into 15…
hallazzang Oct 7, 2021
160ce70
chore: change error message
hallazzang Oct 7, 2021
e1b2ad3
chore: fix typo and use nil EpochRatio instead of zero
hallazzang Oct 7, 2021
b1be679
fix: change the logic to determine what the request is for
hallazzang Oct 8, 2021
5f181b1
fix: apply suggestions from review
hallazzang Oct 13, 2021
8a443c7
feat: refactory ValidateStakingCoinTotalWeights
dongsam Oct 14, 2021
d42d834
feat: refactor validating EpochAmount, EpochRatio
dongsam Oct 14, 2021
8c82f75
chore: fix linter issue
hallazzang Oct 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: change expected error messages
hallazzang committed Oct 6, 2021
commit 8d42bbef48a1ecabd9547810c35efe16eb541ddd
8 changes: 4 additions & 4 deletions x/farming/keeper/proposal_handler_test.go
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ func (suite *KeeperTestSuite) TestValidateAddPublicPlanProposal() {
sdk.NewCoins(sdk.NewInt64Coin(denom3, 1)),
sdk.NewDec(1),
)},
sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "either epoch amount or epoch ratio should be provided"),
sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "only one of epoch amount or epoch ratio must be provided"),
},
{
"epoch amount & epoch ratio case #2",
@@ -142,7 +142,7 @@ func (suite *KeeperTestSuite) TestValidateAddPublicPlanProposal() {
sdk.NewCoins(),
sdk.ZeroDec(),
)},
sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "either epoch amount or epoch ratio must not be zero"),
sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "only one of epoch amount or epoch ratio must be provided"),
},
} {
suite.Run(tc.name, func() {
@@ -320,7 +320,7 @@ func (suite *KeeperTestSuite) TestValidateUpdatePublicPlanProposal() {
sdk.NewCoins(sdk.NewInt64Coin("stake", 100_000)),
plan.(*types.RatioPlan).EpochRatio,
)},
sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "either epoch amount or epoch ratio should be provided"),
sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "only one of epoch amount or epoch ratio must be provided"),
},
{
"epoch amount & epoch ratio case #2",
@@ -336,7 +336,7 @@ func (suite *KeeperTestSuite) TestValidateUpdatePublicPlanProposal() {
sdk.NewCoins(sdk.NewInt64Coin("stake", 0)),
sdk.ZeroDec(),
)},
sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "either epoch amount or epoch ratio must not be zero"),
sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "only one of epoch amount or epoch ratio must be provided"),
},
} {
suite.Run(tc.name, func() {