diff --git a/x/dex/keeper/begin_block_new_block_test.go b/x/dex/keeper/begin_block_new_block_test.go index 240075f59b..a1e3f22a29 100644 --- a/x/dex/keeper/begin_block_new_block_test.go +++ b/x/dex/keeper/begin_block_new_block_test.go @@ -7,8 +7,10 @@ import ( "github.com/sei-protocol/sei-chain/x/dex/keeper" ) -const SupportedFeatures = "iterator,staking,stargate" -const TestContract = "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m" +const ( + SupportedFeatures = "iterator,staking,stargate" + TestContract = "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m" +) func TestHandleBBNewBlock(t *testing.T) { // this test only ensures that HandleBBNewBlock doesn't crash. The actual logic diff --git a/x/mint/client/testutil/cli_test.go b/x/mint/client/testutil/cli_test.go deleted file mode 100644 index 1035ca7502..0000000000 --- a/x/mint/client/testutil/cli_test.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build norace -// +build norace - -package testutil - -import ( - "testing" - - "github.com/cosmos/cosmos-sdk/testutil/network" - - "github.com/stretchr/testify/suite" -) - -func TestIntegrationTestSuite(t *testing.T) { - cfg := network.DefaultConfig() - cfg.NumValidators = 1 - suite.Run(t, NewIntegrationTestSuite(cfg)) -} diff --git a/x/mint/client/testutil/suite.go b/x/mint/client/testutil/suite.go deleted file mode 100644 index 051cebf29a..0000000000 --- a/x/mint/client/testutil/suite.go +++ /dev/null @@ -1,163 +0,0 @@ -package testutil - -import ( - "fmt" - "strings" - - "github.com/stretchr/testify/suite" - tmcli "github.com/tendermint/tendermint/libs/cli" - - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/cosmos/cosmos-sdk/testutil/network" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/sei-protocol/sei-chain/client/cli" - minttypes "github.com/sei-protocol/sei-chain/x/mint/types" -) - -type IntegrationTestSuite struct { - suite.Suite - - cfg network.Config - network *network.Network -} - -func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { - return &IntegrationTestSuite{cfg: cfg} -} - -func (s *IntegrationTestSuite) SetupSuite() { - s.T().Log("setting up integration test suite") - - genesisState := s.cfg.GenesisState - - var mintData minttypes.GenesisState - s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[minttypes.ModuleName], &mintData)) - - inflation := sdk.MustNewDecFromStr("1.0") - mintData.Minter.Inflation = inflation - mintData.Params.InflationMin = inflation - mintData.Params.InflationMax = inflation - - mintDataBz, err := s.cfg.Codec.MarshalJSON(&mintData) - s.Require().NoError(err) - genesisState[minttypes.ModuleName] = mintDataBz - s.cfg.GenesisState = genesisState - - s.network = network.New(s.T(), s.cfg) - - _, err = s.network.WaitForHeight(1) - s.Require().NoError(err) -} - -func (s *IntegrationTestSuite) TearDownSuite() { - s.T().Log("tearing down integration test suite") - s.network.Cleanup() -} - -func (s *IntegrationTestSuite) TestGetCmdQueryParams() { - val := s.network.Validators[0] - - testCases := []struct { - name string - args []string - expectedOutput string - }{ - { - "json output", - []string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, - `{"mint_denom":"stake","inflation_rate_change":"0.130000000000000000","inflation_max":"1.000000000000000000","inflation_min":"1.000000000000000000","goal_bonded":"0.670000000000000000","blocks_per_year":"6311520"}`, - }, - { - "text output", - []string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=text", tmcli.OutputFlag)}, - `blocks_per_year: "6311520" -goal_bonded: "0.670000000000000000" -inflation_max: "1.000000000000000000" -inflation_min: "1.000000000000000000" -inflation_rate_change: "0.130000000000000000" -mint_denom: stake`, - }, - } - - for _, tc := range testCases { - tc := tc - - s.Run(tc.name, func() { - cmd := cli.GetCmdQueryParams() - clientCtx := val.ClientCtx - - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - s.Require().NoError(err) - s.Require().Equal(tc.expectedOutput, strings.TrimSpace(out.String())) - }) - } -} - -func (s *IntegrationTestSuite) TestGetCmdQueryInflation() { - val := s.network.Validators[0] - - testCases := []struct { - name string - args []string - expectedOutput string - }{ - { - "json output", - []string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, - `1.000000000000000000`, - }, - { - "text output", - []string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=text", tmcli.OutputFlag)}, - `1.000000000000000000`, - }, - } - - for _, tc := range testCases { - tc := tc - - s.Run(tc.name, func() { - cmd := cli.GetCmdQueryInflation() - clientCtx := val.ClientCtx - - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - s.Require().NoError(err) - s.Require().Equal(tc.expectedOutput, strings.TrimSpace(out.String())) - }) - } -} - -func (s *IntegrationTestSuite) TestGetCmdQueryAnnualProvisions() { - val := s.network.Validators[0] - - testCases := []struct { - name string - args []string - expectedOutput string - }{ - { - "json output", - []string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, - `500000000.000000000000000000`, - }, - { - "text output", - []string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=text", tmcli.OutputFlag)}, - `500000000.000000000000000000`, - }, - } - - for _, tc := range testCases { - tc := tc - - s.Run(tc.name, func() { - cmd := cli.GetCmdQueryAnnualProvisions() - clientCtx := val.ClientCtx - - out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) - s.Require().NoError(err) - s.Require().Equal(tc.expectedOutput, strings.TrimSpace(out.String())) - }) - } -} diff --git a/x/mint/keeper/hooks.go b/x/mint/keeper/hooks.go index 582be4b42a..eb1b4bf92a 100644 --- a/x/mint/keeper/hooks.go +++ b/x/mint/keeper/hooks.go @@ -12,5 +12,4 @@ func (k Keeper) AfterEpochEnd(ctx sdk.Context, epoch types.Epoch) { // minter := k.GetMinter(ctx) // params := k.GetParams(ctx) // if epoch.CurrentEpochStartTime >= params.Red - } diff --git a/x/mint/module.go b/x/mint/module.go index dea9269598..86c59f1689 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -71,7 +71,7 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the mint module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) //nolint:errcheck // this is inside a module, and the method doesn't return error. Leave it alone. } // GetTxCmd returns no root tx command for the mint module.