diff --git a/x/mint/client/cli/query_test.go b/x/mint/client/cli/query_test.go index 9e9a7620..c30df331 100644 --- a/x/mint/client/cli/query_test.go +++ b/x/mint/client/cli/query_test.go @@ -46,17 +46,15 @@ func TestGetCmdQueryParams(t *testing.T) { "json output", []string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=json", flags.FlagOutput)}, `[--height=1 --output=json]`, - `{"mint_denom":"","inflation_coef":"0","bonding_adjustment":"0","target_bonding_ratio":"0","blocks_per_year":"0"}`, + `{"mint_denom":"","inflation_coef":"0","blocks_per_year":"0"}`, }, { "text output", []string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=text", flags.FlagOutput)}, `[--height=1 --output=text]`, `blocks_per_year: "0" -bonding_adjustment: "0" inflation_coef: "0" -mint_denom: "" -target_bonding_ratio: "0"`, +mint_denom: ""`, }, } diff --git a/x/mint/keeper/genesis_test.go b/x/mint/keeper/genesis_test.go index cde34e40..959484a9 100644 --- a/x/mint/keeper/genesis_test.go +++ b/x/mint/keeper/genesis_test.go @@ -62,8 +62,6 @@ func (s *GenesisTestSuite) TestImportExportGenesis() { genesisState.Params = types.NewParams( "testDenom", sdk.NewDecWithPrec(69, 2), - sdk.NewDecWithPrec(14, 2), - sdk.NewDecWithPrec(56, 2), uint64(60*60*8766/5), ) diff --git a/x/mint/keeper/keeper_test.go b/x/mint/keeper/keeper_test.go index 40043068..4623bc10 100644 --- a/x/mint/keeper/keeper_test.go +++ b/x/mint/keeper/keeper_test.go @@ -77,44 +77,18 @@ func (s *IntegrationTestSuite) TestParams() { { name: "set invalid params", input: types.Params{ - MintDenom: sdk.DefaultBondDenom, - BondingAdjustment: sdk.NewDecWithPrec(-13, 2), - TargetBondingRatio: sdk.NewDecWithPrec(25, 2), - InflationCoef: sdk.NewDecWithPrec(73, 2), - BlocksPerYear: uint64(60 * 60 * 8766 / 5), - }, - expectErr: true, - }, - { - name: "set invalid params", - input: types.Params{ - MintDenom: sdk.DefaultBondDenom, - BondingAdjustment: sdk.NewDecWithPrec(13, 2), - TargetBondingRatio: sdk.NewDecWithPrec(-25, 2), - InflationCoef: sdk.NewDecWithPrec(73, 2), - BlocksPerYear: uint64(60 * 60 * 8766 / 5), - }, - expectErr: true, - }, - { - name: "set invalid params", - input: types.Params{ - MintDenom: sdk.DefaultBondDenom, - BondingAdjustment: sdk.NewDecWithPrec(13, 2), - TargetBondingRatio: sdk.NewDecWithPrec(25, 2), - InflationCoef: sdk.NewDecWithPrec(-73, 2), - BlocksPerYear: uint64(60 * 60 * 8766 / 5), + MintDenom: sdk.DefaultBondDenom, + InflationCoef: sdk.NewDecWithPrec(-73, 2), + BlocksPerYear: uint64(60 * 60 * 8766 / 5), }, expectErr: true, }, { name: "set full valid params", input: types.Params{ - MintDenom: sdk.DefaultBondDenom, - BondingAdjustment: sdk.NewDecWithPrec(13, 2), - TargetBondingRatio: sdk.NewDecWithPrec(25, 2), - InflationCoef: sdk.NewDecWithPrec(73, 2), - BlocksPerYear: uint64(60 * 60 * 8766 / 5), + MintDenom: sdk.DefaultBondDenom, + InflationCoef: sdk.NewDecWithPrec(73, 2), + BlocksPerYear: uint64(60 * 60 * 8766 / 5), }, expectErr: false, }, diff --git a/x/mint/keeper/msg_server_test.go b/x/mint/keeper/msg_server_test.go index 5e37463a..ac18821b 100644 --- a/x/mint/keeper/msg_server_test.go +++ b/x/mint/keeper/msg_server_test.go @@ -19,44 +19,14 @@ func (s *IntegrationTestSuite) TestUpdateParams() { }, expectErr: true, }, - { - name: "set invalid params for bonding adjustment (negative value)", - request: &types.MsgUpdateParams{ - Authority: s.mintKeeper.GetAuthority(), - Params: types.Params{ - MintDenom: sdk.DefaultBondDenom, - BondingAdjustment: sdk.NewDecWithPrec(-13, 2), - TargetBondingRatio: sdk.NewDecWithPrec(25, 2), - InflationCoef: sdk.NewDecWithPrec(73, 2), - BlocksPerYear: uint64(60 * 60 * 8766 / 5), - }, - }, - expectErr: true, - }, - { - name: "set invalid params for target bonding ratio (negative value)", - request: &types.MsgUpdateParams{ - Authority: s.mintKeeper.GetAuthority(), - Params: types.Params{ - MintDenom: sdk.DefaultBondDenom, - BondingAdjustment: sdk.NewDecWithPrec(13, 2), - TargetBondingRatio: sdk.NewDecWithPrec(-25, 2), - InflationCoef: sdk.NewDecWithPrec(73, 2), - BlocksPerYear: uint64(60 * 60 * 8766 / 5), - }, - }, - expectErr: true, - }, { name: "set invalid params for inflation coef (negative value)", request: &types.MsgUpdateParams{ Authority: s.mintKeeper.GetAuthority(), Params: types.Params{ - MintDenom: sdk.DefaultBondDenom, - BondingAdjustment: sdk.NewDecWithPrec(13, 2), - TargetBondingRatio: sdk.NewDecWithPrec(25, 2), - InflationCoef: sdk.NewDecWithPrec(-73, 2), - BlocksPerYear: uint64(60 * 60 * 8766 / 5), + MintDenom: sdk.DefaultBondDenom, + InflationCoef: sdk.NewDecWithPrec(-73, 2), + BlocksPerYear: uint64(60 * 60 * 8766 / 5), }, }, expectErr: true, @@ -66,11 +36,9 @@ func (s *IntegrationTestSuite) TestUpdateParams() { request: &types.MsgUpdateParams{ Authority: s.mintKeeper.GetAuthority(), Params: types.Params{ - MintDenom: sdk.DefaultBondDenom, - BondingAdjustment: sdk.NewDecWithPrec(13, 2), - TargetBondingRatio: sdk.NewDecWithPrec(25, 2), - InflationCoef: sdk.NewDecWithPrec(73, 2), - BlocksPerYear: uint64(60 * 60 * 8766 / 5), + MintDenom: sdk.DefaultBondDenom, + InflationCoef: sdk.NewDecWithPrec(73, 2), + BlocksPerYear: uint64(60 * 60 * 8766 / 5), }, }, expectErr: false, diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go index 0c75c299..6fcdf4f9 100644 --- a/x/mint/simulation/genesis_test.go +++ b/x/mint/simulation/genesis_test.go @@ -44,22 +44,18 @@ func TestRandomizedGenState(t *testing.T) { var mintGenesis types.GenesisState simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &mintGenesis) - dec1, _ := sdk.NewDecFromStr("0.073000000000000000") - dec2, _ := sdk.NewDecFromStr("2.500000000000000000") - dec3, _ := sdk.NewDecFromStr("0.660000000000000000") + inflationCoef := sdk.NewDecWithPrec(3, 2) + bondedRatio := sdk.NewDecWithPrec(2, 1) + minter, _ := types.NewMinterWithInflationCoef(inflationCoef, bondedRatio, simState.InitialStake) require.Equal(t, uint64(6311520), mintGenesis.Params.BlocksPerYear) - require.Equal(t, dec1, mintGenesis.Params.InflationCoef) - require.Equal(t, dec2, mintGenesis.Params.BondingAdjustment) - require.Equal(t, dec3, mintGenesis.Params.TargetBondingRatio) + require.Equal(t, "0.073000000000000000", mintGenesis.Params.InflationCoef.String()) require.Equal(t, "stake", mintGenesis.Params.MintDenom) - require.Equal(t, "0stake", - mintGenesis.Minter.BlockProvision(mintGenesis.Params).String()) - require.Equal(t, "170.000000000000000000", - mintGenesis.Minter.NextAnnualProvisions(mintGenesis.Params, simState.InitialStake).String()) - require.Equal(t, "0.109500000000000000", mintGenesis.Minter.NextInflation(mintGenesis.Params, sdk.NewDecWithPrec(66, 2)).String()) + require.Equal(t, "0stake", mintGenesis.Minter.BlockProvision(mintGenesis.Params).String()) require.Equal(t, "0.170000000000000000", mintGenesis.Minter.Inflation.String()) require.Equal(t, "170.000000000000000000", mintGenesis.Minter.AnnualProvisions.String()) + require.Equal(t, "0.150000000000000000", minter.Inflation.String()) + require.Equal(t, "150.000000000000000000", minter.AnnualProvisions.String()) } // TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState. diff --git a/x/mint/simulation/proposals_test.go b/x/mint/simulation/proposals_test.go index 04f67274..7e1a2176 100644 --- a/x/mint/simulation/proposals_test.go +++ b/x/mint/simulation/proposals_test.go @@ -40,8 +40,6 @@ func TestProposalMsgs(t *testing.T) { assert.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority) assert.Equal(t, uint64(122877), msgUpdateParams.Params.BlocksPerYear) - assert.DeepEqual(t, sdk.NewDecWithPrec(7, 2), msgUpdateParams.Params.TargetBondingRatio) assert.DeepEqual(t, sdk.NewDecWithPrec(95, 2), msgUpdateParams.Params.InflationCoef) - assert.DeepEqual(t, sdk.NewDecWithPrec(6, 1), msgUpdateParams.Params.BondingAdjustment) - assert.Equal(t, "xKGLwQvuyN", msgUpdateParams.Params.MintDenom) + assert.Equal(t, "eAerqyNEUz", msgUpdateParams.Params.MintDenom) }