From 83b25ea32033c3e43a831201bcab8bbf782751e1 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Tue, 3 Sep 2024 22:36:04 -0400 Subject: [PATCH] remove unused functions from emissions module --- .../zetachain/zetacore/emissions/params.proto | 27 +- .../zetachain/zetacore/emissions/query.proto | 15 - x/emissions/client/cli/query.go | 2 - .../client/cli/query_get_emmisons_factors.go | 38 -- .../keeper/block_rewards_components.go | 30 - .../keeper/block_rewards_components_test.go | 109 +--- .../keeper/grpc_query_get_emmisons_factors.go | 28 - .../grpc_query_get_emmisons_factors_test.go | 41 -- x/emissions/keeper/params_test.go | 70 --- x/emissions/migrations/v3/migrate.go | 16 - x/emissions/migrations/v3/migrate_test.go | 10 - x/emissions/types/params.go | 119 ---- x/emissions/types/params.pb.go | 310 +---------- x/emissions/types/params_legacy.go | 9 - x/emissions/types/params_test.go | 126 ----- x/emissions/types/query.pb.go | 513 ++---------------- x/emissions/types/query.pb.gw.go | 65 --- 17 files changed, 97 insertions(+), 1431 deletions(-) delete mode 100644 x/emissions/client/cli/query_get_emmisons_factors.go delete mode 100644 x/emissions/keeper/grpc_query_get_emmisons_factors.go delete mode 100644 x/emissions/keeper/grpc_query_get_emmisons_factors_test.go diff --git a/proto/zetachain/zetacore/emissions/params.proto b/proto/zetachain/zetacore/emissions/params.proto index 53aef8d9e0..384e205fe1 100644 --- a/proto/zetachain/zetacore/emissions/params.proto +++ b/proto/zetachain/zetacore/emissions/params.proto @@ -8,17 +8,34 @@ option go_package = "github.com/zeta-chain/node/x/emissions/types"; // Params defines the parameters for the module. message Params { option (gogoproto.goproto_stringer) = false; - string max_bond_factor = 1; - string min_bond_factor = 2; - string avg_block_time = 3; - string target_bond_ratio = 4; string validator_emission_percentage = 5; string observer_emission_percentage = 6; string tss_signer_emission_percentage = 7; - string duration_factor_constant = 8; string observer_slash_amount = 9 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; int64 ballot_maturity_blocks = 10; + + // not used. do not edit. + reserved 1 to 4; + reserved 8; } + +//// Deprecated: Do not use. Use Params. +// message ParamsLegacy { +// option (gogoproto.goproto_stringer) = false; +// string max_bond_factor = 1; +// string min_bond_factor = 2; +// string avg_block_time = 3; +// string target_bond_ratio = 4; +// string validator_emission_percentage = 5; +// string observer_emission_percentage = 6; +// string tss_signer_emission_percentage = 7; +// string duration_factor_constant = 8; +// string observer_slash_amount = 9 [ +// (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", +// (gogoproto.nullable) = false +// ]; +// int64 ballot_maturity_blocks = 10; +// } diff --git a/proto/zetachain/zetacore/emissions/query.proto b/proto/zetachain/zetacore/emissions/query.proto index 4fc78af850..f2a3e4a5a6 100644 --- a/proto/zetachain/zetacore/emissions/query.proto +++ b/proto/zetachain/zetacore/emissions/query.proto @@ -20,13 +20,6 @@ service Query { option (google.api.http).get = "/zeta-chain/emissions/list_addresses"; } - // Queries a list of GetEmmisonsFactors items. - rpc GetEmissionsFactors(QueryGetEmissionsFactorsRequest) - returns (QueryGetEmissionsFactorsResponse) { - option (google.api.http).get = - "/zeta-chain/emissions/get_emissions_factors"; - } - // Queries a list of ShowAvailableEmissions items. rpc ShowAvailableEmissions(QueryShowAvailableEmissionsRequest) returns (QueryShowAvailableEmissionsResponse) { @@ -54,14 +47,6 @@ message QueryListPoolAddressesResponse { string emission_module_address = 3; } -message QueryGetEmissionsFactorsRequest {} - -message QueryGetEmissionsFactorsResponse { - string reservesFactor = 1; - string bondFactor = 2; - string durationFactor = 3; -} - message QueryShowAvailableEmissionsRequest { string address = 1; } message QueryShowAvailableEmissionsResponse { string amount = 1; } diff --git a/x/emissions/client/cli/query.go b/x/emissions/client/cli/query.go index 066381d930..eb82b7604f 100644 --- a/x/emissions/client/cli/query.go +++ b/x/emissions/client/cli/query.go @@ -22,8 +22,6 @@ func GetQueryCmd(_ string) *cobra.Command { cmd.AddCommand(CmdQueryParams(), CmdListPoolAddresses(), - CmdGetEmmisonsFactors(), CmdShowAvailableEmissions()) - // this line is used by starport scaffolding # 1 return cmd } diff --git a/x/emissions/client/cli/query_get_emmisons_factors.go b/x/emissions/client/cli/query_get_emmisons_factors.go deleted file mode 100644 index c100c91cd1..0000000000 --- a/x/emissions/client/cli/query_get_emmisons_factors.go +++ /dev/null @@ -1,38 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/zeta-chain/node/x/emissions/types" -) - -func CmdGetEmmisonsFactors() *cobra.Command { - cmd := &cobra.Command{ - Use: "get-emmisons-factors", - Short: "Query GetEmmisonsFactors", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryGetEmissionsFactorsRequest{} - - res, err := queryClient.GetEmissionsFactors(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/emissions/keeper/block_rewards_components.go b/x/emissions/keeper/block_rewards_components.go index 213f467b15..1d41415efe 100644 --- a/x/emissions/keeper/block_rewards_components.go +++ b/x/emissions/keeper/block_rewards_components.go @@ -4,40 +4,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/node/cmd/zetacored/config" - "github.com/zeta-chain/node/pkg/coin" "github.com/zeta-chain/node/x/emissions/types" ) -func (k Keeper) GetBlockRewardComponents(ctx sdk.Context, params types.Params) (sdk.Dec, sdk.Dec, sdk.Dec) { - reservesFactor := k.GetReservesFactor(ctx) - if reservesFactor.LTE(sdk.ZeroDec()) { - return sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec() - } - bondFactor := params.GetBondFactor(k.stakingKeeper.BondedRatio(ctx)) - durationFactor := params.GetDurationFactor(ctx.BlockHeight()) - return reservesFactor, bondFactor, durationFactor -} - func (k Keeper) GetReservesFactor(ctx sdk.Context) sdk.Dec { reserveAmount := k.GetBankKeeper().GetBalance(ctx, types.EmissionsModuleAddress, config.BaseDenom) return sdk.NewDecFromInt(reserveAmount.Amount) } - -func (k Keeper) GetFixedBlockRewards() (sdk.Dec, error) { - return CalculateFixedValidatorRewards(types.AvgBlockTime) -} - -func CalculateFixedValidatorRewards(avgBlockTimeString string) (sdk.Dec, error) { - azetaAmountTotalRewards, err := coin.GetAzetaDecFromAmountInZeta(types.BlockRewardsInZeta) - if err != nil { - return sdk.ZeroDec(), err - } - avgBlockTime, err := sdk.NewDecFromStr(avgBlockTimeString) - if err != nil { - return sdk.ZeroDec(), err - } - numberOfBlocksInAMonth := sdk.NewDec(types.SecsInMonth).Quo(avgBlockTime) - numberOfBlocksTotal := numberOfBlocksInAMonth.Mul(sdk.NewDec(12)).Mul(sdk.NewDec(types.EmissionScheduledYears)) - constantRewardPerBlock := azetaAmountTotalRewards.Quo(numberOfBlocksTotal) - return constantRewardPerBlock, nil -} diff --git a/x/emissions/keeper/block_rewards_components_test.go b/x/emissions/keeper/block_rewards_components_test.go index 9027aee58c..4694b7df4a 100644 --- a/x/emissions/keeper/block_rewards_components_test.go +++ b/x/emissions/keeper/block_rewards_components_test.go @@ -3,108 +3,23 @@ package keeper_test import ( "testing" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/zeta-chain/node/cmd/zetacored/config" keepertest "github.com/zeta-chain/node/testutil/keeper" - emissionskeeper "github.com/zeta-chain/node/x/emissions/keeper" - emissionstypes "github.com/zeta-chain/node/x/emissions/types" + "github.com/zeta-chain/node/x/emissions/types" ) -func TestKeeper_CalculateFixedValidatorRewards(t *testing.T) { - tt := []struct { - name string - blockTimeInSecs string - expectedBlockRewards sdk.Dec - wantErr bool - }{ - { - name: "Invalid block time", - blockTimeInSecs: "", - wantErr: true, - }, - { - name: "Block Time 5.7", - blockTimeInSecs: "5.7", - expectedBlockRewards: sdk.MustNewDecFromStr("9620949074074074074.074070733466756687"), - }, - { - name: "Block Time 6", - blockTimeInSecs: "6", - expectedBlockRewards: sdk.MustNewDecFromStr("10127314814814814814.814814814814814815"), - }, - { - name: "Block Time 3", - blockTimeInSecs: "3", - expectedBlockRewards: sdk.MustNewDecFromStr("5063657407407407407.407407407407407407"), - }, - { - name: "Block Time 2", - blockTimeInSecs: "2", - expectedBlockRewards: sdk.MustNewDecFromStr("3375771604938271604.938271604938271605"), - }, - { - name: "Block Time 8", - blockTimeInSecs: "8", - expectedBlockRewards: sdk.MustNewDecFromStr("13503086419753086419.753086419753086420"), - }, - } - for _, tc := range tt { - t.Run(tc.name, func(t *testing.T) { - blockRewards, err := emissionskeeper.CalculateFixedValidatorRewards(tc.blockTimeInSecs) - if tc.wantErr { - require.Error(t, err) - return - } - require.NoError(t, err) - require.Equal(t, tc.expectedBlockRewards, blockRewards) - }) - } -} - -func TestKeeper_GetFixedBlockRewards(t *testing.T) { - k, _, _, _ := keepertest.EmissionsKeeper(t) - fixedBlockRewards, err := k.GetFixedBlockRewards() - require.NoError(t, err) - require.Equal(t, emissionstypes.BlockReward, fixedBlockRewards) -} - -func TestKeeper_GetBlockRewardComponent(t *testing.T) { - t.Run("should return all 0s if reserves factor is 0", func(t *testing.T) { - k, ctx, _, _ := keepertest.EmissionKeeperWithMockOptions(t, keepertest.EmissionMockOptions{ - UseBankMock: true, - }) - - bankMock := keepertest.GetEmissionsBankMock(t, k) - bankMock.On("GetBalance", - ctx, mock.Anything, config.BaseDenom). - Return(sdk.NewCoin(config.BaseDenom, math.NewInt(0)), nil).Once() - - reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx, emissionstypes.DefaultParams()) - require.Equal(t, sdk.ZeroDec(), reservesFactor) - require.Equal(t, sdk.ZeroDec(), bondFactor) - require.Equal(t, sdk.ZeroDec(), durationFactor) - }) - - t.Run("should return if reserves factor is not 0", func(t *testing.T) { - k, ctx, _, _ := keepertest.EmissionKeeperWithMockOptions(t, keepertest.EmissionMockOptions{ - UseBankMock: true, - }) - - bankMock := keepertest.GetEmissionsBankMock(t, k) - bankMock.On("GetBalance", - ctx, mock.Anything, config.BaseDenom). - Return(sdk.NewCoin(config.BaseDenom, math.NewInt(1)), nil).Once() - - reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx, emissionstypes.DefaultParams()) - require.Equal(t, sdk.OneDec(), reservesFactor) - // bonded ratio is 0 - require.Equal(t, sdk.ZeroDec(), bondFactor) - // non 0 value returned - require.NotEqual(t, sdk.ZeroDec(), durationFactor) - require.Positive(t, durationFactor.BigInt().Int64()) +func TestKeeper_GetReservesFactor(t *testing.T) { + t.Run("successfully get reserves factor", func(t *testing.T) { + //Arrange + k, ctx, sdkK, _ := keepertest.EmissionsKeeper(t) + amount := sdk.NewInt(100000000000000000) + err := sdkK.BankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(config.BaseDenom, amount))) + require.NoError(t, err) + //Act + reserveAmount := k.GetReservesFactor(ctx) + //Assert + require.Equal(t, amount.ToLegacyDec(), reserveAmount) }) } diff --git a/x/emissions/keeper/grpc_query_get_emmisons_factors.go b/x/emissions/keeper/grpc_query_get_emmisons_factors.go deleted file mode 100644 index aedb21f654..0000000000 --- a/x/emissions/keeper/grpc_query_get_emmisons_factors.go +++ /dev/null @@ -1,28 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/zeta-chain/node/x/emissions/types" -) - -func (k Keeper) GetEmissionsFactors( - goCtx context.Context, - _ *types.QueryGetEmissionsFactorsRequest, -) (*types.QueryGetEmissionsFactorsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - params, found := k.GetParams(ctx) - if !found { - return nil, status.Error(codes.Internal, "params not found") - } - reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx, params) - return &types.QueryGetEmissionsFactorsResponse{ - ReservesFactor: reservesFactor.String(), - BondFactor: bondFactor.String(), - DurationFactor: durationFactor.String(), - }, nil -} diff --git a/x/emissions/keeper/grpc_query_get_emmisons_factors_test.go b/x/emissions/keeper/grpc_query_get_emmisons_factors_test.go deleted file mode 100644 index 57b92ccfa3..0000000000 --- a/x/emissions/keeper/grpc_query_get_emmisons_factors_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/zeta-chain/node/testutil/keeper" - "github.com/zeta-chain/node/x/emissions/types" -) - -func TestKeeper_GetEmissionsFactors(t *testing.T) { - t.Run("should return emissions factor", func(t *testing.T) { - k, ctx, _, _ := keepertest.EmissionsKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - - res, err := k.GetEmissionsFactors(wctx, nil) - require.NoError(t, err) - - reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx, types.DefaultParams()) - expectedRes := &types.QueryGetEmissionsFactorsResponse{ - ReservesFactor: reservesFactor.String(), - BondFactor: bondFactor.String(), - DurationFactor: durationFactor.String(), - } - require.Equal(t, expectedRes, res) - }) - - t.Run("should fail if params not found", func(t *testing.T) { - k, ctx, _, _ := keepertest.EmissionKeeperWithMockOptions( - t, - keepertest.EmissionMockOptions{SkipSettingParams: true}, - ) - wctx := sdk.WrapSDKContext(ctx) - - res, err := k.GetEmissionsFactors(wctx, nil) - require.Nil(t, res) - require.Error(t, err) - }) -} diff --git a/x/emissions/keeper/params_test.go b/x/emissions/keeper/params_test.go index 84ad58a9b4..82b9e68d1f 100644 --- a/x/emissions/keeper/params_test.go +++ b/x/emissions/keeper/params_test.go @@ -19,14 +19,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "Successfully set params", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "6.00", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "", @@ -34,14 +29,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "negative observer slashed amount", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "6.00", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(-100000000000000000), }, constainsErr: "slash amount cannot be less than 0", @@ -49,14 +39,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "MaxBondFactor too high", params: emissionstypes.Params{ - MaxBondFactor: "1.35", - MinBondFactor: "0.85", - AvgBlockTime: "6.00", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "max bond factor cannot be higher that 1.25", @@ -64,14 +49,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "MinBondFactor too low", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.35", - AvgBlockTime: "6.00", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "min bond factor cannot be lower that 0.75", @@ -79,14 +59,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "invalid block time", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "invalidTime", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "invalid block time", @@ -94,14 +69,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "invalid block time less than 0", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "-2", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "block time cannot be less than or equal to 0", @@ -109,14 +79,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "bond ratio too high", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "6.00", - TargetBondRatio: "2.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "target bond ratio cannot be more than 100 percent", @@ -124,14 +89,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "bond ratio too low", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "6.00", - TargetBondRatio: "-1.00", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "target bond ratio cannot be less than 0 percent", @@ -139,14 +99,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "validator emission percentage too high", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "6.00", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "1.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "validator emission percentage cannot be more than 100 percent", @@ -154,14 +109,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "validator emission percentage too low", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "6.00", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "-1.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "validator emission percentage cannot be less than 0 percent", @@ -169,14 +119,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "observer percentage too low", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "6.00", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "-00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "observer emission percentage cannot be less than 0 percent", @@ -184,14 +129,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "observer percentage too high", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "6.00", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "150.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "observer emission percentage cannot be more than 100 percent", @@ -199,14 +139,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "tss signer percentage too high", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "6.00", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "102.22", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "tss emission percentage cannot be more than 100 percent", @@ -214,14 +149,9 @@ func TestKeeper_GetParams(t *testing.T) { { name: "tss signer percentage too low", params: emissionstypes.Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "6.00", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "-102.22", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, constainsErr: "tss emission percentage cannot be less than 0 percent", diff --git a/x/emissions/migrations/v3/migrate.go b/x/emissions/migrations/v3/migrate.go index 5c38378f26..542bc0e082 100644 --- a/x/emissions/migrations/v3/migrate.go +++ b/x/emissions/migrations/v3/migrate.go @@ -26,19 +26,6 @@ func MigrateStore( defaultParams := types.NewParams() - // ensure params are set with default values if not present in legacy params - if currParams.AvgBlockTime == "" { - currParams.AvgBlockTime = defaultParams.AvgBlockTime - } - if currParams.MaxBondFactor == "" { - currParams.MaxBondFactor = defaultParams.MaxBondFactor - } - if currParams.MinBondFactor == "" { - currParams.MinBondFactor = defaultParams.MinBondFactor - } - if currParams.TargetBondRatio == "" { - currParams.TargetBondRatio = defaultParams.TargetBondRatio - } if currParams.ValidatorEmissionPercentage == "" { currParams.ValidatorEmissionPercentage = defaultParams.ValidatorEmissionPercentage } @@ -48,9 +35,6 @@ func MigrateStore( if currParams.TssSignerEmissionPercentage == "" { currParams.TssSignerEmissionPercentage = defaultParams.TssSignerEmissionPercentage } - if currParams.DurationFactorConstant == "" { - currParams.DurationFactorConstant = defaultParams.DurationFactorConstant - } currParams.ObserverSlashAmount = types.ObserverSlashAmount currParams.BallotMaturityBlocks = int64(types.BallotMaturityBlocks) diff --git a/x/emissions/migrations/v3/migrate_test.go b/x/emissions/migrations/v3/migrate_test.go index f47d8d7b02..13439e8120 100644 --- a/x/emissions/migrations/v3/migrate_test.go +++ b/x/emissions/migrations/v3/migrate_test.go @@ -30,14 +30,9 @@ func TestMigrate(t *testing.T) { k, ctx, _, _ := keepertest.EmissionsKeeper(t) legacyParams := types.Params{ - MaxBondFactor: "1", - MinBondFactor: "0.75", - AvgBlockTime: "5.00", - TargetBondRatio: "00.50", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.35", TssSignerEmissionPercentage: "00.15", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdk.ZeroInt(), } legacySubspace := newMockSubspace(legacyParams) @@ -71,14 +66,9 @@ func TestMigrate(t *testing.T) { k, ctx, _, _ := keepertest.EmissionsKeeper(t) legacyParams := types.Params{ - MaxBondFactor: "1", - MinBondFactor: "0.50", - AvgBlockTime: "5.00", - TargetBondRatio: "00.50", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.35", TssSignerEmissionPercentage: "00.15", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdk.ZeroInt(), } legacySubspace := newMockSubspace(legacyParams) diff --git a/x/emissions/types/params.go b/x/emissions/types/params.go index 23899a4d5c..10477db82f 100644 --- a/x/emissions/types/params.go +++ b/x/emissions/types/params.go @@ -2,7 +2,6 @@ package types import ( "fmt" - "strconv" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -12,14 +11,9 @@ import ( // NewParams creates a new Params instance func NewParams() Params { return Params{ - MaxBondFactor: "1.25", - MinBondFactor: "0.75", - AvgBlockTime: "6.00", - TargetBondRatio: "00.67", ValidatorEmissionPercentage: "00.50", ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", - DurationFactorConstant: "0.001877876953694702", ObserverSlashAmount: sdkmath.NewInt(100000000000000000), BallotMaturityBlocks: 100, } @@ -32,18 +26,6 @@ func DefaultParams() Params { // Validate validates the set of params func (p Params) Validate() error { - if err := validateMaxBondFactor(p.MaxBondFactor); err != nil { - return err - } - if err := validateMinBondFactor(p.MinBondFactor); err != nil { - return err - } - if err := validateAvgBlockTime(p.AvgBlockTime); err != nil { - return err - } - if err := validateTargetBondRatio(p.TargetBondRatio); err != nil { - return err - } if err := validateValidatorEmissionPercentage(p.ValidatorEmissionPercentage); err != nil { return err } @@ -59,45 +41,6 @@ func (p Params) Validate() error { return validateObserverSlashAmount(p.ObserverSlashAmount) } -func (p Params) GetBondFactor(currentBondedRatio sdk.Dec) sdk.Dec { - targetBondRatio := sdk.MustNewDecFromStr(p.TargetBondRatio) - maxBondFactor := sdk.MustNewDecFromStr(p.MaxBondFactor) - minBondFactor := sdk.MustNewDecFromStr(p.MinBondFactor) - - // Bond factor ranges between minBondFactor (0.75) to maxBondFactor (1.25) - if currentBondedRatio.IsZero() { - return sdk.ZeroDec() - } - bondFactor := targetBondRatio.Quo(currentBondedRatio) - if bondFactor.GT(maxBondFactor) { - return maxBondFactor - } - if bondFactor.LT(minBondFactor) { - return minBondFactor - } - return bondFactor -} - -func (p Params) GetDurationFactor(blockHeight int64) sdk.Dec { - avgBlockTime := sdk.MustNewDecFromStr(p.AvgBlockTime) - NumberOfBlocksInAMonth := sdk.NewDec(SecsInMonth).Quo(avgBlockTime) - monthFactor := sdk.NewDec(blockHeight).Quo(NumberOfBlocksInAMonth) - logValueDec := sdk.MustNewDecFromStr(p.DurationFactorConstant) - // month * log(1 + 0.02 / 12) - fractionNumerator := monthFactor.Mul(logValueDec) - // (month * log(1 + 0.02 / 12) ) + 1 - fractionDenominator := fractionNumerator.Add(sdk.OneDec()) - - // (month * log(1 + 0.02 / 12)) / (month * log(1 + 0.02 / 12) ) + 1 - if fractionDenominator.IsZero() { - return sdk.OneDec() - } - if fractionNumerator.IsZero() { - return sdk.ZeroDec() - } - return fractionNumerator.Quo(fractionDenominator) -} - // String implements the Stringer interface. func (p Params) String() string { out, err := yaml.Marshal(p) @@ -107,68 +50,6 @@ func (p Params) String() string { return string(out) } -func validateDurationFactorConstant(i interface{}) error { - _, ok := i.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - return nil -} - -func validateMaxBondFactor(i interface{}) error { - v, ok := i.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - decMaxBond := sdk.MustNewDecFromStr(v) - if decMaxBond.GT(sdk.MustNewDecFromStr("1.25")) { - return fmt.Errorf("max bond factor cannot be higher that 1.25") - } - return nil -} - -func validateMinBondFactor(i interface{}) error { - v, ok := i.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - decMaxBond := sdk.MustNewDecFromStr(v) - if decMaxBond.LT(sdk.MustNewDecFromStr("0.75")) { - return fmt.Errorf("min bond factor cannot be lower that 0.75") - } - return nil -} - -func validateAvgBlockTime(i interface{}) error { - v, ok := i.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - blocktime, err := strconv.ParseFloat(v, 64) - if err != nil { - return fmt.Errorf("invalid block time: %T", i) - } - if blocktime <= 0 { - return fmt.Errorf("block time cannot be less than or equal to 0") - } - return nil -} - -func validateTargetBondRatio(i interface{}) error { - v, ok := i.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - decMaxBond := sdk.MustNewDecFromStr(v) - if decMaxBond.GT(sdk.OneDec()) { - return fmt.Errorf("target bond ratio cannot be more than 100 percent") - } - if decMaxBond.LT(sdk.ZeroDec()) { - return fmt.Errorf("target bond ratio cannot be less than 0 percent") - } - return nil -} - func validateValidatorEmissionPercentage(i interface{}) error { v, ok := i.(string) if !ok { diff --git a/x/emissions/types/params.pb.go b/x/emissions/types/params.pb.go index 5d73389603..e32f5bf55a 100644 --- a/x/emissions/types/params.pb.go +++ b/x/emissions/types/params.pb.go @@ -26,14 +26,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - MaxBondFactor string `protobuf:"bytes,1,opt,name=max_bond_factor,json=maxBondFactor,proto3" json:"max_bond_factor,omitempty"` - MinBondFactor string `protobuf:"bytes,2,opt,name=min_bond_factor,json=minBondFactor,proto3" json:"min_bond_factor,omitempty"` - AvgBlockTime string `protobuf:"bytes,3,opt,name=avg_block_time,json=avgBlockTime,proto3" json:"avg_block_time,omitempty"` - TargetBondRatio string `protobuf:"bytes,4,opt,name=target_bond_ratio,json=targetBondRatio,proto3" json:"target_bond_ratio,omitempty"` ValidatorEmissionPercentage string `protobuf:"bytes,5,opt,name=validator_emission_percentage,json=validatorEmissionPercentage,proto3" json:"validator_emission_percentage,omitempty"` ObserverEmissionPercentage string `protobuf:"bytes,6,opt,name=observer_emission_percentage,json=observerEmissionPercentage,proto3" json:"observer_emission_percentage,omitempty"` TssSignerEmissionPercentage string `protobuf:"bytes,7,opt,name=tss_signer_emission_percentage,json=tssSignerEmissionPercentage,proto3" json:"tss_signer_emission_percentage,omitempty"` - DurationFactorConstant string `protobuf:"bytes,8,opt,name=duration_factor_constant,json=durationFactorConstant,proto3" json:"duration_factor_constant,omitempty"` ObserverSlashAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=observer_slash_amount,json=observerSlashAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"observer_slash_amount"` BallotMaturityBlocks int64 `protobuf:"varint,10,opt,name=ballot_maturity_blocks,json=ballotMaturityBlocks,proto3" json:"ballot_maturity_blocks,omitempty"` } @@ -70,34 +65,6 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetMaxBondFactor() string { - if m != nil { - return m.MaxBondFactor - } - return "" -} - -func (m *Params) GetMinBondFactor() string { - if m != nil { - return m.MinBondFactor - } - return "" -} - -func (m *Params) GetAvgBlockTime() string { - if m != nil { - return m.AvgBlockTime - } - return "" -} - -func (m *Params) GetTargetBondRatio() string { - if m != nil { - return m.TargetBondRatio - } - return "" -} - func (m *Params) GetValidatorEmissionPercentage() string { if m != nil { return m.ValidatorEmissionPercentage @@ -119,13 +86,6 @@ func (m *Params) GetTssSignerEmissionPercentage() string { return "" } -func (m *Params) GetDurationFactorConstant() string { - if m != nil { - return m.DurationFactorConstant - } - return "" -} - func (m *Params) GetBallotMaturityBlocks() int64 { if m != nil { return m.BallotMaturityBlocks @@ -142,37 +102,30 @@ func init() { } var fileDescriptor_259272924aec0acf = []byte{ - // 465 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcd, 0x6a, 0x14, 0x41, - 0x10, 0x80, 0x77, 0xcc, 0xba, 0x9a, 0x46, 0x0d, 0x8e, 0x31, 0x0c, 0x31, 0xce, 0x06, 0x91, 0x10, - 0xc5, 0xcc, 0x1c, 0xf4, 0x20, 0x9e, 0x74, 0x82, 0x01, 0x0f, 0x42, 0xd8, 0x78, 0xf2, 0xd2, 0xf4, - 0xcc, 0xb4, 0xb3, 0x4d, 0xa6, 0xbb, 0x96, 0xae, 0xda, 0x65, 0xe3, 0x53, 0x78, 0xf4, 0xe8, 0xe3, - 0xe4, 0x66, 0x8e, 0xe2, 0x21, 0xc8, 0xee, 0x8b, 0xc8, 0xf4, 0xfc, 0xb0, 0xc2, 0x7a, 0xea, 0xa6, - 0xea, 0xab, 0x8f, 0xaa, 0xee, 0x62, 0xcf, 0xbe, 0x4a, 0x12, 0xd9, 0x58, 0x28, 0x13, 0xbb, 0x1b, - 0x58, 0x19, 0x4b, 0xad, 0x10, 0x15, 0x18, 0x8c, 0x27, 0xc2, 0x0a, 0x8d, 0xd1, 0xc4, 0x02, 0x81, - 0xbf, 0xd7, 0xa1, 0x51, 0x8b, 0x46, 0x1d, 0xba, 0xbb, 0x5d, 0x40, 0x01, 0x0e, 0x8c, 0xab, 0x5b, - 0x5d, 0xf3, 0xe4, 0x67, 0x9f, 0x0d, 0x4e, 0x9d, 0xc4, 0x3f, 0x60, 0x5b, 0x5a, 0xcc, 0x79, 0x0a, - 0x26, 0xe7, 0x5f, 0x44, 0x46, 0x60, 0x03, 0x6f, 0xdf, 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 0xc3, - 0x83, 0x42, 0xd1, 0x78, 0x9a, 0x46, 0x19, 0xe8, 0x38, 0x03, 0xd4, 0x80, 0xcd, 0x71, 0x84, 0xf9, - 0x79, 0x4c, 0x17, 0x13, 0x89, 0xd1, 0x07, 0x43, 0xa3, 0x07, 0xad, 0xec, 0xac, 0x72, 0xbd, 0x73, - 0x2a, 0xff, 0x15, 0xdb, 0x49, 0x45, 0x59, 0x02, 0x71, 0x2d, 0x68, 0x6a, 0x15, 0x5d, 0xd4, 0xdf, - 0x88, 0x01, 0xdb, 0xf7, 0x0e, 0x37, 0x46, 0xdb, 0x75, 0xf6, 0x63, 0x93, 0x74, 0xbf, 0x89, 0x6f, - 0xfa, 0xdf, 0x7f, 0x0c, 0x7b, 0xc9, 0xc9, 0xe5, 0x22, 0xf4, 0xae, 0x16, 0xa1, 0xf7, 0x67, 0x11, - 0x7a, 0xdf, 0x96, 0x61, 0xef, 0x6a, 0x19, 0xf6, 0x7e, 0x2d, 0xc3, 0xde, 0xe7, 0x17, 0x2b, 0x2d, - 0x55, 0x0b, 0x7a, 0x54, 0xaf, 0xb5, 0x81, 0x5c, 0xc6, 0xf3, 0x95, 0xa5, 0x76, 0xcd, 0xa5, 0x03, - 0xb7, 0xa0, 0x2f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xee, 0x18, 0x01, 0xa3, 0x01, 0x03, 0x00, - 0x00, + // 364 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xc1, 0x4e, 0xea, 0x40, + 0x14, 0x86, 0xdb, 0x7b, 0x81, 0x0b, 0xb3, 0x22, 0xbd, 0x68, 0x08, 0x62, 0x21, 0x2e, 0x0c, 0x26, + 0xd2, 0x2e, 0x74, 0xe5, 0x4a, 0x6b, 0x34, 0x91, 0xc4, 0x84, 0xc0, 0xce, 0x4d, 0x33, 0x2d, 0x93, + 0xd2, 0xd0, 0xf6,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 0x21, 0xe0, 0xf6, 0xe9, 0xe2, + 0x68, 0x62, 0x8a, 0x79, 0xcc, 0xd0, 0x78, 0x88, 0xc4, 0xe0, 0x7f, 0x26, 0x1b, 0x26, 0xae, 0x1b, + 0xa9, 0xd2, 0x2e, 0xc9, 0xa1, 0x43, 0x83, 0x00, 0x84, 0x1d, 0x52, 0x31, 0xe5, 0xbe, 0x98, 0xdb, + 0x4e, 0x00, 0xee, 0x04, 0xeb, 0xa4, 0xad, 0x76, 0xfe, 0x0e, 0x6a, 0xe9, 0xf4, 0x71, 0x3b, 0xb4, + 0xe4, 0xec, 0xaa, 0xf0, 0xf6, 0xde, 0x52, 0x7a, 0x85, 0xb2, 0x5a, 0x2d, 0xf6, 0x0a, 0xe5, 0x72, + 0xb5, 0x62, 0xdd, 0x2f, 0xd6, 0xba, 0xba, 0x5c, 0xeb, 0xea, 0xd7, 0x5a, 0x57, 0x5f, 0x37, 0xba, + 0xb2, 0xdc, 0xe8, 0xca, 0xc7, 0x46, 0x57, 0x9e, 0xce, 0x77, 0xea, 0x25, 0x0b, 0xed, 0xa6, 0x67, + 0x10, 0xc1, 0x88, 0x99, 0xcf, 0x3b, 0x47, 0x20, 0x8b, 0x3a, 0x25, 0xb9, 0xd0, 0x8b, 0x9f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xe6, 0x06, 0x30, 0xf9, 0x31, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -210,13 +163,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x4a - if len(m.DurationFactorConstant) > 0 { - i -= len(m.DurationFactorConstant) - copy(dAtA[i:], m.DurationFactorConstant) - i = encodeVarintParams(dAtA, i, uint64(len(m.DurationFactorConstant))) - i-- - dAtA[i] = 0x42 - } if len(m.TssSignerEmissionPercentage) > 0 { i -= len(m.TssSignerEmissionPercentage) copy(dAtA[i:], m.TssSignerEmissionPercentage) @@ -238,34 +184,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a } - if len(m.TargetBondRatio) > 0 { - i -= len(m.TargetBondRatio) - copy(dAtA[i:], m.TargetBondRatio) - i = encodeVarintParams(dAtA, i, uint64(len(m.TargetBondRatio))) - i-- - dAtA[i] = 0x22 - } - if len(m.AvgBlockTime) > 0 { - i -= len(m.AvgBlockTime) - copy(dAtA[i:], m.AvgBlockTime) - i = encodeVarintParams(dAtA, i, uint64(len(m.AvgBlockTime))) - i-- - dAtA[i] = 0x1a - } - if len(m.MinBondFactor) > 0 { - i -= len(m.MinBondFactor) - copy(dAtA[i:], m.MinBondFactor) - i = encodeVarintParams(dAtA, i, uint64(len(m.MinBondFactor))) - i-- - dAtA[i] = 0x12 - } - if len(m.MaxBondFactor) > 0 { - i -= len(m.MaxBondFactor) - copy(dAtA[i:], m.MaxBondFactor) - i = encodeVarintParams(dAtA, i, uint64(len(m.MaxBondFactor))) - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } @@ -286,22 +204,6 @@ func (m *Params) Size() (n int) { } var l int _ = l - l = len(m.MaxBondFactor) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - l = len(m.MinBondFactor) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - l = len(m.AvgBlockTime) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - l = len(m.TargetBondRatio) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } l = len(m.ValidatorEmissionPercentage) if l > 0 { n += 1 + l + sovParams(uint64(l)) @@ -314,10 +216,6 @@ func (m *Params) Size() (n int) { if l > 0 { n += 1 + l + sovParams(uint64(l)) } - l = len(m.DurationFactorConstant) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } l = m.ObserverSlashAmount.Size() n += 1 + l + sovParams(uint64(l)) if m.BallotMaturityBlocks != 0 { @@ -361,134 +259,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxBondFactor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MaxBondFactor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinBondFactor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MinBondFactor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AvgBlockTime", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AvgBlockTime = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetBondRatio", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TargetBondRatio = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorEmissionPercentage", wireType) @@ -585,38 +355,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } m.TssSignerEmissionPercentage = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DurationFactorConstant", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DurationFactorConstant = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ObserverSlashAmount", wireType) diff --git a/x/emissions/types/params_legacy.go b/x/emissions/types/params_legacy.go index 09565233a5..6dae3c3c5d 100644 --- a/x/emissions/types/params_legacy.go +++ b/x/emissions/types/params_legacy.go @@ -17,10 +17,6 @@ func ParamKeyTable() paramtypes.KeyTable { // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyPrefix(ParamMaxBondFactor), &p.MaxBondFactor, validateMaxBondFactor), - paramtypes.NewParamSetPair(KeyPrefix(ParamMinBondFactor), &p.MinBondFactor, validateMinBondFactor), - paramtypes.NewParamSetPair(KeyPrefix(ParamAvgBlockTime), &p.AvgBlockTime, validateAvgBlockTime), - paramtypes.NewParamSetPair(KeyPrefix(ParamTargetBondRatio), &p.TargetBondRatio, validateTargetBondRatio), paramtypes.NewParamSetPair( KeyPrefix(ParamValidatorEmissionPercentage), &p.ValidatorEmissionPercentage, @@ -36,10 +32,5 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { &p.TssSignerEmissionPercentage, validateTssEmissionPercentage, ), - paramtypes.NewParamSetPair( - KeyPrefix(ParamDurationFactorConstant), - &p.DurationFactorConstant, - validateDurationFactorConstant, - ), } } diff --git a/x/emissions/types/params_test.go b/x/emissions/types/params_test.go index a132744031..a90c4d9e05 100644 --- a/x/emissions/types/params_test.go +++ b/x/emissions/types/params_test.go @@ -4,7 +4,6 @@ import ( "testing" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "gopkg.in/yaml.v2" ) @@ -12,21 +11,9 @@ import ( func TestNewParams(t *testing.T) { params := NewParams() - // Verifying all parameters to ensure they are set correctly. - require.Equal(t, "1.25", params.MaxBondFactor, "MaxBondFactor should be set to 1.25") - require.Equal(t, "0.75", params.MinBondFactor, "MinBondFactor should be set to 0.75") - require.Equal(t, "6.00", params.AvgBlockTime, "AvgBlockTime should be set to 6.00") - require.Equal(t, "00.67", params.TargetBondRatio, "TargetBondRatio should be set to 00.67") require.Equal(t, "00.50", params.ValidatorEmissionPercentage, "ValidatorEmissionPercentage should be set to 00.50") require.Equal(t, "00.25", params.ObserverEmissionPercentage, "ObserverEmissionPercentage should be set to 00.25") require.Equal(t, "00.25", params.TssSignerEmissionPercentage, "TssSignerEmissionPercentage should be set to 00.25") - require.Equal( - t, - "0.001877876953694702", - params.DurationFactorConstant, - "DurationFactorConstant should be set to 0.001877876953694702", - ) - require.Equal( t, sdkmath.NewInt(100000000000000000), @@ -42,39 +29,6 @@ func TestDefaultParams(t *testing.T) { require.Equal(t, NewParams(), params) } -func TestValidateDurationFactorConstant(t *testing.T) { - require.NoError(t, validateDurationFactorConstant("1")) - require.Error(t, validateDurationFactorConstant(1)) -} - -func TestValidateMaxBondFactor(t *testing.T) { - require.Error(t, validateMaxBondFactor(1)) - require.NoError(t, validateMaxBondFactor("1.00")) - require.NoError(t, validateMaxBondFactor("1.25")) - require.Error(t, validateMaxBondFactor("1.30")) // Should fail as it's higher than 1.25 -} - -func TestValidateMinBondFactor(t *testing.T) { - require.Error(t, validateMinBondFactor(1)) - require.NoError(t, validateMinBondFactor("0.75")) - require.Error(t, validateMinBondFactor("0.50")) // Should fail as it's lower than 0.75 -} - -func TestValidateAvgBlockTime(t *testing.T) { - require.Error(t, validateAvgBlockTime(6)) - require.Error(t, validateAvgBlockTime("invalid")) - require.NoError(t, validateAvgBlockTime("6.00")) - require.Error(t, validateAvgBlockTime("-1")) // Negative time should fail - require.Error(t, validateAvgBlockTime("0")) // Zero should also fail -} - -func TestValidateTargetBondRatio(t *testing.T) { - require.Error(t, validateTargetBondRatio(0.5)) - require.NoError(t, validateTargetBondRatio("0.50")) - require.Error(t, validateTargetBondRatio("-0.01")) // Less than 0 percent should fail - require.Error(t, validateTargetBondRatio("1.01")) // More than 100 percent should fail -} - func TestValidateValidatorEmissionPercentage(t *testing.T) { require.Error(t, validateValidatorEmissionPercentage(0.5)) require.NoError(t, validateValidatorEmissionPercentage("0.50")) @@ -115,30 +69,6 @@ func TestValidate(t *testing.T) { require.NoError(t, params.Validate()) }) - t.Run("should error for invalid max bond factor", func(t *testing.T) { - params := NewParams() - params.MaxBondFactor = "1.30" - require.Error(t, params.Validate()) - }) - - t.Run("should error for invalid min bond factor", func(t *testing.T) { - params := NewParams() - params.MinBondFactor = "0.50" - require.Error(t, params.Validate()) - }) - - t.Run("should error for invalid avg block time", func(t *testing.T) { - params := NewParams() - params.AvgBlockTime = "-1.30" - require.Error(t, params.Validate()) - }) - - t.Run("should error for invalid target bond ratio", func(t *testing.T) { - params := NewParams() - params.TargetBondRatio = "-1.30" - require.Error(t, params.Validate()) - }) - t.Run("should error for invalid validator emissions percentage", func(t *testing.T) { params := NewParams() params.ValidatorEmissionPercentage = "-1.30" @@ -169,65 +99,9 @@ func TestValidate(t *testing.T) { require.Error(t, params.Validate()) }) } - func TestParamsString(t *testing.T) { params := DefaultParams() out, err := yaml.Marshal(params) require.NoError(t, err) require.Equal(t, string(out), params.String()) } - -func TestParams_GetDurationFactor(t *testing.T) { - t.Run("should return duration factor 0 if duration factor constant is 0", func(t *testing.T) { - params := DefaultParams() - params.DurationFactorConstant = "0" - - duractionFactor := params.GetDurationFactor(1) - require.Equal(t, sdk.ZeroDec(), duractionFactor) - }) - - t.Run("should return duration factor for default params", func(t *testing.T) { - params := DefaultParams() - duractionFactor := params.GetDurationFactor(1) - // hardcoding actual expected value for default params, it will change if logic changes - require.Equal(t, sdk.MustNewDecFromStr("0.000000004346937374"), duractionFactor) - }) -} - -func TestParams_GetBondFactor(t *testing.T) { - t.Run("should return 0 if current bond ratio is 0", func(t *testing.T) { - params := DefaultParams() - bondFactor := params.GetBondFactor(sdk.ZeroDec()) - require.Equal(t, sdk.ZeroDec(), bondFactor) - }) - - t.Run("should return max bond factor if bond factor exceeds max bond factor", func(t *testing.T) { - params := DefaultParams() - params.TargetBondRatio = "0.5" - params.MaxBondFactor = "1.1" - params.MinBondFactor = "0.9" - - bondFactor := params.GetBondFactor(sdk.MustNewDecFromStr("0.25")) - require.Equal(t, sdk.MustNewDecFromStr(params.MaxBondFactor), bondFactor) - }) - - t.Run("should return min bond factor if bond factor below min bond factor", func(t *testing.T) { - params := DefaultParams() - params.TargetBondRatio = "0.5" - params.MaxBondFactor = "1.1" - params.MinBondFactor = "0.9" - - bondFactor := params.GetBondFactor(sdk.MustNewDecFromStr("0.75")) - require.Equal(t, sdk.MustNewDecFromStr(params.MinBondFactor), bondFactor) - }) - - t.Run("should return calculated bond factor if bond factor in range", func(t *testing.T) { - params := DefaultParams() - params.TargetBondRatio = "0.5" - params.MaxBondFactor = "1.1" - params.MinBondFactor = "0.9" - - bondFactor := params.GetBondFactor(sdk.MustNewDecFromStr("0.5")) - require.Equal(t, sdk.OneDec(), bondFactor) - }) -} diff --git a/x/emissions/types/query.pb.go b/x/emissions/types/query.pb.go index 4da7a2ed0d..d6dab4091e 100644 --- a/x/emissions/types/query.pb.go +++ b/x/emissions/types/query.pb.go @@ -209,102 +209,6 @@ func (m *QueryListPoolAddressesResponse) GetEmissionModuleAddress() string { return "" } -type QueryGetEmissionsFactorsRequest struct { -} - -func (m *QueryGetEmissionsFactorsRequest) Reset() { *m = QueryGetEmissionsFactorsRequest{} } -func (m *QueryGetEmissionsFactorsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetEmissionsFactorsRequest) ProtoMessage() {} -func (*QueryGetEmissionsFactorsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_cb9c0dfe78e2fb82, []int{4} -} -func (m *QueryGetEmissionsFactorsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetEmissionsFactorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetEmissionsFactorsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryGetEmissionsFactorsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetEmissionsFactorsRequest.Merge(m, src) -} -func (m *QueryGetEmissionsFactorsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGetEmissionsFactorsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetEmissionsFactorsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetEmissionsFactorsRequest proto.InternalMessageInfo - -type QueryGetEmissionsFactorsResponse struct { - ReservesFactor string `protobuf:"bytes,1,opt,name=reservesFactor,proto3" json:"reservesFactor,omitempty"` - BondFactor string `protobuf:"bytes,2,opt,name=bondFactor,proto3" json:"bondFactor,omitempty"` - DurationFactor string `protobuf:"bytes,3,opt,name=durationFactor,proto3" json:"durationFactor,omitempty"` -} - -func (m *QueryGetEmissionsFactorsResponse) Reset() { *m = QueryGetEmissionsFactorsResponse{} } -func (m *QueryGetEmissionsFactorsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetEmissionsFactorsResponse) ProtoMessage() {} -func (*QueryGetEmissionsFactorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb9c0dfe78e2fb82, []int{5} -} -func (m *QueryGetEmissionsFactorsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetEmissionsFactorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetEmissionsFactorsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryGetEmissionsFactorsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetEmissionsFactorsResponse.Merge(m, src) -} -func (m *QueryGetEmissionsFactorsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGetEmissionsFactorsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetEmissionsFactorsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetEmissionsFactorsResponse proto.InternalMessageInfo - -func (m *QueryGetEmissionsFactorsResponse) GetReservesFactor() string { - if m != nil { - return m.ReservesFactor - } - return "" -} - -func (m *QueryGetEmissionsFactorsResponse) GetBondFactor() string { - if m != nil { - return m.BondFactor - } - return "" -} - -func (m *QueryGetEmissionsFactorsResponse) GetDurationFactor() string { - if m != nil { - return m.DurationFactor - } - return "" -} - type QueryShowAvailableEmissionsRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` } @@ -313,7 +217,7 @@ func (m *QueryShowAvailableEmissionsRequest) Reset() { *m = QueryShowAva func (m *QueryShowAvailableEmissionsRequest) String() string { return proto.CompactTextString(m) } func (*QueryShowAvailableEmissionsRequest) ProtoMessage() {} func (*QueryShowAvailableEmissionsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_cb9c0dfe78e2fb82, []int{6} + return fileDescriptor_cb9c0dfe78e2fb82, []int{4} } func (m *QueryShowAvailableEmissionsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -357,7 +261,7 @@ func (m *QueryShowAvailableEmissionsResponse) Reset() { *m = QueryShowAv func (m *QueryShowAvailableEmissionsResponse) String() string { return proto.CompactTextString(m) } func (*QueryShowAvailableEmissionsResponse) ProtoMessage() {} func (*QueryShowAvailableEmissionsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb9c0dfe78e2fb82, []int{7} + return fileDescriptor_cb9c0dfe78e2fb82, []int{5} } func (m *QueryShowAvailableEmissionsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -398,8 +302,6 @@ func init() { proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.emissions.QueryParamsResponse") proto.RegisterType((*QueryListPoolAddressesRequest)(nil), "zetachain.zetacore.emissions.QueryListPoolAddressesRequest") proto.RegisterType((*QueryListPoolAddressesResponse)(nil), "zetachain.zetacore.emissions.QueryListPoolAddressesResponse") - proto.RegisterType((*QueryGetEmissionsFactorsRequest)(nil), "zetachain.zetacore.emissions.QueryGetEmissionsFactorsRequest") - proto.RegisterType((*QueryGetEmissionsFactorsResponse)(nil), "zetachain.zetacore.emissions.QueryGetEmissionsFactorsResponse") proto.RegisterType((*QueryShowAvailableEmissionsRequest)(nil), "zetachain.zetacore.emissions.QueryShowAvailableEmissionsRequest") proto.RegisterType((*QueryShowAvailableEmissionsResponse)(nil), "zetachain.zetacore.emissions.QueryShowAvailableEmissionsResponse") } @@ -409,49 +311,43 @@ func init() { } var fileDescriptor_cb9c0dfe78e2fb82 = []byte{ - // 663 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4f, 0x4f, 0xd4, 0x5e, - 0x14, 0x9d, 0xf2, 0xfb, 0x39, 0xc6, 0x67, 0x62, 0xe2, 0x03, 0x91, 0x4c, 0xb0, 0x83, 0x75, 0x82, - 0xa8, 0x30, 0x15, 0x48, 0x8c, 0x51, 0x21, 0x30, 0x89, 0xb8, 0x50, 0x23, 0xa2, 0x2e, 0x74, 0xd3, - 0xbc, 0x4e, 0xaf, 0x9d, 0x26, 0x9d, 0xde, 0xa1, 0xf7, 0x15, 0x44, 0xe3, 0xc6, 0xa5, 0x2b, 0x23, - 0x5f, 0xc7, 0x0f, 0x80, 0x3b, 0x12, 0x37, 0xae, 0xd4, 0x80, 0x1f, 0xc3, 0x85, 0xe1, 0xf5, 0xb5, - 0x32, 0xc3, 0xcc, 0x64, 0xc4, 0xdd, 0xfb, 0x73, 0xce, 0xb9, 0xe7, 0xdc, 0xde, 0x97, 0xb2, 0xa9, - 0xd7, 0x20, 0x45, 0xbd, 0x21, 0x82, 0xc8, 0x56, 0x2b, 0x8c, 0xc1, 0x86, 0x66, 0x40, 0x14, 0x60, - 0x44, 0xf6, 0x7a, 0x02, 0xf1, 0x56, 0xb5, 0x15, 0xa3, 0x44, 0x3e, 0x9e, 0x23, 0xab, 0x19, 0xb2, - 0x9a, 0x23, 0x4b, 0x57, 0xeb, 0x48, 0x4d, 0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, 0xe5, 0x7a, 0x3d, 0x94, 0xd2, 0x9d, 0xe3, 0x91, 0xb5, 0xed, 0x69, 0x65, - 0x7b, 0x92, 0x57, 0xba, 0xdb, 0x0e, 0x03, 0x92, 0xd9, 0xc0, 0x02, 0xf1, 0xcf, 0x06, 0x1b, 0xee, - 0x32, 0x6d, 0x7c, 0x61, 0x00, 0x0f, 0xbd, 0x27, 0xb9, 0xb4, 0x78, 0x5c, 0xba, 0x0e, 0x31, 0xaf, - 0x42, 0xcc, 0xf0, 0x6b, 0xdd, 0x43, 0xf8, 0x20, 0x9d, 0x7c, 0xe7, 0xbc, 0xd4, 0x9e, 0xbf, 0x1b, - 0x6c, 0xb4, 0xfb, 0x94, 0xf1, 0xa5, 0x01, 0xfc, 0xf4, 0x1d, 0xf0, 0xd2, 0xf2, 0x3f, 0x28, 0xe8, - 0x50, 0x4b, 0x2a, 0xd4, 0x2d, 0x7e, 0xb3, 0x7b, 0x28, 0x6a, 0xe0, 0xa6, 0x23, 0x32, 0xfa, 0x9f, - 0x7c, 0xf6, 0x1b, 0xfd, 0xb9, 0xde, 0xd6, 0x56, 0x76, 0xf6, 0x4c, 0x63, 0x77, 0xcf, 0x34, 0x7e, - 0xec, 0x99, 0xc6, 0x87, 0x7d, 0xb3, 0xb0, 0xbb, 0x6f, 0x16, 0xbe, 0xee, 0x9b, 0x85, 0x17, 0xd3, - 0x7e, 0x20, 0x1b, 0x89, 0x5b, 0xad, 0x63, 0xf3, 0xb0, 0x7a, 0x84, 0x1e, 0xd8, 0xaf, 0x0e, 0x15, - 0x91, 0x5b, 0x2d, 0x20, 0xb7, 0xa8, 0xfe, 0x11, 0xf3, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x0f, - 0x1e, 0xc8, 0x24, 0xf8, 0x06, 0x00, 0x00, + // 564 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0x8d, 0x4b, 0x09, 0x62, 0x39, 0xb1, 0x94, 0x52, 0x45, 0xc5, 0x45, 0x26, 0x82, 0x82, 0x8a, + 0x4d, 0x8a, 0x84, 0x10, 0x5f, 0x6a, 0x22, 0xc1, 0x05, 0x10, 0x25, 0xc0, 0x01, 0x2e, 0xd6, 0x3a, + 0x5e, 0x39, 0x2b, 0xd9, 0x3b, 0xae, 0x67, 0x9d, 0x52, 0x10, 0x17, 0x7e, 0x01, 0x52, 0xff, 0x0e, + 0xe2, 0xdc, 0x63, 0x25, 0x2e, 0x9c, 0x00, 0x25, 0xfc, 0x0c, 0x0e, 0xa8, 0xeb, 0x75, 0x68, 0x9a, + 0x34, 0x2a, 0x70, 0x5b, 0xef, 0xbe, 0xf7, 0xe6, 0xcd, 0xcc, 0x93, 0xc9, 0xf2, 0x5b, 0xae, 0x58, + 0xa7, 0xcb, 0x84, 0xf4, 0xf4, 0x09, 0x32, 0xee, 0xf1, 0x44, 0x20, 0x0a, 0x90, 0xe8, 0x6d, 0xe4, + 0x3c, 0xdb, 0x72, 0xd3, 0x0c, 0x14, 0xd0, 0xc5, 0x21, 0xd2, 0x2d, 0x91, 0xee, 0x10, 0x59, 0xbb, + 0xda, 0x01, 0x4c, 0x00, 0xbd, 0x80, 0x21, 0x2f, 0x68, 0x5e, 0xaf, 0x11, 0x70, 0xc5, 0x1a, 0x5e, + 0xca, 0x22, 0x21, 0x99, 0x12, 0x20, 0x0b, 0xa5, 0xda, 0x95, 0xa9, 0x35, 0x53, 0x96, 0xb1, 0x04, + 0x0d, 0x74, 0x2e, 0x82, 0x08, 0xf4, 0xd1, 0xdb, 0x3b, 0x99, 0xdb, 0xc5, 0x08, 0x20, 0x8a, 0xb9, + 0xc7, 0x52, 0xe1, 0x31, 0x29, 0x41, 0x69, 0x75, 0xc3, 0x71, 0xe6, 0x08, 0x7d, 0xb6, 0x67, 0x60, + 0x5d, 0x0b, 0xb5, 0xf9, 0x46, 0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xf2, + 0x74, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -470,8 +366,6 @@ type QueryClient interface { Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Queries a list of ListBalances items. ListPoolAddresses(ctx context.Context, in *QueryListPoolAddressesRequest, opts ...grpc.CallOption) (*QueryListPoolAddressesResponse, error) - // Queries a list of GetEmmisonsFactors items. - GetEmissionsFactors(ctx context.Context, in *QueryGetEmissionsFactorsRequest, opts ...grpc.CallOption) (*QueryGetEmissionsFactorsResponse, error) // Queries a list of ShowAvailableEmissions items. ShowAvailableEmissions(ctx context.Context, in *QueryShowAvailableEmissionsRequest, opts ...grpc.CallOption) (*QueryShowAvailableEmissionsResponse, error) } @@ -502,15 +396,6 @@ func (c *queryClient) ListPoolAddresses(ctx context.Context, in *QueryListPoolAd return out, nil } -func (c *queryClient) GetEmissionsFactors(ctx context.Context, in *QueryGetEmissionsFactorsRequest, opts ...grpc.CallOption) (*QueryGetEmissionsFactorsResponse, error) { - out := new(QueryGetEmissionsFactorsResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.emissions.Query/GetEmissionsFactors", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) ShowAvailableEmissions(ctx context.Context, in *QueryShowAvailableEmissionsRequest, opts ...grpc.CallOption) (*QueryShowAvailableEmissionsResponse, error) { out := new(QueryShowAvailableEmissionsResponse) err := c.cc.Invoke(ctx, "/zetachain.zetacore.emissions.Query/ShowAvailableEmissions", in, out, opts...) @@ -526,8 +411,6 @@ type QueryServer interface { Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Queries a list of ListBalances items. ListPoolAddresses(context.Context, *QueryListPoolAddressesRequest) (*QueryListPoolAddressesResponse, error) - // Queries a list of GetEmmisonsFactors items. - GetEmissionsFactors(context.Context, *QueryGetEmissionsFactorsRequest) (*QueryGetEmissionsFactorsResponse, error) // Queries a list of ShowAvailableEmissions items. ShowAvailableEmissions(context.Context, *QueryShowAvailableEmissionsRequest) (*QueryShowAvailableEmissionsResponse, error) } @@ -542,9 +425,6 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq func (*UnimplementedQueryServer) ListPoolAddresses(ctx context.Context, req *QueryListPoolAddressesRequest) (*QueryListPoolAddressesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListPoolAddresses not implemented") } -func (*UnimplementedQueryServer) GetEmissionsFactors(ctx context.Context, req *QueryGetEmissionsFactorsRequest) (*QueryGetEmissionsFactorsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetEmissionsFactors not implemented") -} func (*UnimplementedQueryServer) ShowAvailableEmissions(ctx context.Context, req *QueryShowAvailableEmissionsRequest) (*QueryShowAvailableEmissionsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ShowAvailableEmissions not implemented") } @@ -589,24 +469,6 @@ func _Query_ListPoolAddresses_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _Query_GetEmissionsFactors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetEmissionsFactorsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetEmissionsFactors(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.emissions.Query/GetEmissionsFactors", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetEmissionsFactors(ctx, req.(*QueryGetEmissionsFactorsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_ShowAvailableEmissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryShowAvailableEmissionsRequest) if err := dec(in); err != nil { @@ -637,10 +499,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ListPoolAddresses", Handler: _Query_ListPoolAddresses_Handler, }, - { - MethodName: "GetEmissionsFactors", - Handler: _Query_GetEmissionsFactors_Handler, - }, { MethodName: "ShowAvailableEmissions", Handler: _Query_ShowAvailableEmissions_Handler, @@ -773,73 +631,6 @@ func (m *QueryListPoolAddressesResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryGetEmissionsFactorsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryGetEmissionsFactorsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetEmissionsFactorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryGetEmissionsFactorsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryGetEmissionsFactorsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetEmissionsFactorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.DurationFactor) > 0 { - i -= len(m.DurationFactor) - copy(dAtA[i:], m.DurationFactor) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DurationFactor))) - i-- - dAtA[i] = 0x1a - } - if len(m.BondFactor) > 0 { - i -= len(m.BondFactor) - copy(dAtA[i:], m.BondFactor) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BondFactor))) - i-- - dAtA[i] = 0x12 - } - if len(m.ReservesFactor) > 0 { - i -= len(m.ReservesFactor) - copy(dAtA[i:], m.ReservesFactor) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ReservesFactor))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *QueryShowAvailableEmissionsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -961,36 +752,6 @@ func (m *QueryListPoolAddressesResponse) Size() (n int) { return n } -func (m *QueryGetEmissionsFactorsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryGetEmissionsFactorsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ReservesFactor) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.BondFactor) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.DurationFactor) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - func (m *QueryShowAvailableEmissionsRequest) Size() (n int) { if m == nil { return 0 @@ -1352,202 +1113,6 @@ func (m *QueryListPoolAddressesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetEmissionsFactorsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetEmissionsFactorsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetEmissionsFactorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetEmissionsFactorsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetEmissionsFactorsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetEmissionsFactorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReservesFactor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ReservesFactor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BondFactor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BondFactor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DurationFactor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DurationFactor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryShowAvailableEmissionsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/emissions/types/query.pb.gw.go b/x/emissions/types/query.pb.gw.go index 05b5ad7f8b..51f7a69d78 100644 --- a/x/emissions/types/query.pb.gw.go +++ b/x/emissions/types/query.pb.gw.go @@ -69,24 +69,6 @@ func local_request_Query_ListPoolAddresses_0(ctx context.Context, marshaler runt } -func request_Query_GetEmissionsFactors_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetEmissionsFactorsRequest - var metadata runtime.ServerMetadata - - msg, err := client.GetEmissionsFactors(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GetEmissionsFactors_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetEmissionsFactorsRequest - var metadata runtime.ServerMetadata - - msg, err := server.GetEmissionsFactors(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_ShowAvailableEmissions_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryShowAvailableEmissionsRequest var metadata runtime.ServerMetadata @@ -193,29 +175,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_GetEmissionsFactors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_GetEmissionsFactors_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_GetEmissionsFactors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_ShowAvailableEmissions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -320,26 +279,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_GetEmissionsFactors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_GetEmissionsFactors_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_GetEmissionsFactors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_ShowAvailableEmissions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -368,8 +307,6 @@ var ( pattern_Query_ListPoolAddresses_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "emissions", "list_addresses"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_GetEmissionsFactors_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "emissions", "get_emissions_factors"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ShowAvailableEmissions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "emissions", "show_available_emissions", "address"}, "", runtime.AssumeColonVerbOpt(false))) ) @@ -378,7 +315,5 @@ var ( forward_Query_ListPoolAddresses_0 = runtime.ForwardResponseMessage - forward_Query_GetEmissionsFactors_0 = runtime.ForwardResponseMessage - forward_Query_ShowAvailableEmissions_0 = runtime.ForwardResponseMessage )