From 447c600de4fbb0b278455bfc15f89e08f0a5be7f Mon Sep 17 00:00:00 2001 From: rustdev Date: Fri, 22 Dec 2023 21:00:12 +0000 Subject: [PATCH] refactor custom staking module, remove unnecessary keeper's functions --- app/keepers/keepers.go | 2 +- custom/staking/keeper/keeper.go | 31 -- custom/staking/keeper/msg_server.go | 36 -- custom/staking/module.go | 70 ---- custom/staking/types/keeper_interfaces.go | 10 - proto/centauri/mint/v1beta1/genesis.proto | 7 - .../stakingmiddleware/v1beta1/genesis.proto | 15 +- .../stakingmiddleware/v1beta1/query.proto | 11 +- .../stakingmiddleware/v1beta1/tx.proto | 15 - x/mint/types/genesis.pb.go | 92 +---- x/stakingmiddleware/client/cli/query.go | 24 +- x/stakingmiddleware/client/cli/tx.go | 25 +- x/stakingmiddleware/keeper/genesis.go | 5 +- x/stakingmiddleware/keeper/keeper.go | 200 ---------- x/stakingmiddleware/keeper/msg_server.go | 5 - x/stakingmiddleware/types/codec.go | 2 - x/stakingmiddleware/types/genesis.go | 13 +- x/stakingmiddleware/types/genesis.pb.go | 341 +--------------- x/stakingmiddleware/types/keys.go | 45 +-- x/stakingmiddleware/types/msg.go | 44 --- x/stakingmiddleware/types/query.pb.go | 195 +++++---- x/stakingmiddleware/types/query.pb.gw.go | 28 +- x/stakingmiddleware/types/tx.pb.go | 374 +----------------- 23 files changed, 217 insertions(+), 1373 deletions(-) delete mode 100644 custom/staking/types/keeper_interfaces.go delete mode 100644 x/stakingmiddleware/types/msg.go diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index f7a155c18..c46e8867c 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -196,7 +196,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.StakingMiddlewareKeeper = stakingmiddleware.NewKeeper(appCodec, appKeepers.keys[stakingmiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) appKeepers.CustomStakingKeeper = customstaking.NewKeeper( - appCodec /*appKeepers.keys[stakingtypes.StoreKey],*/, *appKeepers.StakingKeeper, appKeepers.AccountKeeper, &appKeepers.MintKeeper, &appKeepers.StakingMiddlewareKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec /*appKeepers.keys[stakingtypes.StoreKey],*/, *appKeepers.StakingKeeper, appKeepers.AccountKeeper, &appKeepers.StakingMiddlewareKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) appKeepers.DistrKeeper = distrkeeper.NewKeeper( diff --git a/custom/staking/keeper/keeper.go b/custom/staking/keeper/keeper.go index 3b51974e8..309f1b211 100644 --- a/custom/staking/keeper/keeper.go +++ b/custom/staking/keeper/keeper.go @@ -8,7 +8,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking/types" sdk "github.com/cosmos/cosmos-sdk/types" - mintkeeper "github.com/notional-labs/composable/v6/x/mint/keeper" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" ) @@ -16,26 +15,10 @@ type Keeper struct { stakingkeeper.Keeper cdc codec.BinaryCodec acck accountkeeper.AccountKeeper - mintkeeper *mintkeeper.Keeper Stakingmiddleware *stakingmiddleware.Keeper authority string } -// func NewBaseKeeper( -// cdc codec.BinaryCodec, -// key storetypes.StoreKey, -// ak types.AccountKeeper, -// acck accountkeeper.AccountKeeper, -// bk bankkeeper.Keeper, -// authority string, -// ) Keeper { -// keeper := Keeper{ -// Keeper: *stakingkeeper.NewKeeper(cdc, key, ak, bk, authority), -// acck: acck, -// } -// return keeper -// } - func (k Keeper) BlockValidatorUpdates(ctx sdk.Context, hight int64) []abcicometbft.ValidatorUpdate { // Calculate validator set changes. // @@ -128,7 +111,6 @@ func NewKeeper( cdc codec.BinaryCodec, staking stakingkeeper.Keeper, acck accountkeeper.AccountKeeper, - mintkeeper *mintkeeper.Keeper, stakingmiddleware *stakingmiddleware.Keeper, authority string, ) Keeper { @@ -136,21 +118,8 @@ func NewKeeper( Keeper: staking, acck: acck, authority: authority, - mintkeeper: mintkeeper, Stakingmiddleware: stakingmiddleware, cdc: cdc, } return keeper } - -// func (k *Keeper) RegisterKeepers(akk banktypes.StakingKeeper) { -// k.acck = sk -// } - -// func (k Keeper) StoreDelegation(ctx sdk.Context, delegation types.Delegation) { -// delegatorAddress := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) - -// store := ctx.KVStore(k.storeKey) -// b := types.MustMarshalDelegation(k.cdc, delegation) -// store.Set(customstakingtypes.GetDelegationKey(delegatorAddress, delegation.GetValidatorAddr()), b) -// } diff --git a/custom/staking/keeper/msg_server.go b/custom/staking/keeper/msg_server.go index 5b11da707..234f3f2e4 100644 --- a/custom/staking/keeper/msg_server.go +++ b/custom/staking/keeper/msg_server.go @@ -27,54 +27,18 @@ func (k msgServer) EditValidator(goCtx context.Context, msg *types.MsgEditValida } func (k msgServer) Delegate(goCtx context.Context, msg *types.MsgDelegate) (*types.MsgDelegateResponse, error) { - // //todo add validation. check that this account really has some coins - // ctx := sdk.UnwrapSDKContext(goCtx) - - // bondDenom := k.BondDenom(ctx) - // if msg.Amount.Denom != bondDenom { - // return nil, sdkerrors.Wrapf( - // sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Amount.Denom, bondDenom, - // ) - // } - - // // k.mintkeeper.SetLastTotalPower(ctx, math.Int{}) - // // k.stakingmiddleware.SetLastTotalPower(ctx, math.Int{}) - - // // delegations := k.Stakingmiddleware.DequeueAllDelegation(ctx) - // // if len(delegations) > 2 { - // // return nil, sdkerrors.Wrapf( - // // sdkerrors.ErrInvalidRequest, "should always be less then X : got %s, expected %s", len(delegations), 1, - // // ) - // // } - - // k.Stakingmiddleware.SetDelegation(ctx, msg.DelegatorAddress, msg.ValidatorAddress, msg.Amount.Denom, msg.Amount.Amount) - - // return &types.MsgDelegateResponse{}, nil - // return nil, fmt.Errorf("My custom error: Nikita") return k.msgServer.Delegate(goCtx, msg) } func (k msgServer) BeginRedelegate(goCtx context.Context, msg *types.MsgBeginRedelegate) (*types.MsgBeginRedelegateResponse, error) { - //todo add validation. check that this account really has some coins staked with this validator - // ctx := sdk.UnwrapSDKContext(goCtx) - // k.Stakingmiddleware.SetBeginRedelegation(ctx, msg.DelegatorAddress, msg.ValidatorSrcAddress, msg.ValidatorDstAddress, msg.Amount.Denom, msg.Amount.Amount) - // return &types.MsgBeginRedelegateResponse{}, nil return k.msgServer.BeginRedelegate(goCtx, msg) } func (k msgServer) Undelegate(goCtx context.Context, msg *types.MsgUndelegate) (*types.MsgUndelegateResponse, error) { - // //todo add validation. check that this account really has some coins staked with this validator - // ctx := sdk.UnwrapSDKContext(goCtx) - // k.Stakingmiddleware.SetUndelegation(ctx, msg.DelegatorAddress, msg.ValidatorAddress, msg.Amount.Denom, msg.Amount.Amount) - // return &types.MsgUndelegateResponse{}, nil return k.msgServer.Undelegate(goCtx, msg) } func (k msgServer) CancelUnbondingDelegation(goCtx context.Context, msg *types.MsgCancelUnbondingDelegation) (*types.MsgCancelUnbondingDelegationResponse, error) { - // //todo add validation. check that this account really has some coins staked with this validator - // ctx := sdk.UnwrapSDKContext(goCtx) - // k.Stakingmiddleware.SetCancelUndelegation(ctx, msg.DelegatorAddress, msg.ValidatorAddress, msg.Amount.Denom, msg.Amount.Amount, msg.CreationHeight) - // return &types.MsgCancelUnbondingDelegationResponse{}, nil return k.msgServer.CancelUnbondingDelegation(goCtx, msg) } diff --git a/custom/staking/module.go b/custom/staking/module.go index 84baa4b46..44a306f73 100644 --- a/custom/staking/module.go +++ b/custom/staking/module.go @@ -59,75 +59,5 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { } func (am AppModule) EndBlock(ctx sdk.Context, _abc abcitype.RequestEndBlock) []abcitype.ValidatorUpdate { - return EndBlocker(ctx, &am.keeper) - - println("EndBlock Custom Staking Module") - params := am.keeper.Stakingmiddleware.GetParams(ctx) - println("BlocksPerEpoch: ", params.BlocksPerEpoch) - println("Height: ", _abc.Height) - - should_execute_batch := (_abc.Height % int64(params.BlocksPerEpoch)) == 0 - if should_execute_batch { - println("Should batch delegation to be executed at block: ", _abc.Height) - - delegations := am.keeper.Stakingmiddleware.DequeueAllDelegation(ctx) - println("Delegations: ", delegations) - println("Delegations len: ", len(delegations)) - for _, delegation := range delegations { - println("Delegator Address: ", delegation.DelegatorAddress) - println("Validator Address: ", delegation.ValidatorAddress) - fmt.Println("Amount", delegation.Amount.Amount) - - msgDelegate := stakingtypes.MsgDelegate{DelegatorAddress: delegation.DelegatorAddress, ValidatorAddress: delegation.ValidatorAddress, Amount: delegation.Amount} - _, err := am.msgServer.Delegate(ctx, &msgDelegate) - if err != nil { - println("Error for Delegator Address: ", delegation.DelegatorAddress) - } - } - - beginredelegations := am.keeper.Stakingmiddleware.DequeueAllRedelegation(ctx) - println("BeginRedelegations: ", beginredelegations) - println("BeginRedelegations len: ", len(beginredelegations)) - for _, redelegation := range beginredelegations { - println("Delegator Address: ", redelegation.DelegatorAddress) - println("Validator Address: ", redelegation.ValidatorSrcAddress) - - msg_redelegation := stakingtypes.MsgBeginRedelegate{DelegatorAddress: redelegation.DelegatorAddress, ValidatorSrcAddress: redelegation.ValidatorSrcAddress, ValidatorDstAddress: redelegation.ValidatorDstAddress, Amount: redelegation.Amount} - _, err := am.msgServer.BeginRedelegate(ctx, &msg_redelegation) - if err != nil { - println("Error for Delegator Address: ", msg_redelegation.DelegatorAddress) - } - } - - undelegations := am.keeper.Stakingmiddleware.DequeueAllUndelegation(ctx) - println("Undelegation: ", beginredelegations) - println("Undelegation len: ", len(beginredelegations)) - for _, undelegation := range undelegations { - println("Undelegation Delegator Address: ", undelegation.DelegatorAddress) - println("Undelegation Validator Address: ", undelegation.ValidatorAddress) - - msg_undelegate := stakingtypes.MsgUndelegate{DelegatorAddress: undelegation.DelegatorAddress, ValidatorAddress: undelegation.ValidatorAddress, Amount: undelegation.Amount} - _, err := am.msgServer.Undelegate(ctx, &msg_undelegate) - if err != nil { - println("Error for Delegator Address: ", msg_undelegate.DelegatorAddress) - } - } - - cancel_unbonding_delegations := am.keeper.Stakingmiddleware.DequeueAllCancelUnbondingDelegation(ctx) - println("Cancel Unbonding Delegations: ", cancel_unbonding_delegations) - println("Cancel Ubonding Delegations len: ", len(cancel_unbonding_delegations)) - for _, cancel_unbonding_delegation := range cancel_unbonding_delegations { - println("Cancel Unbonding Delegation Delegator Address: ", cancel_unbonding_delegation.DelegatorAddress) - println("Cancel Unbonding Delegations Validator Address: ", cancel_unbonding_delegation.ValidatorAddress) - - msg_cancle_unbonding_delegation := stakingtypes.MsgCancelUnbondingDelegation{DelegatorAddress: cancel_unbonding_delegation.DelegatorAddress, ValidatorAddress: cancel_unbonding_delegation.ValidatorAddress, Amount: cancel_unbonding_delegation.Amount, CreationHeight: cancel_unbonding_delegation.CreationHeight} - _, err := am.msgServer.CancelUnbondingDelegation(ctx, &msg_cancle_unbonding_delegation) - if err != nil { - println("Error for Delegator Address: ", msg_cancle_unbonding_delegation.DelegatorAddress) - } - } - } - - return am.AppModule.EndBlock(ctx, _abc) } diff --git a/custom/staking/types/keeper_interfaces.go b/custom/staking/types/keeper_interfaces.go deleted file mode 100644 index 0907289a7..000000000 --- a/custom/staking/types/keeper_interfaces.go +++ /dev/null @@ -1,10 +0,0 @@ -package types - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type MintKeeper interface { - SetLastTotalPower(ctx sdk.Context, power math.Int) -} diff --git a/proto/centauri/mint/v1beta1/genesis.proto b/proto/centauri/mint/v1beta1/genesis.proto index f984181b3..a30271a06 100644 --- a/proto/centauri/mint/v1beta1/genesis.proto +++ b/proto/centauri/mint/v1beta1/genesis.proto @@ -19,11 +19,4 @@ message GenesisState { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin", (gogoproto.nullable) = false ]; - - // last_total_power tracks the total amounts of bonded tokens recorded during - // the previous end block. - bytes last_total_power = 4 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; } diff --git a/proto/centauri/stakingmiddleware/v1beta1/genesis.proto b/proto/centauri/stakingmiddleware/v1beta1/genesis.proto index d57da1145..f2cdb42c2 100644 --- a/proto/centauri/stakingmiddleware/v1beta1/genesis.proto +++ b/proto/centauri/stakingmiddleware/v1beta1/genesis.proto @@ -10,18 +10,5 @@ option go_package = "x/stakingmiddleware/types"; // GenesisState defines the stakingmiddleware module's genesis state. message GenesisState { - // last_total_power tracks the total amounts of bonded tokens recorded during - // the previous end block. - bytes last_total_power = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - - Params params = 2 [ (gogoproto.nullable) = false ]; - - // delegations defines the delegations active at genesis. - repeated Delegation delegations = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - repeated BeginRedelegate begindelegations = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - repeated Undelegate undelegates = 5 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - repeated CancelUnbondingDelegation cancelunbondingdelegations = 6 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + Params params = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/centauri/stakingmiddleware/v1beta1/query.proto b/proto/centauri/stakingmiddleware/v1beta1/query.proto index 4c592f4b4..026dd1972 100644 --- a/proto/centauri/stakingmiddleware/v1beta1/query.proto +++ b/proto/centauri/stakingmiddleware/v1beta1/query.proto @@ -3,20 +3,23 @@ package centauri.stakingmiddleware.v1beta1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; +import "centauri/stakingmiddleware/v1beta1/stakingmiddleware.proto"; option go_package = "x/stakingmiddleware/types"; // Query provides defines the gRPC querier service. service Query { // Params returns the total set of minting parameters. - rpc Power(QueryPowerRequest) returns (QueryPowerResponse) { - option (google.api.http).get = "/cosmos/stakingmiddleware/v1beta1/params"; + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/mint/v1beta1/params"; } } // QueryParamsRequest is the request type for the Query/Params RPC method. -message QueryPowerRequest {} +message QueryParamsRequest {} // QueryParamsResponse is the response type for the Query/Params RPC method. -message QueryPowerResponse { +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/centauri/stakingmiddleware/v1beta1/tx.proto b/proto/centauri/stakingmiddleware/v1beta1/tx.proto index 4d71b6939..491b4fcab 100644 --- a/proto/centauri/stakingmiddleware/v1beta1/tx.proto +++ b/proto/centauri/stakingmiddleware/v1beta1/tx.proto @@ -14,23 +14,8 @@ service Msg { option (cosmos.msg.v1.service) = true; rpc UpdateEpochParams(MsgUpdateEpochParams) returns (MsgUpdateParamsEpochResponse); - - rpc SetPower(MsgSetPower) returns (MsgSetPowerResponse); -} - -// MsgSetPower is the Msg/SetPower request type. -// -// Since: cosmos-sdk 0.47 -message MsgSetPower { - string from_address = 1; } -// MsgSetPowerResponse defines the response structure for executing a -// MsgSetPower message. -// -// Since: cosmos-sdk 0.47 -message MsgSetPowerResponse {} - // MsgUpdateParams is the Msg/UpdateParams request type. // // Since: cosmos-sdk 0.47 diff --git a/x/mint/types/genesis.pb.go b/x/mint/types/genesis.pb.go index 93b5c6d44..4c2486d24 100644 --- a/x/mint/types/genesis.pb.go +++ b/x/mint/types/genesis.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -32,9 +31,6 @@ type GenesisState struct { // params defines all the paramaters of the module. Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` IncentivesSupply types.Coin `protobuf:"bytes,3,opt,name=incentives_supply,json=incentivesSupply,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coin" json:"incentives_supply"` - // last_total_power tracks the total amounts of bonded tokens recorded during - // the previous end block. - LastTotalPower github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=last_total_power,json=lastTotalPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"last_total_power"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -100,29 +96,26 @@ func init() { } var fileDescriptor_dc8b577617211e57 = []byte{ - // 340 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x41, 0x4b, 0xf3, 0x30, - 0x18, 0x80, 0xdb, 0x7d, 0x63, 0x87, 0x7e, 0x43, 0x66, 0x51, 0xa8, 0x03, 0xb3, 0xa1, 0x30, 0x77, - 0x31, 0x61, 0x7a, 0xf4, 0x56, 0x0f, 0xe2, 0x41, 0x18, 0x9b, 0x07, 0xf1, 0x32, 0xd2, 0x1a, 0x6a, - 0x70, 0x4d, 0x4a, 0xf3, 0x6e, 0x73, 0xff, 0xc2, 0xdf, 0xe1, 0x2f, 0xd9, 0x71, 0x47, 0x51, 0x98, - 0xb2, 0xfd, 0x11, 0x49, 0xd2, 0xcd, 0xcb, 0x10, 0x4f, 0x2d, 0xe4, 0x79, 0x9e, 0xe4, 0xe5, 0xf5, - 0x8e, 0x63, 0x26, 0x80, 0x8e, 0x72, 0x4e, 0x52, 0x2e, 0x80, 0x8c, 0x3b, 0x11, 0x03, 0xda, 0x21, - 0x09, 0x13, 0x4c, 0x71, 0x85, 0xb3, 0x5c, 0x82, 0xf4, 0xf7, 0xd7, 0x10, 0xd6, 0x10, 0x2e, 0xa0, - 0xfa, 0x5e, 0x22, 0x13, 0x69, 0x08, 0xa2, 0xff, 0x2c, 0x5c, 0x6f, 0x6e, 0x2f, 0x1a, 0xd3, 0x12, - 0x28, 0x96, 0x2a, 0x95, 0x8a, 0x44, 0x54, 0xb1, 0xcd, 0x79, 0x2c, 0xb9, 0xb0, 0xe7, 0x47, 0x1f, - 0x25, 0xaf, 0x7a, 0x65, 0x1f, 0xd0, 0x07, 0x0a, 0xcc, 0xbf, 0xf0, 0x2a, 0x5a, 0x67, 0x79, 0xe0, - 0x36, 0xdd, 0xf6, 0xff, 0xb3, 0x43, 0xbc, 0xf5, 0x41, 0xf8, 0xc6, 0x40, 0x61, 0x79, 0xb6, 0x68, - 0x38, 0xbd, 0x42, 0xd1, 0x72, 0x46, 0x73, 0x9a, 0xaa, 0xa0, 0xf4, 0xab, 0xdc, 0x35, 0xd0, 0x5a, - 0xb6, 0x8a, 0x3f, 0xf1, 0x76, 0xb9, 0xd0, 0x3c, 0x1f, 0x33, 0x35, 0x50, 0xa3, 0x2c, 0x1b, 0x4e, - 0x83, 0x7f, 0xa6, 0x73, 0x80, 0xed, 0x18, 0x58, 0x8f, 0xb1, 0xa9, 0x5c, 0x4a, 0x2e, 0x42, 0xa2, - 0x1b, 0xaf, 0x9f, 0x8d, 0x93, 0x84, 0xc3, 0xe3, 0x28, 0xc2, 0xb1, 0x4c, 0x49, 0x31, 0xb3, 0xfd, - 0x9c, 0xaa, 0x87, 0x27, 0x02, 0xd3, 0x8c, 0x29, 0x23, 0xf4, 0x6a, 0x3f, 0x97, 0xf4, 0xcd, 0x1d, - 0xfe, 0x9d, 0x57, 0x1b, 0x52, 0x05, 0x03, 0x90, 0x40, 0x87, 0x83, 0x4c, 0x4e, 0x58, 0x1e, 0x94, - 0x9b, 0x6e, 0xbb, 0x1a, 0x62, 0x1d, 0x7f, 0x5f, 0x34, 0x5a, 0x7f, 0x88, 0x5f, 0x0b, 0xe8, 0xed, - 0xe8, 0xce, 0xad, 0xce, 0x74, 0x75, 0x25, 0x6c, 0xcd, 0x96, 0xc8, 0x9d, 0x2f, 0x91, 0xfb, 0xb5, - 0x44, 0xee, 0xcb, 0x0a, 0x39, 0xf3, 0x15, 0x72, 0xde, 0x56, 0xc8, 0xb9, 0xaf, 0x3e, 0xdb, 0x95, - 0x19, 0x37, 0xaa, 0x98, 0x65, 0x9c, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x51, 0x7e, 0xb8, 0x8b, - 0x22, 0x02, 0x00, 0x00, + // 296 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x3f, 0x4e, 0xc3, 0x30, + 0x14, 0x87, 0xe3, 0x82, 0x3a, 0x84, 0x0e, 0x10, 0x81, 0x14, 0x2a, 0xe1, 0x56, 0x20, 0x01, 0x0b, + 0xb6, 0x0a, 0x23, 0x5b, 0x18, 0x98, 0x90, 0x50, 0xbb, 0xb1, 0x20, 0x27, 0x58, 0xc1, 0x82, 0xd8, + 0x56, 0x9e, 0x53, 0xe8, 0xc8, 0x0d, 0x38, 0x07, 0x27, 0xe9, 0xd8, 0x91, 0x09, 0x50, 0x72, 0x11, + 0x64, 0x3b, 0x2d, 0x4b, 0xc5, 0x64, 0x4b, 0xef, 0xfb, 0x7e, 0xef, 0x4f, 0x78, 0x94, 0x71, 0x69, + 0x58, 0x55, 0x0a, 0x5a, 0x08, 0x69, 0xe8, 0x74, 0x94, 0x72, 0xc3, 0x46, 0x34, 0xe7, 0x92, 0x83, + 0x00, 0xa2, 0x4b, 0x65, 0x54, 0xb4, 0xb7, 0x84, 0x88, 0x85, 0x48, 0x0b, 0xf5, 0x77, 0x73, 0x95, + 0x2b, 0x47, 0x50, 0xfb, 0xf3, 0x70, 0x7f, 0xb8, 0x3e, 0xd1, 0x99, 0x9e, 0xc0, 0x99, 0x82, 0x42, + 0x01, 0x4d, 0x19, 0xf0, 0x55, 0x3d, 0x53, 0x42, 0xfa, 0xfa, 0xe1, 0x5b, 0x27, 0xec, 0x5d, 0xfb, + 0x01, 0x26, 0x86, 0x19, 0x1e, 0x5d, 0x86, 0x5d, 0xab, 0xf3, 0x32, 0x46, 0x43, 0x74, 0xba, 0x75, + 0x7e, 0x40, 0xd6, 0x0e, 0x44, 0x6e, 0x1c, 0x94, 0x6c, 0xce, 0xbf, 0x06, 0xc1, 0xb8, 0x55, 0xac, + 0xac, 0x59, 0xc9, 0x0a, 0x88, 0x3b, 0xff, 0xca, 0xb7, 0x0e, 0x5a, 0xca, 0x5e, 0x89, 0x5e, 0xc2, + 0x1d, 0x21, 0x2d, 0x2f, 0xa6, 0x1c, 0xee, 0xa1, 0xd2, 0xfa, 0x79, 0x16, 0x6f, 0xb8, 0x9c, 0x7d, + 0xe2, 0xd7, 0x20, 0x76, 0x8d, 0x55, 0xca, 0x95, 0x12, 0x32, 0xa1, 0x36, 0xe3, 0xe3, 0x7b, 0x70, + 0x92, 0x0b, 0xf3, 0x58, 0xa5, 0x24, 0x53, 0x05, 0x6d, 0x77, 0xf6, 0xcf, 0x19, 0x3c, 0x3c, 0x51, + 0x33, 0xd3, 0x1c, 0x9c, 0x30, 0xde, 0xfe, 0x6b, 0x32, 0x71, 0x3d, 0x92, 0xe3, 0x79, 0x8d, 0xd1, + 0xa2, 0xc6, 0xe8, 0xa7, 0xc6, 0xe8, 0xbd, 0xc1, 0xc1, 0xa2, 0xc1, 0xc1, 0x67, 0x83, 0x83, 0xbb, + 0xde, 0xab, 0x3f, 0xac, 0xd3, 0xd3, 0xae, 0x3b, 0xd9, 0xc5, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x7c, 0x38, 0xd2, 0x82, 0xc8, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -145,16 +138,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size := m.LastTotalPower.Size() - i -= size - if _, err := m.LastTotalPower.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 { size, err := m.IncentivesSupply.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -211,8 +194,6 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) l = m.IncentivesSupply.Size() n += 1 + l + sovGenesis(uint64(l)) - l = m.LastTotalPower.Size() - n += 1 + l + sovGenesis(uint64(l)) return n } @@ -350,39 +331,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastTotalPower", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LastTotalPower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/stakingmiddleware/client/cli/query.go b/x/stakingmiddleware/client/cli/query.go index 939b8a5c0..31b1150dd 100644 --- a/x/stakingmiddleware/client/cli/query.go +++ b/x/stakingmiddleware/client/cli/query.go @@ -1,8 +1,6 @@ package cli import ( - "fmt" - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -14,14 +12,14 @@ import ( func GetQueryCmd() *cobra.Command { mintingQueryCmd := &cobra.Command{ Use: types.ModuleName, - Short: "Querying commands for the minting module", + Short: "Querying commands for the staking middleware module", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } mintingQueryCmd.AddCommand( - GetCmdQueryPower(), + GetCmdQueryParams(), ) return mintingQueryCmd @@ -29,31 +27,25 @@ func GetQueryCmd() *cobra.Command { // GetCmdQueryParams implements a command to return the current minting // parameters. -func GetCmdQueryPower() *cobra.Command { +func GetCmdQueryParams() *cobra.Command { cmd := &cobra.Command{ - Use: "power", - Short: "Query the current power", + Use: "params", + Short: "Query the current minting parameters", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err } - - return clientCtx.PrintString(fmt.Sprintf("%s\n", "hello world")) - queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryPowerRequest{} - res, err := queryClient.Power(cmd.Context(), params) + params := &types.QueryParamsRequest{} + res, err := queryClient.Params(cmd.Context(), params) if err != nil { return err } - _ = res - // return nil - return clientCtx.PrintString(fmt.Sprintf("%s\n", "hello world")) - // return clientCtx.PrintProto(&res.Power) + return clientCtx.PrintProto(&res.Params) }, } diff --git a/x/stakingmiddleware/client/cli/tx.go b/x/stakingmiddleware/client/cli/tx.go index bd6465a2b..82597aec2 100644 --- a/x/stakingmiddleware/client/cli/tx.go +++ b/x/stakingmiddleware/client/cli/tx.go @@ -2,8 +2,6 @@ package cli import ( "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" @@ -19,28 +17,7 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - txCmd.AddCommand( - GetCmdSetPower(), - ) + txCmd.AddCommand() return txCmd } - -func GetCmdSetPower() *cobra.Command { - cmd := &cobra.Command{ - Use: "fund [amount]", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgSetPower(clientCtx.GetFromAddress()) - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/stakingmiddleware/keeper/genesis.go b/x/stakingmiddleware/keeper/genesis.go index ff48282c9..e5472e6ab 100644 --- a/x/stakingmiddleware/keeper/genesis.go +++ b/x/stakingmiddleware/keeper/genesis.go @@ -7,8 +7,6 @@ import ( // InitGenesis new mint genesis func (keeper Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) { - keeper.SetLastTotalPower(ctx, data.LastTotalPower) - if err := keeper.SetParams(ctx, data.Params); err != nil { panic(err) } @@ -16,7 +14,6 @@ func (keeper Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) { // ExportGenesis returns a GenesisState for a given context and keeper. func (keeper Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - power := keeper.GetLastTotalPower(ctx) params := keeper.GetParams(ctx) - return types.NewGenesisState(power, params) + return types.NewGenesisState(params) } diff --git a/x/stakingmiddleware/keeper/keeper.go b/x/stakingmiddleware/keeper/keeper.go index 5479a2bef..837bbc7c6 100644 --- a/x/stakingmiddleware/keeper/keeper.go +++ b/x/stakingmiddleware/keeper/keeper.go @@ -9,8 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - - sdkmath "cosmossdk.io/math" ) // Keeper of the staking middleware store @@ -45,42 +43,6 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", "x/"+types.ModuleName) } -// // SetParams sets the x/mint module parameters. -// func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { -// if err := p.Validate(); err != nil { -// return err -// } - -// store := ctx.KVStore(k.storeKey) -// bz := k.cdc.MustMarshal(&p) -// store.Set(types.ParamsKey, bz) - -// return nil -// } - -// // GetParams returns the current x/mint module parameters. -// func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { -// store := ctx.KVStore(k.storeKey) -// bz := store.Get(types.ParamsKey) -// if bz == nil { -// return p -// } - -// k.cdc.MustUnmarshal(bz, &p) -// return p -// } - -// func (k Keeper) StoreDelegation(ctx sdk.Context, delegation stakingtypes.Delegation) { -// delegatorAddress := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) -// log := k.Logger(ctx) -// log.Info("StoreDelegation", "delegatorAddress", delegatorAddress, "validatorAddress", delegation.GetValidatorAddr()) -// store := ctx.KVStore(k.storeKey) -// b := stakingtypes.MustMarshalDelegation(k.cdc, delegation) -// kkk := types.GetDelegationKey(delegatorAddress, delegation.GetValidatorAddr()) -// // log.Info() -// store.Set(kkk, b) -// } - // SetParams sets the x/mint module parameters. func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { if p.BlocksPerEpoch < 5 { @@ -109,165 +71,3 @@ func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { k.cdc.MustUnmarshal(bz, &p) return p } - -// SetLastTotalPower Set the last total validator power. -func (k Keeper) SetLastTotalPower(ctx sdk.Context, power sdkmath.Int) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&sdk.IntProto{Int: power}) - store.Set(types.DelegateKey, bz) -} - -func (k Keeper) GetLastTotalPower(ctx sdk.Context) sdkmath.Int { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.DelegateKey) - - if bz == nil { - return sdkmath.ZeroInt() - } - - ip := sdk.IntProto{} - k.cdc.MustUnmarshal(bz, &ip) - - return ip.Int -} - -func (k Keeper) SetDelegation(ctx sdk.Context, sourceDelegatorAddress, validatorAddress, denom string, amount sdkmath.Int) { - delegation := types.Delegation{DelegatorAddress: sourceDelegatorAddress, ValidatorAddress: validatorAddress, Amount: sdk.NewCoin(denom, amount)} - delegatorAddress := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) - - store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshal(&delegation) - store.Set(types.GetDelegateKey(delegatorAddress, GetValidatorAddr(delegation)), b) -} - -func (k Keeper) SetBeginRedelegation(ctx sdk.Context, sourceDelegatorAddress, validatorSrcAddress, validatorDstAddress, denom string, amount sdkmath.Int) { - begindelegation := types.BeginRedelegate{DelegatorAddress: sourceDelegatorAddress, ValidatorSrcAddress: validatorSrcAddress, ValidatorDstAddress: validatorDstAddress, Amount: sdk.NewCoin(denom, amount)} - delegatorAddress := sdk.MustAccAddressFromBech32(begindelegation.DelegatorAddress) - - store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshal(&begindelegation) - store.Set(types.GetBeginRedelegateKey(delegatorAddress, GetValidatorAddrFromStr(validatorSrcAddress)), b) -} - -func (k Keeper) SetUndelegation(ctx sdk.Context, sourceDelegatorAddress, validatorAddress, denom string, amount sdkmath.Int) { - undelegation := types.Undelegate{DelegatorAddress: sourceDelegatorAddress, ValidatorAddress: validatorAddress, Amount: sdk.NewCoin(denom, amount)} - delegatorAddress := sdk.MustAccAddressFromBech32(undelegation.DelegatorAddress) - - store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshal(&undelegation) - store.Set(types.GetUndelegateKey(delegatorAddress, GetValidatorAddrFromStr(validatorAddress)), b) -} - -func (k Keeper) SetCancelUndelegation(ctx sdk.Context, sourceDelegatorAddress, validatorAddress, denom string, amount sdkmath.Int, height int64) { - undelegation := types.CancelUnbondingDelegation{DelegatorAddress: sourceDelegatorAddress, ValidatorAddress: validatorAddress, Amount: sdk.NewCoin(denom, amount), CreationHeight: height} - delegatorAddress := sdk.MustAccAddressFromBech32(undelegation.DelegatorAddress) - - store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshal(&undelegation) - store.Set(types.GetCancelUnbondingDelegateKey(delegatorAddress, GetValidatorAddrFromStr(validatorAddress)), b) -} - -func (k Keeper) DequeueAllDelegation(ctx sdk.Context) (delegations []types.Delegation) { - store := ctx.KVStore(k.storeKey) - - delegationIterator := sdk.KVStorePrefixIterator(store, types.DelegateKey) - defer delegationIterator.Close() - - for ; delegationIterator.Valid(); delegationIterator.Next() { - delegation := types.Delegation{} - value := delegationIterator.Value() - k.cdc.MustUnmarshal(value, &delegation) - - delegations = append(delegations, delegation) - - store.Delete(delegationIterator.Key()) - } - - return delegations -} - -func (k Keeper) DequeueAllRedelegation(ctx sdk.Context) (redelegations []types.BeginRedelegate) { - store := ctx.KVStore(k.storeKey) - - redelegationIterator := sdk.KVStorePrefixIterator(store, types.BeginRedelegateKey) - defer redelegationIterator.Close() - - for ; redelegationIterator.Valid(); redelegationIterator.Next() { - redelegation := types.BeginRedelegate{} - value := redelegationIterator.Value() - k.cdc.MustUnmarshal(value, &redelegation) - - redelegations = append(redelegations, redelegation) - - store.Delete(redelegationIterator.Key()) - } - - return redelegations -} - -func (k Keeper) DequeueAllUndelegation(ctx sdk.Context) (undelegations []types.Undelegate) { - store := ctx.KVStore(k.storeKey) - - undelegationIterator := sdk.KVStorePrefixIterator(store, types.UndelegateKey) - defer undelegationIterator.Close() - - for ; undelegationIterator.Valid(); undelegationIterator.Next() { - undelegation := types.Undelegate{} - value := undelegationIterator.Value() - k.cdc.MustUnmarshal(value, &undelegation) - - undelegations = append(undelegations, undelegation) - - store.Delete(undelegationIterator.Key()) - } - - return undelegations -} - -func (k Keeper) DequeueAllCancelUnbondingDelegation(ctx sdk.Context) (undelegations []types.CancelUnbondingDelegation) { - store := ctx.KVStore(k.storeKey) - - cancelunbondingundelegationIterator := sdk.KVStorePrefixIterator(store, types.CancelUnbondingDelegationKey) - defer cancelunbondingundelegationIterator.Close() - - for ; cancelunbondingundelegationIterator.Valid(); cancelunbondingundelegationIterator.Next() { - cancelunbondingdelegation := types.CancelUnbondingDelegation{} - value := cancelunbondingundelegationIterator.Value() - k.cdc.MustUnmarshal(value, &cancelunbondingdelegation) - - undelegations = append(undelegations, cancelunbondingdelegation) - - store.Delete(cancelunbondingundelegationIterator.Key()) - } - return undelegations -} - -func GetValidatorAddrFromStr(d string) sdk.ValAddress { - addr, err := sdk.ValAddressFromBech32(d) - if err != nil { - panic(err) - } - return addr -} - -func GetValidatorAddr(d types.Delegation) sdk.ValAddress { - addr, err := sdk.ValAddressFromBech32(d.ValidatorAddress) - if err != nil { - panic(err) - } - return addr -} - -func UnmarshalBD(cdc codec.BinaryCodec, value []byte) (ubd types.Delegation, err error) { - err = cdc.Unmarshal(value, &ubd) - return ubd, err -} - -func MustUnmarshalUBD(cdc codec.BinaryCodec, value []byte) types.Delegation { - ubd, err := UnmarshalBD(cdc, value) - if err != nil { - panic(err) - } - - return ubd -} diff --git a/x/stakingmiddleware/keeper/msg_server.go b/x/stakingmiddleware/keeper/msg_server.go index 523b1610b..1d51b5da1 100644 --- a/x/stakingmiddleware/keeper/msg_server.go +++ b/x/stakingmiddleware/keeper/msg_server.go @@ -36,8 +36,3 @@ func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdat return &types.MsgUpdateParamsEpochResponse{}, nil } - -// UpdateParams updates the params. -func (ms msgServer) SetPower(goCtx context.Context, req *types.MsgSetPower) (*types.MsgSetPowerResponse, error) { - return &types.MsgSetPowerResponse{}, nil -} diff --git a/x/stakingmiddleware/types/codec.go b/x/stakingmiddleware/types/codec.go index ed9bf475d..c8986807f 100644 --- a/x/stakingmiddleware/types/codec.go +++ b/x/stakingmiddleware/types/codec.go @@ -16,14 +16,12 @@ import ( // RegisterLegacyAminoCodec registers the account interfaces and concrete types on the // provided LegacyAmino codec. These types are used for Amino JSON serialization func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - legacy.RegisterAminoMsg(cdc, &MsgSetPower{}, "composable/MsgSetPower") legacy.RegisterAminoMsg(cdc, &MsgUpdateEpochParams{}, "composable/MsgUpdateEpochParams") } func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), - &MsgSetPower{}, &MsgUpdateEpochParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/stakingmiddleware/types/genesis.go b/x/stakingmiddleware/types/genesis.go index 7557dfb64..fe53f6d29 100644 --- a/x/stakingmiddleware/types/genesis.go +++ b/x/stakingmiddleware/types/genesis.go @@ -1,23 +1,16 @@ package types -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" -) - // NewGenesisState creates a new GenesisState object -func NewGenesisState(m math.Int, params Params) *GenesisState { +func NewGenesisState(params Params) *GenesisState { return &GenesisState{ - LastTotalPower: m, - Params: params, + Params: params, } } // DefaultGenesisState creates a default GenesisState object func DefaultGenesisState() *GenesisState { return &GenesisState{ - LastTotalPower: sdk.ZeroInt(), - Params: Params{BlocksPerEpoch: 10}, + Params: Params{BlocksPerEpoch: 10}, } } diff --git a/x/stakingmiddleware/types/genesis.pb.go b/x/stakingmiddleware/types/genesis.pb.go index 7cb2d3daa..56b0631be 100644 --- a/x/stakingmiddleware/types/genesis.pb.go +++ b/x/stakingmiddleware/types/genesis.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -27,15 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the stakingmiddleware module's genesis state. type GenesisState struct { - // last_total_power tracks the total amounts of bonded tokens recorded during - // the previous end block. - LastTotalPower github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=last_total_power,json=lastTotalPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"last_total_power"` - Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` - // delegations defines the delegations active at genesis. - Delegations []Delegation `protobuf:"bytes,3,rep,name=delegations,proto3" json:"delegations"` - Begindelegations []BeginRedelegate `protobuf:"bytes,4,rep,name=begindelegations,proto3" json:"begindelegations"` - Undelegates []Undelegate `protobuf:"bytes,5,rep,name=undelegates,proto3" json:"undelegates"` - Cancelunbondingdelegations []CancelUnbondingDelegation `protobuf:"bytes,6,rep,name=cancelunbondingdelegations,proto3" json:"cancelunbondingdelegations"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -78,34 +69,6 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetDelegations() []Delegation { - if m != nil { - return m.Delegations - } - return nil -} - -func (m *GenesisState) GetBegindelegations() []BeginRedelegate { - if m != nil { - return m.Begindelegations - } - return nil -} - -func (m *GenesisState) GetUndelegates() []Undelegate { - if m != nil { - return m.Undelegates - } - return nil -} - -func (m *GenesisState) GetCancelunbondingdelegations() []CancelUnbondingDelegation { - if m != nil { - return m.Cancelunbondingdelegations - } - return nil -} - func init() { proto.RegisterType((*GenesisState)(nil), "centauri.stakingmiddleware.v1beta1.GenesisState") } @@ -115,33 +78,20 @@ func init() { } var fileDescriptor_1aa0bd912277c095 = []byte{ - // 404 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x8a, 0xd3, 0x40, - 0x18, 0x80, 0x33, 0x6e, 0x2d, 0x98, 0x2e, 0xb2, 0x06, 0x0f, 0xb1, 0x87, 0x6c, 0xd9, 0x83, 0x94, - 0x05, 0x27, 0xb6, 0xbd, 0x09, 0x5e, 0xa2, 0xa0, 0xde, 0x4a, 0xb4, 0x20, 0x7a, 0x28, 0x93, 0xe4, - 0x67, 0x1c, 0x9b, 0xcc, 0x84, 0xcc, 0xc4, 0xea, 0x1b, 0x78, 0xf4, 0x31, 0x3c, 0xfa, 0x18, 0x3d, - 0xf6, 0x28, 0x1e, 0x8a, 0x34, 0x07, 0x5f, 0x43, 0x66, 0x92, 0x4a, 0xa0, 0xc5, 0xcd, 0xa5, 0x0d, - 0x43, 0xbe, 0xef, 0xcb, 0x3f, 0xfc, 0xf6, 0xe3, 0x18, 0xb8, 0x22, 0x65, 0xc1, 0x7c, 0xa9, 0xc8, - 0x8a, 0x71, 0x9a, 0xb1, 0x24, 0x49, 0x61, 0x4d, 0x0a, 0xf0, 0x3f, 0x4d, 0x22, 0x50, 0x64, 0xe2, - 0x53, 0xe0, 0x20, 0x99, 0xc4, 0x79, 0x21, 0x94, 0x70, 0xae, 0x0e, 0x04, 0x3e, 0x22, 0x70, 0x43, - 0x0c, 0xef, 0x53, 0x41, 0x85, 0x79, 0xdd, 0xd7, 0x4f, 0x35, 0x39, 0x7c, 0xd2, 0xa1, 0x75, 0xec, - 0xac, 0xd9, 0x7b, 0x24, 0x63, 0x5c, 0xf8, 0xe6, 0xb7, 0x3e, 0xba, 0xaa, 0x7a, 0xf6, 0xf9, 0x8b, - 0xfa, 0xd3, 0x5e, 0x2b, 0xa2, 0xc0, 0x79, 0x6b, 0x5f, 0xa4, 0x44, 0xaa, 0xa5, 0x12, 0x8a, 0xa4, - 0xcb, 0x5c, 0xac, 0xa1, 0x70, 0xd1, 0x08, 0x8d, 0xcf, 0x03, 0xbc, 0xd9, 0x5d, 0x5a, 0xbf, 0x76, - 0x97, 0x0f, 0x29, 0x53, 0x1f, 0xca, 0x08, 0xc7, 0x22, 0xf3, 0x63, 0x21, 0x33, 0x21, 0x9b, 0xbf, - 0x47, 0x32, 0x59, 0xf9, 0xea, 0x4b, 0x0e, 0x12, 0xbf, 0xe2, 0x2a, 0xbc, 0xab, 0x3d, 0x6f, 0xb4, - 0x66, 0xae, 0x2d, 0xce, 0x4b, 0xbb, 0x9f, 0x93, 0x82, 0x64, 0xd2, 0xbd, 0x35, 0x42, 0xe3, 0xc1, - 0xf4, 0x1a, 0xdf, 0x7c, 0x09, 0x78, 0x6e, 0x88, 0xa0, 0xa7, 0xdb, 0x61, 0xc3, 0x3b, 0xef, 0xed, - 0x41, 0x02, 0x29, 0x50, 0xa2, 0x98, 0xe0, 0xd2, 0x3d, 0x1b, 0x9d, 0x8d, 0x07, 0x53, 0xdc, 0x45, - 0xf7, 0xfc, 0x1f, 0x16, 0xdc, 0xd1, 0xca, 0xef, 0x7f, 0x7e, 0x5c, 0xa3, 0xb0, 0x6d, 0x73, 0x3e, - 0xda, 0x17, 0x11, 0x50, 0xc6, 0xdb, 0x85, 0x9e, 0x29, 0xcc, 0xba, 0x14, 0x02, 0xcd, 0x86, 0xd0, - 0xd0, 0xd0, 0xce, 0x1c, 0x79, 0xf5, 0x20, 0xe5, 0xe1, 0x00, 0xa4, 0x7b, 0xbb, 0xfb, 0x20, 0x0b, - 0x7e, 0xaa, 0xd0, 0xb6, 0x39, 0x5f, 0x91, 0x3d, 0x8c, 0x09, 0x8f, 0x21, 0x2d, 0x79, 0x24, 0x78, - 0xc2, 0x38, 0x6d, 0xcf, 0xd4, 0x37, 0xb1, 0xa7, 0x5d, 0x62, 0xcf, 0x8c, 0x65, 0x71, 0xb0, 0x9c, - 0xbe, 0xc4, 0xff, 0xb4, 0x82, 0xd9, 0x66, 0xef, 0xa1, 0xed, 0xde, 0x43, 0xbf, 0xf7, 0x1e, 0xfa, - 0x56, 0x79, 0xd6, 0xb6, 0xf2, 0xac, 0x9f, 0x95, 0x67, 0xbd, 0x7b, 0xf0, 0xf9, 0xc4, 0x1e, 0x9b, - 0x1d, 0x8a, 0xfa, 0x66, 0x43, 0x67, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x66, 0xe2, 0x9b, 0xf3, - 0x5e, 0x03, 0x00, 0x00, + // 206 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0x4e, 0xcd, 0x2b, + 0x49, 0x2c, 0x2d, 0xca, 0xd4, 0x2f, 0x2e, 0x49, 0xcc, 0xce, 0xcc, 0x4b, 0xcf, 0xcd, 0x4c, 0x49, + 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, + 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x82, 0xe9, + 0xd0, 0xc3, 0xd0, 0xa1, 0x07, 0xd5, 0x21, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xae, 0x0f, + 0x62, 0x41, 0x74, 0x4a, 0x59, 0x11, 0x61, 0x17, 0xa6, 0x99, 0x10, 0xbd, 0x82, 0x89, 0xb9, 0x99, + 0x79, 0xf9, 0xfa, 0x60, 0x12, 0x22, 0xa4, 0x14, 0xc1, 0xc5, 0xe3, 0x0e, 0x71, 0x59, 0x70, 0x49, + 0x62, 0x49, 0xaa, 0x90, 0x07, 0x17, 0x5b, 0x41, 0x62, 0x51, 0x62, 0x6e, 0xb1, 0x04, 0xa3, 0x02, + 0xa3, 0x06, 0xb7, 0x91, 0x96, 0x1e, 0x61, 0x97, 0xea, 0x05, 0x80, 0x75, 0x38, 0xb1, 0x9c, 0xb8, + 0x27, 0xcf, 0x10, 0x04, 0xd5, 0xef, 0x64, 0x7c, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, + 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, + 0x0c, 0x51, 0x92, 0x15, 0x58, 0xdc, 0x5e, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, 0x95, + 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x25, 0x9a, 0xf8, 0x52, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -164,62 +114,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Cancelunbondingdelegations) > 0 { - for iNdEx := len(m.Cancelunbondingdelegations) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Cancelunbondingdelegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.Undelegates) > 0 { - for iNdEx := len(m.Undelegates) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Undelegates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.Begindelegations) > 0 { - for iNdEx := len(m.Begindelegations) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Begindelegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Delegations) > 0 { - for iNdEx := len(m.Delegations) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Delegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -229,16 +123,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - { - size := m.LastTotalPower.Size() - i -= size - if _, err := m.LastTotalPower.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -260,34 +144,8 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.LastTotalPower.Size() - n += 1 + l + sovGenesis(uint64(l)) l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.Delegations) > 0 { - for _, e := range m.Delegations { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Begindelegations) > 0 { - for _, e := range m.Begindelegations { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Undelegates) > 0 { - for _, e := range m.Undelegates { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.Cancelunbondingdelegations) > 0 { - for _, e := range m.Cancelunbondingdelegations { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } return n } @@ -327,39 +185,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastTotalPower", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LastTotalPower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } @@ -392,142 +217,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delegations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Delegations = append(m.Delegations, Delegation{}) - if err := m.Delegations[len(m.Delegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Begindelegations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Begindelegations = append(m.Begindelegations, BeginRedelegate{}) - if err := m.Begindelegations[len(m.Begindelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Undelegates", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Undelegates = append(m.Undelegates, Undelegate{}) - if err := m.Undelegates[len(m.Undelegates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cancelunbondingdelegations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Cancelunbondingdelegations = append(m.Cancelunbondingdelegations, CancelUnbondingDelegation{}) - if err := m.Cancelunbondingdelegations[len(m.Cancelunbondingdelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/stakingmiddleware/types/keys.go b/x/stakingmiddleware/types/keys.go index 0e2edc734..dcaab0090 100644 --- a/x/stakingmiddleware/types/keys.go +++ b/x/stakingmiddleware/types/keys.go @@ -1,17 +1,8 @@ package types -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" -) - // MinterKey is the key to use for the keeper store. var ( - DelegateKey = []byte{0x01} // key for a delegation - BeginRedelegateKey = []byte{0x02} // key for a delegation - UndelegateKey = []byte{0x03} // key for a delegation - CancelUnbondingDelegationKey = []byte{0x04} // key for a delegation - ParamsKey = []byte{0x05} // key for global staking middleware params in the keeper store + ParamsKey = []byte{0x01} // key for global staking middleware params in the keeper store ) const ( @@ -22,37 +13,3 @@ const ( StoreKey = "customstmiddleware" // not using the module name because of collisions with key "ibc" ) - -// GetDelegateKey creates the key for delegator bond with validator -// VALUE: staking/Delegation -func GetDelegateKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { - return append(DelegationKey(delAddr), address.MustLengthPrefix(valAddr)...) -} - -func DelegationKey(delAddr sdk.AccAddress) []byte { - return append(DelegateKey, address.MustLengthPrefix(delAddr)...) -} - -func GetBeginRedelegateKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { - return append(BeginRedelegationsKey(delAddr), address.MustLengthPrefix(valAddr)...) -} - -func BeginRedelegationsKey(delAddr sdk.AccAddress) []byte { - return append(BeginRedelegateKey, address.MustLengthPrefix(delAddr)...) -} - -func GetUndelegateKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { - return append(UndelegateionKey(delAddr), address.MustLengthPrefix(valAddr)...) -} - -func UndelegateionKey(delAddr sdk.AccAddress) []byte { - return append(UndelegateKey, address.MustLengthPrefix(delAddr)...) -} - -func GetCancelUnbondingDelegateKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte { - return append(CancelUnbondingDelegateKey(delAddr), address.MustLengthPrefix(valAddr)...) -} - -func CancelUnbondingDelegateKey(delAddr sdk.AccAddress) []byte { - return append(CancelUnbondingDelegationKey, address.MustLengthPrefix(delAddr)...) -} diff --git a/x/stakingmiddleware/types/msg.go b/x/stakingmiddleware/types/msg.go deleted file mode 100644 index 4f182b9a2..000000000 --- a/x/stakingmiddleware/types/msg.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/codec/legacy" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var _ sdk.Msg = &MsgSetPower{} - -// Route Implements Msg. -func (m MsgSetPower) Route() string { return sdk.MsgTypeURL(&m) } - -// Type Implements Msg. -func (m MsgSetPower) Type() string { return sdk.MsgTypeURL(&m) } - -// GetSigners returns the expected signers for a MsgMintAndAllocateExp . -func (m MsgSetPower) GetSigners() []sdk.AccAddress { - daoAccount, err := sdk.AccAddressFromBech32(m.FromAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{daoAccount} -} - -// GetSignBytes Implements Msg. -func (m MsgSetPower) GetSignBytes() []byte { - return sdk.MustSortJSON(legacy.Cdc.MustMarshalJSON(&m)) -} - -// ValidateBasic does a sanity check on the provided data. -func (m MsgSetPower) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.FromAddress) - if err != nil { - return errorsmod.Wrap(err, "from address must be valid address") - } - return nil -} - -func NewMsgSetPower(fromAddr sdk.AccAddress) *MsgSetPower { - return &MsgSetPower{ - FromAddress: fromAddr.String(), - } -} diff --git a/x/stakingmiddleware/types/query.pb.go b/x/stakingmiddleware/types/query.pb.go index 4314b7bbe..772706fc6 100644 --- a/x/stakingmiddleware/types/query.pb.go +++ b/x/stakingmiddleware/types/query.pb.go @@ -30,21 +30,21 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryPowerRequest struct { +type QueryParamsRequest struct { } -func (m *QueryPowerRequest) Reset() { *m = QueryPowerRequest{} } -func (m *QueryPowerRequest) String() string { return proto.CompactTextString(m) } -func (*QueryPowerRequest) ProtoMessage() {} -func (*QueryPowerRequest) Descriptor() ([]byte, []int) { +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_81a7c3c637f3f95a, []int{0} } -func (m *QueryPowerRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPowerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPowerRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -54,34 +54,36 @@ func (m *QueryPowerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *QueryPowerRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPowerRequest.Merge(m, src) +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) } -func (m *QueryPowerRequest) XXX_Size() int { +func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } -func (m *QueryPowerRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPowerRequest.DiscardUnknown(m) +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryPowerRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo // QueryParamsResponse is the response type for the Query/Params RPC method. -type QueryPowerResponse struct { +type QueryParamsResponse struct { + // params defines the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } -func (m *QueryPowerResponse) Reset() { *m = QueryPowerResponse{} } -func (m *QueryPowerResponse) String() string { return proto.CompactTextString(m) } -func (*QueryPowerResponse) ProtoMessage() {} -func (*QueryPowerResponse) Descriptor() ([]byte, []int) { +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_81a7c3c637f3f95a, []int{1} } -func (m *QueryPowerResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPowerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPowerResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -91,21 +93,28 @@ func (m *QueryPowerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryPowerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPowerResponse.Merge(m, src) +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) } -func (m *QueryPowerResponse) XXX_Size() int { +func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } -func (m *QueryPowerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPowerResponse.DiscardUnknown(m) +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryPowerResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} func init() { - proto.RegisterType((*QueryPowerRequest)(nil), "centauri.stakingmiddleware.v1beta1.QueryPowerRequest") - proto.RegisterType((*QueryPowerResponse)(nil), "centauri.stakingmiddleware.v1beta1.QueryPowerResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "centauri.stakingmiddleware.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "centauri.stakingmiddleware.v1beta1.QueryParamsResponse") } func init() { @@ -113,23 +122,26 @@ func init() { } var fileDescriptor_81a7c3c637f3f95a = []byte{ - // 250 bytes of a gzipped FileDescriptorProto + // 290 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4b, 0x4e, 0xcd, 0x2b, 0x49, 0x2c, 0x2d, 0xca, 0xd4, 0x2f, 0x2e, 0x49, 0xcc, 0xce, 0xcc, 0x4b, 0xcf, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x82, 0xa9, 0xd7, 0xc3, 0x50, 0xaf, 0x07, 0x55, 0x2f, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xae, 0x0f, 0x62, 0x41, 0x74, 0x4a, 0xc9, 0xa4, 0xe7, 0xe7, 0xa7, 0xe7, 0xa4, 0xea, 0x27, 0x16, 0x64, 0xea, 0x27, 0xe6, - 0xe5, 0xe5, 0x97, 0x24, 0x96, 0x64, 0xe6, 0xe7, 0x15, 0x43, 0x64, 0x95, 0x84, 0xb9, 0x04, 0x03, - 0x41, 0xd6, 0x04, 0xe4, 0x97, 0xa7, 0x16, 0x05, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0x28, 0x89, - 0x70, 0x09, 0x21, 0x0b, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x1a, 0x6d, 0x62, 0xe4, 0x62, 0x05, - 0x0b, 0x0b, 0xad, 0x60, 0xe4, 0x62, 0x05, 0xcb, 0x09, 0x99, 0xea, 0x11, 0x76, 0x97, 0x1e, 0x86, - 0x05, 0x52, 0x66, 0xa4, 0x6a, 0x83, 0x38, 0x41, 0xc9, 0xa0, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x5a, - 0x42, 0x1a, 0xfa, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0x78, 0x02, 0xaf, 0x20, 0xb1, 0x28, 0x31, - 0xb7, 0xd8, 0xc9, 0xf8, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, - 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x24, 0x2b, - 0xb0, 0xe8, 0x2e, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x87, 0x8d, 0x31, 0x20, 0x00, 0x00, - 0xff, 0xff, 0x00, 0x00, 0x72, 0xbe, 0xa5, 0x01, 0x00, 0x00, + 0xe5, 0xe5, 0x97, 0x24, 0x96, 0x64, 0xe6, 0xe7, 0x15, 0x43, 0x65, 0xad, 0x88, 0x70, 0x07, 0xa6, + 0x8d, 0x60, 0xbd, 0x4a, 0x22, 0x5c, 0x42, 0x81, 0x20, 0x27, 0x06, 0x24, 0x16, 0x25, 0xe6, 0x16, + 0x07, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0x28, 0xc5, 0x73, 0x09, 0xa3, 0x88, 0x16, 0x17, 0xe4, + 0xe7, 0x15, 0xa7, 0x0a, 0x79, 0x70, 0xb1, 0x15, 0x80, 0x45, 0x24, 0x18, 0x15, 0x18, 0x35, 0xb8, + 0x8d, 0xb4, 0xf4, 0x08, 0xfb, 0x48, 0x0f, 0x62, 0x86, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, + 0x50, 0xfd, 0x46, 0x2b, 0x18, 0xb9, 0x58, 0xc1, 0x36, 0x08, 0xcd, 0x63, 0xe4, 0x62, 0x83, 0x28, + 0x11, 0x32, 0x23, 0xc6, 0x38, 0x4c, 0xd7, 0x4a, 0x99, 0x93, 0xac, 0x0f, 0xe2, 0x1f, 0x25, 0xe5, + 0xa6, 0xcb, 0x4f, 0x26, 0x33, 0xc9, 0x0a, 0x49, 0xeb, 0x27, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xeb, + 0xe7, 0x66, 0xe6, 0x95, 0xc0, 0x83, 0x0c, 0xe2, 0x54, 0x27, 0xe3, 0x13, 0x8f, 0xe4, 0x18, 0x2f, + 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, + 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x92, 0xac, 0xc0, 0x12, 0xe0, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, + 0x6c, 0xe0, 0xd0, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x9c, 0xf8, 0x2d, 0x7d, 0x23, 0x02, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -145,7 +157,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { // Params returns the total set of minting parameters. - Power(ctx context.Context, in *QueryPowerRequest, opts ...grpc.CallOption) (*QueryPowerResponse, error) + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) } type queryClient struct { @@ -156,9 +168,9 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Power(ctx context.Context, in *QueryPowerRequest, opts ...grpc.CallOption) (*QueryPowerResponse, error) { - out := new(QueryPowerResponse) - err := c.cc.Invoke(ctx, "/centauri.stakingmiddleware.v1beta1.Query/Power", in, out, opts...) +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/centauri.stakingmiddleware.v1beta1.Query/Params", in, out, opts...) if err != nil { return nil, err } @@ -168,35 +180,35 @@ func (c *queryClient) Power(ctx context.Context, in *QueryPowerRequest, opts ... // QueryServer is the server API for Query service. type QueryServer interface { // Params returns the total set of minting parameters. - Power(context.Context, *QueryPowerRequest) (*QueryPowerResponse, error) + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Power(ctx context.Context, req *QueryPowerRequest) (*QueryPowerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Power not implemented") +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Power_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPowerRequest) +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Power(ctx, in) + return srv.(QueryServer).Params(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/centauri.stakingmiddleware.v1beta1.Query/Power", + FullMethod: "/centauri.stakingmiddleware.v1beta1.Query/Params", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Power(ctx, req.(*QueryPowerRequest)) + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) } return interceptor(ctx, in, info, handler) } @@ -206,15 +218,15 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "Power", - Handler: _Query_Power_Handler, + MethodName: "Params", + Handler: _Query_Params_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "centauri/stakingmiddleware/v1beta1/query.proto", } -func (m *QueryPowerRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -224,12 +236,12 @@ func (m *QueryPowerRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPowerRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPowerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -237,7 +249,7 @@ func (m *QueryPowerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryPowerResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -247,16 +259,26 @@ func (m *QueryPowerResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPowerResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPowerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -271,7 +293,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryPowerRequest) Size() (n int) { +func (m *QueryParamsRequest) Size() (n int) { if m == nil { return 0 } @@ -280,12 +302,14 @@ func (m *QueryPowerRequest) Size() (n int) { return n } -func (m *QueryPowerResponse) Size() (n int) { +func (m *QueryParamsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -295,7 +319,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryPowerRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -318,10 +342,10 @@ func (m *QueryPowerRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPowerRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPowerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -345,7 +369,7 @@ func (m *QueryPowerRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPowerResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -368,12 +392,45 @@ func (m *QueryPowerResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPowerResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPowerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/stakingmiddleware/types/query.pb.gw.go b/x/stakingmiddleware/types/query.pb.gw.go index fdb182ad2..e7c79699d 100644 --- a/x/stakingmiddleware/types/query.pb.gw.go +++ b/x/stakingmiddleware/types/query.pb.gw.go @@ -33,20 +33,20 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_Power_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPowerRequest +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest var metadata runtime.ServerMetadata - msg, err := client.Power(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_Power_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPowerRequest +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest var metadata runtime.ServerMetadata - msg, err := server.Power(ctx, &protoReq) + msg, err := server.Params(ctx, &protoReq) return msg, metadata, err } @@ -57,7 +57,7 @@ func local_request_Query_Power_0(ctx context.Context, marshaler runtime.Marshale // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Power_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -68,7 +68,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Power_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Params_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 { @@ -76,7 +76,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Power_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -121,7 +121,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Power_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Params_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) @@ -130,14 +130,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Power_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_Params_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_Power_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -145,9 +145,9 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Power_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "stakingmiddleware", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "mint", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_Power_0 = runtime.ForwardResponseMessage + forward_Query_Params_0 = runtime.ForwardResponseMessage ) diff --git a/x/stakingmiddleware/types/tx.pb.go b/x/stakingmiddleware/types/tx.pb.go index 189e21a45..a3f3ad136 100644 --- a/x/stakingmiddleware/types/tx.pb.go +++ b/x/stakingmiddleware/types/tx.pb.go @@ -31,93 +31,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgSetPower is the Msg/SetPower request type. -// -// Since: cosmos-sdk 0.47 -type MsgSetPower struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` -} - -func (m *MsgSetPower) Reset() { *m = MsgSetPower{} } -func (m *MsgSetPower) String() string { return proto.CompactTextString(m) } -func (*MsgSetPower) ProtoMessage() {} -func (*MsgSetPower) Descriptor() ([]byte, []int) { - return fileDescriptor_d15665ac9877b062, []int{0} -} -func (m *MsgSetPower) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetPower) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetPower.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 *MsgSetPower) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetPower.Merge(m, src) -} -func (m *MsgSetPower) XXX_Size() int { - return m.Size() -} -func (m *MsgSetPower) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetPower.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSetPower proto.InternalMessageInfo - -func (m *MsgSetPower) GetFromAddress() string { - if m != nil { - return m.FromAddress - } - return "" -} - -// MsgSetPowerResponse defines the response structure for executing a -// MsgSetPower message. -// -// Since: cosmos-sdk 0.47 -type MsgSetPowerResponse struct { -} - -func (m *MsgSetPowerResponse) Reset() { *m = MsgSetPowerResponse{} } -func (m *MsgSetPowerResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSetPowerResponse) ProtoMessage() {} -func (*MsgSetPowerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d15665ac9877b062, []int{1} -} -func (m *MsgSetPowerResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetPowerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetPowerResponse.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 *MsgSetPowerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetPowerResponse.Merge(m, src) -} -func (m *MsgSetPowerResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSetPowerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetPowerResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSetPowerResponse proto.InternalMessageInfo - // MsgUpdateParams is the Msg/UpdateParams request type. // // Since: cosmos-sdk 0.47 @@ -135,7 +48,7 @@ func (m *MsgUpdateEpochParams) Reset() { *m = MsgUpdateEpochParams{} } func (m *MsgUpdateEpochParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateEpochParams) ProtoMessage() {} func (*MsgUpdateEpochParams) Descriptor() ([]byte, []int) { - return fileDescriptor_d15665ac9877b062, []int{2} + return fileDescriptor_d15665ac9877b062, []int{0} } func (m *MsgUpdateEpochParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -189,7 +102,7 @@ func (m *MsgUpdateParamsEpochResponse) Reset() { *m = MsgUpdateParamsEpo func (m *MsgUpdateParamsEpochResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParamsEpochResponse) ProtoMessage() {} func (*MsgUpdateParamsEpochResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d15665ac9877b062, []int{3} + return fileDescriptor_d15665ac9877b062, []int{1} } func (m *MsgUpdateParamsEpochResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -219,8 +132,6 @@ func (m *MsgUpdateParamsEpochResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsEpochResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgSetPower)(nil), "centauri.stakingmiddleware.v1beta1.MsgSetPower") - proto.RegisterType((*MsgSetPowerResponse)(nil), "centauri.stakingmiddleware.v1beta1.MsgSetPowerResponse") proto.RegisterType((*MsgUpdateEpochParams)(nil), "centauri.stakingmiddleware.v1beta1.MsgUpdateEpochParams") proto.RegisterType((*MsgUpdateParamsEpochResponse)(nil), "centauri.stakingmiddleware.v1beta1.MsgUpdateParamsEpochResponse") } @@ -230,7 +141,7 @@ func init() { } var fileDescriptor_d15665ac9877b062 = []byte{ - // 422 bytes of a gzipped FileDescriptorProto + // 360 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4e, 0x4e, 0xcd, 0x2b, 0x49, 0x2c, 0x2d, 0xca, 0xd4, 0x2f, 0x2e, 0x49, 0xcc, 0xce, 0xcc, 0x4b, 0xcf, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, @@ -238,26 +149,22 @@ var fileDescriptor_d15665ac9877b062 = []byte{ 0x55, 0x2c, 0x25, 0x9e, 0x9c, 0x5f, 0x9c, 0x9b, 0x5f, 0xac, 0x9f, 0x5b, 0x9c, 0xae, 0x5f, 0x66, 0x08, 0xa2, 0x20, 0x9a, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x54, 0x48, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xcc, 0xd4, 0x07, 0xb1, 0xa0, 0xa2, 0x92, 0x10, 0x13, 0xe2, 0x21, - 0x12, 0x10, 0x0e, 0x54, 0xca, 0x8a, 0x08, 0xd7, 0x62, 0x3a, 0x0d, 0xac, 0x57, 0xc9, 0x80, 0x8b, - 0xdb, 0xb7, 0x38, 0x3d, 0x38, 0xb5, 0x24, 0x20, 0xbf, 0x3c, 0xb5, 0x48, 0x48, 0x91, 0x8b, 0x27, - 0xad, 0x28, 0x3f, 0x37, 0x3e, 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x58, 0x82, 0x51, 0x81, 0x51, - 0x83, 0x33, 0x88, 0x1b, 0x24, 0xe6, 0x08, 0x11, 0x52, 0x12, 0xe5, 0x12, 0x46, 0xd2, 0x11, 0x94, - 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0xaa, 0x74, 0x8f, 0x91, 0x4b, 0xc4, 0xb7, 0x38, 0x3d, 0xb4, - 0x20, 0x25, 0xb1, 0x24, 0xd5, 0xb5, 0x20, 0x3f, 0x39, 0x23, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, - 0xc8, 0x8c, 0x8b, 0x33, 0xb1, 0xb4, 0x24, 0x23, 0xbf, 0x28, 0xb3, 0xa4, 0x12, 0x62, 0x9e, 0x93, - 0xc4, 0xa5, 0x2d, 0xba, 0x22, 0x50, 0x2f, 0x40, 0x8d, 0x0d, 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0x0f, - 0x42, 0x28, 0x15, 0xf2, 0xe5, 0x62, 0x2b, 0x00, 0x9b, 0x20, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x6d, - 0xa4, 0xa5, 0x47, 0x38, 0x9c, 0xf5, 0x20, 0x76, 0x3a, 0x71, 0x9e, 0xb8, 0x27, 0xcf, 0xb0, 0xe2, - 0xf9, 0x06, 0x2d, 0xc6, 0x20, 0xa8, 0x21, 0x56, 0xf6, 0x4d, 0xcf, 0x37, 0x68, 0x21, 0x8c, 0xef, - 0x7a, 0xbe, 0x41, 0x4b, 0x07, 0x1e, 0x6e, 0x15, 0x58, 0x42, 0x0e, 0xee, 0x19, 0x88, 0x99, 0x4a, - 0x72, 0x5c, 0x32, 0x68, 0x42, 0x60, 0x5f, 0xc2, 0x02, 0xc0, 0x68, 0x0a, 0x13, 0x17, 0xb3, 0x6f, - 0x71, 0xba, 0x50, 0x3f, 0x23, 0x97, 0x20, 0x66, 0x28, 0x58, 0x10, 0xe3, 0x7a, 0x6c, 0xe1, 0x27, - 0xe5, 0x40, 0x92, 0x4e, 0x2c, 0x2e, 0x13, 0x2a, 0xe1, 0xe2, 0x80, 0x47, 0xb0, 0x3e, 0x91, 0xa6, - 0xc1, 0x34, 0x48, 0x99, 0x93, 0xa8, 0x01, 0x66, 0xab, 0x14, 0x6b, 0x03, 0x28, 0xfc, 0x9d, 0x8c, - 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, - 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x12, 0x5b, 0xa8, 0x97, 0x54, - 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x13, 0xa7, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x78, 0x25, - 0x34, 0xad, 0x88, 0x03, 0x00, 0x00, + 0x12, 0x10, 0x0e, 0x54, 0xca, 0x8a, 0x08, 0xd7, 0x62, 0x3a, 0x0d, 0xac, 0x57, 0xe9, 0x1e, 0x23, + 0x97, 0x88, 0x6f, 0x71, 0x7a, 0x68, 0x41, 0x4a, 0x62, 0x49, 0xaa, 0x6b, 0x41, 0x7e, 0x72, 0x46, + 0x40, 0x62, 0x51, 0x62, 0x6e, 0xb1, 0x90, 0x19, 0x17, 0x67, 0x62, 0x69, 0x49, 0x46, 0x7e, 0x51, + 0x66, 0x49, 0xa5, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xc4, 0xa5, 0x2d, 0xba, 0x22, 0x50, + 0x9b, 0x1d, 0x53, 0x52, 0x8a, 0x52, 0x8b, 0x8b, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x83, 0x10, + 0x4a, 0x85, 0x7c, 0xb9, 0xd8, 0x0a, 0xc0, 0x26, 0x48, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x69, + 0xe9, 0x11, 0x0e, 0x1e, 0x3d, 0x88, 0x9d, 0x4e, 0x9c, 0x27, 0xee, 0xc9, 0x33, 0xac, 0x78, 0xbe, + 0x41, 0x8b, 0x31, 0x08, 0x6a, 0x88, 0x95, 0x7d, 0xd3, 0xf3, 0x0d, 0x5a, 0x08, 0xe3, 0xbb, 0x9e, + 0x6f, 0xd0, 0xd2, 0x81, 0x7b, 0xb7, 0x02, 0x8b, 0x87, 0xe1, 0x9e, 0x81, 0x98, 0xa9, 0x24, 0xc7, + 0x25, 0x83, 0x26, 0x04, 0xf6, 0x65, 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0xd1, 0x3c, + 0x46, 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0xa1, 0x7e, 0x46, 0x2e, 0x41, 0xcc, 0x50, 0xb0, 0x20, 0xc6, + 0xf5, 0xd8, 0xc2, 0x4f, 0xca, 0x81, 0x24, 0x9d, 0x58, 0x5c, 0x26, 0xc5, 0xda, 0x00, 0x0a, 0x09, + 0x27, 0xe3, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, + 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x92, 0xc4, 0xe6, 0xff, + 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0xec, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, + 0x89, 0xbf, 0x82, 0x72, 0xc9, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -273,7 +180,6 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochParams, opts ...grpc.CallOption) (*MsgUpdateParamsEpochResponse, error) - SetPower(ctx context.Context, in *MsgSetPower, opts ...grpc.CallOption) (*MsgSetPowerResponse, error) } type msgClient struct { @@ -293,19 +199,9 @@ func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochPar return out, nil } -func (c *msgClient) SetPower(ctx context.Context, in *MsgSetPower, opts ...grpc.CallOption) (*MsgSetPowerResponse, error) { - out := new(MsgSetPowerResponse) - err := c.cc.Invoke(ctx, "/centauri.stakingmiddleware.v1beta1.Msg/SetPower", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // MsgServer is the server API for Msg service. type MsgServer interface { UpdateEpochParams(context.Context, *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) - SetPower(context.Context, *MsgSetPower) (*MsgSetPowerResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -315,9 +211,6 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdateEpochParams(ctx context.Context, req *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateEpochParams not implemented") } -func (*UnimplementedMsgServer) SetPower(ctx context.Context, req *MsgSetPower) (*MsgSetPowerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetPower not implemented") -} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -341,24 +234,6 @@ func _Msg_UpdateEpochParams_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Msg_SetPower_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSetPower) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SetPower(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/centauri.stakingmiddleware.v1beta1.Msg/SetPower", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SetPower(ctx, req.(*MsgSetPower)) - } - return interceptor(ctx, in, info, handler) -} - var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "centauri.stakingmiddleware.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -367,68 +242,11 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateEpochParams", Handler: _Msg_UpdateEpochParams_Handler, }, - { - MethodName: "SetPower", - Handler: _Msg_SetPower_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "centauri/stakingmiddleware/v1beta1/tx.proto", } -func (m *MsgSetPower) 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 *MsgSetPower) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSetPower) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.FromAddress) > 0 { - i -= len(m.FromAddress) - copy(dAtA[i:], m.FromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgSetPowerResponse) 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 *MsgSetPowerResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSetPowerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *MsgUpdateEpochParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -503,28 +321,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgSetPower) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgSetPowerResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgUpdateEpochParams) Size() (n int) { if m == nil { return 0 @@ -555,138 +351,6 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgSetPower) 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 ErrIntOverflowTx - } - 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: MsgSetPower: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetPower: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSetPowerResponse) 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 ErrIntOverflowTx - } - 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: MsgSetPowerResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetPowerResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MsgUpdateEpochParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0