diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ba7d5f61f70..c1a0e1e7989 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,4 @@ name: Test - on: workflow_call: pull_request: @@ -126,35 +125,39 @@ jobs: - uses: actions/setup-go@v4 with: go-version: 1.18 - - name: Install GaiaV8 + - name: Install GaiaV9 run: | - git checkout v8.0.0 + git checkout v9.1.0 make build - cp ./build/gaiad ./build/gaiad8 + cp ./build/gaiad ./build/gaiad9 go clean -modcache if: env.GIT_DIFF - uses: actions/setup-go@v4 with: go-version: 1.20.x - - name: Install GaiaV9 + - name: Install GaiaV10 run: | git checkout - make build - cp ./build/gaiad ./build/gaiad9 + cp ./build/gaiad ./build/gaiad10 if: env.GIT_DIFF - name: Install Cosmovisor run: | go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@latest if: env.GIT_DIFF - - name: Start GaiaV8 + - name: Start GaiaV9 run: | - ./contrib/scripts/run-gaia-v8.sh > v8.out 2>&1 & + go env GOPATH + ./contrib/scripts/run-gaia-v9.sh if: env.GIT_DIFF - name: Submit Upgrade Commands run: | - ./contrib/scripts/run-upgrade-commands.sh 15 + ./contrib/scripts/run-upgrade-commands-v10.sh 15 if: env.GIT_DIFF - name: Check for successful upgrade run: | ./contrib/scripts/test_upgrade.sh 20 5 16 localhost if: env.GIT_DIFF + - name: Check for successful migration + run: | + ./contrib/scripts/test_migration.sh localhost diff --git a/CHANGELOG.md b/CHANGELOG.md index 84f8fc1181b..12d3a9235dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,10 +41,11 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (gaia) [#2442](https://github.com/cosmos/gaia/pull/2442) Bump [Interchain-Security](https://github.com/cosmos/interchain-security) to [v1.1.1](https://github.com/cosmos/interchain-security/tree/v1.1.1). ### State Machine Breaking -* (feat!) [#2424] Add `bypass-min-fee-msg-types` and `maxTotalBypassMinFeeMsgGagUsage` to globalfee params. Note that this change is both state breaking and API breaking. * (gaia) Bump Golang prerequisite from 1.18 to 1.20 see (https://go.dev/blog/go1.20) for details. -* (feat!) [#2447] Update Global Fee's AnteHandler to check tx fees against the network min gas prices in DeliverTx mode. - +* (feat!) [#2424](https://github.com/cosmos/gaia/pull/2424) Add `bypass-min-fee-msg-types` and `maxTotalBypassMinFeeMsgGagUsage` to globalfee params. Note that this change is both state breaking and API breaking. The previous API endpoint was "/gaia/globalfee/v1beta1/minimum_gas_prices," and the new API endpoint is "/gaia/globalfee/v1beta1/params." +* (feat!) [#2352](https://github.com/cosmos/gaia/pull/2352) Create the upgrade handler and params migration for the new Gloabal Fee module parameters introduced in [#2424](https://github.com/cosmos/gaia/pull/2424). +Update the CI upgrade tests from v9 to the v10 and check that the parameters are successfully migrated. +* (feat!) [#2447](https://github.com/cosmos/gaia/pull/2447) Update Global Fee's AnteHandler to check tx fees against the network min gas prices in DeliverTx mode. ## [v9.0.3] - 2023-04-19 * (deps) [#2399](https://github.com/cosmos/gaia/pull/2399) Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.45.15-ics](https://github.com/cosmos/cosmos diff --git a/ante/ante.go b/ante/ante.go index 3adc9605fdb..1e71613324f 100644 --- a/ante/ante.go +++ b/ante/ante.go @@ -10,19 +10,18 @@ import ( ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante" ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper" - gaiafeeante "github.com/cosmos/gaia/v9/x/globalfee/ante" + gaiafeeante "github.com/cosmos/gaia/v10/x/globalfee/ante" ) // HandlerOptions extend the SDK's AnteHandler options by requiring the IBC // channel keeper. type HandlerOptions struct { ante.HandlerOptions - Codec codec.BinaryCodec - GovKeeper *govkeeper.Keeper - IBCkeeper *ibckeeper.Keeper - BypassMinFeeMsgTypes []string - GlobalFeeSubspace paramtypes.Subspace - StakingSubspace paramtypes.Subspace + Codec codec.BinaryCodec + GovKeeper *govkeeper.Keeper + IBCkeeper *ibckeeper.Keeper + GlobalFeeSubspace paramtypes.Subspace + StakingSubspace paramtypes.Subspace } func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) { diff --git a/ante/gov_ante_test.go b/ante/gov_ante_test.go index 14c86948dc2..bfce1c89804 100644 --- a/ante/gov_ante_test.go +++ b/ante/gov_ante_test.go @@ -10,12 +10,13 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/testutil/testdata" - "github.com/cosmos/gaia/v9/ante" - gaiahelpers "github.com/cosmos/gaia/v9/app/helpers" tmrand "github.com/tendermint/tendermint/libs/rand" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - gaiaapp "github.com/cosmos/gaia/v9/app" + "github.com/cosmos/gaia/v10/ante" + gaiahelpers "github.com/cosmos/gaia/v10/app/helpers" + + gaiaapp "github.com/cosmos/gaia/v10/app" ) var ( diff --git a/app/app.go b/app/app.go index 6a8650bebae..111826514f9 100644 --- a/app/app.go +++ b/app/app.go @@ -28,8 +28,6 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" - ibcchanneltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" ibctesting "github.com/cosmos/interchain-security/legacy_ibc_testing/testing" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" @@ -40,12 +38,12 @@ import ( tmos "github.com/tendermint/tendermint/libs/os" dbm "github.com/tendermint/tm-db" - gaiaante "github.com/cosmos/gaia/v9/ante" - "github.com/cosmos/gaia/v9/app/keepers" - gaiaappparams "github.com/cosmos/gaia/v9/app/params" - "github.com/cosmos/gaia/v9/app/upgrades" - v9 "github.com/cosmos/gaia/v9/app/upgrades/v9" - "github.com/cosmos/gaia/v9/x/globalfee" + gaiaante "github.com/cosmos/gaia/v10/ante" + "github.com/cosmos/gaia/v10/app/keepers" + gaiaappparams "github.com/cosmos/gaia/v10/app/params" + "github.com/cosmos/gaia/v10/app/upgrades" + v10 "github.com/cosmos/gaia/v10/app/upgrades/v10" + "github.com/cosmos/gaia/v10/x/globalfee" // unnamed import of statik for swagger UI support _ "github.com/cosmos/cosmos-sdk/client/docs/statik" @@ -55,7 +53,7 @@ var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - Upgrades = []upgrades.Upgrade{v9.Upgrade} + Upgrades = []upgrades.Upgrade{v10.Upgrade} ) var ( @@ -188,19 +186,6 @@ func NewGaiaApp( app.MountTransientStores(app.GetTransientStoreKey()) app.MountMemoryStores(app.GetMemoryStoreKey()) - var bypassMinFeeMsgTypes []string - bypassMinFeeMsgTypesOptions := appOpts.Get(gaiaappparams.BypassMinFeeMsgTypesKey) - if bypassMinFeeMsgTypesOptions == nil { - bypassMinFeeMsgTypes = GetDefaultBypassFeeMessages() - } else { - bypassMinFeeMsgTypes = cast.ToStringSlice(bypassMinFeeMsgTypesOptions) - } - - if err := app.ValidateBypassFeeMsgTypes(bypassMinFeeMsgTypes); err != nil { - app.Logger().Error("invalid 'bypass-min-fee-msg-types' config option", "error", err) - panic(fmt.Sprintf("invalid 'bypass-min-fee-msg-types' config option: %s", err)) - } - anteHandler, err := gaiaante.NewAnteHandler( gaiaante.HandlerOptions{ HandlerOptions: ante.HandlerOptions{ @@ -210,12 +195,11 @@ func NewGaiaApp( SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, - Codec: appCodec, - IBCkeeper: app.IBCKeeper, - GovKeeper: &app.GovKeeper, - BypassMinFeeMsgTypes: bypassMinFeeMsgTypes, - GlobalFeeSubspace: app.GetSubspace(globalfee.ModuleName), - StakingSubspace: app.GetSubspace(stakingtypes.ModuleName), + Codec: appCodec, + IBCkeeper: app.IBCKeeper, + GovKeeper: &app.GovKeeper, + GlobalFeeSubspace: app.GetSubspace(globalfee.ModuleName), + StakingSubspace: app.GetSubspace(stakingtypes.ModuleName), }, ) if err != nil { @@ -239,27 +223,6 @@ func NewGaiaApp( return app } -func GetDefaultBypassFeeMessages() []string { - return []string{ - sdk.MsgTypeURL(&ibcchanneltypes.MsgRecvPacket{}), - sdk.MsgTypeURL(&ibcchanneltypes.MsgAcknowledgement{}), - sdk.MsgTypeURL(&ibcclienttypes.MsgUpdateClient{}), - sdk.MsgTypeURL(&ibcchanneltypes.MsgTimeout{}), - sdk.MsgTypeURL(&ibcchanneltypes.MsgTimeoutOnClose{}), - } -} - -// ValidateBypassFeeMsgTypes checks that a proto message type exists for all MsgTypes in bypassMinFeeMsgTypes -// An error is returned for the first msgType that cannot be resolved -func (app *GaiaApp) ValidateBypassFeeMsgTypes(bypassMinFeeMsgTypes []string) error { - for _, msgType := range bypassMinFeeMsgTypes { - if _, err := app.interfaceRegistry.Resolve(msgType); err != nil { - return err - } - } - return nil -} - // Name returns the name of the App func (app *GaiaApp) Name() string { return app.BaseApp.Name() } diff --git a/app/app_test.go b/app/app_test.go index 3f3e6b6ae33..8695eecfc4d 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -5,11 +5,12 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - gaia "github.com/cosmos/gaia/v9/app" - gaiahelpers "github.com/cosmos/gaia/v9/app/helpers" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" db "github.com/tendermint/tm-db" + + gaia "github.com/cosmos/gaia/v10/app" + gaiahelpers "github.com/cosmos/gaia/v10/app/helpers" ) type EmptyAppOptions struct{} diff --git a/app/encoding.go b/app/encoding.go index 9121c5db80c..8a08b629e03 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -3,7 +3,7 @@ package gaia import ( "github.com/cosmos/cosmos-sdk/std" - "github.com/cosmos/gaia/v9/app/params" + "github.com/cosmos/gaia/v10/app/params" ) // MakeTestEncodingConfig creates an EncodingConfig for testing. This function diff --git a/app/helpers/test_helpers.go b/app/helpers/test_helpers.go index ccf03d641b6..5de0f6228f9 100644 --- a/app/helpers/test_helpers.go +++ b/app/helpers/test_helpers.go @@ -22,7 +22,7 @@ import ( tmtypes "github.com/tendermint/tendermint/types" dbm "github.com/tendermint/tm-db" - gaiaapp "github.com/cosmos/gaia/v9/app" + gaiaapp "github.com/cosmos/gaia/v10/app" ) // SimAppChainID hardcoded chainID for simulation diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index ed7fd888550..adbd254749f 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -41,7 +41,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/upgrade" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/cosmos/gaia/v9/x/globalfee" ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts" icahost "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host" icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper" @@ -62,6 +61,8 @@ import ( routerkeeper "github.com/strangelove-ventures/packet-forward-middleware/v4/router/keeper" routertypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types" + "github.com/cosmos/gaia/v10/x/globalfee" + // unnamed import of statik for swagger UI support _ "github.com/cosmos/cosmos-sdk/client/docs/statik" ) diff --git a/app/modules.go b/app/modules.go index a8d24548aaa..38d84bc3fca 100644 --- a/app/modules.go +++ b/app/modules.go @@ -53,8 +53,8 @@ import ( "github.com/strangelove-ventures/packet-forward-middleware/v4/router" routertypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types" - gaiaappparams "github.com/cosmos/gaia/v9/app/params" - "github.com/cosmos/gaia/v9/x/globalfee" + gaiaappparams "github.com/cosmos/gaia/v10/app/params" + "github.com/cosmos/gaia/v10/x/globalfee" ) var maccPerms = map[string][]string{ diff --git a/app/params/config.go b/app/params/config.go deleted file mode 100644 index 883330c37c3..00000000000 --- a/app/params/config.go +++ /dev/null @@ -1,55 +0,0 @@ -package params - -import ( - "strings" - - serverconfig "github.com/cosmos/cosmos-sdk/server/config" -) - -var ( - // BypassMinFeeMsgTypesKey defines the configuration key for the - // BypassMinFeeMsgTypes value. - //nolint: gosec - BypassMinFeeMsgTypesKey = "bypass-min-fee-msg-types" - - // customGaiaConfigTemplate defines Gaia's custom application configuration TOML template. - customGaiaConfigTemplate = ` -############################################################################### -### Custom Gaia Configuration ### -############################################################################### -# bypass-min-fee-msg-types defines custom message types the operator may set that -# will bypass minimum fee checks during CheckTx. -# NOTE: -# bypass-min-fee-msg-types = [] will deactivate the bypass - no messages will be allowed to bypass the minimum fee check -# bypass-min-fee-msg-types = [...] will allow messages of specified type to bypass the minimum fee check -# removing bypass-min-fee-msg-types from the config file will apply the default values: -# ["/ibc.core.channel.v1.MsgRecvPacket", "/ibc.core.channel.v1.MsgAcknowledgement", "/ibc.core.client.v1.MsgUpdateClient"] -# -# Example: -# bypass-min-fee-msg-types = ["/ibc.core.channel.v1.MsgRecvPacket", "/ibc.core.channel.v1.MsgAcknowledgement", "/ibc.core.client.v1.MsgUpdateClient"] -bypass-min-fee-msg-types = [{{ range .BypassMinFeeMsgTypes }}{{ printf "%q, " . }}{{end}}] -` -) - -// CustomConfigTemplate defines Gaia's custom application configuration TOML -// template. It extends the core SDK template. -func CustomConfigTemplate() string { - config := serverconfig.DefaultConfigTemplate - lines := strings.Split(config, "\n") - // add the Gaia config at the second line of the file - lines[2] += customGaiaConfigTemplate - return strings.Join(lines, "\n") -} - -// CustomAppConfig defines Gaia's custom application configuration. -type CustomAppConfig struct { - serverconfig.Config - - // BypassMinFeeMsgTypes defines custom message types the operator may set that - // will bypass minimum fee checks during CheckTx. - // NOTE: - // bypass-min-fee-msg-types = [] will deactivate the bypass - no messages will be allowed to bypass the minimum fee check - // bypass-min-fee-msg-types = [] will allow messages of specified type to bypass the minimum fee check - // omitting bypass-min-fee-msg-types from the config file will use the default values: ["/ibc.core.channel.v1.MsgRecvPacket", "/ibc.core.channel.v1.MsgAcknowledgement", "/ibc.core.client.v1.MsgUpdateClient"] - BypassMinFeeMsgTypes []string `mapstructure:"bypass-min-fee-msg-types"` -} diff --git a/app/sim/sim_state.go b/app/sim/sim_state.go index d3d0227511f..4b828f03cae 100644 --- a/app/sim/sim_state.go +++ b/app/sim/sim_state.go @@ -8,11 +8,11 @@ import ( "os" "time" - "github.com/cosmos/gaia/v9/app" - tmjson "github.com/tendermint/tendermint/libs/json" tmtypes "github.com/tendermint/tendermint/types" + gaia "github.com/cosmos/gaia/v10/app" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" simappparams "github.com/cosmos/cosmos-sdk/simapp/params" diff --git a/app/sim/sim_utils.go b/app/sim/sim_utils.go index 1d7b175c7fc..3e910a43c5c 100644 --- a/app/sim/sim_utils.go +++ b/app/sim/sim_utils.go @@ -5,11 +5,11 @@ import ( "fmt" "os" - "github.com/cosmos/gaia/v9/app" - "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" + gaia "github.com/cosmos/gaia/v10/app" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp/helpers" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/app/sim_test.go b/app/sim_test.go index b19398dc436..240d89cec2e 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -16,10 +16,10 @@ import ( "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" - gaia "github.com/cosmos/gaia/v9/app" - "github.com/cosmos/gaia/v9/app/helpers" - "github.com/cosmos/gaia/v9/app/params" - "github.com/cosmos/gaia/v9/app/sim" + gaia "github.com/cosmos/gaia/v10/app" + "github.com/cosmos/gaia/v10/app/helpers" + "github.com/cosmos/gaia/v10/app/params" + "github.com/cosmos/gaia/v10/app/sim" ) func init() { diff --git a/app/upgrades/types.go b/app/upgrades/types.go index f0a28fa0035..adff1558b18 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/cosmos/gaia/v9/app/keepers" + "github.com/cosmos/gaia/v10/app/keepers" ) // Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal diff --git a/app/upgrades/v10/constants.go b/app/upgrades/v10/constants.go new file mode 100644 index 00000000000..2bd6941c96e --- /dev/null +++ b/app/upgrades/v10/constants.go @@ -0,0 +1,15 @@ +package v10 + +import ( + "github.com/cosmos/gaia/v10/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name. + UpgradeName = "v10" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, +} diff --git a/app/upgrades/v10/upgrades.go b/app/upgrades/v10/upgrades.go new file mode 100644 index 00000000000..d4fdb58159c --- /dev/null +++ b/app/upgrades/v10/upgrades.go @@ -0,0 +1,27 @@ +package v10 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/gaia/v10/app/keepers" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("Starting module migrations...") + + vm, err := mm.RunMigrations(ctx, configurator, vm) + if err != nil { + return vm, err + } + + ctx.Logger().Info("Upgrade complete") + return vm, err + } +} diff --git a/app/upgrades/v7/constants.go b/app/upgrades/v7/constants.go index 8090f57df82..7cb75e521bd 100644 --- a/app/upgrades/v7/constants.go +++ b/app/upgrades/v7/constants.go @@ -4,7 +4,7 @@ import ( store "github.com/cosmos/cosmos-sdk/store/types" icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types" - "github.com/cosmos/gaia/v9/app/upgrades" + "github.com/cosmos/gaia/v10/app/upgrades" ) const ( diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go index 3ba7db9affd..0481db24501 100644 --- a/app/upgrades/v7/upgrades.go +++ b/app/upgrades/v7/upgrades.go @@ -9,7 +9,7 @@ import ( icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types" - "github.com/cosmos/gaia/v9/app/keepers" + "github.com/cosmos/gaia/v10/app/keepers" ) func CreateUpgradeHandler( diff --git a/app/upgrades/v8/constants.go b/app/upgrades/v8/constants.go index 0dd9b2bd261..2b9b702eb67 100644 --- a/app/upgrades/v8/constants.go +++ b/app/upgrades/v8/constants.go @@ -3,8 +3,8 @@ package v8 import ( store "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cosmos/gaia/v9/app/upgrades" - "github.com/cosmos/gaia/v9/x/globalfee" + "github.com/cosmos/gaia/v10/app/upgrades" + "github.com/cosmos/gaia/v10/x/globalfee" ) const ( diff --git a/app/upgrades/v8/upgrades.go b/app/upgrades/v8/upgrades.go index 506df1fc179..f562ce5b419 100644 --- a/app/upgrades/v8/upgrades.go +++ b/app/upgrades/v8/upgrades.go @@ -13,7 +13,7 @@ import ( icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types" ibcchanneltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" - "github.com/cosmos/gaia/v9/app/keepers" + "github.com/cosmos/gaia/v10/app/keepers" ) func FixBankMetadata(ctx sdk.Context, keepers *keepers.AppKeepers) error { diff --git a/app/upgrades/v9/constants.go b/app/upgrades/v9/constants.go index d3afa97871a..5f57de44808 100644 --- a/app/upgrades/v9/constants.go +++ b/app/upgrades/v9/constants.go @@ -4,7 +4,7 @@ import ( store "github.com/cosmos/cosmos-sdk/store/types" ccvprovider "github.com/cosmos/interchain-security/x/ccv/provider/types" - "github.com/cosmos/gaia/v9/app/upgrades" + "github.com/cosmos/gaia/v10/app/upgrades" ) const ( diff --git a/app/upgrades/v9/upgrades.go b/app/upgrades/v9/upgrades.go index 44a20a120ac..8d4c950c682 100644 --- a/app/upgrades/v9/upgrades.go +++ b/app/upgrades/v9/upgrades.go @@ -4,7 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/cosmos/gaia/v9/app/keepers" + + "github.com/cosmos/gaia/v10/app/keepers" ) func CreateUpgradeHandler( diff --git a/cmd/gaiad/cmd/bech32_convert.go b/cmd/gaiad/cmd/bech32_convert.go index 29e5243ce15..3b54ce42c7b 100644 --- a/cmd/gaiad/cmd/bech32_convert.go +++ b/cmd/gaiad/cmd/bech32_convert.go @@ -3,7 +3,7 @@ package cmd import ( "fmt" - addressutil "github.com/cosmos/gaia/v9/pkg/address" + addressutil "github.com/cosmos/gaia/v10/pkg/address" "github.com/spf13/cobra" ) diff --git a/cmd/gaiad/cmd/root.go b/cmd/gaiad/cmd/root.go index 2183e7fac6c..f727db37ae5 100644 --- a/cmd/gaiad/cmd/root.go +++ b/cmd/gaiad/cmd/root.go @@ -30,8 +30,8 @@ import ( "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" - gaia "github.com/cosmos/gaia/v9/app" - "github.com/cosmos/gaia/v9/app/params" + gaia "github.com/cosmos/gaia/v10/app" + "github.com/cosmos/gaia/v10/app/params" ) // NewRootCmd creates a new root command for simd. It is called once in the @@ -81,10 +81,7 @@ func initAppConfig() (string, interface{}) { srvCfg.StateSync.SnapshotInterval = 1000 srvCfg.StateSync.SnapshotKeepRecent = 10 - return params.CustomConfigTemplate(), params.CustomAppConfig{ - Config: *srvCfg, - BypassMinFeeMsgTypes: gaia.GetDefaultBypassFeeMessages(), - } + return serverconfig.DefaultConfigTemplate, *srvCfg } func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { diff --git a/cmd/gaiad/cmd/root_test.go b/cmd/gaiad/cmd/root_test.go index 2e811f450f2..3bf150175cb 100644 --- a/cmd/gaiad/cmd/root_test.go +++ b/cmd/gaiad/cmd/root_test.go @@ -6,8 +6,8 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/stretchr/testify/require" - app "github.com/cosmos/gaia/v9/app" - "github.com/cosmos/gaia/v9/cmd/gaiad/cmd" + app "github.com/cosmos/gaia/v10/app" + "github.com/cosmos/gaia/v10/cmd/gaiad/cmd" ) func TestRootCmdConfig(t *testing.T) { diff --git a/cmd/gaiad/cmd/testnet.go b/cmd/gaiad/cmd/testnet.go index 10210d103ec..997ebfed7fc 100644 --- a/cmd/gaiad/cmd/testnet.go +++ b/cmd/gaiad/cmd/testnet.go @@ -30,11 +30,8 @@ import ( tmrand "github.com/tendermint/tendermint/libs/rand" "github.com/tendermint/tendermint/types" tmtime "github.com/tendermint/tendermint/types/time" - // ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" // ibcchanneltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" - - "github.com/cosmos/gaia/v9/app/params" ) var ( @@ -149,9 +146,7 @@ func InitTestnet( nodeIDs := make([]string, numValidators) valPubKeys := make([]cryptotypes.PubKey, numValidators) - simappConfig := params.CustomAppConfig{ - Config: *srvconfig.DefaultConfig(), - } + simappConfig := *srvconfig.DefaultConfig() simappConfig.MinGasPrices = minGasPrices simappConfig.API.Enable = true simappConfig.Telemetry.Enabled = true diff --git a/cmd/gaiad/main.go b/cmd/gaiad/main.go index 093b19cfaa9..40fb174d1ca 100644 --- a/cmd/gaiad/main.go +++ b/cmd/gaiad/main.go @@ -6,8 +6,8 @@ import ( "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - app "github.com/cosmos/gaia/v9/app" - "github.com/cosmos/gaia/v9/cmd/gaiad/cmd" + app "github.com/cosmos/gaia/v10/app" + "github.com/cosmos/gaia/v10/cmd/gaiad/cmd" ) func main() { diff --git a/contrib/scripts/run-gaia-v9.sh b/contrib/scripts/run-gaia-v9.sh new file mode 100755 index 00000000000..52267a211b7 --- /dev/null +++ b/contrib/scripts/run-gaia-v9.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +set -o errexit -o nounset + +NODE_HOME=$(realpath ./build/.gaia) +echo "NODE_HOME = ${NODE_HOME}" +BINARY=$NODE_HOME/cosmovisor/genesis/bin/gaiad +echo "BINARY = ${BINARY}" +CHAINID=cosmoshub-4 + +USER_MNEMONIC="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art" + +if ! test -f "./build/gaiad9"; then + echo "gaiad v9 does not exist" + exit +fi + + +rm -rf ./build/.gaia + +mkdir -p "$NODE_HOME"/cosmovisor/genesis/bin +cp ./build/gaiad9 "$NODE_HOME"/cosmovisor/genesis/bin/gaiad +$BINARY init upgrader --chain-id $CHAINID --home "$NODE_HOME" + + +if ! test -f "./build/gaiad10"; then + echo "gaiad v10 does not exist" + exit +fi + +mkdir -p "$NODE_HOME"/cosmovisor/upgrades/v10/bin +cp ./build/gaiad10 "$NODE_HOME"/cosmovisor/upgrades/v10/bin/gaiad + +GOPATH=$(go env GOPATH) + +export DAEMON_NAME=gaiad +export DAEMON_HOME=$NODE_HOME +COSMOVISOR=$GOPATH/bin/cosmovisor + + +$BINARY config chain-id $CHAINID --home $NODE_HOME +$BINARY config keyring-backend test --home $NODE_HOME +tmp=$(mktemp) + +# add bank part of genesis +jq --argjson foo "$(jq -c '.' contrib/denom.json)" '.app_state.bank.denom_metadata = $foo' $NODE_HOME/config/genesis.json > "$tmp" && mv "$tmp" $NODE_HOME/config/genesis.json + +# replace default stake token with uatom +sed -i -e 's/stake/uatom/g' $NODE_HOME/config/genesis.json +# min deposition amount (this one isn't working) +sed -i -e 's%"amount": "10000000",%"amount": "1",%g' $NODE_HOME/config/genesis.json +# min voting power that a proposal requires in order to be a valid proposal +sed -i -e 's%"quorum": "0.334000000000000000",%"quorum": "0.000000000000000001",%g' $NODE_HOME/config/genesis.json +# the minimum proportion of "yes" votes requires for the proposal to pass +sed -i -e 's%"threshold": "0.500000000000000000",%"threshold": "0.000000000000000001",%g' $NODE_HOME/config/genesis.json +# voting period to 30s +sed -i -e 's%"voting_period": "172800s"%"voting_period": "30s"%g' $NODE_HOME/config/genesis.json + +echo $USER_MNEMONIC | $BINARY --home $NODE_HOME keys add val --recover --keyring-backend=test +$BINARY add-genesis-account val 10000000000000000000000000uatom --home $NODE_HOME --keyring-backend test +$BINARY gentx val 1000000000uatom --home $NODE_HOME --chain-id $CHAINID +$BINARY collect-gentxs --home $NODE_HOME + +sed -i.bak'' 's/minimum-gas-prices = ""/minimum-gas-prices = "0uatom"/' $NODE_HOME/config/app.toml + +perl -i~ -0777 -pe 's/# Enable defines if the API server should be enabled. +enable = false/# Enable defines if the API server should be enabled. +enable = true/g' $NODE_HOME/config/app.toml + +pwd +ls $NODE_HOME + +$COSMOVISOR run start --home $NODE_HOME --x-crisis-skip-assert-invariants > v9.out 2>&1 & + diff --git a/contrib/scripts/run-upgrade-commands-v10.sh b/contrib/scripts/run-upgrade-commands-v10.sh new file mode 100755 index 00000000000..26fb52b07e0 --- /dev/null +++ b/contrib/scripts/run-upgrade-commands-v10.sh @@ -0,0 +1,76 @@ +#!/bin/sh + +set -o errexit -o nounset + +UPGRADE_HEIGHT=$1 + +if [ -z "$1" ]; then + echo "Need to add an upgrade height" + exit 1 +fi + +NODE_HOME=$(realpath ./build/.gaia) + +echo "NODE_HOME = ${NODE_HOME}" + +BINARY=$NODE_HOME/cosmovisor/genesis/bin/gaiad +echo "BINARY = ${BINARY}" + +$BINARY version + +USER_MNEMONIC="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art" +CHAINID=cosmoshub-4 + +if test -f "$BINARY"; then + + echo "wait 10 seconds for blockchain to start" + sleep 10 + + $BINARY config chain-id $CHAINID --home $NODE_HOME + $BINARY config output json --home $NODE_HOME + $BINARY config keyring-backend test --home $NODE_HOME + $BINARY config --home $NODE_HOME + + + key=$($BINARY keys show val --home $NODE_HOME) + if [ -z "$key" ]; then + echo $USER_MNEMONIC | $BINARY --home $NODE_HOME keys add val --recover --keyring-backend=test + fi + + + echo "\n" + echo "Submitting proposal... \n" + $BINARY tx gov submit-proposal software-upgrade v10 \ + --title v10 \ + --deposit 10000000uatom \ + --upgrade-height $UPGRADE_HEIGHT \ + --upgrade-info "upgrade to v10" \ + --description "upgrade to v10" \ + --gas auto \ + --fees 400uatom \ + --from val \ + --keyring-backend test \ + --chain-id $CHAINID \ + --home $NODE_HOME \ + --node tcp://localhost:26657 \ + --yes + echo "Done \n" + + sleep 6 + echo "Casting vote... \n" + + $BINARY tx gov vote 1 yes \ + --from val \ + --keyring-backend test \ + --chain-id $CHAINID \ + --home $NODE_HOME \ + --gas auto \ + --fees 400uatom \ + --node tcp://localhost:26657 \ + --yes + + echo "Done \n" + +else + echo "Please build gaia v9 and move to ./build/gaiad9" +fi diff --git a/contrib/scripts/run-upgrade-commands.sh b/contrib/scripts/run-upgrade-commands.sh index c4b952ffe5b..fa8b5922cab 100755 --- a/contrib/scripts/run-upgrade-commands.sh +++ b/contrib/scripts/run-upgrade-commands.sh @@ -35,7 +35,6 @@ if test -f "$BINARY"; then echo $USER_MNEMONIC | $BINARY --home $NODE_HOME keys add val --recover --keyring-backend=test fi - # $BINARY keys list --home $NODE_HOME echo "\n" echo "Submitting proposal... \n" diff --git a/contrib/scripts/test_migration.sh b/contrib/scripts/test_migration.sh new file mode 100755 index 00000000000..60ad12304d1 --- /dev/null +++ b/contrib/scripts/test_migration.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +NODEADDR=$1 + +# Define default global fee module's params +# according to gaia/x/globalfee/types/params.go +default_globalfee_params=' +{ + "params": { + "minimum_gas_prices": [], + "bypass_min_fee_msg_types": [ + "/ibc.core.channel.v1.MsgRecvPacket", + "/ibc.core.channel.v1.MsgAcknowledgement", + "/ibc.core.client.v1.MsgUpdateClient", + "/ibc.core.channel.v1.MsgTimeout", + "/ibc.core.channel.v1.MsgTimeoutOnClose" + ], + "max_total_bypass_min_fee_msg_gas_usage": "1000000" + } +}' + +# Get current global fee default params +curr_params=$(curl -s $NODEADDR:1317/gaia/globalfee/v1beta1/params) + +# Check if retrieved params are equal to expected default params +DIFF=$(diff <(echo ${default_globalfee_params} | jq --sort-keys .) <(echo ${curr_params} | jq --sort-keys .)) + +if [ "$DIFF" != "" ] +then + printf "expected default global fee params:\n${DIFF}" + exit 1 +fi diff --git a/contrib/single-node.sh b/contrib/single-node.sh index 9570b1a15fb..ae22fb1a012 100755 --- a/contrib/single-node.sh +++ b/contrib/single-node.sh @@ -25,10 +25,12 @@ gaiad gentx validator 5000000000stake --keyring-backend="test" --chain-id $CHAIN gaiad collect-gentxs # Set proper defaults and change ports -sed -i 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' ~/.gaia/config/config.toml -sed -i 's/timeout_commit = "5s"/timeout_commit = "1s"/g' ~/.gaia/config/config.toml -sed -i 's/timeout_propose = "3s"/timeout_propose = "1s"/g' ~/.gaia/config/config.toml -sed -i 's/index_all_keys = false/index_all_keys = true/g' ~/.gaia/config/config.toml +echo "Setting rpc listen address" +sed -i '' 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' ~/.gaia/config/config.toml +echo 2 +sed -i '' 's/timeout_commit = "5s"/timeout_commit = "1s"/g' ~/.gaia/config/config.toml +sed -i '' 's/timeout_propose = "3s"/timeout_propose = "1s"/g' ~/.gaia/config/config.toml +sed -i '' 's/index_all_keys = false/index_all_keys = true/g' ~/.gaia/config/config.toml # Start the gaia gaiad start --pruning=nothing diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index e2f17b2f6b5..6a2ef421170 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -45,9 +45,7 @@ Query/MinimumGasPrices RPC method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `minimum_gas_prices` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | repeated | | -| `bypass_min_fee_msg_types` | [string](#string) | repeated | | -| `max_total_bypass_min_fee_msg_gas_usage` | [uint64](#uint64) | | | +| `params` | [Params](#gaia.globalfee.v1beta1.Params) | | | diff --git a/go.mod b/go.mod index 8d0b1c9a629..91f989540ab 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/cosmos/gaia/v9 +module github.com/cosmos/gaia/v10 go 1.20 @@ -16,7 +16,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/ory/dockertest/v3 v3.10.0 github.com/rakyll/statik v0.1.7 - github.com/spf13/cast v1.5.0 + github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.7.0 github.com/spf13/viper v1.15.0 github.com/strangelove-ventures/packet-forward-middleware/v4 v4.0.5 diff --git a/go.sum b/go.sum index 5ba1ab8a35c..29707674fa1 100644 --- a/go.sum +++ b/go.sum @@ -405,7 +405,7 @@ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8 github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -1209,8 +1209,8 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= -github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= +github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= diff --git a/proto/gaia/globalfee/v1beta1/genesis.proto b/proto/gaia/globalfee/v1beta1/genesis.proto index d83815a060a..93f31965214 100644 --- a/proto/gaia/globalfee/v1beta1/genesis.proto +++ b/proto/gaia/globalfee/v1beta1/genesis.proto @@ -28,6 +28,7 @@ message Params { (gogoproto.moretags) = "yaml:\"minimum_gas_prices\"", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" ]; + // bypass_min_fee_msg_types defines a list of message type urls // that are free of fee charge. repeated string bypass_min_fee_msg_types = 2 [ diff --git a/proto/gaia/globalfee/v1beta1/query.proto b/proto/gaia/globalfee/v1beta1/query.proto index 43598286976..ef1bf4b5e1a 100644 --- a/proto/gaia/globalfee/v1beta1/query.proto +++ b/proto/gaia/globalfee/v1beta1/query.proto @@ -3,7 +3,7 @@ package gaia.globalfee.v1beta1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "cosmos/base/v1beta1/coin.proto"; +import "gaia/globalfee/v1beta1/genesis.proto"; option go_package = "github.com/cosmos/gaia/x/globalfee/types"; @@ -23,13 +23,5 @@ message QueryParamsRequest {} // QueryMinimumGasPricesResponse is the response type for the // Query/MinimumGasPrices RPC method. message QueryParamsResponse { - repeated cosmos.base.v1beta1.DecCoin minimum_gas_prices = 1 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "minimum_gas_prices,omitempty", - (gogoproto.moretags) = "yaml:\"minimum_gas_prices\"", - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" - ]; - - repeated string bypass_min_fee_msg_types = 2 [(gogoproto.moretags) = "yaml:\"bypass_min_fee_msg_types\""]; - uint64 max_total_bypass_min_fee_msg_gas_usage = 3; + Params params = 1 [(gogoproto.nullable) = false]; } diff --git a/tests/e2e/chain.go b/tests/e2e/chain.go index 6524cdc3894..b825a13258f 100644 --- a/tests/e2e/chain.go +++ b/tests/e2e/chain.go @@ -12,8 +12,8 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" tmrand "github.com/tendermint/tendermint/libs/rand" - gaia "github.com/cosmos/gaia/v9/app" - "github.com/cosmos/gaia/v9/app/params" + gaia "github.com/cosmos/gaia/v10/app" + "github.com/cosmos/gaia/v10/app/params" ) const ( diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index 9fad1f1c26b..b7b46e86ec0 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -29,7 +29,6 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" - ibcchanneltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" "github.com/ory/dockertest/v3" "github.com/ory/dockertest/v3/docker" "github.com/spf13/viper" @@ -38,8 +37,6 @@ import ( tmjson "github.com/tendermint/tendermint/libs/json" "github.com/tendermint/tendermint/libs/rand" rpchttp "github.com/tendermint/tendermint/rpc/client/http" - - "github.com/cosmos/gaia/v9/app/params" ) const ( @@ -508,31 +505,8 @@ func (s *IntegrationTestSuite) initValidatorConfigs(c *chain) { appConfig.API.Enable = true appConfig.MinGasPrices = fmt.Sprintf("%s%s", minGasPrice, uatomDenom) - // srvconfig.WriteConfigFile(appCfgPath, appConfig) - appCustomConfig := params.CustomAppConfig{ - Config: *appConfig, - BypassMinFeeMsgTypes: []string{ - // todo: use ibc as example ? - sdk.MsgTypeURL(&ibcchanneltypes.MsgRecvPacket{}), - sdk.MsgTypeURL(&ibcchanneltypes.MsgAcknowledgement{}), - sdk.MsgTypeURL(&ibcclienttypes.MsgUpdateClient{}), - "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", - }, - } - - customAppTemplate := ` -############################################################################### -### Custom Gaia Configuration ### -############################################################################### -# bypass-min-fee-msg-types defines custom message types the operator may set that -# will bypass minimum fee checks during CheckTx. -# -# Example: -# ["/ibc.core.channel.v1.MsgRecvPacket", "/ibc.core.channel.v1.MsgAcknowledgement", ...] -bypass-min-fee-msg-types = ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward","/ibc.applications.transfer.v1.MsgTransfer"] -` + srvconfig.DefaultConfigTemplate - srvconfig.SetConfigTemplate(customAppTemplate) - srvconfig.WriteConfigFile(appCfgPath, appCustomConfig) + srvconfig.SetConfigTemplate(srvconfig.DefaultConfigTemplate) + srvconfig.WriteConfigFile(appCfgPath, appConfig) } } diff --git a/tests/e2e/e2e_vesting_test.go b/tests/e2e/e2e_vesting_test.go index 70f13572596..666ae146283 100644 --- a/tests/e2e/e2e_vesting_test.go +++ b/tests/e2e/e2e_vesting_test.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/gaia/v9/x/globalfee/ante" + "github.com/cosmos/gaia/v10/x/globalfee/ante" ) const ( diff --git a/tests/e2e/genesis.go b/tests/e2e/genesis.go index 55ebc05dc5b..1c84b8f28aa 100644 --- a/tests/e2e/genesis.go +++ b/tests/e2e/genesis.go @@ -14,9 +14,10 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - globfeetypes "github.com/cosmos/gaia/v9/x/globalfee/types" icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types" tmtypes "github.com/tendermint/tendermint/types" + + globfeetypes "github.com/cosmos/gaia/v10/x/globalfee/types" ) func getGenDoc(path string) (*tmtypes.GenesisDoc, error) { diff --git a/tests/e2e/query.go b/tests/e2e/query.go index 819feff91b4..2edfacd3c7b 100644 --- a/tests/e2e/query.go +++ b/tests/e2e/query.go @@ -17,7 +17,7 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/gaia/v9/x/globalfee/types" + "github.com/cosmos/gaia/v10/x/globalfee/types" ) func queryGaiaTx(endpoint, txHash string) error { @@ -74,15 +74,15 @@ func queryGaiaAllBalances(endpoint, addr string) (sdk.Coins, error) { return balancesResp.Balances, nil } -func queryGlobalFeeParams(endpoint string) (types.Params, error) { +func queryGlobalFeeParams(endpoint string) (types.QueryParamsResponse, error) { body, err := httpGet(fmt.Sprintf("%s/gaia/globalfee/v1beta1/params", endpoint)) if err != nil { - return types.Params{}, fmt.Errorf("failed to execute HTTP request: %w", err) + return types.QueryParamsResponse{}, fmt.Errorf("failed to execute HTTP request: %w", err) } - var params types.Params + var params types.QueryParamsResponse if err := cdc.UnmarshalJSON(body, ¶ms); err != nil { - return types.Params{}, err + return types.QueryParamsResponse{}, err } return params, nil @@ -91,19 +91,19 @@ func queryGlobalFeeParams(endpoint string) (types.Params, error) { func queryGlobalFees(endpoint string) (sdk.DecCoins, error) { p, err := queryGlobalFeeParams(endpoint) - return p.MinimumGasPrices, err + return p.Params.MinimumGasPrices, err } func queryBypassMsgs(endpoint string) ([]string, error) { p, err := queryGlobalFeeParams(endpoint) - return p.BypassMinFeeMsgTypes, err + return p.Params.BypassMinFeeMsgTypes, err } func queryMaxTotalBypassMinFeeMsgGasUsage(endpoint string) (uint64, error) { p, err := queryGlobalFeeParams(endpoint) - return p.MaxTotalBypassMinFeeMsgGasUsage, err + return p.Params.MaxTotalBypassMinFeeMsgGasUsage, err } func queryDelegation(endpoint string, validatorAddr string, delegatorAddr string) (stakingtypes.QueryDelegationResponse, error) { diff --git a/tests/e2e/validator.go b/tests/e2e/validator.go index e64e9f55ea8..2dfa9c20271 100644 --- a/tests/e2e/validator.go +++ b/tests/e2e/validator.go @@ -19,11 +19,12 @@ import ( authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" "github.com/cosmos/cosmos-sdk/x/genutil" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - gaia "github.com/cosmos/gaia/v9/app" tmcfg "github.com/tendermint/tendermint/config" tmos "github.com/tendermint/tendermint/libs/os" "github.com/tendermint/tendermint/p2p" "github.com/tendermint/tendermint/privval" + + gaia "github.com/cosmos/gaia/v10/app" ) //nolint:unused diff --git a/tests/ics/interchain_security_test.go b/tests/ics/interchain_security_test.go index 7c6908f9829..1fba2753956 100644 --- a/tests/ics/interchain_security_test.go +++ b/tests/ics/interchain_security_test.go @@ -9,10 +9,11 @@ import ( icstestingutils "github.com/cosmos/interchain-security/testutil/ibc_testing" "github.com/stretchr/testify/suite" - gaiaApp "github.com/cosmos/gaia/v9/app" ibctesting "github.com/cosmos/interchain-security/legacy_ibc_testing/testing" "github.com/tendermint/tendermint/libs/log" tmdb "github.com/tendermint/tm-db" + + gaiaApp "github.com/cosmos/gaia/v10/app" ) func TestCCVTestSuite(t *testing.T) { diff --git a/x/globalfee/alias.go b/x/globalfee/alias.go index 74e59e3869e..286247dd179 100644 --- a/x/globalfee/alias.go +++ b/x/globalfee/alias.go @@ -1,7 +1,7 @@ package globalfee import ( - "github.com/cosmos/gaia/v9/x/globalfee/types" + "github.com/cosmos/gaia/v10/x/globalfee/types" ) const ( diff --git a/x/globalfee/ante/antetest/fee_test.go b/x/globalfee/ante/antetest/fee_test.go index f7901369e79..0d0860f4a54 100644 --- a/x/globalfee/ante/antetest/fee_test.go +++ b/x/globalfee/ante/antetest/fee_test.go @@ -11,8 +11,8 @@ import ( ibcchanneltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" "github.com/stretchr/testify/suite" - gaiafeeante "github.com/cosmos/gaia/v9/x/globalfee/ante" - globfeetypes "github.com/cosmos/gaia/v9/x/globalfee/types" + gaiafeeante "github.com/cosmos/gaia/v10/x/globalfee/ante" + globfeetypes "github.com/cosmos/gaia/v10/x/globalfee/types" ) var testGasLimit uint64 = 200_000 @@ -603,6 +603,7 @@ func (s *IntegrationTestSuite) TestGlobalFeeMinimumGasFeeAnteHandler() { BypassMinFeeMsgTypes: globfeetypes.DefaultBypassMinFeeMsgTypes, MaxTotalBypassMinFeeMsgGasUsage: globfeetypes.DefaultmaxTotalBypassMinFeeMsgGasUsage, } + for name, tc := range testCases { s.Run(name, func() { // set globalfees and min gas price diff --git a/x/globalfee/ante/antetest/fee_test_setup.go b/x/globalfee/ante/antetest/fee_test_setup.go index e8ed50b13e9..e5caa1f4711 100644 --- a/x/globalfee/ante/antetest/fee_test_setup.go +++ b/x/globalfee/ante/antetest/fee_test_setup.go @@ -16,12 +16,12 @@ import ( tmrand "github.com/tendermint/tendermint/libs/rand" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - gaiahelpers "github.com/cosmos/gaia/v9/app/helpers" - gaiafeeante "github.com/cosmos/gaia/v9/x/globalfee/ante" + gaiahelpers "github.com/cosmos/gaia/v10/app/helpers" + gaiafeeante "github.com/cosmos/gaia/v10/x/globalfee/ante" - gaiaapp "github.com/cosmos/gaia/v9/app" - "github.com/cosmos/gaia/v9/x/globalfee" - globfeetypes "github.com/cosmos/gaia/v9/x/globalfee/types" + gaiaapp "github.com/cosmos/gaia/v10/app" + "github.com/cosmos/gaia/v10/x/globalfee" + globfeetypes "github.com/cosmos/gaia/v10/x/globalfee/types" ) type IntegrationTestSuite struct { diff --git a/x/globalfee/ante/fee.go b/x/globalfee/ante/fee.go index 071cc0eee78..bdb54b582de 100644 --- a/x/globalfee/ante/fee.go +++ b/x/globalfee/ante/fee.go @@ -10,8 +10,8 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" tmstrings "github.com/tendermint/tendermint/libs/strings" - "github.com/cosmos/gaia/v9/x/globalfee" - "github.com/cosmos/gaia/v9/x/globalfee/types" + "github.com/cosmos/gaia/v10/x/globalfee" + "github.com/cosmos/gaia/v10/x/globalfee/types" ) // FeeWithBypassDecorator checks if the transaction's fee is at least as large @@ -242,6 +242,7 @@ func (mfd FeeDecorator) GetBypassMsgTypes(ctx sdk.Context) (res []string) { if mfd.GlobalMinFee.Has(ctx, types.ParamStoreKeyBypassMinFeeMsgTypes) { mfd.GlobalMinFee.Get(ctx, types.ParamStoreKeyBypassMinFeeMsgTypes, &res) } + return } diff --git a/x/globalfee/client/cli/query.go b/x/globalfee/client/cli/query.go index 4215d2ccfdb..5e6b90acaf3 100644 --- a/x/globalfee/client/cli/query.go +++ b/x/globalfee/client/cli/query.go @@ -5,7 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - "github.com/cosmos/gaia/v9/x/globalfee/types" + "github.com/cosmos/gaia/v10/x/globalfee/types" ) func GetQueryCmd() *cobra.Command { @@ -39,7 +39,7 @@ func GetCmdShowGlobalFeeParams() *cobra.Command { if err != nil { return err } - return clientCtx.PrintProto(res) + return clientCtx.PrintProto(&res.Params) }, } flags.AddQueryFlagsToCmd(cmd) diff --git a/x/globalfee/genesis_test.go b/x/globalfee/genesis_test.go index b27f207f60e..07897f090e9 100644 --- a/x/globalfee/genesis_test.go +++ b/x/globalfee/genesis_test.go @@ -17,7 +17,7 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" dbm "github.com/tendermint/tm-db" - "github.com/cosmos/gaia/v9/x/globalfee/types" + "github.com/cosmos/gaia/v10/x/globalfee/types" ) func TestDefaultGenesis(t *testing.T) { diff --git a/x/globalfee/keeper/migrations.go b/x/globalfee/keeper/migrations.go new file mode 100644 index 00000000000..cfb1d53e455 --- /dev/null +++ b/x/globalfee/keeper/migrations.go @@ -0,0 +1,23 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + + v2 "github.com/cosmos/gaia/v10/x/globalfee/migrations/v2" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + globalfeeSubspace paramtypes.Subspace +} + +// NewMigrator returns a new Migrator. +func NewMigrator(globalfeeSubspace paramtypes.Subspace) Migrator { + return Migrator{globalfeeSubspace: globalfeeSubspace} +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v2.MigrateStore(ctx, m.globalfeeSubspace) +} diff --git a/x/globalfee/migrations/v2/migration.go b/x/globalfee/migrations/v2/migration.go new file mode 100644 index 00000000000..615747d7a12 --- /dev/null +++ b/x/globalfee/migrations/v2/migration.go @@ -0,0 +1,37 @@ +package v2 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cosmos/gaia/v10/x/globalfee/types" +) + +// MigrateStore performs in-place params migrations of +// BypassMinFeeMsgTypes and MaxTotalBypassMinFeeMsgGasUsage +// from app.toml to globalfee params. +// The migration includes: +// Add bypass-min-fee-msg-types params that are set +// ["/ibc.core.channel.v1.MsgRecvPacket", +// "/ibc.core.channel.v1.MsgAcknowledgement", +// "/ibc.core.client.v1.MsgUpdateClient", +// "/ibc.core.channel.v1.MsgTimeout", +// "/ibc.core.channel.v1.MsgTimeoutOnClose"] as default and +// add MaxTotalBypassMinFeeMsgGasUsage that is set 1_000_000 as default. +func MigrateStore(ctx sdk.Context, globalfeeSubspace paramtypes.Subspace) error { + var oldGlobalMinGasPrices sdk.DecCoins + globalfeeSubspace.Get(ctx, types.ParamStoreKeyMinGasPrices, &oldGlobalMinGasPrices) + defaultParams := types.DefaultParams() + params := types.Params{ + MinimumGasPrices: oldGlobalMinGasPrices, + BypassMinFeeMsgTypes: defaultParams.BypassMinFeeMsgTypes, + MaxTotalBypassMinFeeMsgGasUsage: defaultParams.MaxTotalBypassMinFeeMsgGasUsage, + } + + if !globalfeeSubspace.HasKeyTable() { + globalfeeSubspace.WithKeyTable(types.ParamKeyTable()) + } + + globalfeeSubspace.SetParamSet(ctx, ¶ms) + + return nil +} diff --git a/x/globalfee/migrations/v2/v2_test/migration_test.go b/x/globalfee/migrations/v2/v2_test/migration_test.go new file mode 100644 index 00000000000..93341c77d61 --- /dev/null +++ b/x/globalfee/migrations/v2/v2_test/migration_test.go @@ -0,0 +1,106 @@ +package v2_test + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + v2 "github.com/cosmos/gaia/v10/x/globalfee/migrations/v2" + globalfeetypes "github.com/cosmos/gaia/v10/x/globalfee/types" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmdb "github.com/tendermint/tm-db" +) + +func TestMigrateStore(t *testing.T) { + db := tmdb.NewMemDB() + stateStore := store.NewCommitMultiStore(db) + + storeKey := sdk.NewKVStoreKey(paramtypes.StoreKey) + memStoreKey := storetypes.NewMemoryStoreKey("mem_key") + + stateStore.MountStoreWithDB(storeKey, sdk.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(memStoreKey, sdk.StoreTypeMemory, nil) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + + require.NoError(t, stateStore.LoadLatestVersion()) + + // Create new empty subspace + newSubspace := paramtypes.NewSubspace(cdc, + codec.NewLegacyAmino(), + storeKey, + memStoreKey, + paramtypes.ModuleName, + ) + // register the subspace withthe v10 paramKeyTable + newSubspace.WithKeyTable(globalfeetypes.ParamKeyTable()) + + // check MinGasPrices isn't set + _, ok := getMinGasPrice(newSubspace, ctx) + require.Equal(t, ok, false) + + // set a minGasPrice different that default value + minGasPrices := sdk.NewDecCoins(sdk.NewDecCoin("uatom", sdk.OneInt())) + newSubspace.Set(ctx, globalfeetypes.ParamStoreKeyMinGasPrices, minGasPrices) + require.False(t, minGasPrices.IsEqual(globalfeetypes.DefaultMinGasPrices)) + + // check that the new parameters aren't set + _, ok = getBypassMsgTypes(newSubspace, ctx) + require.Equal(t, ok, false) + _, ok = getMaxTotalBypassMinFeeMsgGasUsage(newSubspace, ctx) + require.Equal(t, ok, false) + + // run global fee migration + err := v2.MigrateStore(ctx, newSubspace) + require.NoError(t, err) + + newMinGasPrices, _ := getMinGasPrice(newSubspace, ctx) + bypassMsgTypes, _ := getBypassMsgTypes(newSubspace, ctx) + maxGas, _ := getMaxTotalBypassMinFeeMsgGasUsage(newSubspace, ctx) + + require.Equal(t, bypassMsgTypes, globalfeetypes.DefaultBypassMinFeeMsgTypes) + require.Equal(t, maxGas, globalfeetypes.DefaultmaxTotalBypassMinFeeMsgGasUsage) + require.Equal(t, minGasPrices, newMinGasPrices) +} + +func getBypassMsgTypes(globalfeeSubspace paramtypes.Subspace, ctx sdk.Context) ([]string, bool) { + bypassMsgs := []string{} + if globalfeeSubspace.Has(ctx, globalfeetypes.ParamStoreKeyBypassMinFeeMsgTypes) { + globalfeeSubspace.Get(ctx, globalfeetypes.ParamStoreKeyBypassMinFeeMsgTypes, &bypassMsgs) + } else { + return bypassMsgs, false + } + + return bypassMsgs, true +} + +func getMaxTotalBypassMinFeeMsgGasUsage(globalfeeSubspace paramtypes.Subspace, ctx sdk.Context) (uint64, bool) { + var maxTotalBypassMinFeeMsgGasUsage uint64 + if globalfeeSubspace.Has(ctx, globalfeetypes.ParamStoreKeyMaxTotalBypassMinFeeMsgGasUsage) { + globalfeeSubspace.Get(ctx, globalfeetypes.ParamStoreKeyMaxTotalBypassMinFeeMsgGasUsage, &maxTotalBypassMinFeeMsgGasUsage) + } else { + return maxTotalBypassMinFeeMsgGasUsage, false + } + + return maxTotalBypassMinFeeMsgGasUsage, true +} + +func getMinGasPrice(globalfeeSubspace paramtypes.Subspace, ctx sdk.Context) (sdk.DecCoins, bool) { + var globalMinGasPrices sdk.DecCoins + if globalfeeSubspace.Has(ctx, globalfeetypes.ParamStoreKeyMinGasPrices) { + globalfeeSubspace.Get(ctx, globalfeetypes.ParamStoreKeyMinGasPrices, &globalMinGasPrices) + } else { + return globalMinGasPrices, false + } + + return globalMinGasPrices, true +} diff --git a/x/globalfee/module.go b/x/globalfee/module.go index d2cf91c0f41..499c72b6082 100644 --- a/x/globalfee/module.go +++ b/x/globalfee/module.go @@ -3,6 +3,7 @@ package globalfee import ( "context" "encoding/json" + "fmt" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -16,8 +17,9 @@ import ( "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" - "github.com/cosmos/gaia/v9/x/globalfee/client/cli" - "github.com/cosmos/gaia/v9/x/globalfee/types" + "github.com/cosmos/gaia/v10/x/globalfee/client/cli" + "github.com/cosmos/gaia/v10/x/globalfee/keeper" + "github.com/cosmos/gaia/v10/x/globalfee/types" ) var ( @@ -93,6 +95,7 @@ func NewAppModule(paramSpace paramstypes.Subspace) *AppModule { func (a AppModule) InitGenesis(ctx sdk.Context, marshaler codec.JSONCodec, message json.RawMessage) []abci.ValidatorUpdate { var genesisState types.GenesisState marshaler.MustUnmarshalJSON(message, &genesisState) + a.paramSpace.SetParamSet(ctx, &genesisState.Params) return nil } @@ -120,6 +123,11 @@ func (a AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { func (a AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), NewGrpcQuerier(a.paramSpace)) + + m := keeper.NewMigrator(a.paramSpace) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { + panic(fmt.Sprintf("failed to migrate x/globalfee from version 1 to 2: %v", err)) + } } func (a AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { @@ -134,5 +142,5 @@ func (a AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Valida // introduced by the module. To avoid wrong/empty versions, the initial version // should be set to 1. func (a AppModule) ConsensusVersion() uint64 { - return 1 + return 2 } diff --git a/x/globalfee/querier.go b/x/globalfee/querier.go index 7187239c679..d621e6f67ce 100644 --- a/x/globalfee/querier.go +++ b/x/globalfee/querier.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/gaia/v9/x/globalfee/types" + "github.com/cosmos/gaia/v10/x/globalfee/types" ) var _ types.QueryServer = &GrpcQuerier{} @@ -30,6 +30,7 @@ func (g GrpcQuerier) Params(stdCtx context.Context, _ *types.QueryParamsRequest) var bypassMinFeeMsgTypes []string var maxTotalBypassMinFeeMsgGasUsage uint64 ctx := sdk.UnwrapSDKContext(stdCtx) + // todo: if return err if not exist? if g.paramSource.Has(ctx, types.ParamStoreKeyMinGasPrices) { g.paramSource.Get(ctx, types.ParamStoreKeyMinGasPrices, &minGasPrices) @@ -42,8 +43,10 @@ func (g GrpcQuerier) Params(stdCtx context.Context, _ *types.QueryParamsRequest) } return &types.QueryParamsResponse{ - MinimumGasPrices: minGasPrices, - BypassMinFeeMsgTypes: bypassMinFeeMsgTypes, - MaxTotalBypassMinFeeMsgGasUsage: maxTotalBypassMinFeeMsgGasUsage, + Params: types.Params{ + MinimumGasPrices: minGasPrices, + BypassMinFeeMsgTypes: bypassMinFeeMsgTypes, + MaxTotalBypassMinFeeMsgGasUsage: maxTotalBypassMinFeeMsgGasUsage, + }, }, nil } diff --git a/x/globalfee/querier_test.go b/x/globalfee/querier_test.go index 0b86a3bdc21..ac9943d59b5 100644 --- a/x/globalfee/querier_test.go +++ b/x/globalfee/querier_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/cosmos/gaia/v9/x/globalfee/types" + "github.com/cosmos/gaia/v10/x/globalfee/types" ) func TestQueryMinimumGasPrices(t *testing.T) { @@ -50,7 +50,7 @@ func TestQueryMinimumGasPrices(t *testing.T) { gotResp, gotErr := q.Params(sdk.WrapSDKContext(ctx), nil) require.NoError(t, gotErr) require.NotNil(t, gotResp) - assert.Equal(t, spec.expMin, gotResp.MinimumGasPrices) + assert.Equal(t, spec.expMin, gotResp.Params.MinimumGasPrices) }) } } diff --git a/x/globalfee/types/query.pb.go b/x/globalfee/types/query.pb.go index 054f0c41b4b..3b73bc4570a 100644 --- a/x/globalfee/types/query.pb.go +++ b/x/globalfee/types/query.pb.go @@ -6,8 +6,6 @@ package types import ( context "context" fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -72,9 +70,7 @@ var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo // QueryMinimumGasPricesResponse is the response type for the // Query/MinimumGasPrices RPC method. type QueryParamsResponse struct { - MinimumGasPrices github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=minimum_gas_prices,json=minimumGasPrices,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"minimum_gas_prices,omitempty" yaml:"minimum_gas_prices"` - BypassMinFeeMsgTypes []string `protobuf:"bytes,2,rep,name=bypass_min_fee_msg_types,json=bypassMinFeeMsgTypes,proto3" json:"bypass_min_fee_msg_types,omitempty" yaml:"bypass_min_fee_msg_types"` - MaxTotalBypassMinFeeMsgGasUsage uint64 `protobuf:"varint,3,opt,name=max_total_bypass_min_fee_msg_gas_usage,json=maxTotalBypassMinFeeMsgGasUsage,proto3" json:"max_total_bypass_min_fee_msg_gas_usage,omitempty"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } @@ -110,25 +106,11 @@ func (m *QueryParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo -func (m *QueryParamsResponse) GetMinimumGasPrices() github_com_cosmos_cosmos_sdk_types.DecCoins { +func (m *QueryParamsResponse) GetParams() Params { if m != nil { - return m.MinimumGasPrices + return m.Params } - return nil -} - -func (m *QueryParamsResponse) GetBypassMinFeeMsgTypes() []string { - if m != nil { - return m.BypassMinFeeMsgTypes - } - return nil -} - -func (m *QueryParamsResponse) GetMaxTotalBypassMinFeeMsgGasUsage() uint64 { - if m != nil { - return m.MaxTotalBypassMinFeeMsgGasUsage - } - return 0 + return Params{} } func init() { @@ -141,37 +123,25 @@ func init() { } var fileDescriptor_12a736cede25d10a = []byte{ - // 465 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbf, 0x6e, 0xd4, 0x40, - 0x10, 0xc6, 0xcf, 0x39, 0x88, 0x84, 0x69, 0xd0, 0x72, 0x42, 0xc7, 0xe9, 0x64, 0x9f, 0x8c, 0x14, - 0x9d, 0x08, 0xec, 0x2a, 0xa1, 0xa3, 0x34, 0x88, 0x54, 0x11, 0xe1, 0x14, 0x1a, 0x28, 0xac, 0xb1, - 0xd9, 0x2c, 0x2b, 0xbc, 0x7f, 0x72, 0xb3, 0x46, 0xe7, 0x36, 0x1d, 0x1d, 0x52, 0xde, 0x82, 0x67, - 0xe0, 0x01, 0x52, 0x46, 0xa2, 0xa1, 0x3a, 0xd0, 0x1d, 0x15, 0x65, 0x9e, 0x00, 0xd9, 0xbe, 0x00, - 0x91, 0x13, 0x29, 0x95, 0xad, 0x9d, 0xdf, 0x7c, 0xdf, 0xce, 0x7e, 0xe3, 0x47, 0x02, 0x24, 0x30, - 0x91, 0x9b, 0x14, 0xf2, 0x03, 0xce, 0xd9, 0xc7, 0xad, 0x94, 0x3b, 0xd8, 0x62, 0x87, 0x05, 0x9f, - 0x96, 0xd4, 0x4e, 0x8d, 0x33, 0xe4, 0x5e, 0xc5, 0xd0, 0xbf, 0x0c, 0x5d, 0x31, 0x83, 0x9e, 0x30, - 0xc2, 0xd4, 0x08, 0xab, 0xfe, 0x1a, 0x7a, 0x30, 0x14, 0xc6, 0x88, 0x9c, 0x33, 0xb0, 0x92, 0x81, - 0xd6, 0xc6, 0x81, 0x93, 0x46, 0xe3, 0xaa, 0x1a, 0x64, 0x06, 0x95, 0x41, 0x96, 0x02, 0xfe, 0x33, - 0xcb, 0x8c, 0xd4, 0x4d, 0x3d, 0xea, 0xf9, 0xe4, 0x55, 0x65, 0xbd, 0x07, 0x53, 0x50, 0x38, 0xe1, - 0x87, 0x05, 0x47, 0x17, 0x1d, 0x75, 0xfd, 0xbb, 0x17, 0x8e, 0xd1, 0x1a, 0x8d, 0x9c, 0x7c, 0xf5, - 0x7c, 0xa2, 0xa4, 0x96, 0xaa, 0x50, 0x89, 0x00, 0x4c, 0xec, 0x54, 0x66, 0x1c, 0xfb, 0xde, 0xa8, - 0x3b, 0xbe, 0xbd, 0x3d, 0xa4, 0x8d, 0x17, 0xad, 0xbc, 0xce, 0x2f, 0x4d, 0x9f, 0xf3, 0xec, 0x99, - 0x91, 0x3a, 0xb6, 0x27, 0xf3, 0xb0, 0xf3, 0x7b, 0x1e, 0x0e, 0xdb, 0xfd, 0x8f, 0x8c, 0x92, 0x8e, - 0x2b, 0xeb, 0xca, 0xb3, 0x79, 0x78, 0xbf, 0x04, 0x95, 0x3f, 0x8d, 0xda, 0x54, 0xf4, 0xe5, 0x47, - 0xb8, 0x29, 0xa4, 0x7b, 0x5f, 0xa4, 0x34, 0x33, 0x8a, 0xad, 0x06, 0x6b, 0x3e, 0x8f, 0xf1, 0xdd, - 0x07, 0xe6, 0x4a, 0xcb, 0xf1, 0xdc, 0x10, 0x27, 0x77, 0x56, 0x1a, 0x3b, 0x80, 0x7b, 0xb5, 0x02, - 0x79, 0xeb, 0xf7, 0xd3, 0xd2, 0x02, 0x62, 0xa2, 0xa4, 0x4e, 0x0e, 0x38, 0x4f, 0x14, 0x8a, 0xa4, - 0x6e, 0xeb, 0xaf, 0x8d, 0xba, 0xe3, 0x5b, 0xf1, 0x83, 0xb3, 0x79, 0x18, 0x36, 0x37, 0xb8, 0x8a, - 0x8c, 0x26, 0xbd, 0xa6, 0xb4, 0x2b, 0xf5, 0x0b, 0xce, 0x77, 0x51, 0xec, 0x57, 0xc7, 0xe4, 0xa5, - 0xbf, 0xa1, 0x60, 0x96, 0x38, 0xe3, 0x20, 0x4f, 0x2e, 0x69, 0xae, 0x26, 0x29, 0x10, 0x04, 0xef, - 0x77, 0x47, 0xde, 0xf8, 0xc6, 0x24, 0x54, 0x30, 0xdb, 0xaf, 0xe0, 0xf8, 0xa2, 0xda, 0x0e, 0xe0, - 0xeb, 0x0a, 0xdb, 0x3e, 0xf6, 0xfc, 0x9b, 0x75, 0x08, 0xe4, 0x93, 0xe7, 0xaf, 0x37, 0x49, 0x90, - 0x87, 0xf4, 0xf2, 0xe5, 0xa0, 0xed, 0x14, 0x07, 0x9b, 0xd7, 0x62, 0x9b, 0x68, 0xa3, 0x8d, 0xa3, - 0x6f, 0xbf, 0x8e, 0xd7, 0x46, 0x24, 0x60, 0x57, 0x6c, 0xa8, 0xad, 0xf9, 0x38, 0x3e, 0x59, 0x04, - 0xde, 0xe9, 0x22, 0xf0, 0x7e, 0x2e, 0x02, 0xef, 0xf3, 0x32, 0xe8, 0x9c, 0x2e, 0x83, 0xce, 0xf7, - 0x65, 0xd0, 0x79, 0x33, 0x6e, 0x87, 0x53, 0x4b, 0xcd, 0xfe, 0x13, 0xab, 0x5f, 0x30, 0x5d, 0xaf, - 0x77, 0xef, 0xc9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x5c, 0xb6, 0x1a, 0x0d, 0x03, 0x00, - 0x00, + // 286 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0x31, 0x4b, 0xc3, 0x40, + 0x14, 0xc7, 0x73, 0xa2, 0x1d, 0xce, 0xed, 0x2c, 0x22, 0x41, 0xce, 0x12, 0x44, 0x8a, 0xc2, 0x1d, + 0xad, 0xab, 0x53, 0x3e, 0x81, 0xd6, 0xcd, 0xed, 0x52, 0x9e, 0x67, 0x20, 0xc9, 0x4b, 0x73, 0x17, + 0xb1, 0xab, 0x9b, 0x9b, 0xd0, 0x2f, 0xd5, 0xb1, 0xe0, 0xe2, 0x24, 0x92, 0xf8, 0x41, 0x24, 0xb9, + 0x20, 0x8a, 0x06, 0xdc, 0x8e, 0x77, 0xbf, 0xf7, 0x7f, 0x3f, 0xfe, 0x34, 0xd0, 0x2a, 0x56, 0x52, + 0x27, 0x18, 0xa9, 0xe4, 0x16, 0x40, 0xde, 0x4f, 0x22, 0xb0, 0x6a, 0x22, 0x17, 0x25, 0x14, 0x4b, + 0x91, 0x17, 0x68, 0x91, 0xed, 0x37, 0x8c, 0xf8, 0x62, 0x44, 0xc7, 0xf8, 0x43, 0x8d, 0x1a, 0x5b, + 0x44, 0x36, 0x2f, 0x47, 0xfb, 0x87, 0x1a, 0x51, 0x27, 0x20, 0x55, 0x1e, 0x4b, 0x95, 0x65, 0x68, + 0x95, 0x8d, 0x31, 0x33, 0xdd, 0xef, 0x71, 0xcf, 0x3d, 0x0d, 0x19, 0x98, 0xb8, 0xa3, 0x82, 0x21, + 0x65, 0x57, 0x8d, 0xc0, 0xa5, 0x2a, 0x54, 0x6a, 0x66, 0xb0, 0x28, 0xc1, 0xd8, 0xe0, 0x9a, 0xee, + 0xfd, 0x98, 0x9a, 0x1c, 0x33, 0x03, 0xec, 0x82, 0x0e, 0xf2, 0x76, 0x72, 0x40, 0x46, 0x64, 0xbc, + 0x3b, 0xe5, 0xe2, 0x6f, 0x5f, 0xe1, 0xf6, 0xc2, 0xed, 0xf5, 0xdb, 0x91, 0x37, 0xeb, 0x76, 0xa6, + 0x2b, 0x42, 0x77, 0xda, 0x54, 0xf6, 0x44, 0xe8, 0xc0, 0x21, 0xec, 0xb4, 0x2f, 0xe2, 0xb7, 0x95, + 0x7f, 0xf6, 0x2f, 0xd6, 0xb9, 0x06, 0x27, 0x8f, 0x2f, 0x1f, 0xab, 0xad, 0x11, 0xe3, 0xb2, 0xa7, + 0x07, 0x67, 0x15, 0x86, 0xeb, 0x8a, 0x93, 0x4d, 0xc5, 0xc9, 0x7b, 0xc5, 0xc9, 0x73, 0xcd, 0xbd, + 0x4d, 0xcd, 0xbd, 0xd7, 0x9a, 0x7b, 0x37, 0x63, 0x1d, 0xdb, 0xbb, 0x32, 0x12, 0x73, 0x4c, 0xe5, + 0x1c, 0x4d, 0x8a, 0xc6, 0x45, 0x3d, 0x7c, 0x0b, 0xb3, 0xcb, 0x1c, 0x4c, 0x34, 0x68, 0xbb, 0x3c, + 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x01, 0xc5, 0x11, 0x71, 0xe3, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -297,34 +267,16 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.MaxTotalBypassMinFeeMsgGasUsage != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.MaxTotalBypassMinFeeMsgGasUsage)) - i-- - dAtA[i] = 0x18 - } - if len(m.BypassMinFeeMsgTypes) > 0 { - for iNdEx := len(m.BypassMinFeeMsgTypes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.BypassMinFeeMsgTypes[iNdEx]) - copy(dAtA[i:], m.BypassMinFeeMsgTypes[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BypassMinFeeMsgTypes[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.MinimumGasPrices) > 0 { - for iNdEx := len(m.MinimumGasPrices) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MinimumGasPrices[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -354,21 +306,8 @@ func (m *QueryParamsResponse) Size() (n int) { } var l int _ = l - if len(m.MinimumGasPrices) > 0 { - for _, e := range m.MinimumGasPrices { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if len(m.BypassMinFeeMsgTypes) > 0 { - for _, s := range m.BypassMinFeeMsgTypes { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.MaxTotalBypassMinFeeMsgGasUsage != 0 { - n += 1 + sovQuery(uint64(m.MaxTotalBypassMinFeeMsgGasUsage)) - } + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -459,7 +398,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinimumGasPrices", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -486,62 +425,10 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MinimumGasPrices = append(m.MinimumGasPrices, types.DecCoin{}) - if err := m.MinimumGasPrices[len(m.MinimumGasPrices)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BypassMinFeeMsgTypes", 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.BypassMinFeeMsgTypes = append(m.BypassMinFeeMsgTypes, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxTotalBypassMinFeeMsgGasUsage", wireType) - } - m.MaxTotalBypassMinFeeMsgGasUsage = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxTotalBypassMinFeeMsgGasUsage |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:])