From d72bde6d1ce3bb67c45d215f35c8f6a0b513aa38 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 2 Sep 2024 17:30:00 +0200 Subject: [PATCH] chore :extract improvements from #21497 --- UPGRADING.md | 50 +++++-------------------------- docs/learn/advanced/00-baseapp.md | 2 +- server/v2/cometbft/abci.go | 2 +- server/v2/types.go | 2 +- simapp/v2/app_config.go | 6 +++- x/distribution/keeper/abci.go | 1 - 6 files changed, 16 insertions(+), 47 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index e8693d50141a..f9d378319e16 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -106,7 +106,7 @@ For non depinject users, simply call `RegisterLegacyAminoCodec` and `RegisterInt Additionally, thanks to the genesis simplification, as explained in [the genesis interface update](#genesis-interface), the module manager `InitGenesis` and `ExportGenesis` methods do not require the codec anymore. -##### GRPC-WEB +##### GRPC WEB Grpc-web embedded client has been removed from the server. If you would like to use grpc-web, you can use the [envoy proxy](https://www.envoyproxy.io/docs/envoy/latest/start/start). Here's how to set it up: @@ -347,6 +347,8 @@ Also, any usages of the interfaces `AnyUnpacker` and `UnpackInterfacesMessage` m #### `**all**` +All modules were spun out into their own `go.mod`. Replace imports by `cosmossdk.io/x/{moduleName}`. + ##### Core API Core API has been introduced for modules since v0.47. With the deprecation of `sdk.Context`, we strongly recommend to use the `cosmossdk.io/core/appmodule` interfaces for the modules. This will allow the modules to work out of the box with server/v2 and baseapp, as well as limit their dependencies on the SDK. @@ -399,7 +401,7 @@ All modules using dependency injection must update their imports. ##### Params -Previous module migrations have been removed. It is required to migrate to v0.50 prior to upgrading to v0.51 for not missing any module migrations. +Previous module migrations have been removed. It is required to migrate to v0.50 prior to upgrading to v0.52 for not missing any module migrations. ##### Genesis Interface @@ -436,60 +438,24 @@ if err != nil { } ``` -#### `x/auth` - -Auth was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/auth` - -#### `x/authz` - -Authz was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/authz` - -#### `x/bank` - -Bank was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/bank` - ### `x/crsis` -The Crisis module was removed due to it not being supported or functional any longer. +The `x/crisis` module was removed due to it not being supported or functional any longer. #### `x/distribution` -Distribution was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/distribution` - -The existing chains using x/distribution module needs to add the new x/protocolpool module. - -#### `x/group` - -Group was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/group` +Existing chains using `x/distribution` module must add the new `x/protocolpool` module. #### `x/gov` -Gov was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/gov` - Gov v1beta1 proposal handler has been changed to take in a `context.Context` instead of `sdk.Context`. This change was made to allow legacy proposals to be compatible with server/v2. If you wish to migrate to server/v2, you should update your proposal handler to take in a `context.Context` and use services. On the other hand, if you wish to keep using baseapp, simply unwrap the sdk context in your proposal handler. -#### `x/mint` - -Mint was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/mint` - -#### `x/slashing` - -Slashing was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/slashing` - -#### `x/staking` - -Staking was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/staking` - -#### `x/params` - -A standalone Go module was created and it is accessible at "cosmossdk.io/x/params". - #### `x/protocolpool` -Introducing a new `x/protocolpool` module to handle community pool funds. Its store must be added while upgrading to v0.51.x. +Introducing a new `x/protocolpool` module to handle community pool funds. Its store must be added while upgrading to v0.52.x. Example: @@ -506,7 +472,7 @@ func (app SimApp) RegisterUpgradeHandlers() { } ``` -Add `x/protocolpool` store while upgrading to v0.51.x: +Add `x/protocolpool` store while upgrading to v0.52.x: ```go storetypes.StoreUpgrades{ diff --git a/docs/learn/advanced/00-baseapp.md b/docs/learn/advanced/00-baseapp.md index 1a7cd28fdc96..20968f91bd0f 100644 --- a/docs/learn/advanced/00-baseapp.md +++ b/docs/learn/advanced/00-baseapp.md @@ -205,7 +205,7 @@ newly committed state and `finalizeBlockState` is set to `nil` to be reset on `F During `InitChain`, the `RequestInitChain` provides `ConsensusParams` which contains parameters related to block execution such as maximum gas and size in addition to evidence parameters. If these parameters are non-nil, they are set in the BaseApp's `ParamStore`. Behind the scenes, the `ParamStore` -is managed by an `x/consensus_params` module. This allows the parameters to be tweaked via +is managed by an `x/consensus` module. This allows the parameters to be tweaked via on-chain governance. ## Service Routers diff --git a/server/v2/cometbft/abci.go b/server/v2/cometbft/abci.go index f842bfc56ff8..36a0e0de1cbd 100644 --- a/server/v2/cometbft/abci.go +++ b/server/v2/cometbft/abci.go @@ -67,7 +67,7 @@ type Consensus[T transaction.Tx] struct { func NewConsensus[T transaction.Tx]( logger log.Logger, appName string, - consensusAuthority string, + consensusAuthority string, // TODO remove app *appmanager.AppManager[T], mp mempool.Mempool[T], indexedEvents map[string]struct{}, diff --git a/server/v2/types.go b/server/v2/types.go index 3979f99f48db..f25dbb8ab388 100644 --- a/server/v2/types.go +++ b/server/v2/types.go @@ -16,7 +16,7 @@ type AppI[T transaction.Tx] interface { Name() string InterfaceRegistry() server.InterfaceRegistry GetAppManager() *appmanager.AppManager[T] - GetConsensusAuthority() string + GetConsensusAuthority() string // TODO remove GetGPRCMethodsToMessageMap() map[string]func() gogoproto.Message GetStore() any } diff --git a/simapp/v2/app_config.go b/simapp/v2/app_config.go index c126d1dcfa90..69b537fe167b 100644 --- a/simapp/v2/app_config.go +++ b/simapp/v2/app_config.go @@ -138,6 +138,10 @@ var ( ModuleName: authtypes.ModuleName, KvStoreKey: "acc", }, + { + ModuleName: accounts.ModuleName, + KvStoreKey: accounts.StoreKey, + }, }, // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. @@ -260,7 +264,7 @@ var ( { Name: consensustypes.ModuleName, Config: appconfig.WrapAny(&consensusmodulev1.Module{ - Authority: "consensus", + Authority: "consensus", // TODO remove. }), }, { diff --git a/x/distribution/keeper/abci.go b/x/distribution/keeper/abci.go index 64cb205f5c11..5831ee9e1b9d 100644 --- a/x/distribution/keeper/abci.go +++ b/x/distribution/keeper/abci.go @@ -10,7 +10,6 @@ import ( // BeginBlocker sets the proposer for determining distribution during endblock // and distribute rewards for the previous block. -// TODO: use context.Context after including the comet service func (k Keeper) BeginBlocker(ctx context.Context) error { defer telemetry.ModuleMeasureSince(types.ModuleName, telemetry.Now(), telemetry.MetricKeyBeginBlocker)