Skip to content

Commit f8f4c35

Browse files
authored
refactor(types)!: remove handler and update docs (#17358)
1 parent 840482f commit f8f4c35

File tree

5 files changed

+3
-13
lines changed

5 files changed

+3
-13
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
6464

6565
### API Breaking Changes
6666

67+
* (types) [#17358](https://github.com/cosmos/cosmos-sdk/pull/17358) Remove deprecated `sdk.Handler`, use `baseapp.MsgServiceHandler` instead.
6768
* (x/slashing) [17044](https://github.com/cosmos/cosmos-sdk/pull/17044) Use collections for `AddrPubkeyRelation`:
6869
* remove from `types`: `AddrPubkeyRelationKey`
6970
* remove from `Keeper`: `AddPubkey`

docs/docs/building-modules/01-module-manager.md

-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ The module manager is used throughout the application whenever an action on a co
261261
* `SetOrderPrepareCheckStaters(moduleNames ...string)`: Sets the order in which the `PrepareCheckState()` function of each module will be called during commit of each block. This function is generally called from the application's main [constructor function](../basics/00-app-anatomy.md#constructor-function).
262262
* `SetOrderMigrations(moduleNames ...string)`: Sets the order of migrations to be run. If not set then migrations will be run with an order defined in `DefaultMigrationsOrder`.
263263
* `RegisterInvariants(ir sdk.InvariantRegistry)`: Registers the [invariants](./07-invariants.md) of module implementing the `HasInvariants` interface.
264-
* `RegisterRoutes(router sdk.Router, queryRouter sdk.QueryRouter, legacyQuerierCdc *codec.LegacyAmino)`: Registers legacy [`Msg`](./02-messages-and-queries.md#messages) and [`querier`](./04-query-services.md#legacy-queriers) routes.
265264
* `RegisterServices(cfg Configurator)`: Registers the services of modules implementing the `HasServices` interface.
266265
* `InitGenesis(ctx context.Context, cdc codec.JSONCodec, genesisData map[string]json.RawMessage)`: Calls the [`InitGenesis`](./08-genesis.md#initgenesis) function of each module when the application is first started, in the order defined in `OrderInitGenesis`. Returns an `abci.ResponseInitChain` to the underlying consensus engine, which can contain validator updates.
267266
* `ExportGenesis(ctx context.Context, cdc codec.JSONCodec)`: Calls the [`ExportGenesis`](./08-genesis.md#exportgenesis) function of each module, in the order defined in `OrderExportGenesis`. The export constructs a genesis file from a previously existing state, and is mainly used when a hard-fork upgrade of the chain is required.

docs/docs/core/08-events.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,7 @@ ctx.EventManager().EmitEvent(
9696
)
9797
```
9898

99-
Module's `handler` function should also set a new `EventManager` to the `context` to isolate emitted Events per `message`:
100-
101-
```go
102-
func NewHandler(keeper Keeper) sdk.Handler {
103-
return func(ctx context.Context, msg sdk.Msg) (*sdk.Result, error) {
104-
ctx = ctx.WithEventManager(sdk.NewEventManager())
105-
switch msg := msg.(type) {
106-
```
99+
Where the `EventManager` is accessed via the [`Context`](./02-context.md).
107100

108101
See the [`Msg` services](../building-modules/03-msg-services.md) concept doc for a more detailed
109102
view on how to typically implement Events and use the `EventManager` in modules.

server/mock/app.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func NewApp(rootDir string, logger log.Logger) (servertypes.ABCI, error) {
6666

6767
// KVStoreHandler is a simple handler that takes KVStoreTx and writes
6868
// them to the db.
69-
func KVStoreHandler(storeKey storetypes.StoreKey) sdk.Handler {
69+
func KVStoreHandler(storeKey storetypes.StoreKey) bam.MsgServiceHandler {
7070
return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
7171
dTx, ok := msg.(*KVStoreTx)
7272
if !ok {

types/handler.go

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package types
22

3-
// Handler defines the core of the state transition function of an application.
4-
type Handler func(ctx Context, msg Msg) (*Result, error)
5-
63
// AnteHandler authenticates transactions, before their internal messages are handled.
74
// If newCtx.IsZero(), ctx is used instead.
85
type AnteHandler func(ctx Context, tx Tx, simulate bool) (newCtx Context, err error)

0 commit comments

Comments
 (0)