Skip to content

Commit

Permalink
chores: prepare v0.10.4 (#223)
Browse files Browse the repository at this point in the history
* chores: prepare v0.10.4

Bump cosmos-sdk to v0.45.4
Bump tendermint to v0.34.19
Bump wasmvm to v1.0.0-beta10

Integrate and initialize x/upgrade module

* chore: switch cosmos-sdk to proper tag
  • Loading branch information
daeMOn63 authored May 2, 2022
1 parent e7b7407 commit fda87e5
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 243 deletions.
47 changes: 38 additions & 9 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/distribution"
distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
Expand Down Expand Up @@ -104,9 +104,11 @@ import (
const Name = "fetchd"

var (
// ProposalsEnabled controls x/wasm Proposals
// If EnabledSpecificProposals is "", and this is "true", then enable all x/wasm proposals.
// If EnabledSpecificProposals is "", and this is not "true", then disable all x/wasm proposals.
ProposalsEnabled = "false"
// EnableSpecificProposals allows to enable only specific x/wasm proposals
// If set to non-empty string it must be comma-separated list of values that are all a subset
// of "EnableAllProposals" (takes precedence over ProposalsEnabled)
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
Expand Down Expand Up @@ -144,7 +146,7 @@ var (
capability.AppModuleBasic{},
staking.AppModuleBasic{},
mint.AppModuleBasic{},
distr.AppModuleBasic{},
distribution.AppModuleBasic{},
gov.NewAppModuleBasic(
append(
wasmclient.ProposalHandlers,
Expand Down Expand Up @@ -239,8 +241,6 @@ type App struct {

// the module manager
mm *module.Manager

configurator module.Configurator
}

// New returns a reference to an initialized Gaia.
Expand Down Expand Up @@ -343,7 +343,7 @@ func New(
govRouter := govtypes.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(distrtypes.RouterKey, distribution.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))

Expand Down Expand Up @@ -434,7 +434,7 @@ func New(
gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
distribution.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
upgrade.NewAppModule(app.UpgradeKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
Expand All @@ -446,7 +446,7 @@ func New(
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper),
)

// During begin block slashing happens after distr.BeginBlocker so that
// During begin block slashing happens after distribution.BeginBlocker so that
// there is nothing left over in the validator fee pool, so as to keep the
// CanWithdrawInvariant invariant.
// NOTE: staking module is required if HistoricalEntries param > 0
Expand Down Expand Up @@ -523,8 +523,10 @@ func New(

app.mm.RegisterInvariants(&app.CrisisKeeper)
app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
app.mm.RegisterServices(app.configurator)
cfg := module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())

app.RegisterUpgradeHandlers(cfg)
app.mm.RegisterServices(cfg)

// initialize stores
app.MountKVStores(keys)
Expand Down Expand Up @@ -599,6 +601,7 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res
if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
panic(err)
}
app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())
return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
}

Expand Down Expand Up @@ -667,6 +670,32 @@ func (app *App) GetSubspace(moduleName string) paramstypes.Subspace {
return subspace
}

func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) {
app.UpgradeKeeper.SetUpgradeHandler("fetchd-v0.10.4", func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// manually add every existing modules to prevent the migration calling InitGenesis on them
fromVM[authz.ModuleName] = authzmodule.AppModule{}.ConsensusVersion()
fromVM[banktypes.ModuleName] = bank.AppModule{}.ConsensusVersion()
fromVM[capabilitytypes.ModuleName] = capability.AppModule{}.ConsensusVersion()
fromVM[crisistypes.ModuleName] = crisis.AppModule{}.ConsensusVersion()
fromVM[distrtypes.ModuleName] = distribution.AppModule{}.ConsensusVersion()
fromVM[stakingtypes.ModuleName] = staking.AppModule{}.ConsensusVersion()
fromVM[evidencetypes.ModuleName] = evidence.AppModule{}.ConsensusVersion()
fromVM[feegrant.ModuleName] = feegrantmodule.AppModule{}.ConsensusVersion()
fromVM[genutiltypes.ModuleName] = genutil.AppModule{}.ConsensusVersion()
fromVM[govtypes.ModuleName] = gov.AppModule{}.ConsensusVersion()
fromVM[ibchost.ModuleName] = ibc.AppModule{}.ConsensusVersion()
fromVM[minttypes.ModuleName] = mint.AppModule{}.ConsensusVersion()
fromVM[paramstypes.ModuleName] = params.AppModule{}.ConsensusVersion()
fromVM[slashingtypes.ModuleName] = slashing.AppModule{}.ConsensusVersion()
fromVM[ibctransfertypes.ModuleName] = transfer.AppModule{}.ConsensusVersion()
fromVM[authtypes.ModuleName] = auth.AppModule{}.ConsensusVersion()
fromVM[upgradetypes.ModuleName] = upgrade.AppModule{}.ConsensusVersion()
fromVM[vestingtypes.ModuleName] = vesting.AppModule{}.ConsensusVersion()
fromVM[wasm.ModuleName] = wasm.AppModule{}.ConsensusVersion()
return app.mm.RunMigrations(ctx, cfg, fromVM)
})
}

// RegisterAPIRoutes registers all application module routes with the provided
// API server.
func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
Expand Down
219 changes: 0 additions & 219 deletions cmd/fetchd/cmd/doradomigrate.go

This file was deleted.

3 changes: 1 addition & 2 deletions cmd/fetchd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome),
config.Cmd(),
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
AddStakeReconciliationMigrateCmd(),
AddDoradoMigrateCmd(),
// AddStakeReconciliationMigrateCmd(),
genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
genutilcli.ValidateGenesisCmd(app.ModuleBasics),
AddGenesisAccountCmd(app.DefaultNodeHome),
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ go 1.17

require (
github.com/CosmWasm/wasmd v0.26.0
github.com/cosmos/cosmos-sdk v0.45.1
github.com/cosmos/cosmos-sdk v0.45.4
github.com/cosmos/ibc-go/v2 v2.2.0
github.com/gorilla/mux v1.8.0
github.com/prometheus/client_golang v1.12.1
github.com/rakyll/statik v0.1.7
github.com/spf13/cast v1.4.1
github.com/spf13/cobra v1.3.0
github.com/tendermint/tendermint v0.34.16
github.com/spf13/cobra v1.4.0
github.com/tendermint/tendermint v0.34.19
github.com/tendermint/tm-db v0.6.7
)

require (
filippo.io/edwards25519 v1.0.0-beta.2 // indirect
github.com/99designs/keyring v1.1.6 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
github.com/CosmWasm/wasmvm v1.0.0-beta8 // indirect
github.com/CosmWasm/wasmvm v1.0.0-beta10 // indirect
github.com/DataDog/zstd v1.4.5 // indirect
github.com/Workiva/go-datastructures v1.0.53 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
Expand Down Expand Up @@ -114,7 +114,7 @@ require (
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20220302033224-9aa15565e42a // indirect
google.golang.org/grpc v1.44.0 // indirect
google.golang.org/grpc v1.45.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand All @@ -128,4 +128,4 @@ replace google.golang.org/grpc => google.golang.org/grpc v1.33.2

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

replace github.com/cosmos/cosmos-sdk => github.com/fetchai/cosmos-sdk v0.18.0
replace github.com/cosmos/cosmos-sdk => github.com/fetchai/cosmos-sdk v0.18.1
Loading

0 comments on commit fda87e5

Please sign in to comment.