diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 5f56a1e6472..2a5e3162c16 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -75,8 +75,6 @@ import ( "github.com/osmosis-labs/osmosis/v12/x/txfees" txfeeskeeper "github.com/osmosis-labs/osmosis/v12/x/txfees/keeper" txfeestypes "github.com/osmosis-labs/osmosis/v12/x/txfees/types" - valsetpref "github.com/osmosis-labs/osmosis/v12/x/valset-pref" - valsetpreftypes "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types" ) type AppKeepers struct { @@ -94,30 +92,29 @@ type AppKeepers struct { ScopedWasmKeeper capabilitykeeper.ScopedKeeper // "Normal" keepers - AccountKeeper *authkeeper.AccountKeeper - BankKeeper *bankkeeper.BaseKeeper - AuthzKeeper *authzkeeper.Keeper - StakingKeeper *stakingkeeper.Keeper - DistrKeeper *distrkeeper.Keeper - SlashingKeeper *slashingkeeper.Keeper - IBCKeeper *ibckeeper.Keeper - ICAHostKeeper *icahostkeeper.Keeper - TransferKeeper *ibctransferkeeper.Keeper - EvidenceKeeper *evidencekeeper.Keeper - GAMMKeeper *gammkeeper.Keeper - TwapKeeper *twap.Keeper - LockupKeeper *lockupkeeper.Keeper - EpochsKeeper *epochskeeper.Keeper - IncentivesKeeper *incentiveskeeper.Keeper - MintKeeper *mintkeeper.Keeper - PoolIncentivesKeeper *poolincentiveskeeper.Keeper - TxFeesKeeper *txfeeskeeper.Keeper - SuperfluidKeeper *superfluidkeeper.Keeper - GovKeeper *govkeeper.Keeper - WasmKeeper *wasm.Keeper - ContractKeeper *wasmkeeper.PermissionedKeeper - TokenFactoryKeeper *tokenfactorykeeper.Keeper - ValidatorSetPreferenceKeeper *valsetpref.Keeper + AccountKeeper *authkeeper.AccountKeeper + BankKeeper *bankkeeper.BaseKeeper + AuthzKeeper *authzkeeper.Keeper + StakingKeeper *stakingkeeper.Keeper + DistrKeeper *distrkeeper.Keeper + SlashingKeeper *slashingkeeper.Keeper + IBCKeeper *ibckeeper.Keeper + ICAHostKeeper *icahostkeeper.Keeper + TransferKeeper *ibctransferkeeper.Keeper + EvidenceKeeper *evidencekeeper.Keeper + GAMMKeeper *gammkeeper.Keeper + TwapKeeper *twap.Keeper + LockupKeeper *lockupkeeper.Keeper + EpochsKeeper *epochskeeper.Keeper + IncentivesKeeper *incentiveskeeper.Keeper + MintKeeper *mintkeeper.Keeper + PoolIncentivesKeeper *poolincentiveskeeper.Keeper + TxFeesKeeper *txfeeskeeper.Keeper + SuperfluidKeeper *superfluidkeeper.Keeper + GovKeeper *govkeeper.Keeper + WasmKeeper *wasm.Keeper + ContractKeeper *wasmkeeper.PermissionedKeeper + TokenFactoryKeeper *tokenfactorykeeper.Keeper // IBC modules // transfer module @@ -341,14 +338,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers( ) appKeepers.TokenFactoryKeeper = &tokenFactoryKeeper - validatorSetPreferenceKeeper := valsetpref.NewKeeper( - appKeepers.keys[valsetpreftypes.StoreKey], - appKeepers.GetSubspace(valsetpreftypes.ModuleName), - appKeepers.StakingKeeper, - ) - - appKeepers.ValidatorSetPreferenceKeeper = &validatorSetPreferenceKeeper - // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks supportedFeatures := "iterator,staking,stargate,osmosis,cosmwasm_1_1" @@ -567,6 +556,5 @@ func KVStoreKeys() []string { superfluidtypes.StoreKey, wasm.StoreKey, tokenfactorytypes.StoreKey, - valsetpreftypes.StoreKey, } } diff --git a/app/keepers/modules.go b/app/keepers/modules.go index a24fccd4e97..88f214644c7 100644 --- a/app/keepers/modules.go +++ b/app/keepers/modules.go @@ -40,7 +40,6 @@ import ( "github.com/osmosis-labs/osmosis/v12/x/tokenfactory" "github.com/osmosis-labs/osmosis/v12/x/twap/twapmodule" "github.com/osmosis-labs/osmosis/v12/x/txfees" - valsetprefmodule "github.com/osmosis-labs/osmosis/v12/x/valset-pref/valpref-module" ) // AppModuleBasics returns ModuleBasics for the module BasicManager. @@ -85,7 +84,6 @@ var AppModuleBasics = []module.AppModuleBasic{ epochs.AppModuleBasic{}, superfluid.AppModuleBasic{}, tokenfactory.AppModuleBasic{}, - valsetprefmodule.AppModuleBasic{}, wasm.AppModuleBasic{}, ica.AppModuleBasic{}, } diff --git a/app/modules.go b/app/modules.go index 8c9ed5eb1cf..3421fec2ba9 100644 --- a/app/modules.go +++ b/app/modules.go @@ -67,8 +67,6 @@ import ( twaptypes "github.com/osmosis-labs/osmosis/v12/x/twap/types" "github.com/osmosis-labs/osmosis/v12/x/txfees" txfeestypes "github.com/osmosis-labs/osmosis/v12/x/txfees/types" - valsetpreftypes "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types" - valsetprefmodule "github.com/osmosis-labs/osmosis/v12/x/valset-pref/valpref-module" ) // moduleAccountPermissions defines module account permissions @@ -92,7 +90,6 @@ var moduleAccountPermissions = map[string][]string{ txfeestypes.NonNativeFeeCollectorName: nil, wasm.ModuleName: {authtypes.Burner}, tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - valsetpreftypes.ModuleName: {authtypes.Staking}, } // appModules return modules to initialize module manager. @@ -145,7 +142,6 @@ func appModules( app.EpochsKeeper, ), tokenfactory.NewAppModule(*app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper), - valsetprefmodule.NewAppModule(appCodec, *app.ValidatorSetPreferenceKeeper), } } @@ -215,7 +211,6 @@ func OrderInitGenesis(allModuleNames []string) []string { poolincentivestypes.ModuleName, superfluidtypes.ModuleName, tokenfactorytypes.ModuleName, - valsetpreftypes.ModuleName, incentivestypes.ModuleName, epochstypes.ModuleName, lockuptypes.ModuleName, diff --git a/app/upgrades/v13/constants.go b/app/upgrades/v13/constants.go index cd42ff4813a..7779df096f6 100644 --- a/app/upgrades/v13/constants.go +++ b/app/upgrades/v13/constants.go @@ -1,19 +1,16 @@ package v13 import ( - store "github.com/cosmos/cosmos-sdk/store/types" "github.com/osmosis-labs/osmosis/v12/app/upgrades" - valsetpreftypes "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types" + + store "github.com/cosmos/cosmos-sdk/store/types" ) -// UpgradeName defines the on-chain upgrade name for the Osmosis v13 upgrade. +// UpgradeName defines the on-chain upgrade name for the Osmosis v9 upgrade. const UpgradeName = "v13" var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{valsetpreftypes.StoreKey}, - Deleted: []string{}, // double check bech32ibc - }, + StoreUpgrades: store.StoreUpgrades{}, } diff --git a/osmoutils/slice_helper.go b/osmoutils/slice_helper.go index a7ee4db4eb0..f4c14a7b975 100644 --- a/osmoutils/slice_helper.go +++ b/osmoutils/slice_helper.go @@ -35,17 +35,3 @@ func ReverseSlice[T any](s []T) []T { } return s } - -// ContainsDuplicate checks if there are any duplicate -// elements in the slice. -func ContainsDuplicate[T any](arr []T) bool { - visited := make(map[any]bool, 0) - for i := 0; i < len(arr); i++ { - if visited[arr[i]] { - return true - } else { - visited[arr[i]] = true - } - } - return false -} diff --git a/proto/osmosis/valset-pref/v1beta1/query.proto b/proto/osmosis/validator-preference/v1beta1/query.proto similarity index 68% rename from proto/osmosis/valset-pref/v1beta1/query.proto rename to proto/osmosis/validator-preference/v1beta1/query.proto index e2ed5a54ac8..9a6d666c8e4 100644 --- a/proto/osmosis/valset-pref/v1beta1/query.proto +++ b/proto/osmosis/validator-preference/v1beta1/query.proto @@ -1,11 +1,11 @@ syntax = "proto3"; -package osmosis.valsetpref.v1beta1; +package osmosis.validatorpreference.v1beta1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "osmosis/valset-pref/v1beta1/state.proto"; +import "osmosis/validator-preference/v1beta1/state.proto"; -option go_package = "github.com/osmosis-labs/osmosis/v12/x/valset-pref/client/queryproto"; +option go_package = "github.com/osmosis-labs/osmosis/v12/x/validator-preference/client/queryproto"; option (gogoproto.goproto_getters_all) = false; // Query defines the gRPC querier service. @@ -13,14 +13,15 @@ service Query { // Returns the list of ValidatorPreferences for the user. rpc UserValidatorPreferences(QueryUserValidatorPreferences) returns (QueryUserValidatorPreferenceResponse) { - option (google.api.http).get = "/osmosis/valset-pref/v1beta1/{address}"; + option (google.api.http).get = + "/osmosis/validator-preference/v1beta1/{user}"; } } // Request type for UserValidatorPreferences. message QueryUserValidatorPreferences { // user account address - string address = 1; + string user = 1; } // Response type the QueryUserValidatorPreferences query request diff --git a/proto/osmosis/valset-pref/v1beta1/state.proto b/proto/osmosis/validator-preference/v1beta1/state.proto similarity index 90% rename from proto/osmosis/valset-pref/v1beta1/state.proto rename to proto/osmosis/validator-preference/v1beta1/state.proto index 3b1ee283714..cbfcf56a34d 100644 --- a/proto/osmosis/valset-pref/v1beta1/state.proto +++ b/proto/osmosis/validator-preference/v1beta1/state.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package osmosis.valsetpref.v1beta1; +package osmosis.validatorpreference.v1beta1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types"; +option go_package = "github.com/osmosis-labs/osmosis/v12/x/validator-preference/types"; option (gogoproto.goproto_getters_all) = false; // ValidatorPreference defines the message structure for diff --git a/proto/osmosis/valset-pref/v1beta1/tx.proto b/proto/osmosis/validator-preference/v1beta1/tx.proto similarity index 92% rename from proto/osmosis/valset-pref/v1beta1/tx.proto rename to proto/osmosis/validator-preference/v1beta1/tx.proto index e0ef71fdcfd..00967e38c9a 100644 --- a/proto/osmosis/valset-pref/v1beta1/tx.proto +++ b/proto/osmosis/validator-preference/v1beta1/tx.proto @@ -1,13 +1,13 @@ syntax = "proto3"; -package osmosis.valsetpref.v1beta1; +package osmosis.validatorpreference.v1beta1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; -import "osmosis/valset-pref/v1beta1/state.proto"; +import "osmosis/validator-preference/v1beta1/state.proto"; -option go_package = "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types"; +option go_package = "github.com/osmosis-labs/osmosis/v12/x/validator-preference/types"; -// Msg defines the valset-pref modules's gRPC message service. +// Msg defines the validator-preference modules's gRPC message service. service Msg { // SetValidatorSetPreference creates a set of validator preference. // This message will process both create + update request. diff --git a/tests/e2e/scripts/rate_limiter.wasm b/tests/e2e/scripts/rate_limiter.wasm index e19651209c4..f3f763f30a4 100755 Binary files a/tests/e2e/scripts/rate_limiter.wasm and b/tests/e2e/scripts/rate_limiter.wasm differ diff --git a/x/valset-pref/README.md b/x/valset-pref/README.md deleted file mode 100644 index 6239c5b9b0d..00000000000 --- a/x/valset-pref/README.md +++ /dev/null @@ -1,155 +0,0 @@ -# validator-set Preference - -## Abstract - -Validator-Set preference is a new module which gives users and contracts a -better UX for staking to a set of validators. For example: a one click button -that delegates to multiple validators. Then the user can set (or realistically a frontend provides) -a list of recommended defaults (Ex: active governors, relayers, core stack contributors etc). -Currently this can be done on-chain with frontends, but having a preference list stored locally -eases frontend code burden. - -## Design - -How does this module work? - -- Allow a user to set a list of {val-addr, weight} in the state, called their validator-set preference. -- Allow a user to update a list of {val-addr, weight} in the state, then do the following; - - Unstake the existing tokens (run the same unbond logic as cosmos-sdk staking). - - Update the validator distribution weights. - - Stake the tokens based on the new weights. - - Redelegate their current delegation to the currently configured set. -- Give users a single message to delegate {X} tokens, according to their validator-set preference distribution. -- Give users a single message to undelegate {X} tokens, according to their validator-set preference distribution. -- Give users a single message to claim rewards from everyone on their preference list. -- If the delegator has not set a validator-set preference list then the validator set, then it defaults to their current validator set. -- If a user has no preference list and has not staked, then these messages / queries return errors. - -## Calculations - -Staking Calculation - -- The user provides an amount to delegate and our `MsgStakeToValidatorSet` divides the amount based on validator weight distribution. - For example: Stake 100osmo with validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2} - our delegate logic will attempt to delegate (100 * 0.5) 50osmo for ValA , (100 * 0.3) 30osmo from ValB and (100 * 0.2) 20osmo from ValC. - -UnStaking Calculation - -- The user provides an amount to undelegate and our `MsgUnStakeFromValidatorSet` divides the amount based on validator weight distribution. -- Here, the user can either undelegate the entire amount or partial amount - - Entire amount unstaking: UnStake 100osmo from validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2}, - our undelegate logic will attempt to undelegate 50osmo from ValA , 30osmo from ValB, 20osmo from ValC - - Partial amount unstaking: UnStake 27osmo from validator-set {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2}, - our undelegate logic will attempt to undelegate (27 * 0.5) 13.5osmos from ValA, (27 * 0.3), 8.1osmo from ValB, - and (50 * 0.2) 5.4smo from ValC where 13.5osmo + 8.1osmo + 5.4osmo = 27osmo - - The user will then have 73osmo remaining with unchanged weights {ValA -> 0.5, ValB -> 0.3, ValC -> 0.2}, - -## Messages - -### CreateValidatorSetPreference - -Creates a validator-set of `{valAddr, Weight}` given the delegator address. -and preferences. The weights are in decimal format from 0 to 1 and must add up to 1. - -```go - string delegator = 1 [ (gogoproto.moretags) = "yaml:\"delegator\"" ]; - repeated ValidatorPreference preferences = 2 [ - (gogoproto.moretags) = "yaml:\"preferences\"", - (gogoproto.nullable) = false - ]; -``` - -**State Modifications:** - -- Safety Checks - - check if the user already has a validator-set created. - - check if the validator exist and is valid. - - check if the validator-set add up to 1. -- Add owner address to the `KVStore`, where a state of validator-set is stored. - -### UpdateValidatorSetPreference - -Updates a validator-set of `{valAddr, Weight}` given the delegator address -and existing preferences. The weights calculations follow the same rule as `CreateValidatorSetPreference`. -If a user changes their preferences list, the unstaking logic will run from the old set and -restaking to a new set is going to happen behind the scenes. - -```go - string delegator = 1 [ (gogoproto.moretags) = "yaml:\"delegator\"" ]; - repeated ValidatorPreference preferences = 2 [ - (gogoproto.moretags) = "yaml:\"preferences\"", - (gogoproto.nullable) = false - ]; -``` - -**State Modifications:** - -- Follows the same rule as `CreateValidatorSetPreference` for weights checks. -- Update the `KVStore` value for the specific owner address key. -- Run the undelegate logic and restake the tokens with updated weights. - -### StakeToValidatorSet - -Gets the existing validator-set of the delegator and delegates the given amount. The given amount -will be divided based on the weights distributed to the validators. The weights will be unchanged! - -```go - string delegator = 1 [ (gogoproto.moretags) = "yaml:\"delegator\"" ]; - repeated ValidatorPreference preferences = 2 [ - (gogoproto.moretags) = "yaml:\"preferences\"", - (gogoproto.nullable) = false - ]; -``` - -**State Modifications:** - -- Check if the user has a validator-set and if so, get the users validator-set from `KVStore`. -- Safety Checks - - check if the user has enough funds to delegate. - - check overflow/underflow since `Delegate` method takes `sdk.Int` as tokenAmount. -- use the [Delegate](https://github.com/cosmos/cosmos-sdk/blob/main/x/staking/keeper/delegation.go#L614) method from the cosmos-sdk to handle delegation. - -### UnStakeFromValidatorSet - -Gets the existing validator-set of the delegator and undelegate the given amount. The amount to undelegate will -will be divided based on the weights distributed to the validators. The weights will be unchanged! - -The given amount will be divided based on the weights distributed to the validators. - -```go - string delegator = 1 [ (gogoproto.moretags) = "yaml:\"delegator\"" ]; - repeated ValidatorPreference preferences = 2 [ - (gogoproto.moretags) = "yaml:\"preferences\"", - (gogoproto.nullable) = false - ]; -``` - -**State Modifications:** - -- Check if the user has a validator-set and if so, get the users validator-set from `KVStore`. -- The unbonding logic will be follow the `UnDelegate` logic from the cosmos-sdk. -- Safety Checks - - check that the amount of funds to undelegate is <= to the funds the user has in the address. - - `UnDelegate` method takes `sdk.Dec` as tokenAmount, so check if overflow/underflow case is relevant. -- use the [UnDelegate](https://github.com/cosmos/cosmos-sdk/blob/main/x/staking/keeper/delegation.go#L614) method from the cosmos-sdk to handle delegation. - -### WithdrawDelegationRewards - -Allows the user to claim rewards based from the existing validator-set. The user can claim rewards from all the validators at once. - -```go - string delegator = 1 [ (gogoproto.moretags) = "yaml:\"delegator\"" ]; -``` - -## Code Layout - -The Code Layout is very similar to TWAP module. - -- client/* - Implementation of GRPC and CLI queries -- types/* - Implement ValidatorSetPreference, GenesisState. Define the interface and setup keys. -- twapmodule/validatorsetpreference.go - SDK AppModule interface implementation. -- api.go - Public API, that other users / modules can/should depend on -- listeners.go - Defines hooks & calls to logic.go, for triggering actions on -- keeper.go - generic SDK boilerplate (defining a wrapper for store keys + params) -- msg_server.go - handle messages request from client and process responses. -- store.go - Managing logic for getting and setting things to underlying stores (KVStore) diff --git a/x/valset-pref/client/query_proto_wrap.go b/x/valset-pref/client/query_proto_wrap.go deleted file mode 100644 index 8d597222851..00000000000 --- a/x/valset-pref/client/query_proto_wrap.go +++ /dev/null @@ -1,22 +0,0 @@ -package client - -import ( - "context" - - validatorprefkeeper "github.com/osmosis-labs/osmosis/v12/x/valset-pref" - "github.com/osmosis-labs/osmosis/v12/x/valset-pref/client/queryproto" -) - -type Querier struct { - validatorprefkeeper.Keeper -} - -var _ queryproto.QueryServer = Querier{} - -func NewQuerier(k validatorprefkeeper.Keeper) Querier { - return Querier{k} -} - -func (q Querier) UserValidatorPreferences(ctx context.Context, req *queryproto.QueryUserValidatorPreferences) (*queryproto.QueryUserValidatorPreferenceResponse, error) { - return &queryproto.QueryUserValidatorPreferenceResponse{}, nil -} diff --git a/x/valset-pref/client/queryproto/query.pb.go b/x/valset-pref/client/queryproto/query.pb.go deleted file mode 100644 index 4c160f8c932..00000000000 --- a/x/valset-pref/client/queryproto/query.pb.go +++ /dev/null @@ -1,588 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/valset-pref/v1beta1/query.proto - -package queryproto - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - types "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Request type for UserValidatorPreferences. -type QueryUserValidatorPreferences struct { - // user account address - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` -} - -func (m *QueryUserValidatorPreferences) Reset() { *m = QueryUserValidatorPreferences{} } -func (m *QueryUserValidatorPreferences) String() string { return proto.CompactTextString(m) } -func (*QueryUserValidatorPreferences) ProtoMessage() {} -func (*QueryUserValidatorPreferences) Descriptor() ([]byte, []int) { - return fileDescriptor_9ffbeb4123fe56ae, []int{0} -} -func (m *QueryUserValidatorPreferences) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryUserValidatorPreferences) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryUserValidatorPreferences.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 *QueryUserValidatorPreferences) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUserValidatorPreferences.Merge(m, src) -} -func (m *QueryUserValidatorPreferences) XXX_Size() int { - return m.Size() -} -func (m *QueryUserValidatorPreferences) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUserValidatorPreferences.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryUserValidatorPreferences proto.InternalMessageInfo - -// Response type the QueryUserValidatorPreferences query request -type QueryUserValidatorPreferenceResponse struct { - Preferences []types.ValidatorPreference `protobuf:"bytes,1,rep,name=preferences,proto3" json:"preferences"` -} - -func (m *QueryUserValidatorPreferenceResponse) Reset() { *m = QueryUserValidatorPreferenceResponse{} } -func (m *QueryUserValidatorPreferenceResponse) String() string { return proto.CompactTextString(m) } -func (*QueryUserValidatorPreferenceResponse) ProtoMessage() {} -func (*QueryUserValidatorPreferenceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9ffbeb4123fe56ae, []int{1} -} -func (m *QueryUserValidatorPreferenceResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryUserValidatorPreferenceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryUserValidatorPreferenceResponse.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 *QueryUserValidatorPreferenceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUserValidatorPreferenceResponse.Merge(m, src) -} -func (m *QueryUserValidatorPreferenceResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryUserValidatorPreferenceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUserValidatorPreferenceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryUserValidatorPreferenceResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*QueryUserValidatorPreferences)(nil), "osmosis.valsetpref.v1beta1.QueryUserValidatorPreferences") - proto.RegisterType((*QueryUserValidatorPreferenceResponse)(nil), "osmosis.valsetpref.v1beta1.QueryUserValidatorPreferenceResponse") -} - -func init() { - proto.RegisterFile("osmosis/valset-pref/v1beta1/query.proto", fileDescriptor_9ffbeb4123fe56ae) -} - -var fileDescriptor_9ffbeb4123fe56ae = []byte{ - // 338 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xcd, 0x4a, 0x03, 0x31, - 0x14, 0x85, 0x27, 0xfe, 0x62, 0xba, 0x1b, 0x5c, 0x0c, 0x83, 0xc6, 0x52, 0x44, 0xbb, 0x69, 0x42, - 0xeb, 0xaa, 0x3b, 0xa9, 0x2f, 0xa0, 0x05, 0x15, 0xdc, 0x65, 0xda, 0xdb, 0x71, 0x60, 0x3a, 0x19, - 0x73, 0xd3, 0xa2, 0x88, 0x08, 0x3e, 0x81, 0xe0, 0x43, 0xd9, 0x65, 0xc5, 0x8d, 0x2b, 0xd1, 0xd6, - 0x07, 0x91, 0xce, 0x0f, 0x55, 0xb0, 0xb3, 0x70, 0x95, 0x84, 0x7c, 0xf7, 0x9c, 0x7b, 0x72, 0x43, - 0xf7, 0x15, 0xf6, 0x15, 0x06, 0x28, 0x86, 0x32, 0x44, 0x30, 0xb5, 0x58, 0x43, 0x4f, 0x0c, 0xeb, - 0x1e, 0x18, 0x59, 0x17, 0x57, 0x03, 0xd0, 0x37, 0x3c, 0xd6, 0xca, 0x28, 0xdb, 0xcd, 0x40, 0x9e, - 0x82, 0x33, 0x8e, 0x67, 0x9c, 0xbb, 0xe9, 0x2b, 0x5f, 0x25, 0x98, 0x98, 0xed, 0xd2, 0x0a, 0x77, - 0xcb, 0x57, 0xca, 0x0f, 0x41, 0xc8, 0x38, 0x10, 0x32, 0x8a, 0x94, 0x91, 0x26, 0x50, 0x11, 0x66, - 0xb7, 0x85, 0xc6, 0x68, 0xa4, 0x81, 0x14, 0xac, 0x34, 0xe9, 0xf6, 0xc9, 0xac, 0x8f, 0x53, 0x04, - 0x7d, 0x26, 0xc3, 0xa0, 0x2b, 0x8d, 0xd2, 0xc7, 0x1a, 0x7a, 0xa0, 0x21, 0xea, 0x00, 0xda, 0x0e, - 0x5d, 0x97, 0xdd, 0xae, 0x06, 0x44, 0x87, 0x94, 0x49, 0x75, 0xa3, 0x9d, 0x1f, 0x2b, 0xf7, 0x74, - 0xb7, 0xa8, 0xb4, 0x0d, 0x18, 0xab, 0x08, 0xc1, 0x3e, 0xa7, 0xa5, 0x78, 0x2e, 0xe8, 0x90, 0xf2, - 0x72, 0xb5, 0xd4, 0x10, 0x7c, 0x71, 0x62, 0xfe, 0x87, 0x5a, 0x6b, 0x65, 0xf4, 0xbe, 0x63, 0xb5, - 0x7f, 0x2a, 0x35, 0x5e, 0x08, 0x5d, 0x4d, 0x3a, 0xb0, 0x9f, 0x09, 0x75, 0x16, 0x26, 0x68, 0x16, - 0x59, 0x15, 0x86, 0x77, 0x0f, 0xff, 0x5b, 0x9a, 0x87, 0xaf, 0xf0, 0x87, 0xd7, 0xaf, 0xa7, 0xa5, - 0xaa, 0xbd, 0x27, 0x8a, 0x26, 0x72, 0x9b, 0xbd, 0xe9, 0x5d, 0x4b, 0x8e, 0x3e, 0x99, 0x35, 0x9a, - 0x30, 0x32, 0x9e, 0x30, 0xf2, 0x31, 0x61, 0xe4, 0x71, 0xca, 0xac, 0xf1, 0x94, 0x59, 0x6f, 0x53, - 0x66, 0x5d, 0x1c, 0xf9, 0x81, 0xb9, 0x1c, 0x78, 0xbc, 0xa3, 0xfa, 0xb9, 0x5e, 0x2d, 0x94, 0x1e, - 0xce, 0xc5, 0xeb, 0x0d, 0x71, 0xfd, 0xcb, 0xa2, 0x13, 0x06, 0x10, 0x99, 0xf4, 0xb3, 0x25, 0x23, - 0xf7, 0xd6, 0x92, 0xe5, 0xe0, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xbd, 0xc4, 0xe6, 0x56, 0x9d, 0x02, - 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// 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 { - // Returns the list of ValidatorPreferences for the user. - UserValidatorPreferences(ctx context.Context, in *QueryUserValidatorPreferences, opts ...grpc.CallOption) (*QueryUserValidatorPreferenceResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) UserValidatorPreferences(ctx context.Context, in *QueryUserValidatorPreferences, opts ...grpc.CallOption) (*QueryUserValidatorPreferenceResponse, error) { - out := new(QueryUserValidatorPreferenceResponse) - err := c.cc.Invoke(ctx, "/osmosis.valsetpref.v1beta1.Query/UserValidatorPreferences", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Returns the list of ValidatorPreferences for the user. - UserValidatorPreferences(context.Context, *QueryUserValidatorPreferences) (*QueryUserValidatorPreferenceResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) UserValidatorPreferences(ctx context.Context, req *QueryUserValidatorPreferences) (*QueryUserValidatorPreferenceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UserValidatorPreferences not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_UserValidatorPreferences_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryUserValidatorPreferences) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).UserValidatorPreferences(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.valsetpref.v1beta1.Query/UserValidatorPreferences", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).UserValidatorPreferences(ctx, req.(*QueryUserValidatorPreferences)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "osmosis.valsetpref.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "UserValidatorPreferences", - Handler: _Query_UserValidatorPreferences_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "osmosis/valset-pref/v1beta1/query.proto", -} - -func (m *QueryUserValidatorPreferences) 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 *QueryUserValidatorPreferences) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUserValidatorPreferences) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryUserValidatorPreferenceResponse) 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 *QueryUserValidatorPreferenceResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUserValidatorPreferenceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Preferences) > 0 { - for iNdEx := len(m.Preferences) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Preferences[iNdEx].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 -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryUserValidatorPreferences) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryUserValidatorPreferenceResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Preferences) > 0 { - for _, e := range m.Preferences { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryUserValidatorPreferences) 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: QueryUserValidatorPreferences: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUserValidatorPreferences: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = 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 *QueryUserValidatorPreferenceResponse) 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: QueryUserValidatorPreferenceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUserValidatorPreferenceResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Preferences", 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 - } - m.Preferences = append(m.Preferences, types.ValidatorPreference{}) - if err := m.Preferences[len(m.Preferences)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - 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 skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/valset-pref/client/queryproto/query.pb.gw.go b/x/valset-pref/client/queryproto/query.pb.gw.go deleted file mode 100644 index c79a1f8f501..00000000000 --- a/x/valset-pref/client/queryproto/query.pb.gw.go +++ /dev/null @@ -1,189 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: osmosis/valset-pref/v1beta1/query.proto - -/* -Package queryproto is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package queryproto - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -func request_Query_UserValidatorPreferences_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryUserValidatorPreferences - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") - } - - protoReq.Address, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) - } - - msg, err := client.UserValidatorPreferences(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_UserValidatorPreferences_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryUserValidatorPreferences - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") - } - - protoReq.Address, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) - } - - msg, err := server.UserValidatorPreferences(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// 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_UserValidatorPreferences_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_UserValidatorPreferences_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_UserValidatorPreferences_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_UserValidatorPreferences_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_UserValidatorPreferences_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_UserValidatorPreferences_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_UserValidatorPreferences_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"osmosis", "valset-pref", "v1beta1", "address"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_UserValidatorPreferences_0 = runtime.ForwardResponseMessage -) diff --git a/x/valset-pref/keeper.go b/x/valset-pref/keeper.go deleted file mode 100644 index ffa5184e1e8..00000000000 --- a/x/valset-pref/keeper.go +++ /dev/null @@ -1,53 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/tendermint/tendermint/libs/log" - - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/gogo/protobuf/proto" - "github.com/osmosis-labs/osmosis/v12/osmoutils" - "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types" -) - -type Keeper struct { - storeKey sdk.StoreKey - paramSpace paramtypes.Subspace - stakingKeeper types.StakingInterface -} - -func NewKeeper(storeKey sdk.StoreKey, - paramSpace paramtypes.Subspace, - stakingKeeper types.StakingInterface, -) Keeper { - return Keeper{ - storeKey: storeKey, - paramSpace: paramSpace, - stakingKeeper: stakingKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -func (k Keeper) SetValidatorSetPreferences(ctx sdk.Context, delegator string, validators types.ValidatorSetPreferences) { - store := ctx.KVStore(k.storeKey) - osmoutils.MustSet(store, []byte(delegator), &validators) -} - -func (k Keeper) GetValidatorSetPreference(ctx sdk.Context, delegator string) (types.ValidatorSetPreferences, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte(delegator)) - if bz == nil { - return types.ValidatorSetPreferences{}, false - } - var valsetPref types.ValidatorSetPreferences - if err := proto.Unmarshal(bz, &valsetPref); err != nil { - return types.ValidatorSetPreferences{}, false - } - - return valsetPref, true -} diff --git a/x/valset-pref/keeper_test.go b/x/valset-pref/keeper_test.go deleted file mode 100644 index 3498c2eccda..00000000000 --- a/x/valset-pref/keeper_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/osmosis-labs/osmosis/v12/app/apptesting" - "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types" - "github.com/stretchr/testify/suite" -) - -type KeeperTestSuite struct { - apptesting.KeeperTestHelper -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.Setup() -} - -// SetupMultipleValidators setups "numValidator" validators and returns their address in string -func (suite *KeeperTestSuite) SetupMultipleValidators(numValidator int) []string { - valAddrs := []string{} - for i := 0; i < numValidator; i++ { - valAddr := suite.SetupValidator(stakingtypes.Bonded) - valAddrs = append(valAddrs, valAddr.String()) - } - return valAddrs -} - -func (suite *KeeperTestSuite) PrepareDelegateToValidatorSet() []types.ValidatorPreference { - valAddrs := suite.SetupMultipleValidators(3) - valPreferences := []types.ValidatorPreference{ - { - ValOperAddress: valAddrs[0], - Weight: sdk.NewDecWithPrec(5, 1), - }, - { - ValOperAddress: valAddrs[1], - Weight: sdk.NewDecWithPrec(3, 1), - }, - { - ValOperAddress: valAddrs[2], - Weight: sdk.NewDecWithPrec(2, 1), - }, - } - return valPreferences -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} diff --git a/x/valset-pref/msg_server.go b/x/valset-pref/msg_server.go deleted file mode 100644 index 22be1b7ff88..00000000000 --- a/x/valset-pref/msg_server.go +++ /dev/null @@ -1,50 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types" -) - -type msgServer struct { - keeper *Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper *Keeper) types.MsgServer { - return &msgServer{ - keeper: keeper, - } -} - -var _ types.MsgServer = msgServer{} - -func (server msgServer) SetValidatorSetPreference(goCtx context.Context, msg *types.MsgSetValidatorSetPreference) (*types.MsgSetValidatorSetPreferenceResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - err := server.keeper.SetupValidatorSetPreference(ctx, msg.Delegator, msg.Preferences) - if err != nil { - return nil, err - } - - setMsg := types.ValidatorSetPreferences{ - Preferences: msg.Preferences, - } - - server.keeper.SetValidatorSetPreferences(ctx, msg.Delegator, setMsg) - return &types.MsgSetValidatorSetPreferenceResponse{}, nil -} - -func (server msgServer) DelegateToValidatorSet(goCtx context.Context, msg *types.MsgDelegateToValidatorSet) (*types.MsgDelegateToValidatorSetResponse, error) { - return &types.MsgDelegateToValidatorSetResponse{}, nil -} - -func (server msgServer) UndelegateFromValidatorSet(goCtx context.Context, msg *types.MsgUndelegateFromValidatorSet) (*types.MsgUndelegateFromValidatorSetResponse, error) { - return &types.MsgUndelegateFromValidatorSetResponse{}, nil -} - -func (server msgServer) WithdrawDelegationRewards(goCtx context.Context, msg *types.MsgWithdrawDelegationRewards) (*types.MsgWithdrawDelegationRewardsResponse, error) { - return &types.MsgWithdrawDelegationRewardsResponse{}, nil -} diff --git a/x/valset-pref/msg_server_test.go b/x/valset-pref/msg_server_test.go deleted file mode 100644 index 2a97e899068..00000000000 --- a/x/valset-pref/msg_server_test.go +++ /dev/null @@ -1,126 +0,0 @@ -package keeper_test - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - valPref "github.com/osmosis-labs/osmosis/v12/x/valset-pref" - "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types" -) - -func (suite *KeeperTestSuite) TestSetValidatorSetPreference() { - suite.SetupTest() - - // setup 3 validators - valAddrs := suite.SetupMultipleValidators(3) - - tests := []struct { - name string - delegator sdk.AccAddress - preferences []types.ValidatorPreference - expectPass bool - }{ - { - name: "creation of new validator set", - delegator: sdk.AccAddress([]byte("addr1---------------")), - preferences: []types.ValidatorPreference{ - { - ValOperAddress: valAddrs[0], - Weight: sdk.NewDecWithPrec(5, 1), - }, - { - ValOperAddress: valAddrs[1], - Weight: sdk.NewDecWithPrec(3, 1), - }, - { - ValOperAddress: valAddrs[2], - Weight: sdk.NewDecWithPrec(2, 1), - }, - }, - expectPass: true, - }, - { - name: "update 2 validator weights but leave the 3rd one as is", - delegator: sdk.AccAddress([]byte("addr1---------------")), - preferences: []types.ValidatorPreference{ - { - ValOperAddress: valAddrs[0], - Weight: sdk.NewDecWithPrec(5, 1), - }, - { - ValOperAddress: valAddrs[1], - Weight: sdk.NewDecWithPrec(4, 1), - }, - { - ValOperAddress: valAddrs[2], - Weight: sdk.NewDecWithPrec(1, 1), - }, - }, - expectPass: true, - }, - { - name: "update existing validator with same valAddr and weights", - delegator: sdk.AccAddress([]byte("addr1---------------")), - preferences: []types.ValidatorPreference{ - { - ValOperAddress: valAddrs[0], - Weight: sdk.NewDecWithPrec(5, 1), - }, - { - ValOperAddress: valAddrs[1], - Weight: sdk.NewDecWithPrec(4, 1), - }, - { - ValOperAddress: valAddrs[2], - Weight: sdk.NewDecWithPrec(1, 1), - }, - }, - expectPass: false, - }, - { - name: "update existing validator with same valAddr but different weights", - delegator: sdk.AccAddress([]byte("addr1---------------")), - preferences: []types.ValidatorPreference{ - { - ValOperAddress: valAddrs[0], - Weight: sdk.NewDecWithPrec(1, 1), - }, - { - ValOperAddress: valAddrs[1], - Weight: sdk.NewDecWithPrec(2, 1), - }, - { - ValOperAddress: valAddrs[2], - Weight: sdk.NewDecWithPrec(7, 1), - }, - }, - expectPass: true, - }, - { - name: "create validator set with unknown validator address", - delegator: sdk.AccAddress([]byte("addr1---------------")), - preferences: []types.ValidatorPreference{ - { - ValOperAddress: "addr1---------------", - Weight: sdk.NewDec(1), - }, - }, - expectPass: false, - }, - } - - for _, test := range tests { - suite.Run(test.name, func() { - // setup message server - msgServer := valPref.NewMsgServerImpl(suite.App.ValidatorSetPreferenceKeeper) - c := sdk.WrapSDKContext(suite.Ctx) - - // call the create validator set preference - _, err := msgServer.SetValidatorSetPreference(c, types.NewMsgSetValidatorSetPreference(test.delegator, test.preferences)) - if test.expectPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - - }) - } -} diff --git a/x/valset-pref/types/codec.go b/x/valset-pref/types/codec.go deleted file mode 100644 index 995b19f8034..00000000000 --- a/x/valset-pref/types/codec.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgSetValidatorSetPreference{}, "osmosis/valset-pref/MsgSetValidatorSetPreference", nil) - cdc.RegisterConcrete(&MsgDelegateToValidatorSet{}, "osmosis/valset-pref/MsgDelegateToValidatorSet", nil) - cdc.RegisterConcrete(&MsgUndelegateFromValidatorSet{}, "osmosis/valset-pref/MsgUndelegateFromValidatorSet", nil) - cdc.RegisterConcrete(&MsgWithdrawDelegationRewards{}, "osmosis/valset-pref/MsgWithdrawDelegationRewards", nil) -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgSetValidatorSetPreference{}, - &MsgDelegateToValidatorSet{}, - &MsgUndelegateFromValidatorSet{}, - &MsgWithdrawDelegationRewards{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/valset-pref/types/expected_interfaces.go b/x/valset-pref/types/expected_interfaces.go deleted file mode 100644 index 7a54060e1d2..00000000000 --- a/x/valset-pref/types/expected_interfaces.go +++ /dev/null @@ -1,17 +0,0 @@ -package types - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// StakingInterface expected staking keeper. -type StakingInterface interface { - GetAllValidators(ctx sdk.Context) (validators []stakingtypes.Validator) - GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) - Delegate(ctx sdk.Context, delAddr sdk.AccAddress, bondAmt sdk.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool) (newShares sdk.Dec, err error) - GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation stakingtypes.Delegation, found bool) - Undelegate(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdk.Dec) (time.Time, error) -} diff --git a/x/valset-pref/types/keys.go b/x/valset-pref/types/keys.go deleted file mode 100644 index 24347ccf83e..00000000000 --- a/x/valset-pref/types/keys.go +++ /dev/null @@ -1,15 +0,0 @@ -package types - -var ( - // ModuleName defines the module name - ModuleName = "validatorsetpreference" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // KeyPrefixValidatorSet defines prefix key for validator set. - KeyPrefixValidatorSet = []byte{0x01} - - // QuerierRoute defines the module's query routing key - QuerierRoute = ModuleName -) diff --git a/x/valset-pref/types/msgs.go b/x/valset-pref/types/msgs.go deleted file mode 100644 index d0288b35a8a..00000000000 --- a/x/valset-pref/types/msgs.go +++ /dev/null @@ -1,176 +0,0 @@ -package types - -import ( - fmt "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/osmosis-labs/osmosis/v12/osmoutils" -) - -// constants -const ( - TypeMsgSetValidatorSetPreference = "set_validator_set_preference" -) - -var _ sdk.Msg = &MsgSetValidatorSetPreference{} - -// NewMsgCreateValidatorSetPreference creates a msg to create a validator-set preference. -func NewMsgSetValidatorSetPreference(delegator sdk.AccAddress, preferences []ValidatorPreference) *MsgSetValidatorSetPreference { - return &MsgSetValidatorSetPreference{ - Delegator: delegator.String(), - Preferences: preferences, - } -} - -func (m MsgSetValidatorSetPreference) Type() string { return TypeMsgSetValidatorSetPreference } -func (m MsgSetValidatorSetPreference) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Delegator) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid delegator address (%s)", err) - } - - totalWeight := sdk.ZeroDec() - validatorAddrs := []string{} - for _, validator := range m.Preferences { - _, err := sdk.ValAddressFromBech32(validator.ValOperAddress) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid validator address (%s)", err) - } - - totalWeight = totalWeight.Add(validator.Weight) - validatorAddrs = append(validatorAddrs, validator.ValOperAddress) - } - - // check that all the validator address are unique - containsDuplicate := osmoutils.ContainsDuplicate(validatorAddrs) - if containsDuplicate { - return fmt.Errorf("The validator operator address are duplicated") - } - - // check if the total validator distribution weights equal 1 - if !totalWeight.Equal(sdk.OneDec()) { - return fmt.Errorf("The weights allocated to the validators do not add up to 1, Got: %d", totalWeight) - } - - return nil -} - -func (m MsgSetValidatorSetPreference) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -// GetSigners takes a create validator-set message and returns the delegator in a byte array. -func (m MsgSetValidatorSetPreference) GetSigners() []sdk.AccAddress { - delegator, _ := sdk.AccAddressFromBech32(m.Delegator) - return []sdk.AccAddress{delegator} -} - -// constants -const ( - TypeMsgDelegateToValidatorSet = "delegate_to_validator_set" -) - -var _ sdk.Msg = &MsgDelegateToValidatorSet{} - -// NewMsgMsgStakeToValidatorSet creates a msg to stake to a validator set. -func NewMsgMsgStakeToValidatorSet(delegator sdk.AccAddress, coin sdk.Coin) *MsgDelegateToValidatorSet { - return &MsgDelegateToValidatorSet{ - Delegator: delegator.String(), - Coin: coin, - } -} - -func (m MsgDelegateToValidatorSet) Type() string { return TypeMsgDelegateToValidatorSet } -func (m MsgDelegateToValidatorSet) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Delegator) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) - } - - if !m.Coin.IsValid() { - return fmt.Errorf("The stake coin is not valid") - } - - return nil -} - -func (m MsgDelegateToValidatorSet) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -func (m MsgDelegateToValidatorSet) GetSigners() []sdk.AccAddress { - delegator, _ := sdk.AccAddressFromBech32(m.Delegator) - return []sdk.AccAddress{delegator} -} - -// constants -const ( - TypeMsgUndelegateFromValidatorSet = "undelegate_from_validator_set" -) - -var _ sdk.Msg = &MsgUndelegateFromValidatorSet{} - -// NewMsgMsgStakeToValidatorSet creates a msg to stake to a validator. -func NewMsgUndelegateFromValidatorSet(delegator sdk.AccAddress, coin sdk.Coin) *MsgUndelegateFromValidatorSet { - return &MsgUndelegateFromValidatorSet{ - Delegator: delegator.String(), - Coin: coin, - } -} - -func (m MsgUndelegateFromValidatorSet) Type() string { return TypeMsgUndelegateFromValidatorSet } -func (m MsgUndelegateFromValidatorSet) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Delegator) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) - } - - if !m.Coin.IsValid() { - return fmt.Errorf("The stake coin is not valid") - } - - return nil -} - -func (m MsgUndelegateFromValidatorSet) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -func (m MsgUndelegateFromValidatorSet) GetSigners() []sdk.AccAddress { - delegator, _ := sdk.AccAddressFromBech32(m.Delegator) - return []sdk.AccAddress{delegator} -} - -// constants -const ( - TypeMsgWithdrawDelegationRewards = "withdraw_delegation_rewards" -) - -var _ sdk.Msg = &MsgWithdrawDelegationRewards{} - -// NewMsgMsgStakeToValidatorSet creates a msg to stake to a validator. -func NewMsgWithdrawDelegationRewards(delegator sdk.AccAddress) *MsgWithdrawDelegationRewards { - return &MsgWithdrawDelegationRewards{ - Delegator: delegator.String(), - } -} - -func (m MsgWithdrawDelegationRewards) Type() string { return TypeMsgWithdrawDelegationRewards } -func (m MsgWithdrawDelegationRewards) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Delegator) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) - } - - return nil -} - -func (m MsgWithdrawDelegationRewards) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -func (m MsgWithdrawDelegationRewards) GetSigners() []sdk.AccAddress { - delegator, _ := sdk.AccAddressFromBech32(m.Delegator) - return []sdk.AccAddress{delegator} -} diff --git a/x/valset-pref/types/msgs_test.go b/x/valset-pref/types/msgs_test.go deleted file mode 100644 index 85456aca4b5..00000000000 --- a/x/valset-pref/types/msgs_test.go +++ /dev/null @@ -1,157 +0,0 @@ -package types_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/osmosis-labs/osmosis/v12/app/apptesting" - appParams "github.com/osmosis-labs/osmosis/v12/app/params" - "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types" -) - -func TestMsgSetValidatorSetPreference(t *testing.T) { - appParams.SetAddressPrefixes() - addr1, invalidAddr := apptesting.GenerateTestAddrs() - - tests := []struct { - name string - msg types.MsgSetValidatorSetPreference - expectPass bool - }{ - { - name: "proper msg", - msg: types.MsgSetValidatorSetPreference{ - Delegator: addr1, - Preferences: []types.ValidatorPreference{ - { - ValOperAddress: "osmovaloper1x2cfenmflhj3dwm2ph6nkgqr3nppkg86fxaymg", - Weight: sdk.NewDecWithPrec(5, 1), - }, - { - ValOperAddress: "osmovaloper1jcr68jghzm24zwe78zuhz7xahua8429erxk7vm", - Weight: sdk.NewDecWithPrec(3, 1), - }, - { - ValOperAddress: "osmovaloper1gqsr38e4zteekwr6kq5se5jpadafqmcfyz8jds", - Weight: sdk.NewDecWithPrec(2, 1), - }, - }, - }, - expectPass: true, - }, - { - name: "duplicate validator msg", - msg: types.MsgSetValidatorSetPreference{ - Delegator: addr1, - Preferences: []types.ValidatorPreference{ - { - ValOperAddress: "osmovaloper1x2cfenmflhj3dwm2ph6nkgqr3nppkg86fxaymg", - Weight: sdk.NewDecWithPrec(6, 1), - }, - { - ValOperAddress: "osmovaloper1x2cfenmflhj3dwm2ph6nkgqr3nppkg86fxaymg", - Weight: sdk.NewDecWithPrec(4, 1), - }, - { - ValOperAddress: "osmovaloper1jcr68jghzm24zwe78zuhz7xahua8429erxk7vm", - Weight: sdk.NewDecWithPrec(2, 1), - }, - }, - }, - expectPass: false, - }, - { - name: "invalid delegator", - msg: types.MsgSetValidatorSetPreference{ - Delegator: invalidAddr, - Preferences: []types.ValidatorPreference{ - { - ValOperAddress: "osmovaloper1x2cfenmflhj3dwm2ph6nkgqr3nppkg86fxaymg", - Weight: sdk.NewDec(1), - }, - }, - }, - expectPass: false, - }, - { - name: "invalid validator address", - msg: types.MsgSetValidatorSetPreference{ - Delegator: addr1, - Preferences: []types.ValidatorPreference{ - { - ValOperAddress: "osmovaloper1x2cfenmflhj3dwm2ph6nkgqr3nppkg86fxay", // invalid address - Weight: sdk.NewDecWithPrec(2, 1), - }, - { - ValOperAddress: "osmovaloper1jcr68jghzm24zwe78zuhz7xahua8429erxk7vm", - Weight: sdk.NewDecWithPrec(2, 1), - }, - { - ValOperAddress: "osmovaloper1x2cfenmflhj3dwm2ph6nkgqr3nppkg86fxaymg", - Weight: sdk.NewDecWithPrec(6, 1), - }, - }, - }, - expectPass: false, - }, - { - name: "weights > 1", - msg: types.MsgSetValidatorSetPreference{ - Delegator: addr1, - Preferences: []types.ValidatorPreference{ - { - ValOperAddress: "osmovaloper1x2cfenmflhj3dwm2ph6nkgqr3nppkg86fxaymg", - Weight: sdk.NewDecWithPrec(5, 1), - }, - { - ValOperAddress: "osmovaloper1jcr68jghzm24zwe78zuhz7xahua8429erxk7vm", - Weight: sdk.NewDecWithPrec(3, 1), - }, - { - ValOperAddress: "osmovaloper1gqsr38e4zteekwr6kq5se5jpadafqmcfyz8jds", - Weight: sdk.NewDecWithPrec(3, 1), - }, - }, - }, - expectPass: false, - }, - { - name: "weights < 1", - msg: types.MsgSetValidatorSetPreference{ - Delegator: addr1, - Preferences: []types.ValidatorPreference{ - { - ValOperAddress: "osmovaloper1x2cfenmflhj3dwm2ph6nkgqr3nppkg86fxaymg", - Weight: sdk.NewDecWithPrec(2, 1), - }, - { - ValOperAddress: "osmovaloper1jcr68jghzm24zwe78zuhz7xahua8429erxk7vm", - Weight: sdk.NewDecWithPrec(2, 1), - }, - { - ValOperAddress: "osmovaloper1gqsr38e4zteekwr6kq5se5jpadafqmcfyz8jds", - Weight: sdk.NewDecWithPrec(2, 1), - }, - }, - }, - expectPass: false, - }, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - if test.expectPass { - require.NoError(t, test.msg.ValidateBasic(), "test: %v", test.name) - require.Equal(t, test.msg.Type(), "set_validator_set_preference") - signers := test.msg.GetSigners() - require.Equal(t, len(signers), 1) - require.Equal(t, signers[0].String(), addr1) - } else { - require.Error(t, test.msg.ValidateBasic(), "test: %v", test.name) - } - }) - } - -} diff --git a/x/valset-pref/types/state.pb.go b/x/valset-pref/types/state.pb.go deleted file mode 100644 index 0874415d570..00000000000 --- a/x/valset-pref/types/state.pb.go +++ /dev/null @@ -1,559 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/valset-pref/v1beta1/state.proto - -package types - -import ( - fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// ValidatorPreference defines the message structure for -// CreateValidatorSetPreference. It allows a user to set {val_addr, weight} in -// state. If a user does not have a validator set preference list set, and has -// staked, make their preference list default to their current staking -// distribution. -type ValidatorPreference struct { - // val_oper_address holds the validator address the user wants to delegate - // funds to. - ValOperAddress string `protobuf:"bytes,1,opt,name=val_oper_address,json=valOperAddress,proto3" json:"val_oper_address,omitempty" yaml:"val_oper_address"` - // weight is decimal between 0 and 1, and they all sum to 1. - Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight"` -} - -func (m *ValidatorPreference) Reset() { *m = ValidatorPreference{} } -func (m *ValidatorPreference) String() string { return proto.CompactTextString(m) } -func (*ValidatorPreference) ProtoMessage() {} -func (*ValidatorPreference) Descriptor() ([]byte, []int) { - return fileDescriptor_d3010474a5b89fce, []int{0} -} -func (m *ValidatorPreference) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ValidatorPreference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ValidatorPreference.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 *ValidatorPreference) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorPreference.Merge(m, src) -} -func (m *ValidatorPreference) XXX_Size() int { - return m.Size() -} -func (m *ValidatorPreference) XXX_DiscardUnknown() { - xxx_messageInfo_ValidatorPreference.DiscardUnknown(m) -} - -var xxx_messageInfo_ValidatorPreference proto.InternalMessageInfo - -// ValidatorSetPreferences defines a delegator's validator set preference. -// It contains a list of (validator, percent_allocation) pairs. -// The percent allocation are arranged in decimal notation from 0 to 1 and must -// add up to 1. -type ValidatorSetPreferences struct { - // preference holds {valAddr, weight} for the user who created it. - Preferences []ValidatorPreference `protobuf:"bytes,2,rep,name=preferences,proto3" json:"preferences" yaml:"preferences"` -} - -func (m *ValidatorSetPreferences) Reset() { *m = ValidatorSetPreferences{} } -func (m *ValidatorSetPreferences) String() string { return proto.CompactTextString(m) } -func (*ValidatorSetPreferences) ProtoMessage() {} -func (*ValidatorSetPreferences) Descriptor() ([]byte, []int) { - return fileDescriptor_d3010474a5b89fce, []int{1} -} -func (m *ValidatorSetPreferences) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ValidatorSetPreferences) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ValidatorSetPreferences.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 *ValidatorSetPreferences) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorSetPreferences.Merge(m, src) -} -func (m *ValidatorSetPreferences) XXX_Size() int { - return m.Size() -} -func (m *ValidatorSetPreferences) XXX_DiscardUnknown() { - xxx_messageInfo_ValidatorSetPreferences.DiscardUnknown(m) -} - -var xxx_messageInfo_ValidatorSetPreferences proto.InternalMessageInfo - -func init() { - proto.RegisterType((*ValidatorPreference)(nil), "osmosis.valsetpref.v1beta1.ValidatorPreference") - proto.RegisterType((*ValidatorSetPreferences)(nil), "osmosis.valsetpref.v1beta1.ValidatorSetPreferences") -} - -func init() { - proto.RegisterFile("osmosis/valset-pref/v1beta1/state.proto", fileDescriptor_d3010474a5b89fce) -} - -var fileDescriptor_d3010474a5b89fce = []byte{ - // 355 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xcf, 0x4a, 0xeb, 0x40, - 0x18, 0xc5, 0x93, 0x5e, 0x28, 0xdc, 0x14, 0x44, 0xa2, 0xd0, 0x12, 0x25, 0x29, 0x59, 0x68, 0x37, - 0x9d, 0xa1, 0x75, 0x21, 0xb8, 0xb3, 0xa8, 0x5b, 0xa5, 0xa2, 0x0b, 0x37, 0x65, 0x92, 0x7c, 0x4d, - 0x83, 0x93, 0xcc, 0x30, 0x33, 0x46, 0xfb, 0x06, 0x2e, 0x7d, 0x08, 0x1f, 0xa6, 0xcb, 0x2e, 0xc5, - 0x45, 0xd0, 0xf6, 0x0d, 0xfa, 0x04, 0xd2, 0x24, 0xb4, 0x55, 0x74, 0x35, 0xff, 0x7e, 0xe7, 0xe3, - 0x9c, 0x39, 0xc6, 0x21, 0x93, 0x31, 0x93, 0x91, 0xc4, 0x29, 0xa1, 0x12, 0x54, 0x9b, 0x0b, 0x18, - 0xe2, 0xb4, 0xe3, 0x81, 0x22, 0x1d, 0x2c, 0x15, 0x51, 0x80, 0xb8, 0x60, 0x8a, 0x99, 0x56, 0x09, - 0xa2, 0x02, 0x5c, 0x72, 0xa8, 0xe4, 0xac, 0xdd, 0x90, 0x85, 0x2c, 0xc7, 0xf0, 0x72, 0x57, 0x28, - 0xac, 0xfd, 0x90, 0xb1, 0x90, 0x02, 0x26, 0x3c, 0xc2, 0x24, 0x49, 0x98, 0x22, 0x2a, 0x62, 0x89, - 0x2c, 0x5e, 0xdd, 0x57, 0xdd, 0xd8, 0xb9, 0x25, 0x34, 0x0a, 0x88, 0x62, 0xe2, 0x4a, 0xc0, 0x10, - 0x04, 0x24, 0x3e, 0x98, 0xe7, 0xc6, 0x76, 0x4a, 0xe8, 0x80, 0x71, 0x10, 0x03, 0x12, 0x04, 0x02, - 0xa4, 0x6c, 0xe8, 0x4d, 0xbd, 0xf5, 0xbf, 0xb7, 0xb7, 0xc8, 0x9c, 0xfa, 0x98, 0xc4, 0xf4, 0xc4, - 0xfd, 0x49, 0xb8, 0xfd, 0xad, 0x94, 0xd0, 0x4b, 0x0e, 0xe2, 0xb4, 0xb8, 0x30, 0x2f, 0x8c, 0xea, - 0x23, 0x44, 0xe1, 0x48, 0x35, 0x2a, 0xb9, 0x18, 0x4d, 0x32, 0x47, 0x7b, 0xcf, 0x9c, 0x83, 0x30, - 0x52, 0xa3, 0x07, 0x0f, 0xf9, 0x2c, 0xc6, 0x7e, 0x1e, 0xa9, 0x5c, 0xda, 0x32, 0xb8, 0xc7, 0x6a, - 0xcc, 0x41, 0xa2, 0x33, 0xf0, 0xfb, 0xa5, 0xda, 0x7d, 0xd6, 0x8d, 0xfa, 0xca, 0xe6, 0x35, 0xa8, - 0xb5, 0x53, 0x69, 0xc6, 0x46, 0x8d, 0xaf, 0x8f, 0x8d, 0x4a, 0xf3, 0x5f, 0xab, 0xd6, 0xc5, 0xe8, - 0xef, 0x8f, 0x42, 0xbf, 0x04, 0xee, 0x59, 0x4b, 0x67, 0x8b, 0xcc, 0x31, 0x8b, 0x68, 0x1b, 0x13, - 0xdd, 0xfe, 0xe6, 0xfc, 0xde, 0xcd, 0xe4, 0xd3, 0xd6, 0x26, 0x33, 0x5b, 0x9f, 0xce, 0x6c, 0xfd, - 0x63, 0x66, 0xeb, 0x2f, 0x73, 0x5b, 0x9b, 0xce, 0x6d, 0xed, 0x6d, 0x6e, 0x6b, 0x77, 0xc7, 0x1b, - 0xc1, 0x4a, 0x07, 0x6d, 0x4a, 0x3c, 0x89, 0x57, 0x05, 0x77, 0xba, 0xf8, 0xe9, 0x5b, 0xcd, 0x79, - 0x5a, 0xaf, 0x9a, 0xf7, 0x71, 0xf4, 0x15, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x8b, 0x26, 0x51, 0x0a, - 0x02, 0x00, 0x00, -} - -func (m *ValidatorPreference) 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 *ValidatorPreference) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValidatorPreference) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Weight.Size() - i -= size - if _, err := m.Weight.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintState(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.ValOperAddress) > 0 { - i -= len(m.ValOperAddress) - copy(dAtA[i:], m.ValOperAddress) - i = encodeVarintState(dAtA, i, uint64(len(m.ValOperAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ValidatorSetPreferences) 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 *ValidatorSetPreferences) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValidatorSetPreferences) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Preferences) > 0 { - for iNdEx := len(m.Preferences) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Preferences[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintState(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - return len(dAtA) - i, nil -} - -func encodeVarintState(dAtA []byte, offset int, v uint64) int { - offset -= sovState(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ValidatorPreference) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValOperAddress) - if l > 0 { - n += 1 + l + sovState(uint64(l)) - } - l = m.Weight.Size() - n += 1 + l + sovState(uint64(l)) - return n -} - -func (m *ValidatorSetPreferences) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Preferences) > 0 { - for _, e := range m.Preferences { - l = e.Size() - n += 1 + l + sovState(uint64(l)) - } - } - return n -} - -func sovState(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozState(x uint64) (n int) { - return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ValidatorPreference) 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 ErrIntOverflowState - } - 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: ValidatorPreference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValidatorPreference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValOperAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValOperAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipState(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthState - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ValidatorSetPreferences) 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 ErrIntOverflowState - } - 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: ValidatorSetPreferences: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValidatorSetPreferences: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Preferences", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthState - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Preferences = append(m.Preferences, ValidatorPreference{}) - if err := m.Preferences[len(m.Preferences)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipState(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthState - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipState(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowState - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowState - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowState - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthState - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupState - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthState - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthState = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowState = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupState = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/valset-pref/types/tx.pb.go b/x/valset-pref/types/tx.pb.go deleted file mode 100644 index 96bffff9b22..00000000000 --- a/x/valset-pref/types/tx.pb.go +++ /dev/null @@ -1,1726 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/valset-pref/v1beta1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgCreateValidatorSetPreference is a list that holds validator-set. -type MsgSetValidatorSetPreference struct { - // delegator is the user who is trying to create a validator-set. - Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"delegator"` - // list of {valAddr, weight} to delegate to - Preferences []ValidatorPreference `protobuf:"bytes,2,rep,name=preferences,proto3" json:"preferences" yaml:"preferences"` -} - -func (m *MsgSetValidatorSetPreference) Reset() { *m = MsgSetValidatorSetPreference{} } -func (m *MsgSetValidatorSetPreference) String() string { return proto.CompactTextString(m) } -func (*MsgSetValidatorSetPreference) ProtoMessage() {} -func (*MsgSetValidatorSetPreference) Descriptor() ([]byte, []int) { - return fileDescriptor_daa95be02b2fc560, []int{0} -} -func (m *MsgSetValidatorSetPreference) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetValidatorSetPreference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetValidatorSetPreference.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 *MsgSetValidatorSetPreference) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetValidatorSetPreference.Merge(m, src) -} -func (m *MsgSetValidatorSetPreference) XXX_Size() int { - return m.Size() -} -func (m *MsgSetValidatorSetPreference) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetValidatorSetPreference.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSetValidatorSetPreference proto.InternalMessageInfo - -func (m *MsgSetValidatorSetPreference) GetDelegator() string { - if m != nil { - return m.Delegator - } - return "" -} - -func (m *MsgSetValidatorSetPreference) GetPreferences() []ValidatorPreference { - if m != nil { - return m.Preferences - } - return nil -} - -type MsgSetValidatorSetPreferenceResponse struct { -} - -func (m *MsgSetValidatorSetPreferenceResponse) Reset() { *m = MsgSetValidatorSetPreferenceResponse{} } -func (m *MsgSetValidatorSetPreferenceResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSetValidatorSetPreferenceResponse) ProtoMessage() {} -func (*MsgSetValidatorSetPreferenceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_daa95be02b2fc560, []int{1} -} -func (m *MsgSetValidatorSetPreferenceResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetValidatorSetPreferenceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetValidatorSetPreferenceResponse.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 *MsgSetValidatorSetPreferenceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetValidatorSetPreferenceResponse.Merge(m, src) -} -func (m *MsgSetValidatorSetPreferenceResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSetValidatorSetPreferenceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetValidatorSetPreferenceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSetValidatorSetPreferenceResponse proto.InternalMessageInfo - -// MsgDelegateToValidatorSet allows users to delegate to an existing -// validator-set -type MsgDelegateToValidatorSet struct { - // delegator is the user who is trying to delegate. - Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"delegator"` - // the amount of tokens the user is trying to delegate. - // For ex: delegate 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, ValC - // -> 0.2} our staking logic would attempt to delegate 5osmo to A , 3osmo to - // B, 2osmo to C. - Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coin" json:"coin"` -} - -func (m *MsgDelegateToValidatorSet) Reset() { *m = MsgDelegateToValidatorSet{} } -func (m *MsgDelegateToValidatorSet) String() string { return proto.CompactTextString(m) } -func (*MsgDelegateToValidatorSet) ProtoMessage() {} -func (*MsgDelegateToValidatorSet) Descriptor() ([]byte, []int) { - return fileDescriptor_daa95be02b2fc560, []int{2} -} -func (m *MsgDelegateToValidatorSet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDelegateToValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDelegateToValidatorSet.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 *MsgDelegateToValidatorSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDelegateToValidatorSet.Merge(m, src) -} -func (m *MsgDelegateToValidatorSet) XXX_Size() int { - return m.Size() -} -func (m *MsgDelegateToValidatorSet) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDelegateToValidatorSet.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDelegateToValidatorSet proto.InternalMessageInfo - -func (m *MsgDelegateToValidatorSet) GetDelegator() string { - if m != nil { - return m.Delegator - } - return "" -} - -func (m *MsgDelegateToValidatorSet) GetCoin() types.Coin { - if m != nil { - return m.Coin - } - return types.Coin{} -} - -type MsgDelegateToValidatorSetResponse struct { -} - -func (m *MsgDelegateToValidatorSetResponse) Reset() { *m = MsgDelegateToValidatorSetResponse{} } -func (m *MsgDelegateToValidatorSetResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDelegateToValidatorSetResponse) ProtoMessage() {} -func (*MsgDelegateToValidatorSetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_daa95be02b2fc560, []int{3} -} -func (m *MsgDelegateToValidatorSetResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDelegateToValidatorSetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDelegateToValidatorSetResponse.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 *MsgDelegateToValidatorSetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDelegateToValidatorSetResponse.Merge(m, src) -} -func (m *MsgDelegateToValidatorSetResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDelegateToValidatorSetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDelegateToValidatorSetResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDelegateToValidatorSetResponse proto.InternalMessageInfo - -type MsgUndelegateFromValidatorSet struct { - // delegator is the user who is trying to undelegate. - Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"delegator"` - // the amount the user wants to undelegate - // For ex: Undelegate 10osmo with validator-set {ValA -> 0.5, ValB -> 0.3, - // ValC - // -> 0.2} our undelegate logic would attempt to undelegate 5osmo from A , - // 3osmo from B, 2osmo from C - Coin types.Coin `protobuf:"bytes,3,opt,name=coin,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coin" json:"coin"` -} - -func (m *MsgUndelegateFromValidatorSet) Reset() { *m = MsgUndelegateFromValidatorSet{} } -func (m *MsgUndelegateFromValidatorSet) String() string { return proto.CompactTextString(m) } -func (*MsgUndelegateFromValidatorSet) ProtoMessage() {} -func (*MsgUndelegateFromValidatorSet) Descriptor() ([]byte, []int) { - return fileDescriptor_daa95be02b2fc560, []int{4} -} -func (m *MsgUndelegateFromValidatorSet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUndelegateFromValidatorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUndelegateFromValidatorSet.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 *MsgUndelegateFromValidatorSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUndelegateFromValidatorSet.Merge(m, src) -} -func (m *MsgUndelegateFromValidatorSet) XXX_Size() int { - return m.Size() -} -func (m *MsgUndelegateFromValidatorSet) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUndelegateFromValidatorSet.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUndelegateFromValidatorSet proto.InternalMessageInfo - -func (m *MsgUndelegateFromValidatorSet) GetDelegator() string { - if m != nil { - return m.Delegator - } - return "" -} - -func (m *MsgUndelegateFromValidatorSet) GetCoin() types.Coin { - if m != nil { - return m.Coin - } - return types.Coin{} -} - -type MsgUndelegateFromValidatorSetResponse struct { -} - -func (m *MsgUndelegateFromValidatorSetResponse) Reset() { *m = MsgUndelegateFromValidatorSetResponse{} } -func (m *MsgUndelegateFromValidatorSetResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUndelegateFromValidatorSetResponse) ProtoMessage() {} -func (*MsgUndelegateFromValidatorSetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_daa95be02b2fc560, []int{5} -} -func (m *MsgUndelegateFromValidatorSetResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUndelegateFromValidatorSetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUndelegateFromValidatorSetResponse.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 *MsgUndelegateFromValidatorSetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUndelegateFromValidatorSetResponse.Merge(m, src) -} -func (m *MsgUndelegateFromValidatorSetResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUndelegateFromValidatorSetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUndelegateFromValidatorSetResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUndelegateFromValidatorSetResponse proto.InternalMessageInfo - -// MsgWithdrawDelegationRewards allows user to claim staking rewards from the -// validator set. -type MsgWithdrawDelegationRewards struct { - // delegator is the user who is trying to claim staking rewards. - Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty" yaml:"delegator"` -} - -func (m *MsgWithdrawDelegationRewards) Reset() { *m = MsgWithdrawDelegationRewards{} } -func (m *MsgWithdrawDelegationRewards) String() string { return proto.CompactTextString(m) } -func (*MsgWithdrawDelegationRewards) ProtoMessage() {} -func (*MsgWithdrawDelegationRewards) Descriptor() ([]byte, []int) { - return fileDescriptor_daa95be02b2fc560, []int{6} -} -func (m *MsgWithdrawDelegationRewards) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgWithdrawDelegationRewards) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgWithdrawDelegationRewards.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 *MsgWithdrawDelegationRewards) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdrawDelegationRewards.Merge(m, src) -} -func (m *MsgWithdrawDelegationRewards) XXX_Size() int { - return m.Size() -} -func (m *MsgWithdrawDelegationRewards) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdrawDelegationRewards.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgWithdrawDelegationRewards proto.InternalMessageInfo - -func (m *MsgWithdrawDelegationRewards) GetDelegator() string { - if m != nil { - return m.Delegator - } - return "" -} - -type MsgWithdrawDelegationRewardsResponse struct { -} - -func (m *MsgWithdrawDelegationRewardsResponse) Reset() { *m = MsgWithdrawDelegationRewardsResponse{} } -func (m *MsgWithdrawDelegationRewardsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgWithdrawDelegationRewardsResponse) ProtoMessage() {} -func (*MsgWithdrawDelegationRewardsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_daa95be02b2fc560, []int{7} -} -func (m *MsgWithdrawDelegationRewardsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgWithdrawDelegationRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgWithdrawDelegationRewardsResponse.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 *MsgWithdrawDelegationRewardsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdrawDelegationRewardsResponse.Merge(m, src) -} -func (m *MsgWithdrawDelegationRewardsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgWithdrawDelegationRewardsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdrawDelegationRewardsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgWithdrawDelegationRewardsResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgSetValidatorSetPreference)(nil), "osmosis.valsetpref.v1beta1.MsgSetValidatorSetPreference") - proto.RegisterType((*MsgSetValidatorSetPreferenceResponse)(nil), "osmosis.valsetpref.v1beta1.MsgSetValidatorSetPreferenceResponse") - proto.RegisterType((*MsgDelegateToValidatorSet)(nil), "osmosis.valsetpref.v1beta1.MsgDelegateToValidatorSet") - proto.RegisterType((*MsgDelegateToValidatorSetResponse)(nil), "osmosis.valsetpref.v1beta1.MsgDelegateToValidatorSetResponse") - proto.RegisterType((*MsgUndelegateFromValidatorSet)(nil), "osmosis.valsetpref.v1beta1.MsgUndelegateFromValidatorSet") - proto.RegisterType((*MsgUndelegateFromValidatorSetResponse)(nil), "osmosis.valsetpref.v1beta1.MsgUndelegateFromValidatorSetResponse") - proto.RegisterType((*MsgWithdrawDelegationRewards)(nil), "osmosis.valsetpref.v1beta1.MsgWithdrawDelegationRewards") - proto.RegisterType((*MsgWithdrawDelegationRewardsResponse)(nil), "osmosis.valsetpref.v1beta1.MsgWithdrawDelegationRewardsResponse") -} - -func init() { - proto.RegisterFile("osmosis/valset-pref/v1beta1/tx.proto", fileDescriptor_daa95be02b2fc560) -} - -var fileDescriptor_daa95be02b2fc560 = []byte{ - // 530 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x4d, 0x8b, 0xd3, 0x40, - 0x18, 0xee, 0x6c, 0x17, 0x61, 0xa7, 0x17, 0x09, 0x8b, 0xb4, 0x41, 0xd3, 0x1a, 0x57, 0xdb, 0x4b, - 0x33, 0x34, 0x22, 0x7e, 0x80, 0xa0, 0x55, 0xbc, 0x15, 0x34, 0xeb, 0x07, 0x78, 0x10, 0x26, 0xcd, - 0xbb, 0xd9, 0x60, 0x92, 0x09, 0x99, 0x71, 0x3f, 0xfe, 0x84, 0x78, 0x13, 0xfc, 0x09, 0x5e, 0x3c, - 0xf8, 0x0b, 0xbc, 0xed, 0x71, 0x8f, 0x9e, 0xaa, 0xb4, 0x07, 0xef, 0xfb, 0x0b, 0x24, 0x1f, 0x3b, - 0x8d, 0x60, 0x12, 0x08, 0x7a, 0x6a, 0x61, 0x9e, 0xe7, 0x79, 0x9f, 0x27, 0xef, 0x33, 0x83, 0x77, - 0x18, 0x0f, 0x18, 0xf7, 0x38, 0x39, 0xa0, 0x3e, 0x07, 0x31, 0x8e, 0x62, 0xd8, 0x23, 0x07, 0x13, - 0x1b, 0x04, 0x9d, 0x10, 0x71, 0x64, 0x44, 0x31, 0x13, 0x4c, 0x51, 0x73, 0x94, 0x91, 0xa1, 0x12, - 0x90, 0x91, 0x83, 0xd4, 0x6d, 0x97, 0xb9, 0x2c, 0x85, 0x91, 0xe4, 0x5f, 0xc6, 0x50, 0xb5, 0x79, - 0x4a, 0x21, 0x36, 0xe5, 0x20, 0xf5, 0xe6, 0xcc, 0x0b, 0xf3, 0xf3, 0x61, 0xd5, 0x5c, 0x2e, 0xa8, - 0x80, 0x0c, 0xa8, 0x7f, 0x43, 0xf8, 0xf2, 0x8c, 0xbb, 0xbb, 0x20, 0x5e, 0x52, 0xdf, 0x73, 0xa8, - 0x60, 0xf1, 0x2e, 0x88, 0xa7, 0x31, 0xec, 0x41, 0x0c, 0xe1, 0x1c, 0x14, 0x13, 0x6f, 0x39, 0xe0, - 0x83, 0x9b, 0x9c, 0x74, 0xd1, 0x00, 0x8d, 0xb6, 0xa6, 0xdb, 0x67, 0x8b, 0xfe, 0xc5, 0x63, 0x1a, - 0xf8, 0xf7, 0x74, 0x79, 0xa4, 0x5b, 0x6b, 0x98, 0x12, 0xe0, 0x4e, 0x24, 0x15, 0x78, 0x77, 0x63, - 0xd0, 0x1e, 0x75, 0x4c, 0x62, 0x94, 0xa7, 0x34, 0xe4, 0xf0, 0xf5, 0xe4, 0xa9, 0x7a, 0xb2, 0xe8, - 0xb7, 0xce, 0x16, 0x7d, 0x25, 0x1b, 0x55, 0x50, 0xd4, 0xad, 0xa2, 0xbe, 0x7e, 0x03, 0xef, 0x54, - 0x45, 0xb0, 0x80, 0x47, 0x2c, 0xe4, 0xa0, 0x7f, 0x41, 0xb8, 0x37, 0xe3, 0xee, 0xe3, 0xcc, 0x27, - 0x3c, 0x67, 0x45, 0x7c, 0xa3, 0xa0, 0x6f, 0xf0, 0x66, 0xf2, 0xd1, 0xbb, 0x1b, 0x03, 0x34, 0xea, - 0x98, 0x3d, 0x23, 0xdb, 0x8a, 0x91, 0x6c, 0x45, 0x46, 0x7b, 0xc4, 0xbc, 0x70, 0x4a, 0x92, 0x2c, - 0x9f, 0x7f, 0xf4, 0x87, 0xae, 0x27, 0xf6, 0xdf, 0xd9, 0xc6, 0x9c, 0x05, 0x24, 0x5f, 0x61, 0xf6, - 0x33, 0xe6, 0xce, 0x5b, 0x22, 0x8e, 0x23, 0xe0, 0x29, 0xc1, 0x4a, 0x75, 0xf5, 0x6b, 0xf8, 0x6a, - 0xa9, 0x61, 0x19, 0xeb, 0x2b, 0xc2, 0x57, 0x66, 0xdc, 0x7d, 0x11, 0xe6, 0xbe, 0xe0, 0x49, 0xcc, - 0x82, 0x7f, 0x16, 0xad, 0xfd, 0x9f, 0xa2, 0x0d, 0xf1, 0xf5, 0x4a, 0xd3, 0x32, 0x9e, 0x95, 0x16, - 0xf4, 0x95, 0x27, 0xf6, 0x9d, 0x98, 0x1e, 0xe6, 0xdf, 0xc2, 0x63, 0xa1, 0x05, 0x87, 0x34, 0x76, - 0x78, 0x93, 0x70, 0x79, 0x63, 0x4a, 0x35, 0xcf, 0x67, 0x9b, 0xbf, 0x36, 0x71, 0x7b, 0xc6, 0x5d, - 0xe5, 0x23, 0xc2, 0xbd, 0xf2, 0x2b, 0x72, 0xa7, 0xaa, 0xd9, 0x55, 0xcd, 0x54, 0x1f, 0x34, 0x65, - 0x9e, 0x3b, 0x54, 0xde, 0x23, 0x7c, 0xa9, 0xa4, 0xd0, 0xb7, 0x6a, 0xc4, 0xff, 0x4e, 0x53, 0xef, - 0x37, 0xa2, 0x49, 0x43, 0x9f, 0x10, 0x56, 0x2b, 0xaa, 0x78, 0xb7, 0x46, 0xbd, 0x9c, 0xaa, 0x3e, - 0x6c, 0x4c, 0x95, 0xe6, 0x92, 0x3d, 0x96, 0x37, 0xa9, 0x6e, 0x8f, 0xa5, 0xcc, 0xda, 0x3d, 0xd6, - 0x36, 0x6d, 0xfa, 0xec, 0x64, 0xa9, 0xa1, 0xd3, 0xa5, 0x86, 0x7e, 0x2e, 0x35, 0xf4, 0x61, 0xa5, - 0xb5, 0x4e, 0x57, 0x5a, 0xeb, 0xfb, 0x4a, 0x6b, 0xbd, 0xbe, 0x5d, 0xb8, 0x57, 0xf9, 0x94, 0xb1, - 0x4f, 0x6d, 0x4e, 0xe4, 0x13, 0x3f, 0x31, 0xc9, 0xd1, 0x1f, 0x0f, 0x7d, 0x7a, 0xd9, 0xec, 0x0b, - 0xe9, 0x0b, 0x7f, 0xf3, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x1f, 0xbc, 0x17, 0x84, 0x06, - 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// 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 { - // SetValidatorSetPreference creates a set of validator preference. - // This message will process both create + update request. - SetValidatorSetPreference(ctx context.Context, in *MsgSetValidatorSetPreference, opts ...grpc.CallOption) (*MsgSetValidatorSetPreferenceResponse, error) - // DelegateToValidatorSet gets the owner, coins and delegates to a - // validator-set. - DelegateToValidatorSet(ctx context.Context, in *MsgDelegateToValidatorSet, opts ...grpc.CallOption) (*MsgDelegateToValidatorSetResponse, error) - // UndelegateFromValidatorSet gets the owner and coins and undelegates from - // validator-set. The unbonding logic will follow the `Undelegate` logic from - // the sdk. - UndelegateFromValidatorSet(ctx context.Context, in *MsgUndelegateFromValidatorSet, opts ...grpc.CallOption) (*MsgUndelegateFromValidatorSetResponse, error) - // WithdrawDelegationRewards allows users to claim rewards from the - // validator-set. - WithdrawDelegationRewards(ctx context.Context, in *MsgWithdrawDelegationRewards, opts ...grpc.CallOption) (*MsgWithdrawDelegationRewardsResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) SetValidatorSetPreference(ctx context.Context, in *MsgSetValidatorSetPreference, opts ...grpc.CallOption) (*MsgSetValidatorSetPreferenceResponse, error) { - out := new(MsgSetValidatorSetPreferenceResponse) - err := c.cc.Invoke(ctx, "/osmosis.valsetpref.v1beta1.Msg/SetValidatorSetPreference", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) DelegateToValidatorSet(ctx context.Context, in *MsgDelegateToValidatorSet, opts ...grpc.CallOption) (*MsgDelegateToValidatorSetResponse, error) { - out := new(MsgDelegateToValidatorSetResponse) - err := c.cc.Invoke(ctx, "/osmosis.valsetpref.v1beta1.Msg/DelegateToValidatorSet", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UndelegateFromValidatorSet(ctx context.Context, in *MsgUndelegateFromValidatorSet, opts ...grpc.CallOption) (*MsgUndelegateFromValidatorSetResponse, error) { - out := new(MsgUndelegateFromValidatorSetResponse) - err := c.cc.Invoke(ctx, "/osmosis.valsetpref.v1beta1.Msg/UndelegateFromValidatorSet", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) WithdrawDelegationRewards(ctx context.Context, in *MsgWithdrawDelegationRewards, opts ...grpc.CallOption) (*MsgWithdrawDelegationRewardsResponse, error) { - out := new(MsgWithdrawDelegationRewardsResponse) - err := c.cc.Invoke(ctx, "/osmosis.valsetpref.v1beta1.Msg/WithdrawDelegationRewards", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // SetValidatorSetPreference creates a set of validator preference. - // This message will process both create + update request. - SetValidatorSetPreference(context.Context, *MsgSetValidatorSetPreference) (*MsgSetValidatorSetPreferenceResponse, error) - // DelegateToValidatorSet gets the owner, coins and delegates to a - // validator-set. - DelegateToValidatorSet(context.Context, *MsgDelegateToValidatorSet) (*MsgDelegateToValidatorSetResponse, error) - // UndelegateFromValidatorSet gets the owner and coins and undelegates from - // validator-set. The unbonding logic will follow the `Undelegate` logic from - // the sdk. - UndelegateFromValidatorSet(context.Context, *MsgUndelegateFromValidatorSet) (*MsgUndelegateFromValidatorSetResponse, error) - // WithdrawDelegationRewards allows users to claim rewards from the - // validator-set. - WithdrawDelegationRewards(context.Context, *MsgWithdrawDelegationRewards) (*MsgWithdrawDelegationRewardsResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) SetValidatorSetPreference(ctx context.Context, req *MsgSetValidatorSetPreference) (*MsgSetValidatorSetPreferenceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetValidatorSetPreference not implemented") -} -func (*UnimplementedMsgServer) DelegateToValidatorSet(ctx context.Context, req *MsgDelegateToValidatorSet) (*MsgDelegateToValidatorSetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegateToValidatorSet not implemented") -} -func (*UnimplementedMsgServer) UndelegateFromValidatorSet(ctx context.Context, req *MsgUndelegateFromValidatorSet) (*MsgUndelegateFromValidatorSetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UndelegateFromValidatorSet not implemented") -} -func (*UnimplementedMsgServer) WithdrawDelegationRewards(ctx context.Context, req *MsgWithdrawDelegationRewards) (*MsgWithdrawDelegationRewardsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method WithdrawDelegationRewards not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_SetValidatorSetPreference_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSetValidatorSetPreference) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SetValidatorSetPreference(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.valsetpref.v1beta1.Msg/SetValidatorSetPreference", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SetValidatorSetPreference(ctx, req.(*MsgSetValidatorSetPreference)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_DelegateToValidatorSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDelegateToValidatorSet) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).DelegateToValidatorSet(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.valsetpref.v1beta1.Msg/DelegateToValidatorSet", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DelegateToValidatorSet(ctx, req.(*MsgDelegateToValidatorSet)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UndelegateFromValidatorSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUndelegateFromValidatorSet) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UndelegateFromValidatorSet(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.valsetpref.v1beta1.Msg/UndelegateFromValidatorSet", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UndelegateFromValidatorSet(ctx, req.(*MsgUndelegateFromValidatorSet)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_WithdrawDelegationRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgWithdrawDelegationRewards) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).WithdrawDelegationRewards(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.valsetpref.v1beta1.Msg/WithdrawDelegationRewards", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).WithdrawDelegationRewards(ctx, req.(*MsgWithdrawDelegationRewards)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "osmosis.valsetpref.v1beta1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SetValidatorSetPreference", - Handler: _Msg_SetValidatorSetPreference_Handler, - }, - { - MethodName: "DelegateToValidatorSet", - Handler: _Msg_DelegateToValidatorSet_Handler, - }, - { - MethodName: "UndelegateFromValidatorSet", - Handler: _Msg_UndelegateFromValidatorSet_Handler, - }, - { - MethodName: "WithdrawDelegationRewards", - Handler: _Msg_WithdrawDelegationRewards_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "osmosis/valset-pref/v1beta1/tx.proto", -} - -func (m *MsgSetValidatorSetPreference) 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 *MsgSetValidatorSetPreference) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSetValidatorSetPreference) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Preferences) > 0 { - for iNdEx := len(m.Preferences) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Preferences[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Delegator) > 0 { - i -= len(m.Delegator) - copy(dAtA[i:], m.Delegator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Delegator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgSetValidatorSetPreferenceResponse) 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 *MsgSetValidatorSetPreferenceResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSetValidatorSetPreferenceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgDelegateToValidatorSet) 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 *MsgDelegateToValidatorSet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDelegateToValidatorSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Delegator) > 0 { - i -= len(m.Delegator) - copy(dAtA[i:], m.Delegator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Delegator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgDelegateToValidatorSetResponse) 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 *MsgDelegateToValidatorSetResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDelegateToValidatorSetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUndelegateFromValidatorSet) 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 *MsgUndelegateFromValidatorSet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUndelegateFromValidatorSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Delegator) > 0 { - i -= len(m.Delegator) - copy(dAtA[i:], m.Delegator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Delegator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUndelegateFromValidatorSetResponse) 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 *MsgUndelegateFromValidatorSetResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUndelegateFromValidatorSetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgWithdrawDelegationRewards) 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 *MsgWithdrawDelegationRewards) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgWithdrawDelegationRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Delegator) > 0 { - i -= len(m.Delegator) - copy(dAtA[i:], m.Delegator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Delegator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgWithdrawDelegationRewardsResponse) 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 *MsgWithdrawDelegationRewardsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgWithdrawDelegationRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgSetValidatorSetPreference) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Delegator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Preferences) > 0 { - for _, e := range m.Preferences { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgSetValidatorSetPreferenceResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgDelegateToValidatorSet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Delegator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Coin.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgDelegateToValidatorSetResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUndelegateFromValidatorSet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Delegator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Coin.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgUndelegateFromValidatorSetResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgWithdrawDelegationRewards) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Delegator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgWithdrawDelegationRewardsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgSetValidatorSetPreference) 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: MsgSetValidatorSetPreference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetValidatorSetPreference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delegator", 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.Delegator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Preferences", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Preferences = append(m.Preferences, ValidatorPreference{}) - if err := m.Preferences[len(m.Preferences)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - 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 *MsgSetValidatorSetPreferenceResponse) 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: MsgSetValidatorSetPreferenceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetValidatorSetPreferenceResponse: 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 *MsgDelegateToValidatorSet) 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: MsgDelegateToValidatorSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegateToValidatorSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delegator", 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.Delegator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - 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 *MsgDelegateToValidatorSetResponse) 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: MsgDelegateToValidatorSetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegateToValidatorSetResponse: 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 *MsgUndelegateFromValidatorSet) 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: MsgUndelegateFromValidatorSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUndelegateFromValidatorSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delegator", 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.Delegator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - 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 *MsgUndelegateFromValidatorSetResponse) 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: MsgUndelegateFromValidatorSetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUndelegateFromValidatorSetResponse: 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 *MsgWithdrawDelegationRewards) 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: MsgWithdrawDelegationRewards: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawDelegationRewards: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delegator", 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.Delegator = 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 *MsgWithdrawDelegationRewardsResponse) 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: MsgWithdrawDelegationRewardsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawDelegationRewardsResponse: 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 skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/valset-pref/validator_set.go b/x/valset-pref/validator_set.go deleted file mode 100644 index 0973a30fd05..00000000000 --- a/x/valset-pref/validator_set.go +++ /dev/null @@ -1,89 +0,0 @@ -package keeper - -import ( - "fmt" - "sort" - - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types" -) - -func (k Keeper) SetupValidatorSetPreference(ctx sdk.Context, delegator string, preferences []types.ValidatorPreference) error { - // check if a user already has a validator-set created - existingValidators, found := k.GetValidatorSetPreference(ctx, delegator) - if found { - // check if the new preferences is the same as the existing preferences - isEqual := k.IsValidatorSetEqual(preferences, existingValidators.Preferences) - if isEqual { - return fmt.Errorf("The preferences (validator and weights) are the same") - } - } - - // checks that all the validators exist on chain - isValid := k.IsPreferenceValid(ctx, preferences) - if !isValid { - return fmt.Errorf("The validator preference list is not valid") - } - - return nil -} - -// GetValAddrAndVal checks if the validator address is valid and the validator provided exists on chain. -func (k Keeper) getValAddrAndVal(ctx sdk.Context, valOperAddress string) (sdk.ValAddress, stakingtypes.Validator, error) { - valAddr, err := sdk.ValAddressFromBech32(valOperAddress) - if err != nil { - return nil, stakingtypes.Validator{}, fmt.Errorf("validator address not formatted") - } - - validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { - return nil, stakingtypes.Validator{}, fmt.Errorf("validator not found %s", validator) - } - - return valAddr, validator, nil -} - -// IsPreferenceValid loops through the validator preferences and checks its existence and validity. -func (k Keeper) IsPreferenceValid(ctx sdk.Context, preferences []types.ValidatorPreference) bool { - for _, val := range preferences { - _, _, err := k.getValAddrAndVal(ctx, val.ValOperAddress) - if err != nil { - return false - } - } - return true -} - -// IsValidatorSetEqual returns true if the two preferences are equal. -func (k Keeper) IsValidatorSetEqual(newPreferences, existingPreferences []types.ValidatorPreference) bool { - var isEqual bool - // check if the two validator-set length are equal - if len(newPreferences) != len(existingPreferences) { - return false - } - - // sort the new validator-set - sort.Slice(newPreferences, func(i, j int) bool { - return newPreferences[i].ValOperAddress < newPreferences[j].ValOperAddress - }) - - // sort the existing validator-set - sort.Slice(existingPreferences, func(i, j int) bool { - return existingPreferences[i].ValOperAddress < existingPreferences[j].ValOperAddress - }) - - // make sure that both valAddress and weights cannot be the same in the new val-set - // if we just find one difference between two sets we can guarantee that they are different - for i := range newPreferences { - if newPreferences[i].ValOperAddress != existingPreferences[i].ValOperAddress || - !newPreferences[i].Weight.Equal(existingPreferences[i].Weight) { - isEqual = false - break - } else { - isEqual = true - } - } - - return isEqual -} diff --git a/x/valset-pref/valpref-module/module.go b/x/valset-pref/valpref-module/module.go deleted file mode 100644 index 0c5904fbf1a..00000000000 --- a/x/valset-pref/valpref-module/module.go +++ /dev/null @@ -1,189 +0,0 @@ -package validator_preference - -import ( - "context" - "encoding/json" - "fmt" - "math/rand" - - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - - keeper "github.com/osmosis-labs/osmosis/v12/x/valset-pref" - "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types" - "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - validatorprefclient "github.com/osmosis-labs/osmosis/v12/x/valset-pref/client" - "github.com/osmosis-labs/osmosis/v12/x/valset-pref/client/queryproto" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { - cdc codec.Codec -} - -func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the capability module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers the module's interface types. -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns the capability module's default genesis state. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return nil -} - -// ValidateGenesis performs genesis state validation for the capability module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - return nil -} - -// RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - queryproto.RegisterQueryHandlerClient(context.Background(), mux, queryproto.NewQueryClient(clientCtx)) //nolint:errcheck -} - -// GetTxCmd returns the capability module's root tx command. -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return nil -} - -// GetQueryCmd returns the capability module's root query command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return nil -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface for the capability module. -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper -} - -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - } -} - -// Name returns the capability module's name. -func (am AppModule) Name() string { - return am.AppModuleBasic.Name() -} - -// Route returns the capability module's message routing key. -func (am AppModule) Route() sdk.Route { - return sdk.Route{} -} - -// QuerierRoute returns the capability module's query routing key. -func (AppModule) QuerierRoute() string { return types.QuerierRoute } - -// LegacyQuerierHandler returns the x/valset-pref module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return func(sdk.Context, []string, abci.RequestQuery) ([]byte, error) { - return nil, fmt.Errorf("legacy querier not supported for the x/%s module", types.ModuleName) - } -} - -// RegisterServices registers module services. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(&am.keeper)) - queryproto.RegisterQueryServer(cfg.QueryServer(), validatorprefclient.NewQuerier(am.keeper)) -} - -// RegisterInvariants registers the capability module's invariants. -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { -} - -// InitGenesis performs the capability module's genesis initialization It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - return nil -} - -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock executes all ABCI EndBlock logic respective to the capability module. It -// returns no validator updates. -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} - -// ___________________________________________________________________________ - -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the pool-incentives module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { -} - -// ProposalContents doesn't return any content functions for governance proposals. -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { - return []simtypes.WeightedProposalContent{} -} - -// RandomizedParams creates randomized pool-incentives param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return nil -} - -// RegisterStoreDecoder registers a decoder for supply module's types. -func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { -} - -// WeightedOperations returns the all the module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - return []simtypes.WeightedOperation{} -} - -func (am AppModule) ConsensusVersion() uint64 { - return 1 -}