From 513ed2a6c14fd53b408a9423461fbe74499b315e Mon Sep 17 00:00:00 2001 From: larry <26318510+larry0x@users.noreply.github.com> Date: Tue, 9 May 2023 08:27:19 +0100 Subject: [PATCH] implement gas consume on denom creation (#4983) * implement gas consume on denom creation * apply state changes after running migrations * update readme * revert an unintended change * update changelog * adjust gas consume amount * add a test case for gas consumption --- CHANGELOG.md | 2 + app/upgrades/v16/constants.go | 6 ++ app/upgrades/v16/export_test.go | 5 ++ app/upgrades/v16/upgrades.go | 9 ++ app/upgrades/v16/upgrades_test.go | 4 + .../osmosis/tokenfactory/v1beta1/params.proto | 12 +++ x/tokenfactory/README.md | 2 + x/tokenfactory/keeper/createdenom.go | 25 ++++-- x/tokenfactory/keeper/createdenom_test.go | 65 ++++++++++++++ x/tokenfactory/types/params.go | 21 ++++- x/tokenfactory/types/params.pb.go | 87 ++++++++++++++----- 11 files changed, 205 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1b4ffe120d..81e86fd71ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,8 +73,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#4682](https://github.com/osmosis-labs/osmosis/pull/4682) Deprecate x/gamm SpotPrice v2 query. The new one is located in x/poolmanager. * [#4801](https://github.com/osmosis-labs/osmosis/pull/4801) remove GetTotalShares, GetTotalLiquidity and GetExitFee from PoolI. Define all on CFMMPoolI, define GetTotalLiquidity on PoolModuleI only. * [#4868](https://github.com/osmosis-labs/osmosis/pull/4868) Remove wasmEnabledProposals []wasm.ProposalType from NewOsmosisApp +* [#4983](https://github.com/osmosis-labs/osmosis/pull/4983) Consume a gas when creating a new token using tokenfactory as a spam deterrence mechanism. * [#4951](https://github.com/osmosis-labs/osmosis/pull/4951) Implement pool liquidity query in pool manager, deprecate the one in gamm + ## v15.1.0 ### Security diff --git a/app/upgrades/v16/constants.go b/app/upgrades/v16/constants.go index 4d9bae2f517..cf303c9c5d5 100644 --- a/app/upgrades/v16/constants.go +++ b/app/upgrades/v16/constants.go @@ -11,6 +11,12 @@ import ( // UpgradeName defines the on-chain upgrade name for the Osmosis v16 upgrade. const UpgradeName = "v16" +// new token factory parameters +// +// at the current gas price of 0.0025uosmo, this corresponds to 0.1 OSMO per +// denom creation. +const NewDenomCreationGasConsume uint64 = 40_000_000 + var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, CreateUpgradeHandler: CreateUpgradeHandler, diff --git a/app/upgrades/v16/export_test.go b/app/upgrades/v16/export_test.go index b7875c61aff..a28d3bd8bb4 100644 --- a/app/upgrades/v16/export_test.go +++ b/app/upgrades/v16/export_test.go @@ -8,6 +8,7 @@ import ( gammkeeper "github.com/osmosis-labs/osmosis/v15/x/gamm/keeper" "github.com/osmosis-labs/osmosis/v15/x/poolmanager" poolmanagertypes "github.com/osmosis-labs/osmosis/v15/x/poolmanager/types" + tokenfactorykeeper "github.com/osmosis-labs/osmosis/v15/x/tokenfactory/keeper" ) var ( @@ -22,3 +23,7 @@ func CreateConcentratedPoolFromCFMM(ctx sdk.Context, cfmmPoolIdToLinkWith uint64 func CreateCanonicalConcentratedLiuqidityPoolAndMigrationLink(ctx sdk.Context, cfmmPoolId uint64, desiredDenom0 string, keepers *keepers.AppKeepers) error { return createCanonicalConcentratedLiquidityPoolAndMigrationLink(ctx, cfmmPoolId, desiredDenom0, keepers) } + +func UpdateTokenFactoryParams(ctx sdk.Context, tokenFactoryKeeper *tokenfactorykeeper.Keeper) { + updateTokenFactoryParams(ctx, tokenFactoryKeeper) +} diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index c970a4b2461..939dff202e5 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -9,6 +9,9 @@ import ( "github.com/osmosis-labs/osmosis/v15/app/keepers" "github.com/osmosis-labs/osmosis/v15/app/upgrades" + + tokenfactorykeeper "github.com/osmosis-labs/osmosis/v15/x/tokenfactory/keeper" + tokenfactorytypes "github.com/osmosis-labs/osmosis/v15/x/tokenfactory/types" ) const ( @@ -81,6 +84,12 @@ func CreateUpgradeHandler( return nil, err } + updateTokenFactoryParams(ctx, keepers.TokenFactoryKeeper) + return migrations, nil } } + +func updateTokenFactoryParams(ctx sdk.Context, tokenFactoryKeeper *tokenfactorykeeper.Keeper) { + tokenFactoryKeeper.SetParams(ctx, tokenfactorytypes.NewParams(nil, NewDenomCreationGasConsume)) +} diff --git a/app/upgrades/v16/upgrades_test.go b/app/upgrades/v16/upgrades_test.go index d77cfadb183..32f3220fece 100644 --- a/app/upgrades/v16/upgrades_test.go +++ b/app/upgrades/v16/upgrades_test.go @@ -105,6 +105,10 @@ func (suite *UpgradeTestSuite) TestUpgrade() { suite.Require().False(params.IsPermissionlessPoolCreationEnabled) }, func() { + // Validate that tokenfactory params have been updated + params := suite.App.TokenFactoryKeeper.GetParams(suite.Ctx) + suite.Require().Nil(params.DenomCreationFee) + suite.Require().Equal(v16.NewDenomCreationGasConsume, params.DenomCreationGasConsume) }, }, { diff --git a/proto/osmosis/tokenfactory/v1beta1/params.proto b/proto/osmosis/tokenfactory/v1beta1/params.proto index 04c4073d184..6ff5d0b3a3f 100644 --- a/proto/osmosis/tokenfactory/v1beta1/params.proto +++ b/proto/osmosis/tokenfactory/v1beta1/params.proto @@ -10,9 +10,21 @@ option go_package = "github.com/osmosis-labs/osmosis/v15/x/tokenfactory/types"; // Params defines the parameters for the tokenfactory module. message Params { + // DenomCreationFee defines the fee to be charged on the creation of a new + // denom. The fee is drawn from the MsgCreateDenom's sender account, and + // transferred to the community pool. repeated cosmos.base.v1beta1.Coin denom_creation_fee = 1 [ (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.moretags) = "yaml:\"denom_creation_fee\"", (gogoproto.nullable) = false ]; + + // DenomCreationGasConsume defines the gas cost for creating a new denom. + // This is intended as a spam deterrence mechanism. + // + // See: https://github.com/CosmWasm/token-factory/issues/11 + uint64 denom_creation_gas_consume = 2 [ + (gogoproto.moretags) = "yaml:\"denom_creation_gas_consume\"", + (gogoproto.nullable) = true + ]; } diff --git a/x/tokenfactory/README.md b/x/tokenfactory/README.md index 643478499f9..cd49e084ef8 100644 --- a/x/tokenfactory/README.md +++ b/x/tokenfactory/README.md @@ -35,6 +35,8 @@ message MsgCreateDenom { - Fund community pool with the denom creation fee from the creator address, set in `Params`. +- Consume an amount of gas corresponding to the `DenomCreationGasConsume` parameter + specified in `Params`. - Set `DenomMetaData` via bank keeper. - Set `AuthorityMetadata` for the given denom to store the admin for the created denom `factory/{creator address}/{subdenom}`. Admin is automatically set as the diff --git a/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go index 8066c766589..c8a4cc62eeb 100644 --- a/x/tokenfactory/keeper/createdenom.go +++ b/x/tokenfactory/keeper/createdenom.go @@ -71,16 +71,25 @@ func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr string, subdeno } func (k Keeper) chargeForCreateDenom(ctx sdk.Context, creatorAddr string, subdenom string) (err error) { - // Send creation fee to community pool - creationFee := k.GetParams(ctx).DenomCreationFee - accAddr, err := sdk.AccAddressFromBech32(creatorAddr) - if err != nil { - return err - } - if creationFee != nil { - if err := k.communityPoolKeeper.FundCommunityPool(ctx, creationFee, accAddr); err != nil { + params := k.GetParams(ctx) + + // if DenomCreationFee is non-zero, transfer the tokens from the creator + // account to community pool + if params.DenomCreationFee != nil { + accAddr, err := sdk.AccAddressFromBech32(creatorAddr) + if err != nil { + return err + } + + if err := k.communityPoolKeeper.FundCommunityPool(ctx, params.DenomCreationFee, accAddr); err != nil { return err } } + + // if DenomCreationGasConsume is non-zero, consume the gas + if params.DenomCreationGasConsume != 0 { + ctx.GasMeter().ConsumeGas(params.DenomCreationGasConsume, "consume denom creation gas") + } + return nil } diff --git a/x/tokenfactory/keeper/createdenom_test.go b/x/tokenfactory/keeper/createdenom_test.go index fb8cf86e838..a8f90506444 100644 --- a/x/tokenfactory/keeper/createdenom_test.go +++ b/x/tokenfactory/keeper/createdenom_test.go @@ -161,3 +161,68 @@ func (suite *KeeperTestSuite) TestCreateDenom() { }) } } + +func (suite *KeeperTestSuite) TestGasConsume() { + // It's hard to estimate exactly how much gas will be consumed when creating a + // denom, because besides consuming the gas specified by the params, the keeper + // also does a bunch of other things that consume gas. + // + // Rather, we test whether the gas consumed is within a range. Specifically, + // the range [gasConsume, gasConsume + offset]. If the actual gas consumption + // falls within the range for all test cases, we consider the test passed. + // + // In experience, the total amount of gas consumed should consume be ~30k more + // than the set amount. + const offset = 50000 + + for _, tc := range []struct { + desc string + gasConsume uint64 + }{ + { + desc: "gas consume zero", + gasConsume: 0, + }, + { + desc: "gas consume 1,000,000", + gasConsume: 1_000_000, + }, + { + desc: "gas consume 10,000,000", + gasConsume: 10_000_000, + }, + { + desc: "gas consume 25,000,000", + gasConsume: 25_000_000, + }, + { + desc: "gas consume 50,000,000", + gasConsume: 50_000_000, + }, + { + desc: "gas consume 200,000,000", + gasConsume: 200_000_000, + }, + } { + suite.SetupTest() + suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { + // set params with the gas consume amount + suite.App.TokenFactoryKeeper.SetParams(suite.Ctx, types.NewParams(nil, tc.gasConsume)) + + // amount of gas consumed prior to the denom creation + gasConsumedBefore := suite.Ctx.GasMeter().GasConsumed() + + // create a denom + _, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "larry")) + suite.Require().NoError(err) + + // amount of gas consumed after the denom creation + gasConsumedAfter := suite.Ctx.GasMeter().GasConsumed() + + // the amount of gas consumed must be within the range + gasConsumed := gasConsumedAfter - gasConsumedBefore + suite.Require().Greater(gasConsumed, tc.gasConsume) + suite.Require().Less(gasConsumed, tc.gasConsume+offset) + }) + } +} diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index ab0bb10f5d2..97706221dd5 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -11,7 +11,8 @@ import ( // Parameter store keys. var ( - KeyDenomCreationFee = []byte("DenomCreationFee") + KeyDenomCreationFee = []byte("DenomCreationFee") + KeyDenomCreationGasConsume = []byte("DenomCreationGasConsume") ) // ParamTable for gamm module. @@ -19,16 +20,18 @@ func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } -func NewParams(denomCreationFee sdk.Coins) Params { +func NewParams(denomCreationFee sdk.Coins, denomCreationGasConsume uint64) Params { return Params{ - DenomCreationFee: denomCreationFee, + DenomCreationFee: denomCreationFee, + DenomCreationGasConsume: denomCreationGasConsume, } } // default gamm module parameters. func DefaultParams() Params { return Params{ - DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin(appparams.BaseCoinUnit, 10_000_000)), // 10 OSMO + DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin(appparams.BaseCoinUnit, 10_000_000)), // 10 OSMO + DenomCreationGasConsume: 0, } } @@ -45,6 +48,7 @@ func (p Params) Validate() error { func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(KeyDenomCreationFee, &p.DenomCreationFee, validateDenomCreationFee), + paramtypes.NewParamSetPair(KeyDenomCreationGasConsume, &p.DenomCreationGasConsume, validateDenomCreationGasConsume), } } @@ -60,3 +64,12 @@ func validateDenomCreationFee(i interface{}) error { return nil } + +func validateDenomCreationGasConsume(i interface{}) error { + _, ok := i.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + return nil +} diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go index a9c6a0a0949..ddfc0b5dd60 100644 --- a/x/tokenfactory/types/params.pb.go +++ b/x/tokenfactory/types/params.pb.go @@ -28,7 +28,15 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the tokenfactory module. type Params struct { + // DenomCreationFee defines the fee to be charged on the creation of a new + // denom. The fee is drawn from the MsgCreateDenom's sender account, and + // transferred to the community pool. DenomCreationFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=denom_creation_fee,json=denomCreationFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"denom_creation_fee" yaml:"denom_creation_fee"` + // DenomCreationGasConsume defines the gas cost for creating a new denom. + // This is intended as a spam deterrence mechanism. + // + // See: https://github.com/CosmWasm/token-factory/issues/11 + DenomCreationGasConsume uint64 `protobuf:"varint,2,opt,name=denom_creation_gas_consume,json=denomCreationGasConsume,proto3" json:"denom_creation_gas_consume,omitempty" yaml:"denom_creation_gas_consume"` } func (m *Params) Reset() { *m = Params{} } @@ -71,6 +79,13 @@ func (m *Params) GetDenomCreationFee() github_com_cosmos_cosmos_sdk_types.Coins return nil } +func (m *Params) GetDenomCreationGasConsume() uint64 { + if m != nil { + return m.DenomCreationGasConsume + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "osmosis.tokenfactory.v1beta1.Params") } @@ -80,27 +95,30 @@ func init() { } var fileDescriptor_cc8299d306f3ff47 = []byte{ - // 310 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcc, 0x2f, 0xce, 0xcd, - 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0x4b, 0x4b, 0x4c, 0x2e, 0xc9, 0x2f, 0xaa, - 0xd4, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x81, 0x2a, 0xd5, 0x43, 0x56, 0xaa, 0x07, 0x55, 0x2a, - 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa8, 0x0f, 0x62, 0x41, 0xf4, 0x48, 0x99, 0xe0, 0x35, - 0x3e, 0xb1, 0xb4, 0x24, 0x23, 0xbf, 0x28, 0xb3, 0xa4, 0xd2, 0x37, 0xb5, 0x24, 0x31, 0x25, 0xb1, - 0x24, 0x11, 0xaa, 0x4b, 0x32, 0x19, 0xac, 0x2d, 0x1e, 0x62, 0x1c, 0x84, 0x03, 0x95, 0x92, 0x83, - 0xf0, 0xf4, 0x93, 0x12, 0x8b, 0x53, 0xe1, 0xe6, 0x24, 0xe7, 0x67, 0xe6, 0x41, 0xe4, 0x95, 0x16, - 0x32, 0x72, 0xb1, 0x05, 0x80, 0x5d, 0x2d, 0x34, 0x8d, 0x91, 0x4b, 0x28, 0x25, 0x35, 0x2f, 0x3f, - 0x37, 0x3e, 0xb9, 0x28, 0x35, 0xb1, 0x24, 0x33, 0x3f, 0x2f, 0x3e, 0x2d, 0x35, 0x55, 0x82, 0x51, - 0x81, 0x59, 0x83, 0xdb, 0x48, 0x52, 0x0f, 0x6a, 0x2c, 0xc8, 0x20, 0x98, 0x27, 0xf4, 0x9c, 0xf3, - 0x33, 0xf3, 0x9c, 0x7c, 0x4f, 0xdc, 0x93, 0x67, 0xf8, 0x74, 0x4f, 0x5e, 0xb2, 0x32, 0x31, 0x37, - 0xc7, 0x4a, 0x09, 0xd3, 0x08, 0xa5, 0x55, 0xf7, 0xe5, 0x35, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, - 0xf4, 0x92, 0xf3, 0x73, 0xa1, 0x0e, 0x84, 0x52, 0xba, 0xc5, 0x29, 0xd9, 0xfa, 0x25, 0x95, 0x05, - 0xa9, 0xc5, 0x60, 0xd3, 0x8a, 0x83, 0x04, 0xc0, 0x06, 0x38, 0x43, 0xf5, 0xbb, 0xa5, 0xa6, 0x3a, - 0x05, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, - 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x05, 0x92, 0xa9, 0xd0, - 0x90, 0xd3, 0xcd, 0x49, 0x4c, 0x2a, 0x86, 0x71, 0xf4, 0xcb, 0x0c, 0x4d, 0xf5, 0x2b, 0x50, 0x03, - 0x13, 0x6c, 0x57, 0x12, 0x1b, 0xd8, 0xfb, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x98, 0x20, - 0x9a, 0x6f, 0xd0, 0x01, 0x00, 0x00, + // 355 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xbf, 0x6e, 0xea, 0x30, + 0x14, 0xc6, 0x63, 0xee, 0x15, 0x43, 0xee, 0x72, 0x15, 0x55, 0x2a, 0xa0, 0xca, 0xa1, 0x99, 0x60, + 0x20, 0x16, 0xfd, 0x23, 0x55, 0x1d, 0x41, 0x6a, 0x27, 0xa4, 0x8a, 0xb1, 0x4b, 0x74, 0x12, 0x4c, + 0x88, 0x20, 0x39, 0x28, 0x36, 0xa8, 0x79, 0x84, 0x6e, 0x9d, 0xfa, 0x10, 0x7d, 0x12, 0x46, 0xc6, + 0x4e, 0x69, 0x05, 0x6f, 0xc0, 0x13, 0x54, 0x38, 0xa6, 0x82, 0xb6, 0xea, 0x64, 0x1f, 0x9d, 0xef, + 0xfb, 0xf9, 0x3b, 0x3e, 0x66, 0x13, 0x45, 0x8c, 0x22, 0x12, 0x4c, 0xe2, 0x98, 0x27, 0x43, 0x08, + 0x24, 0xa6, 0x19, 0x9b, 0xb7, 0x7d, 0x2e, 0xa1, 0xcd, 0xa6, 0x90, 0x42, 0x2c, 0xdc, 0x69, 0x8a, + 0x12, 0xad, 0x13, 0x2d, 0x75, 0xf7, 0xa5, 0xae, 0x96, 0xd6, 0x8e, 0x42, 0x0c, 0x51, 0x09, 0xd9, + 0xf6, 0x56, 0x78, 0x6a, 0x17, 0xbf, 0xe2, 0x61, 0x26, 0x47, 0x98, 0x46, 0x32, 0xeb, 0x71, 0x09, + 0x03, 0x90, 0xa0, 0x5d, 0xd5, 0x40, 0xd9, 0xbc, 0x02, 0x57, 0x14, 0xba, 0x45, 0x8b, 0x8a, 0xf9, + 0x20, 0xf8, 0x27, 0x27, 0xc0, 0x28, 0x29, 0xfa, 0xce, 0x63, 0xc9, 0x2c, 0xdf, 0xa9, 0xd4, 0xd6, + 0x33, 0x31, 0xad, 0x01, 0x4f, 0x30, 0xf6, 0x82, 0x94, 0x83, 0x8c, 0x30, 0xf1, 0x86, 0x9c, 0x57, + 0x48, 0xfd, 0x4f, 0xe3, 0xdf, 0x59, 0xd5, 0xd5, 0xd8, 0x2d, 0x68, 0x37, 0x84, 0xdb, 0xc5, 0x28, + 0xe9, 0xf4, 0x16, 0xb9, 0x6d, 0x6c, 0x72, 0xbb, 0x9a, 0x41, 0x3c, 0xb9, 0x76, 0xbe, 0x23, 0x9c, + 0x97, 0x37, 0xbb, 0x11, 0x46, 0x72, 0x34, 0xf3, 0xdd, 0x00, 0x63, 0x1d, 0x50, 0x1f, 0x2d, 0x31, + 0x18, 0x33, 0x99, 0x4d, 0xb9, 0x50, 0x34, 0xd1, 0xff, 0xaf, 0x00, 0x5d, 0xed, 0xbf, 0xe1, 0xdc, + 0x1a, 0x9a, 0xb5, 0x2f, 0xd0, 0x10, 0x84, 0x17, 0x60, 0x22, 0x66, 0x31, 0xaf, 0x94, 0xea, 0xa4, + 0xf1, 0xb7, 0xd3, 0x5c, 0xe4, 0x36, 0xd9, 0xe4, 0xf6, 0xe9, 0x8f, 0x21, 0xf6, 0xf4, 0x4e, 0xff, + 0xf8, 0xe0, 0x81, 0x5b, 0x10, 0xdd, 0xa2, 0xd3, 0xe9, 0x2f, 0x56, 0x94, 0x2c, 0x57, 0x94, 0xbc, + 0xaf, 0x28, 0x79, 0x5a, 0x53, 0x63, 0xb9, 0xa6, 0xc6, 0xeb, 0x9a, 0x1a, 0xf7, 0x57, 0x7b, 0xe9, + 0xf5, 0x86, 0x5a, 0x13, 0xf0, 0xc5, 0xae, 0x60, 0xf3, 0xf6, 0x25, 0x7b, 0x38, 0x5c, 0x9a, 0x9a, + 0xc9, 0x2f, 0xab, 0x6f, 0x3e, 0xff, 0x08, 0x00, 0x00, 0xff, 0xff, 0x34, 0xd9, 0xad, 0x98, 0x38, + 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -123,6 +141,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.DenomCreationGasConsume != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.DenomCreationGasConsume)) + i-- + dAtA[i] = 0x10 + } if len(m.DenomCreationFee) > 0 { for iNdEx := len(m.DenomCreationFee) - 1; iNdEx >= 0; iNdEx-- { { @@ -163,6 +186,9 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) } } + if m.DenomCreationGasConsume != 0 { + n += 1 + sovParams(uint64(m.DenomCreationGasConsume)) + } return n } @@ -235,6 +261,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomCreationGasConsume", wireType) + } + m.DenomCreationGasConsume = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DenomCreationGasConsume |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:])