Skip to content

Commit

Permalink
chore: extract improvements from #21497 (#21506)
Browse files Browse the repository at this point in the history
Co-authored-by: Akhil Kumar P <36399231+akhilkumarpilli@users.noreply.github.com>
(cherry picked from commit 6ffa71a)

# Conflicts:
#	server/v2/types.go
  • Loading branch information
julienrbrt authored and mergify[bot] committed Sep 4, 2024
1 parent 8c2a2b9 commit 2646211
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 47 deletions.
52 changes: 9 additions & 43 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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:

Expand Down Expand Up @@ -306,6 +306,8 @@ Also, any usages of the interfaces `AnyUnpacker` and `UnpackInterfacesMessage` m

#### `**all**`

All modules (expect `auth`) were spun out into their own `go.mod`. Replace their 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.
Expand Down Expand Up @@ -358,7 +360,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

Expand Down Expand Up @@ -395,60 +397,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`
### `x/crisis`

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:

Expand All @@ -465,7 +431,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{
Expand Down
2 changes: 1 addition & 1 deletion docs/learn/advanced/00-baseapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/v2/cometbft/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand Down
22 changes: 22 additions & 0 deletions server/v2/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package serverv2

import (
gogoproto "github.com/cosmos/gogoproto/proto"
"github.com/spf13/viper"

"cosmossdk.io/core/server"
"cosmossdk.io/core/transaction"
"cosmossdk.io/log"
"cosmossdk.io/server/v2/appmanager"

Check failure on line 10 in server/v2/types.go

View workflow job for this annotation

GitHub Actions / split-test-files

no required module provides package cosmossdk.io/server/v2/appmanager; to add it:

Check failure on line 10 in server/v2/types.go

View workflow job for this annotation

GitHub Actions / dependency-review

no required module provides package cosmossdk.io/server/v2/appmanager; to add it:

Check failure on line 10 in server/v2/types.go

View workflow job for this annotation

GitHub Actions / dependency-review

no required module provides package cosmossdk.io/server/v2/appmanager; to add it:

Check failure on line 10 in server/v2/types.go

View workflow job for this annotation

GitHub Actions / dependency-review

could not import cosmossdk.io/server/v2/appmanager (invalid package name: "")
)

type AppCreator[T transaction.Tx] func(log.Logger, *viper.Viper) AppI[T]

type AppI[T transaction.Tx] interface {
Name() string
InterfaceRegistry() server.InterfaceRegistry
GetAppManager() *appmanager.AppManager[T]
GetConsensusAuthority() string // TODO remove
GetGPRCMethodsToMessageMap() map[string]func() gogoproto.Message
GetStore() any
}
6 changes: 5 additions & 1 deletion simapp/v2/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -260,7 +264,7 @@ var (
{
Name: consensustypes.ModuleName,
Config: appconfig.WrapAny(&consensusmodulev1.Module{
Authority: "consensus",
Authority: "consensus", // TODO remove.
}),
},
{
Expand Down
1 change: 0 additions & 1 deletion x/distribution/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 2646211

Please sign in to comment.