diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aada9e323c..d6254d71094 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#7833](https://github.com/osmosis-labs/osmosis/pull/7883) Bump max gas wanted per tx to 6 mil * [#7839](https://github.com/osmosis-labs/osmosis/pull/7839) Add ICA controller * [#7527](https://github.com/osmosis-labs/osmosis/pull/7527) Add 30M gas limit to CW pool contract calls +* [#7855](https://github.com/osmosis-labs/osmosis/pull/7855) Whitelist address parameter for setting fee tokens * [#7857](https://github.com/osmosis-labs/osmosis/pull/7857) SuperfluidDelegationsByValidatorDenom query now returns equivalent staked amount ### SDK @@ -90,6 +91,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#514](https://github.com/osmosis-labs/cosmos-sdk/pull/514) Let gov hooks return an error * [#580](https://github.com/osmosis-labs/cosmos-sdk/pull/580) Less time intensive slashing migration +### CometBFT + +* [#5](https://github.com/osmosis-labs/cometbft/pull/5) Batch verification +* [#11](https://github.com/osmosis-labs/cometbft/pull/11) Skip verification of commit sigs +* [#13](https://github.com/osmosis-labs/cometbft/pull/13) Avoid double-saving ABCI responses +* [#20](https://github.com/osmosis-labs/cometbft/pull/20) Fix the rollback command + ## v23.0.8-iavl-v1 & v23.0.8 * [#7769](https://github.com/osmosis-labs/osmosis/pull/7769) Set and default timeout commit to 3s. Add flag to prevent custom overrides if not desired. diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 3e822054cb7..58cd9149a25 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -439,6 +439,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.DistrKeeper, appKeepers.ConsensusParamsKeeper, dataDir, + appKeepers.GetSubspace(txfeestypes.ModuleName), ) appKeepers.TxFeesKeeper = &txFeesKeeper @@ -749,6 +750,7 @@ func (appKeepers *AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legac paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable()) paramsKeeper.Subspace(cosmwasmpooltypes.ModuleName) paramsKeeper.Subspace(ibchookstypes.ModuleName) + paramsKeeper.Subspace(txfeestypes.ModuleName) return paramsKeeper } diff --git a/app/upgrades/v24/constants.go b/app/upgrades/v24/constants.go index 073f877d816..078ed10d76b 100644 --- a/app/upgrades/v24/constants.go +++ b/app/upgrades/v24/constants.go @@ -3,6 +3,7 @@ package v24 import ( ibcwasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" + "github.com/osmosis-labs/osmosis/v24/app/upgrades" store "github.com/cosmos/cosmos-sdk/store/types" @@ -20,6 +21,8 @@ var Upgrade = upgrades.Upgrade{ }, } +var WhitelistedFeeTokenSetters = []string{"osmo17eqe9dpglajwd48r65lasq3mftra5q4uxce525htyvjdp0q037vqpurhve"} + var FinalIncentiveAccumulatorPoolIDsToMigrate = map[uint64]struct{}{ // token0 ibc/E7905742CE2EA4EA5D592527DC89220C59B617DE803939FE7293805A64B484D7 // token1 uosmo diff --git a/app/upgrades/v24/upgrades.go b/app/upgrades/v24/upgrades.go index 3431844610d..7d8e690b2d8 100644 --- a/app/upgrades/v24/upgrades.go +++ b/app/upgrades/v24/upgrades.go @@ -14,6 +14,7 @@ import ( concentratedliquidity "github.com/osmosis-labs/osmosis/v24/x/concentrated-liquidity" cwpooltypes "github.com/osmosis-labs/osmosis/v24/x/cosmwasmpool/types" incentivestypes "github.com/osmosis-labs/osmosis/v24/x/incentives/types" + txfeestypes "github.com/osmosis-labs/osmosis/v24/x/txfees/types" ) const ( @@ -98,6 +99,8 @@ func CreateUpgradeHandler( keepers.CosmwasmPoolKeeper.SetPool(ctx, cwPool) } + // Set whitelistedFeeTokenSetters param as per https://forum.osmosis.zone/t/temperature-check-add-a-permissioned-address-to-manage-the-fee-token-whitelist/2604 + keepers.TxFeesKeeper.SetParam(ctx, txfeestypes.KeyWhitelistedFeeTokenSetters, WhitelistedFeeTokenSetters) return migrations, nil } } diff --git a/app/upgrades/v24/upgrades_test.go b/app/upgrades/v24/upgrades_test.go index 3958450979d..1294fb35851 100644 --- a/app/upgrades/v24/upgrades_test.go +++ b/app/upgrades/v24/upgrades_test.go @@ -256,6 +256,14 @@ func (s *UpgradeTestSuite) TestUpgrade() { // Test that the white whale pools have been updated s.requirePoolsHaveCodeId(whiteWhalePoolIds, 572) + + // TXFEES Tests + // + + // Check that the whitelisted fee token address has been set + whitelistedFeeTokenSetters := s.App.TxFeesKeeper.GetParams(s.Ctx).WhitelistedFeeTokenSetters + s.Require().Len(whitelistedFeeTokenSetters, 1) + s.Require().Equal(whitelistedFeeTokenSetters, v24.WhitelistedFeeTokenSetters) } func (s *UpgradeTestSuite) requirePoolsHaveCodeId(pools []uint64, codeId uint64) { diff --git a/proto/osmosis/txfees/v1beta1/genesis.proto b/proto/osmosis/txfees/v1beta1/genesis.proto index 98115e57b40..db7d6c8df8d 100644 --- a/proto/osmosis/txfees/v1beta1/genesis.proto +++ b/proto/osmosis/txfees/v1beta1/genesis.proto @@ -4,6 +4,7 @@ package osmosis.txfees.v1beta1; import "gogoproto/gogo.proto"; import "osmosis/txfees/v1beta1/feetoken.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "osmosis/txfees/v1beta1/params.proto"; option go_package = "github.com/osmosis-labs/osmosis/v24/x/txfees/types"; @@ -16,4 +17,7 @@ message GenesisState { // TxFeesTracker txFeesTracker = 3; reserved 3; reserved "txFeesTracker"; + + // params is the container of txfees parameters. + Params params = 4 [ (gogoproto.nullable) = false ]; } diff --git a/proto/osmosis/txfees/v1beta1/params.proto b/proto/osmosis/txfees/v1beta1/params.proto new file mode 100644 index 00000000000..3f8a7e10c6b --- /dev/null +++ b/proto/osmosis/txfees/v1beta1/params.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package osmosis.txfees.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v24/x/txfees/types"; + +// Params holds parameters for the txfees module +message Params { + repeated string whitelisted_fee_token_setters = 1 [ + (gogoproto.moretags) = "yaml:\"whitelisted_fee_token_setters\"", + (gogoproto.nullable) = false + ]; +} diff --git a/proto/osmosis/txfees/v1beta1/tx.proto b/proto/osmosis/txfees/v1beta1/tx.proto new file mode 100644 index 00000000000..c96e9638b88 --- /dev/null +++ b/proto/osmosis/txfees/v1beta1/tx.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package osmosis.txfees.v1beta1; + +import "gogoproto/gogo.proto"; +import "amino/amino.proto"; +import "osmosis/txfees/v1beta1/feetoken.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v24/x/txfees/types"; + +service Msg { + rpc SetFeeTokens(MsgSetFeeTokens) returns (MsgSetFeeTokensResponse); +} + +// ===================== MsgSetFeeTokens +message MsgSetFeeTokens { + option (amino.name) = "osmosis/set-fee-tokens"; + + repeated FeeToken fee_tokens = 1 [ + (gogoproto.moretags) = "yaml:\"fee_tokens\"", + (gogoproto.nullable) = false + ]; + string sender = 2 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; +} + +message MsgSetFeeTokensResponse {} diff --git a/x/txfees/client/cli/query.go b/x/txfees/client/cli/query.go index b6691180910..0672102a36a 100644 --- a/x/txfees/client/cli/query.go +++ b/x/txfees/client/cli/query.go @@ -4,6 +4,7 @@ import ( "github.com/spf13/cobra" "github.com/osmosis-labs/osmosis/osmoutils/osmocli" + "github.com/osmosis-labs/osmosis/v24/x/twap/client/queryproto" "github.com/osmosis-labs/osmosis/v24/x/txfees/types" ) @@ -15,6 +16,8 @@ func GetQueryCmd() *cobra.Command { GetCmdFeeTokens(), GetCmdDenomPoolID(), GetCmdBaseDenom(), + osmocli.GetParams[*queryproto.ParamsRequest]( + types.ModuleName, queryproto.NewQueryClient), ) osmocli.AddQueryCmd(cmd, types.NewQueryClient, GetCmdQueryBaseFee) diff --git a/x/txfees/keeper/feetokens.go b/x/txfees/keeper/feetokens.go index b149fb22054..ef749a71acb 100644 --- a/x/txfees/keeper/feetokens.go +++ b/x/txfees/keeper/feetokens.go @@ -9,6 +9,8 @@ import ( "github.com/osmosis-labs/osmosis/v24/x/txfees/types" sdk "github.com/cosmos/cosmos-sdk/types" + + osmoutils "github.com/osmosis-labs/osmosis/osmoutils" ) // ConvertToBaseToken converts a fee amount in a whitelisted fee token to the base fee token amount. @@ -186,3 +188,17 @@ func (k Keeper) SetFeeTokens(ctx sdk.Context, feetokens []types.FeeToken) error } return nil } + +// SenderValidationSetFeeTokens first checks to see if the sender is whitelisted to set fee tokens. +// If the sender is whitelisted, it sets the fee tokens. +// If the sender is not whitelisted, it returns an error. +func (k Keeper) SenderValidationSetFeeTokens(ctx sdk.Context, sender string, feetokens []types.FeeToken) error { + whitelistedAddresses := k.GetParams(ctx).WhitelistedFeeTokenSetters + + isWhitelisted := osmoutils.Contains(whitelistedAddresses, sender) + if !isWhitelisted { + return errorsmod.Wrapf(types.ErrNotWhitelistedFeeTokenSetter, "%s", sender) + } + + return k.SetFeeTokens(ctx, feetokens) +} diff --git a/x/txfees/keeper/feetokens_test.go b/x/txfees/keeper/feetokens_test.go index 66b36abac47..1cfed154e66 100644 --- a/x/txfees/keeper/feetokens_test.go +++ b/x/txfees/keeper/feetokens_test.go @@ -1,6 +1,8 @@ package keeper_test import ( + "fmt" + "github.com/osmosis-labs/osmosis/osmomath" "github.com/osmosis-labs/osmosis/v24/x/txfees/types" @@ -281,3 +283,98 @@ func (s *KeeperTestSuite) TestFeeTokenConversions() { }) } } + +func (s *KeeperTestSuite) TestSenderValidationSetFeeTokens() { + s.SetupTest(false) + + baseDenom, _ := s.App.TxFeesKeeper.GetBaseDenom(s.Ctx) + + tests := []struct { + name string + isWhitelistedAddr bool + prepareFeePools bool + feeTokensToSet []types.FeeToken + expectedError error + }{ + { + name: "Set multiple fee tokens with whitelisted address", + feeTokensToSet: []types.FeeToken{ + {Denom: "foo", PoolID: 1}, + {Denom: "bar", PoolID: 2}, + }, + prepareFeePools: true, + isWhitelistedAddr: true, + }, + { + name: "Set single fee token with whitelisted address", + feeTokensToSet: []types.FeeToken{ + {Denom: "foo", PoolID: 1}, + }, + prepareFeePools: true, + isWhitelistedAddr: true, + }, + { + name: "Error: Set multiple fee tokens with non-whitelisted address", + feeTokensToSet: []types.FeeToken{ + {Denom: "foo", PoolID: 1}, + {Denom: "bar", PoolID: 2}, + }, + prepareFeePools: true, + isWhitelistedAddr: false, + expectedError: types.ErrNotWhitelistedFeeTokenSetter, + }, + { + name: "Error: Set single fee token with non-whitelisted address", + feeTokensToSet: []types.FeeToken{ + {Denom: "foo", PoolID: 1}, + }, + prepareFeePools: true, + isWhitelistedAddr: false, + expectedError: types.ErrNotWhitelistedFeeTokenSetter, + }, + { + name: "Error: Set single fee token with whitelisted address with fee pool not set", + feeTokensToSet: []types.FeeToken{ + {Denom: "foo", PoolID: 1}, + }, + prepareFeePools: false, + isWhitelistedAddr: true, + expectedError: fmt.Errorf("failed to find route for pool id (1)"), + }, + } + + for _, tc := range tests { + s.SetupTest(false) + + s.Run(tc.name, func() { + if tc.prepareFeePools { + for _, feeToken := range tc.feeTokensToSet { + s.PrepareBalancerPoolWithCoins(sdk.NewInt64Coin(baseDenom, 100), sdk.NewInt64Coin(feeToken.Denom, 100)) + } + } + + if tc.isWhitelistedAddr { + s.App.TxFeesKeeper.SetParam(s.Ctx, types.KeyWhitelistedFeeTokenSetters, []string{s.TestAccs[0].String()}) + } + + // Retrieve fee tokens before setting + feeTokensBefore := s.App.TxFeesKeeper.GetFeeTokens(s.Ctx) + + err := s.App.TxFeesKeeper.SenderValidationSetFeeTokens(s.Ctx, s.TestAccs[0].String(), tc.feeTokensToSet) + + // Retrieve fee tokens after setting + feeTokensAfter := s.App.TxFeesKeeper.GetFeeTokens(s.Ctx) + + if tc.expectedError != nil { + s.Require().Error(err) + s.Require().ErrorContains(err, tc.expectedError.Error()) + // Ensure that the fee tokens are the same + s.Require().Equal(len(feeTokensAfter), len(feeTokensBefore)) + } else { + s.Require().NoError(err) + // Ensure that the fee tokens now include the new fee tokens + s.Require().Equal(len(feeTokensAfter), len(feeTokensBefore)+len(tc.feeTokensToSet)) + } + }) + } +} diff --git a/x/txfees/keeper/genesis.go b/x/txfees/keeper/genesis.go index 0872688f8d7..53293aaeb29 100644 --- a/x/txfees/keeper/genesis.go +++ b/x/txfees/keeper/genesis.go @@ -17,6 +17,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { if err != nil { panic(err) } + k.SetParams(ctx, genState.Params) } // ExportGenesis returns the txfees module's exported genesis. @@ -24,5 +25,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Basedenom, _ = k.GetBaseDenom(ctx) genesis.Feetokens = k.GetFeeTokens(ctx) + genesis.Params = k.GetParams(ctx) return genesis } diff --git a/x/txfees/keeper/genesis_test.go b/x/txfees/keeper/genesis_test.go index bae25f0844c..569917d9b72 100644 --- a/x/txfees/keeper/genesis_test.go +++ b/x/txfees/keeper/genesis_test.go @@ -18,6 +18,7 @@ var ( PoolID: 2, }, } + testWhitelistAddrs = []string{"osmo106x8q2nv7xsg7qrec2zgdf3vvq0t3gn49zvaha", "osmo105l5r3rjtynn7lg362r2m9hkpfvmgmjtkglsn9"} ) func (s *KeeperTestSuite) TestInitGenesis() { @@ -28,13 +29,18 @@ func (s *KeeperTestSuite) TestInitGenesis() { s.App.TxFeesKeeper.InitGenesis(s.Ctx, types.GenesisState{ Basedenom: testBaseDenom, Feetokens: testFeeTokens, + Params: types.Params{ + WhitelistedFeeTokenSetters: testWhitelistAddrs, + }, }) actualBaseDenom, err := s.App.TxFeesKeeper.GetBaseDenom(s.Ctx) s.Require().NoError(err) - s.Require().Equal(testBaseDenom, actualBaseDenom) s.Require().Equal(testFeeTokens, s.App.TxFeesKeeper.GetFeeTokens(s.Ctx)) + + actualParams := s.App.TxFeesKeeper.GetParams(s.Ctx) + s.Require().Equal(testWhitelistAddrs, actualParams.WhitelistedFeeTokenSetters) } func (s *KeeperTestSuite) TestExportGenesis() { @@ -45,9 +51,13 @@ func (s *KeeperTestSuite) TestExportGenesis() { s.App.TxFeesKeeper.InitGenesis(s.Ctx, types.GenesisState{ Basedenom: testBaseDenom, Feetokens: testFeeTokens, + Params: types.Params{ + WhitelistedFeeTokenSetters: testWhitelistAddrs, + }, }) genesis := s.App.TxFeesKeeper.ExportGenesis(s.Ctx) s.Require().Equal(testBaseDenom, genesis.Basedenom) s.Require().Equal(testFeeTokens, genesis.Feetokens) + s.Require().Equal(testWhitelistAddrs, genesis.Params.WhitelistedFeeTokenSetters) } diff --git a/x/txfees/keeper/keeper.go b/x/txfees/keeper/keeper.go index 80a1622aa19..f06686c47ee 100644 --- a/x/txfees/keeper/keeper.go +++ b/x/txfees/keeper/keeper.go @@ -11,6 +11,7 @@ import ( "github.com/osmosis-labs/osmosis/v24/x/txfees/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" ) @@ -25,6 +26,8 @@ type Keeper struct { distributionKeeper types.DistributionKeeper consensusKeeper types.ConsensusKeeper dataDir string + + paramSpace paramtypes.Subspace } var _ types.TxFeesKeeper = (*Keeper)(nil) @@ -38,7 +41,13 @@ func NewKeeper( distributionKeeper types.DistributionKeeper, consensusKeeper types.ConsensusKeeper, dataDir string, + paramSpace paramtypes.Subspace, ) Keeper { + // set KeyTable if it has not already been set + if !paramSpace.HasKeyTable() { + paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) + } + return Keeper{ accountKeeper: accountKeeper, bankKeeper: bankKeeper, @@ -48,9 +57,26 @@ func NewKeeper( distributionKeeper: distributionKeeper, consensusKeeper: consensusKeeper, dataDir: dataDir, + paramSpace: paramSpace, } } +// GetParams returns the total set of txfees parameters. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + k.paramSpace.GetParamSet(ctx, ¶ms) + return params +} + +// SetParams sets the total set of txfees parameters. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramSpace.SetParamSet(ctx, ¶ms) +} + +// SetParam sets a specific txfees module's parameter with the provided parameter. +func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{}) { + k.paramSpace.Set(ctx, key, value) +} + func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } diff --git a/x/txfees/keeper/msg_server.go b/x/txfees/keeper/msg_server.go new file mode 100644 index 00000000000..28ff05f7e80 --- /dev/null +++ b/x/txfees/keeper/msg_server.go @@ -0,0 +1,31 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/osmosis-labs/osmosis/v24/x/txfees/types" +) + +type msgServer struct { + keeper *Keeper +} + +func NewMsgServerImpl(keeper *Keeper) types.MsgServer { + return &msgServer{ + keeper: keeper, + } +} + +// SetFeeTokens sets the provided fee tokens for the chain. The sender must be whitelisted to set fee tokens. +func (server msgServer) SetFeeTokens(goCtx context.Context, msg *types.MsgSetFeeTokens) (*types.MsgSetFeeTokensResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + err := server.keeper.SenderValidationSetFeeTokens(ctx, msg.Sender, msg.FeeTokens) + if err != nil { + return nil, err + } + + return &types.MsgSetFeeTokensResponse{}, nil +} diff --git a/x/txfees/module.go b/x/txfees/module.go index 9d478d4b0fa..22915ec5798 100644 --- a/x/txfees/module.go +++ b/x/txfees/module.go @@ -123,6 +123,7 @@ func (AppModule) QuerierRoute() string { return "" } // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(&am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.keeper)) } diff --git a/x/txfees/types/codec.go b/x/txfees/types/codec.go index 7e96117de80..eeaddb4b2c4 100644 --- a/x/txfees/types/codec.go +++ b/x/txfees/types/codec.go @@ -2,12 +2,17 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&UpdateFeeTokenProposal{}, "osmosis/UpdateFeeTokenProposal", nil) + legacy.RegisterAminoMsg(cdc, &MsgSetFeeTokens{}, "osmosis/txfees/set-fee-tokens") } func RegisterInterfaces(registry types.InterfaceRegistry) { @@ -15,9 +20,25 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { (*govtypesv1.Content)(nil), &UpdateFeeTokenProposal{}, ) + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgSetFeeTokens{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } var ( amino = codec.NewLegacyAmino() ModuleCdc = codec.NewAminoCodec(amino) ) + +func init() { + RegisterLegacyAminoCodec(amino) + sdk.RegisterLegacyAminoCodec(amino) + + // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be + // used to properly serialize MsgGrant and MsgExec instances + RegisterLegacyAminoCodec(authzcodec.Amino) + amino.Seal() +} diff --git a/x/txfees/types/errors.go b/x/txfees/types/errors.go index bdf015c9633..9ae19118ff0 100644 --- a/x/txfees/types/errors.go +++ b/x/txfees/types/errors.go @@ -8,7 +8,8 @@ import ( // x/txfees module errors. var ( - ErrNoBaseDenom = errorsmod.Register(ModuleName, 1, "no base denom was set") - ErrTooManyFeeCoins = errorsmod.Register(ModuleName, 2, "too many fee coins. only accepts fees in one denom") - ErrInvalidFeeToken = errorsmod.Register(ModuleName, 3, "invalid fee token") + ErrNoBaseDenom = errorsmod.Register(ModuleName, 1, "no base denom was set") + ErrTooManyFeeCoins = errorsmod.Register(ModuleName, 2, "too many fee coins. only accepts fees in one denom") + ErrInvalidFeeToken = errorsmod.Register(ModuleName, 3, "invalid fee token") + ErrNotWhitelistedFeeTokenSetter = errorsmod.Register(ModuleName, 4, "not whitelisted fee token setter") ) diff --git a/x/txfees/types/genesis.go b/x/txfees/types/genesis.go index 8f874dddbae..396e067652d 100644 --- a/x/txfees/types/genesis.go +++ b/x/txfees/types/genesis.go @@ -7,6 +7,7 @@ func DefaultGenesis() *GenesisState { return &GenesisState{ Basedenom: sdk.DefaultBondDenom, Feetokens: []FeeToken{}, + Params: DefaultParams(), } } @@ -26,5 +27,9 @@ func (gs GenesisState) Validate() error { } } + if err := gs.Params.Validate(); err != nil { + return err + } + return nil } diff --git a/x/txfees/types/genesis.pb.go b/x/txfees/types/genesis.pb.go index 5c85f73ef10..983bd7ec8c3 100644 --- a/x/txfees/types/genesis.pb.go +++ b/x/txfees/types/genesis.pb.go @@ -28,6 +28,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { Basedenom string `protobuf:"bytes,1,opt,name=basedenom,proto3" json:"basedenom,omitempty"` Feetokens []FeeToken `protobuf:"bytes,2,rep,name=feetokens,proto3" json:"feetokens"` + // params is the container of txfees parameters. + Params Params `protobuf:"bytes,4,opt,name=params,proto3" json:"params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -77,6 +79,13 @@ func (m *GenesisState) GetFeetokens() []FeeToken { return nil } +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + func init() { proto.RegisterType((*GenesisState)(nil), "osmosis.txfees.v1beta1.GenesisState") } @@ -86,24 +95,26 @@ func init() { } var fileDescriptor_4423c18e3d020b37 = []byte{ - // 272 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc9, 0x2f, 0xce, 0xcd, - 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xa9, 0x48, 0x4b, 0x4d, 0x2d, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, - 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, - 0x17, 0x12, 0x83, 0xaa, 0xd2, 0x83, 0xa8, 0xd2, 0x83, 0xaa, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, - 0x07, 0x2b, 0xd1, 0x07, 0xb1, 0x20, 0xaa, 0xa5, 0x54, 0x71, 0x98, 0x99, 0x96, 0x9a, 0x5a, 0x92, - 0x9f, 0x9d, 0x9a, 0x07, 0x55, 0x26, 0x97, 0x0c, 0x56, 0xa7, 0x9f, 0x94, 0x58, 0x9c, 0x0a, 0x57, - 0x93, 0x9c, 0x9f, 0x09, 0x95, 0x57, 0x6a, 0x67, 0xe4, 0xe2, 0x71, 0x87, 0x38, 0x23, 0xb8, 0x24, - 0xb1, 0x24, 0x55, 0x48, 0x86, 0x8b, 0x13, 0xa4, 0x36, 0x25, 0x35, 0x2f, 0x3f, 0x57, 0x82, 0x51, - 0x81, 0x51, 0x83, 0x33, 0x08, 0x21, 0x20, 0xe4, 0xc2, 0xc5, 0x09, 0xb3, 0xa0, 0x58, 0x82, 0x49, - 0x81, 0x59, 0x83, 0xdb, 0x48, 0x41, 0x0f, 0xbb, 0xbb, 0xf5, 0xdc, 0x52, 0x53, 0x43, 0x40, 0x0a, - 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x42, 0x68, 0xf4, 0x62, 0xe1, 0x60, 0x16, 0x60, 0x09, - 0xe2, 0x2d, 0xa9, 0x70, 0x4b, 0x4d, 0x2d, 0x0e, 0x29, 0x4a, 0x4c, 0xce, 0x4e, 0x2d, 0x72, 0xf2, - 0x39, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, - 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xa3, 0xf4, 0xcc, 0x92, 0x8c, - 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0x5d, 0xba, 0x39, 0x89, 0x49, 0xc5, 0x30, 0x8e, - 0x7e, 0x99, 0x91, 0x89, 0x7e, 0x05, 0x2c, 0x20, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, - 0xde, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x4c, 0xab, 0xf2, 0xfc, 0x7b, 0x01, 0x00, 0x00, + // 304 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xcb, 0x4a, 0xf3, 0x40, + 0x18, 0x86, 0x33, 0x7f, 0x43, 0xf9, 0x93, 0x2a, 0x48, 0x10, 0x09, 0x45, 0xc6, 0xe0, 0x01, 0xb2, + 0x71, 0x86, 0x46, 0x97, 0xae, 0x8a, 0x54, 0x10, 0x17, 0x12, 0xbb, 0x72, 0x37, 0x89, 0x5f, 0x63, + 0xa8, 0xc9, 0x84, 0xcc, 0x58, 0xe2, 0x5d, 0x78, 0x53, 0x42, 0x97, 0x5d, 0xba, 0x12, 0x49, 0x6e, + 0x44, 0x92, 0x4c, 0xec, 0xc6, 0xec, 0xe6, 0xf0, 0x7c, 0xcf, 0xbc, 0xf3, 0x9a, 0xa7, 0x5c, 0x24, + 0x5c, 0xc4, 0x82, 0xca, 0x62, 0x01, 0x20, 0xe8, 0x6a, 0x12, 0x80, 0x64, 0x13, 0x1a, 0x41, 0x0a, + 0x22, 0x16, 0x24, 0xcb, 0xb9, 0xe4, 0xd6, 0x81, 0xa2, 0x48, 0x4b, 0x11, 0x45, 0x8d, 0xf7, 0x23, + 0x1e, 0xf1, 0x06, 0xa1, 0xf5, 0xaa, 0xa5, 0xc7, 0x67, 0x3d, 0xce, 0x05, 0x80, 0xe4, 0x4b, 0x48, + 0x15, 0x86, 0xc3, 0x86, 0xa3, 0x01, 0x13, 0xf0, 0xcb, 0x84, 0x3c, 0xee, 0xee, 0x4f, 0x7a, 0x34, + 0x19, 0xcb, 0x59, 0xa2, 0x92, 0x1d, 0x7f, 0x20, 0x73, 0xe7, 0xa6, 0xcd, 0xfa, 0x20, 0x99, 0x04, + 0xeb, 0xd0, 0x34, 0x6a, 0xe1, 0x13, 0xa4, 0x3c, 0xb1, 0x91, 0x83, 0x5c, 0xc3, 0xdf, 0x1e, 0x58, + 0xd7, 0xa6, 0xd1, 0xa5, 0x10, 0xf6, 0x3f, 0x67, 0xe0, 0x8e, 0x3c, 0x87, 0xfc, 0xfd, 0x39, 0x32, + 0x03, 0x98, 0xd7, 0xe0, 0x54, 0x5f, 0x7f, 0x1d, 0x69, 0xfe, 0x76, 0xd0, 0xba, 0x32, 0x87, 0x6d, + 0x08, 0x5b, 0x77, 0x90, 0x3b, 0xf2, 0x70, 0x9f, 0xe2, 0xbe, 0xa1, 0x94, 0x40, 0xcd, 0xdc, 0xea, + 0xff, 0x07, 0x7b, 0xba, 0xbf, 0x2b, 0x8b, 0x19, 0x80, 0x98, 0xe7, 0x2c, 0x5c, 0x42, 0x3e, 0xbd, + 0x5b, 0x97, 0x18, 0x6d, 0x4a, 0x8c, 0xbe, 0x4b, 0x8c, 0xde, 0x2b, 0xac, 0x6d, 0x2a, 0xac, 0x7d, + 0x56, 0x58, 0x7b, 0xf4, 0xa2, 0x58, 0x3e, 0xbf, 0x06, 0x24, 0xe4, 0x09, 0x55, 0xcf, 0x9c, 0xbf, + 0xb0, 0x40, 0x74, 0x1b, 0xba, 0xf2, 0x2e, 0x69, 0xd1, 0x95, 0x24, 0xdf, 0x32, 0x10, 0xc1, 0xb0, + 0x29, 0xe7, 0xe2, 0x27, 0x00, 0x00, 0xff, 0xff, 0x2d, 0x7e, 0x18, 0x10, 0xde, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -126,6 +137,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 if len(m.Feetokens) > 0 { for iNdEx := len(m.Feetokens) - 1; iNdEx >= 0; iNdEx-- { { @@ -177,6 +198,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -281,6 +304,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/txfees/types/msgs.go b/x/txfees/types/msgs.go new file mode 100644 index 00000000000..b34ce8731ab --- /dev/null +++ b/x/txfees/types/msgs.go @@ -0,0 +1,41 @@ +package types + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// constants. +const ( + TypeMsgSetFeeTokens = "set-fee-tokens" +) + +var _ sdk.Msg = &MsgSetFeeTokens{} + +func (msg MsgSetFeeTokens) Route() string { return RouterKey } +func (msg MsgSetFeeTokens) Type() string { return TypeMsgSetFeeTokens } +func (msg MsgSetFeeTokens) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return fmt.Errorf("Invalid sender address (%s)", err) + } + + if len(msg.FeeTokens) == 0 { + return fmt.Errorf("Fee tokens must not be empty") + } + + return nil +} + +func (msg MsgSetFeeTokens) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +func (msg MsgSetFeeTokens) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} diff --git a/x/txfees/types/msgs_test.go b/x/txfees/types/msgs_test.go new file mode 100644 index 00000000000..7aef0968543 --- /dev/null +++ b/x/txfees/types/msgs_test.go @@ -0,0 +1,125 @@ +package types_test + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + appParams "github.com/osmosis-labs/osmosis/v24/app/params" + + "github.com/osmosis-labs/osmosis/v24/x/txfees/types" +) + +type extMsg interface { + sdk.Msg + Route() string + Type() string +} + +var ( + addr1 string + addr2 string + invalidAddr sdk.AccAddress +) + +func init() { + appParams.SetAddressPrefixes() + pk1 := ed25519.GenPrivKey().PubKey() + addr1 = sdk.AccAddress(pk1.Address()).String() + pk2 := ed25519.GenPrivKey().PubKey() + addr2 = sdk.AccAddress(pk2.Address()).String() + invalidAddr = sdk.AccAddress("invalid") +} + +func runValidateBasicTest(t *testing.T, name string, msg extMsg, expectPass bool, expType string) { + if expectPass { + require.NoError(t, msg.ValidateBasic(), "test: %v", name) + require.Equal(t, msg.Route(), types.RouterKey) + require.Equal(t, msg.Type(), expType) + signers := msg.GetSigners() + require.Equal(t, len(signers), 1) + require.Equal(t, signers[0].String(), addr1) + } else { + require.Error(t, msg.ValidateBasic(), "test: %v", name) + } +} + +func TestMsgSetFeeTokens(t *testing.T) { + tests := []struct { + name string + msg types.MsgSetFeeTokens + expectPass bool + }{ + { + name: "proper msg: set multiple fee tokens", + msg: types.MsgSetFeeTokens{ + FeeTokens: []types.FeeToken{ + {Denom: "foo", PoolID: 1}, + {Denom: "bar", PoolID: 2}, + }, + Sender: addr1, + }, + expectPass: true, + }, + { + name: "proper msg: set single fee token", + msg: types.MsgSetFeeTokens{ + FeeTokens: []types.FeeToken{ + {Denom: "foo", PoolID: 1}, + }, + Sender: addr1, + }, + expectPass: true, + }, + { + name: "improper msg: empty fee tokens", + msg: types.MsgSetFeeTokens{ + FeeTokens: []types.FeeToken{}, + Sender: addr1, + }, + expectPass: false, + }, + { + name: "improper msg: invalid sender address", + msg: types.MsgSetFeeTokens{ + FeeTokens: []types.FeeToken{ + {Denom: "foo", PoolID: 1}, + }, + Sender: invalidAddr.String(), + }, + expectPass: false, + }, + { + name: "improper msg: empty sender address", + msg: types.MsgSetFeeTokens{ + FeeTokens: []types.FeeToken{ + {Denom: "foo", PoolID: 1}, + }, + Sender: "", + }, + expectPass: false, + }, + { + name: "improper msg: empty fee tokens and invalid sender address", + msg: types.MsgSetFeeTokens{ + FeeTokens: []types.FeeToken{}, + Sender: invalidAddr.String(), + }, + expectPass: false, + }, + { + name: "improper msg: empty fee tokens and empty sender address", + msg: types.MsgSetFeeTokens{ + FeeTokens: []types.FeeToken{}, + Sender: "", + }, + expectPass: false, + }, + } + + for _, test := range tests { + runValidateBasicTest(t, test.name, &test.msg, test.expectPass, types.TypeMsgSetFeeTokens) + } +} diff --git a/x/txfees/types/params.go b/x/txfees/types/params.go new file mode 100644 index 00000000000..4b0dd8e2ef6 --- /dev/null +++ b/x/txfees/types/params.go @@ -0,0 +1,46 @@ +package types + +import ( + "github.com/osmosis-labs/osmosis/osmoutils" + + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// Parameter store keys. +var ( + KeyWhitelistedFeeTokenSetters = []byte("WhitelistedFeeTokenSetters") +) + +// ParamTable for txfees module. +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +func NewParams(whitelistedFeeTokenSetters []string) Params { + return Params{ + WhitelistedFeeTokenSetters: whitelistedFeeTokenSetters, + } +} + +// DefaultParams are the default txfees module parameters. +func DefaultParams() Params { + return Params{ + WhitelistedFeeTokenSetters: []string{}, + } +} + +// validate params. +func (p Params) Validate() error { + if err := osmoutils.ValidateAddressList(p.WhitelistedFeeTokenSetters); err != nil { + return err + } + + return nil +} + +// Implements params.ParamSet. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyWhitelistedFeeTokenSetters, &p.WhitelistedFeeTokenSetters, osmoutils.ValidateAddressList), + } +} diff --git a/x/txfees/types/params.pb.go b/x/txfees/types/params.pb.go new file mode 100644 index 00000000000..bf3c4b2a10b --- /dev/null +++ b/x/txfees/types/params.pb.go @@ -0,0 +1,327 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/txfees/v1beta1/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + 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 + +// Params holds parameters for the txfees module +type Params struct { + WhitelistedFeeTokenSetters []string `protobuf:"bytes,1,rep,name=whitelisted_fee_token_setters,json=whitelistedFeeTokenSetters,proto3" json:"whitelisted_fee_token_setters,omitempty" yaml:"whitelisted_fee_token_setters"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_fcbfbe8e37bb08e6, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetWhitelistedFeeTokenSetters() []string { + if m != nil { + return m.WhitelistedFeeTokenSetters + } + return nil +} + +func init() { + proto.RegisterType((*Params)(nil), "osmosis.txfees.v1beta1.Params") +} + +func init() { + proto.RegisterFile("osmosis/txfees/v1beta1/params.proto", fileDescriptor_fcbfbe8e37bb08e6) +} + +var fileDescriptor_fcbfbe8e37bb08e6 = []byte{ + // 230 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xce, 0x2f, 0xce, 0xcd, + 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xa9, 0x48, 0x4b, 0x4d, 0x2d, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, + 0x49, 0x34, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x12, 0x83, 0x2a, 0xd2, 0x83, 0x28, 0xd2, 0x83, 0x2a, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, + 0x2b, 0xd1, 0x07, 0xb1, 0x20, 0xaa, 0x95, 0x2a, 0xb9, 0xd8, 0x02, 0xc0, 0xba, 0x85, 0xf2, 0xb9, + 0x64, 0xcb, 0x33, 0x32, 0x4b, 0x52, 0x73, 0x32, 0x8b, 0x4b, 0x52, 0x53, 0xe2, 0xd3, 0x52, 0x53, + 0xe3, 0x4b, 0xf2, 0xb3, 0x53, 0xf3, 0xe2, 0x8b, 0x53, 0x4b, 0x4a, 0x52, 0x8b, 0x8a, 0x25, 0x18, + 0x15, 0x98, 0x35, 0x38, 0x9d, 0x74, 0x4e, 0xdc, 0x93, 0x67, 0xf8, 0x74, 0x4f, 0x5e, 0xa5, 0x32, + 0x31, 0x37, 0xc7, 0x4a, 0x09, 0xaf, 0x16, 0xa5, 0x20, 0x29, 0x24, 0x79, 0xb7, 0xd4, 0xd4, 0x10, + 0x90, 0x6c, 0x30, 0x44, 0xd2, 0xc9, 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, + 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, + 0xa2, 0x8c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xa1, 0xbe, 0xd1, + 0xcd, 0x49, 0x4c, 0x2a, 0x86, 0x71, 0xf4, 0xcb, 0x8c, 0x4c, 0xf4, 0x2b, 0x60, 0xa1, 0x50, 0x52, + 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0x8f, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x54, 0x2a, + 0x56, 0x19, 0x24, 0x01, 0x00, 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.WhitelistedFeeTokenSetters) > 0 { + for iNdEx := len(m.WhitelistedFeeTokenSetters) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.WhitelistedFeeTokenSetters[iNdEx]) + copy(dAtA[i:], m.WhitelistedFeeTokenSetters[iNdEx]) + i = encodeVarintParams(dAtA, i, uint64(len(m.WhitelistedFeeTokenSetters[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.WhitelistedFeeTokenSetters) > 0 { + for _, s := range m.WhitelistedFeeTokenSetters { + l = len(s) + n += 1 + l + sovParams(uint64(l)) + } + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WhitelistedFeeTokenSetters", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WhitelistedFeeTokenSetters = append(m.WhitelistedFeeTokenSetters, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/txfees/types/tx.pb.go b/x/txfees/types/tx.pb.go new file mode 100644 index 00000000000..7661781fc7e --- /dev/null +++ b/x/txfees/types/tx.pb.go @@ -0,0 +1,594 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/txfees/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/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 + +// ===================== MsgSetFeeTokens +type MsgSetFeeTokens struct { + FeeTokens []FeeToken `protobuf:"bytes,1,rep,name=fee_tokens,json=feeTokens,proto3" json:"fee_tokens" yaml:"fee_tokens"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` +} + +func (m *MsgSetFeeTokens) Reset() { *m = MsgSetFeeTokens{} } +func (m *MsgSetFeeTokens) String() string { return proto.CompactTextString(m) } +func (*MsgSetFeeTokens) ProtoMessage() {} +func (*MsgSetFeeTokens) Descriptor() ([]byte, []int) { + return fileDescriptor_3d23e2aa9435ce2a, []int{0} +} +func (m *MsgSetFeeTokens) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetFeeTokens) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetFeeTokens.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 *MsgSetFeeTokens) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetFeeTokens.Merge(m, src) +} +func (m *MsgSetFeeTokens) XXX_Size() int { + return m.Size() +} +func (m *MsgSetFeeTokens) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetFeeTokens.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetFeeTokens proto.InternalMessageInfo + +func (m *MsgSetFeeTokens) GetFeeTokens() []FeeToken { + if m != nil { + return m.FeeTokens + } + return nil +} + +func (m *MsgSetFeeTokens) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +type MsgSetFeeTokensResponse struct { +} + +func (m *MsgSetFeeTokensResponse) Reset() { *m = MsgSetFeeTokensResponse{} } +func (m *MsgSetFeeTokensResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetFeeTokensResponse) ProtoMessage() {} +func (*MsgSetFeeTokensResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3d23e2aa9435ce2a, []int{1} +} +func (m *MsgSetFeeTokensResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetFeeTokensResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetFeeTokensResponse.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 *MsgSetFeeTokensResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetFeeTokensResponse.Merge(m, src) +} +func (m *MsgSetFeeTokensResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetFeeTokensResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetFeeTokensResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetFeeTokensResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgSetFeeTokens)(nil), "osmosis.txfees.v1beta1.MsgSetFeeTokens") + proto.RegisterType((*MsgSetFeeTokensResponse)(nil), "osmosis.txfees.v1beta1.MsgSetFeeTokensResponse") +} + +func init() { proto.RegisterFile("osmosis/txfees/v1beta1/tx.proto", fileDescriptor_3d23e2aa9435ce2a) } + +var fileDescriptor_3d23e2aa9435ce2a = []byte{ + // 329 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcf, 0x2f, 0xce, 0xcd, + 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xa9, 0x48, 0x4b, 0x4d, 0x2d, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, + 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, 0x2a, 0xd0, + 0x83, 0x28, 0xd0, 0x83, 0x2a, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd1, 0x07, 0xb1, + 0x20, 0xaa, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x54, 0x48, 0x15, 0x87, + 0x0d, 0x69, 0xa9, 0xa9, 0x25, 0xf9, 0xd9, 0xa9, 0x79, 0x10, 0x65, 0x4a, 0x5b, 0x19, 0xb9, 0xf8, + 0x7d, 0x8b, 0xd3, 0x83, 0x53, 0x4b, 0xdc, 0x52, 0x53, 0x43, 0x40, 0x12, 0xc5, 0x42, 0x51, 0x5c, + 0x5c, 0x69, 0xa9, 0xa9, 0xf1, 0x60, 0x65, 0xc5, 0x12, 0x8c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0x0a, + 0x7a, 0xd8, 0x1d, 0xa4, 0x07, 0xd3, 0xe6, 0x24, 0x79, 0xe2, 0x9e, 0x3c, 0xc3, 0xa7, 0x7b, 0xf2, + 0x82, 0x95, 0x89, 0xb9, 0x39, 0x56, 0x4a, 0x08, 0x13, 0x94, 0x82, 0x38, 0xd3, 0xe0, 0x66, 0x6b, + 0x72, 0xb1, 0x15, 0xa7, 0xe6, 0xa5, 0xa4, 0x16, 0x49, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x3a, 0x09, + 0x7e, 0xba, 0x27, 0xcf, 0x0b, 0xd1, 0x01, 0x11, 0x57, 0x0a, 0x82, 0x2a, 0xb0, 0x92, 0xee, 0x7a, + 0xbe, 0x41, 0x0b, 0x16, 0x0e, 0xfa, 0xc5, 0xa9, 0x25, 0xba, 0x69, 0xa9, 0xa9, 0xba, 0x50, 0x33, + 0x25, 0xb9, 0xc4, 0xd1, 0x9c, 0x1d, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x6a, 0x94, 0xcf, + 0xc5, 0xec, 0x5b, 0x9c, 0x2e, 0x94, 0xc1, 0xc5, 0x83, 0xe2, 0x2b, 0x75, 0x5c, 0x3e, 0x40, 0x33, + 0x47, 0x4a, 0x9f, 0x48, 0x85, 0x30, 0x0b, 0x9d, 0x7c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, + 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, + 0x58, 0x8e, 0x21, 0xca, 0x28, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, + 0x6a, 0xa8, 0x6e, 0x4e, 0x62, 0x52, 0x31, 0x8c, 0xa3, 0x5f, 0x66, 0x64, 0xa2, 0x5f, 0x01, 0x8b, + 0xa2, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0xc4, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x7c, 0x5a, 0x5e, 0x70, 0x23, 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 + +// 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 { + SetFeeTokens(ctx context.Context, in *MsgSetFeeTokens, opts ...grpc.CallOption) (*MsgSetFeeTokensResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) SetFeeTokens(ctx context.Context, in *MsgSetFeeTokens, opts ...grpc.CallOption) (*MsgSetFeeTokensResponse, error) { + out := new(MsgSetFeeTokensResponse) + err := c.cc.Invoke(ctx, "/osmosis.txfees.v1beta1.Msg/SetFeeTokens", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + SetFeeTokens(context.Context, *MsgSetFeeTokens) (*MsgSetFeeTokensResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) SetFeeTokens(ctx context.Context, req *MsgSetFeeTokens) (*MsgSetFeeTokensResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetFeeTokens not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_SetFeeTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetFeeTokens) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetFeeTokens(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.txfees.v1beta1.Msg/SetFeeTokens", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetFeeTokens(ctx, req.(*MsgSetFeeTokens)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "osmosis.txfees.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SetFeeTokens", + Handler: _Msg_SetFeeTokens_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "osmosis/txfees/v1beta1/tx.proto", +} + +func (m *MsgSetFeeTokens) 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 *MsgSetFeeTokens) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetFeeTokens) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if len(m.FeeTokens) > 0 { + for iNdEx := len(m.FeeTokens) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FeeTokens[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgSetFeeTokensResponse) 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 *MsgSetFeeTokensResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetFeeTokensResponse) 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 *MsgSetFeeTokens) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.FeeTokens) > 0 { + for _, e := range m.FeeTokens { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetFeeTokensResponse) 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 *MsgSetFeeTokens) 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: MsgSetFeeTokens: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetFeeTokens: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeTokens", 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.FeeTokens = append(m.FeeTokens, FeeToken{}) + if err := m.FeeTokens[len(m.FeeTokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = 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 *MsgSetFeeTokensResponse) 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: MsgSetFeeTokensResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetFeeTokensResponse: 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") +)