From 29e098728a33ec5b6a6ecf043f2ce103c9b83f99 Mon Sep 17 00:00:00 2001 From: Peter Bukva Date: Fri, 21 Jul 2023 11:59:55 +0100 Subject: [PATCH] Fixing uTest --- x/mint/cache/municipal_inflation_cahe.go | 2 +- x/mint/keeper/grpc_query.go | 4 ++-- x/mint/types/inflations.go | 4 ++-- x/mint/types/inflations_test.go | 2 +- x/mint/types/mint.pb.go | 6 +++--- x/mint/types/minter.go | 2 +- x/mint/types/query.pb.go | 16 ++++++++-------- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/x/mint/cache/municipal_inflation_cahe.go b/x/mint/cache/municipal_inflation_cahe.go index f8bbfc7a03..ada28de821 100644 --- a/x/mint/cache/municipal_inflation_cahe.go +++ b/x/mint/cache/municipal_inflation_cahe.go @@ -8,7 +8,7 @@ import ( type MunicipalInflationCacheItem struct { PerBlockInflation sdk.Dec - Inflation *types.MunicipalInflation + AnnualInflation *types.MunicipalInflation } type MunicipalInflationCache struct { diff --git a/x/mint/keeper/grpc_query.go b/x/mint/keeper/grpc_query.go index bb778a6113..e4a65d8b56 100644 --- a/x/mint/keeper/grpc_query.go +++ b/x/mint/keeper/grpc_query.go @@ -18,7 +18,7 @@ func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.Q return &types.QueryParamsResponse{Params: params}, nil } -// Inflation returns minter.Inflation of the mint module. +// Inflation returns minter.AnnualInflation of the mint module. func (k Keeper) Inflation(c context.Context, _ *types.QueryInflationRequest) (*types.QueryInflationResponse, error) { ctx := sdk.UnwrapSDKContext(c) minter := k.GetMinter(ctx) @@ -43,7 +43,7 @@ func (k Keeper) MunicipalInflation(c context.Context, req *types.QueryMunicipalI return nil, fmt.Errorf("there is no municipal inflation defined for requested \"%s\" denomination", denom) } - return &types.QueryMunicipalInflationResponse{Inflations: []*types.MunicipalInflationPair{{denom, infl.Inflation}}}, nil + return &types.QueryMunicipalInflationResponse{Inflations: []*types.MunicipalInflationPair{{denom, infl.AnnualInflation}}}, nil } // AnnualProvisions returns minter.AnnualProvisions of the mint module. diff --git a/x/mint/types/inflations.go b/x/mint/types/inflations.go index f214b2b058..c3851c586c 100644 --- a/x/mint/types/inflations.go +++ b/x/mint/types/inflations.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// NewMunicipalInflation returns a new Inflation object with the given denom, target_address +// NewMunicipalInflation returns a new AnnualInflation object with the given denom, target_address // and inflation_rate func NewMunicipalInflation(targetAddress string, inflation sdk.Dec) *MunicipalInflation { return &MunicipalInflation{ @@ -28,7 +28,7 @@ func CalculateInflationIssuance(inflation sdk.Dec, supply sdk.Coin) (result sdk. return sdk.NewCoins(sdk.NewCoin(supply.Denom, issuedAmount)) } -// Validate ensures validity of Inflation object fields +// Validate ensures validity of AnnualInflation object fields func (inflation *MunicipalInflation) Validate() error { // NOTE(pb): Algebraically speaking, negative inflation >= -1 is logically diff --git a/x/mint/types/inflations_test.go b/x/mint/types/inflations_test.go index e51e8d2eb8..7f4ed482fe 100644 --- a/x/mint/types/inflations_test.go +++ b/x/mint/types/inflations_test.go @@ -220,7 +220,7 @@ func TestHandleMunicipalInflation(t *testing.T) { var testMunicipalInflations = make([]*types.MunicipalInflationPair, len(definedInfations)) for i, infl := range definedInfations { - testMunicipalInflations[i] = &types.MunicipalInflationPair{"denom0", &types.MunicipalInflation{targetAccounts[i].Address.String(), infl.annualInflation}} + testMunicipalInflations[i] = &types.MunicipalInflationPair{infl.denom, &types.MunicipalInflation{targetAccounts[i].Address.String(), infl.annualInflation}} } // Configure/initialise Minter with MunicipalInflation: diff --git a/x/mint/types/mint.pb.go b/x/mint/types/mint.pb.go index e550a21ae9..5d287d86d0 100644 --- a/x/mint/types/mint.pb.go +++ b/x/mint/types/mint.pb.go @@ -571,7 +571,7 @@ func (m *Minter) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Inflation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AnnualInflation", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -755,7 +755,7 @@ func (m *MunicipalInflation) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Inflation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AnnualInflation", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -871,7 +871,7 @@ func (m *MunicipalInflationPair) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Inflation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AnnualInflation", wireType) } var msglen int for shift := uint(0); ; shift += 7 { diff --git a/x/mint/types/minter.go b/x/mint/types/minter.go index 84a9b7edf1..484a8d27ea 100644 --- a/x/mint/types/minter.go +++ b/x/mint/types/minter.go @@ -36,7 +36,7 @@ func DefaultInitialMinter() Minter { // validate minter func ValidateMinter(minter Minter) error { if minter.Inflation.IsNegative() { - return fmt.Errorf("mint parameter Inflation should be positive, is %s", + return fmt.Errorf("mint parameter AnnualInflation should be positive, is %s", minter.Inflation.String()) } return nil diff --git a/x/mint/types/query.pb.go b/x/mint/types/query.pb.go index 7ad6836671..3e3bb95831 100644 --- a/x/mint/types/query.pb.go +++ b/x/mint/types/query.pb.go @@ -113,7 +113,7 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -// QueryInflationRequest is the request type for the Query/Inflation RPC method. +// QueryInflationRequest is the request type for the Query/AnnualInflation RPC method. type QueryInflationRequest struct { } @@ -223,7 +223,7 @@ func (*QueryMunicipalInflationRequest) XXX_OneofWrappers() []interface{} { } } -// QueryInflationResponse is the response type for the Query/Inflation RPC +// QueryInflationResponse is the response type for the Query/AnnualInflation RPC // method. type QueryInflationResponse struct { // inflation is the current minting inflation value. @@ -263,7 +263,7 @@ func (m *QueryInflationResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryInflationResponse proto.InternalMessageInfo -// QueryInflationResponse is the response type for the Query/Inflation RPC +// QueryInflationResponse is the response type for the Query/AnnualInflation RPC // method. type QueryMunicipalInflationResponse struct { // inflation is the current minting inflation value. @@ -481,7 +481,7 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . func (c *queryClient) Inflation(ctx context.Context, in *QueryInflationRequest, opts ...grpc.CallOption) (*QueryInflationResponse, error) { out := new(QueryInflationResponse) - err := c.cc.Invoke(ctx, "/cosmos.mint.v1beta1.Query/Inflation", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmos.mint.v1beta1.Query/AnnualInflation", in, out, opts...) if err != nil { return nil, err } @@ -526,7 +526,7 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } func (*UnimplementedQueryServer) Inflation(ctx context.Context, req *QueryInflationRequest) (*QueryInflationResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Inflation not implemented") + return nil, status.Errorf(codes.Unimplemented, "method AnnualInflation not implemented") } func (*UnimplementedQueryServer) MunicipalInflation(ctx context.Context, req *QueryMunicipalInflationRequest) (*QueryMunicipalInflationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MunicipalInflation not implemented") @@ -567,7 +567,7 @@ func _Query_Inflation_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.mint.v1beta1.Query/Inflation", + FullMethod: "/cosmos.mint.v1beta1.Query/AnnualInflation", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Inflation(ctx, req.(*QueryInflationRequest)) @@ -620,7 +620,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_Params_Handler, }, { - MethodName: "Inflation", + MethodName: "AnnualInflation", Handler: _Query_Inflation_Handler, }, { @@ -1297,7 +1297,7 @@ func (m *QueryInflationResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Inflation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AnnualInflation", wireType) } var byteLen int for shift := uint(0); ; shift += 7 {