diff --git a/x/cellarfees/migrations/v1/keeper/query_server.go b/x/cellarfees/migrations/v1/keeper/query_server.go index ac9a7066..56997644 100644 --- a/x/cellarfees/migrations/v1/keeper/query_server.go +++ b/x/cellarfees/migrations/v1/keeper/query_server.go @@ -5,51 +5,50 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/peggyjv/sommelier/v7/x/cellarfees/migrations/v1/types" - v1types "github.com/peggyjv/sommelier/v7/x/cellarfees/migrations/v1/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) var _ types.QueryServer = Keeper{} -func (k Keeper) QueryParams(c context.Context, req *v1types.QueryParamsRequest) (*v1types.QueryParamsResponse, error) { +func (k Keeper) QueryParams(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } - return &v1types.QueryParamsResponse{ + return &types.QueryParamsResponse{ Params: k.GetParams(sdk.UnwrapSDKContext(c)), }, nil } -func (k Keeper) QueryModuleAccounts(c context.Context, req *v1types.QueryModuleAccountsRequest) (*v1types.QueryModuleAccountsResponse, error) { +func (k Keeper) QueryModuleAccounts(c context.Context, req *types.QueryModuleAccountsRequest) (*types.QueryModuleAccountsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } - return &v1types.QueryModuleAccountsResponse{ + return &types.QueryModuleAccountsResponse{ FeesAddress: k.GetFeesAccount(sdk.UnwrapSDKContext(c)).GetAddress().String(), }, nil } -func (k Keeper) QueryLastRewardSupplyPeak(c context.Context, req *v1types.QueryLastRewardSupplyPeakRequest) (*v1types.QueryLastRewardSupplyPeakResponse, error) { +func (k Keeper) QueryLastRewardSupplyPeak(c context.Context, req *types.QueryLastRewardSupplyPeakRequest) (*types.QueryLastRewardSupplyPeakResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } - return &v1types.QueryLastRewardSupplyPeakResponse{LastRewardSupplyPeak: k.GetLastRewardSupplyPeak(sdk.UnwrapSDKContext(c))}, nil + return &types.QueryLastRewardSupplyPeakResponse{LastRewardSupplyPeak: k.GetLastRewardSupplyPeak(sdk.UnwrapSDKContext(c))}, nil } -func (k Keeper) QueryFeeAccrualCounters(c context.Context, req *v1types.QueryFeeAccrualCountersRequest) (*v1types.QueryFeeAccrualCountersResponse, error) { +func (k Keeper) QueryFeeAccrualCounters(c context.Context, req *types.QueryFeeAccrualCountersRequest) (*types.QueryFeeAccrualCountersResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } - return &v1types.QueryFeeAccrualCountersResponse{FeeAccrualCounters: k.GetFeeAccrualCounters(sdk.UnwrapSDKContext(c))}, nil + return &types.QueryFeeAccrualCountersResponse{FeeAccrualCounters: k.GetFeeAccrualCounters(sdk.UnwrapSDKContext(c))}, nil } -func (k Keeper) QueryAPY(c context.Context, _ *v1types.QueryAPYRequest) (*v1types.QueryAPYResponse, error) { - return &v1types.QueryAPYResponse{ +func (k Keeper) QueryAPY(c context.Context, _ *types.QueryAPYRequest) (*types.QueryAPYResponse, error) { + return &types.QueryAPYResponse{ Apy: k.GetAPY(sdk.UnwrapSDKContext(c)).String(), }, nil } diff --git a/x/incentives/keeper/abci_test.go b/x/incentives/keeper/abci_test.go index e137b3f0..1bf7edb1 100644 --- a/x/incentives/keeper/abci_test.go +++ b/x/incentives/keeper/abci_test.go @@ -124,8 +124,7 @@ func (suite *KeeperTestSuite) TestBeginBlockerSuccess() { suite.distributionKeeper.EXPECT().GetFeePool(ctx).Return(pool) // Mock validators - validators, err := getMockValidators(suite) - require.NoError(err) + validators := suite.getMockValidators() validator1, validator2 := validators[0], validators[1] consAddr1, err := validator1.GetConsAddr() diff --git a/x/incentives/keeper/incentives_test.go b/x/incentives/keeper/incentives_test.go index 301c1c70..fdef4003 100644 --- a/x/incentives/keeper/incentives_test.go +++ b/x/incentives/keeper/incentives_test.go @@ -30,22 +30,21 @@ var ( } ) -func getMockValidators(suite *KeeperTestSuite) ([]*stakingtypes.Validator, error) { +func (suite *KeeperTestSuite) getMockValidators() []*stakingtypes.Validator { validator1, err := stakingtypes.NewValidator(sdk.ValAddress([]byte("val1val1val1val1val1")), ConsPubKeys[0], stakingtypes.Description{}) suite.Require().NoError(err) validator2, err := stakingtypes.NewValidator(sdk.ValAddress([]byte("val2val2val2val2val2")), ConsPubKeys[1], stakingtypes.Description{}) suite.Require().NoError(err) validator3, err := stakingtypes.NewValidator(sdk.ValAddress([]byte("val3val3val3val3val3")), ConsPubKeys[2], stakingtypes.Description{}) suite.Require().NoError(err) - return []*stakingtypes.Validator{&validator1, &validator2, &validator3}, nil + return []*stakingtypes.Validator{&validator1, &validator2, &validator3} } func (suite *KeeperTestSuite) TestGetValidatorInfos() { ctx, incentivesKeeper := suite.ctx, suite.incentivesKeeper // Create mock validators - validators, err := getMockValidators(suite) - suite.Require().NoError(err) + validators := suite.getMockValidators() validator1, validator2, validator3 := validators[0], validators[1], validators[2] consAddr1, err := validator1.GetConsAddr() @@ -232,10 +231,10 @@ func (suite *KeeperTestSuite) TestAllocateTokensToValidator() { event := events[0] suite.Require().Equal(types.EventTypeIncentivesRewards, event.Type) suite.Require().Len(event.Attributes, 2) - suite.Require().Equal(sdk.AttributeKeyAmount, string(event.Attributes[0].Key)) - suite.Require().Equal(tokens.String(), string(event.Attributes[0].Value)) - suite.Require().Equal(types.AttributeKeyValidator, string(event.Attributes[1].Key)) - suite.Require().Equal(valAddr.String(), string(event.Attributes[1].Value)) + suite.Require().Equal(sdk.AttributeKeyAmount, event.Attributes[0].Key) + suite.Require().Equal(tokens.String(), event.Attributes[0].Value) + suite.Require().Equal(types.AttributeKeyValidator, event.Attributes[1].Key) + suite.Require().Equal(valAddr.String(), event.Attributes[1].Value) } func (suite *KeeperTestSuite) TestAllocateTokensToValidatorWithExistingRewards() { @@ -275,18 +274,17 @@ func (suite *KeeperTestSuite) TestAllocateTokensToValidatorWithExistingRewards() event := events[0] suite.Require().Equal(types.EventTypeIncentivesRewards, event.Type) suite.Require().Len(event.Attributes, 2) - suite.Require().Equal(sdk.AttributeKeyAmount, string(event.Attributes[0].Key)) - suite.Require().Equal(newTokens.String(), string(event.Attributes[0].Value)) - suite.Require().Equal(types.AttributeKeyValidator, string(event.Attributes[1].Key)) - suite.Require().Equal(valAddr.String(), string(event.Attributes[1].Value)) + suite.Require().Equal(sdk.AttributeKeyAmount, event.Attributes[0].Key) + suite.Require().Equal(newTokens.String(), event.Attributes[0].Value) + suite.Require().Equal(types.AttributeKeyValidator, event.Attributes[1].Key) + suite.Require().Equal(valAddr.String(), event.Attributes[1].Value) } func (suite *KeeperTestSuite) TestAllocateTokens() { ctx, incentivesKeeper := suite.ctx, suite.incentivesKeeper // Create mock validators - validators, err := getMockValidators(suite) - suite.Require().NoError(err) + validators := suite.getMockValidators() validator1, validator2, validator3 := validators[0], validators[1], validators[2] // Set up qualifying voters @@ -336,9 +334,9 @@ func (suite *KeeperTestSuite) TestAllocateTokens() { for i, event := range events { suite.Require().Equal(types.EventTypeIncentivesRewards, event.Type) suite.Require().Len(event.Attributes, 2) - suite.Require().Equal(sdk.AttributeKeyAmount, string(event.Attributes[0].Key)) - suite.Require().Equal(types.AttributeKeyValidator, string(event.Attributes[1].Key)) - suite.Require().Equal(qualifyingVoters[i].Validator.GetOperator().String(), string(event.Attributes[1].Value)) + suite.Require().Equal(sdk.AttributeKeyAmount, event.Attributes[0].Key) + suite.Require().Equal(types.AttributeKeyValidator, event.Attributes[1].Key) + suite.Require().Equal(qualifyingVoters[i].Validator.GetOperator().String(), event.Attributes[1].Value) } }