Skip to content

Commit

Permalink
refactor: extract posthandler package (celestiaorg#3055)
Browse files Browse the repository at this point in the history
Another small refactor to make app.go more readable.
  • Loading branch information
rootulp authored Jan 30, 2024
1 parent f99b54f commit ef3c0d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
15 changes: 2 additions & 13 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app
import (
"io"

"github.com/celestiaorg/celestia-app/app/posthandler"
"github.com/celestiaorg/celestia-app/x/mint"
mintkeeper "github.com/celestiaorg/celestia-app/x/mint/keeper"
minttypes "github.com/celestiaorg/celestia-app/x/mint/types"
Expand All @@ -23,7 +24,6 @@ import (
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/posthandler"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
Expand Down Expand Up @@ -496,7 +496,7 @@ func New(
ante.DefaultSigVerificationGasConsumer,
app.IBCKeeper,
))
app.setPostHanders()
app.SetPostHandler(posthandler.New())

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
Expand Down Expand Up @@ -663,17 +663,6 @@ func (app *App) RegisterNodeService(clientCtx client.Context) {
nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter())
}

func (app *App) setPostHanders() {
postHandler, err := posthandler.NewPostHandler(
posthandler.HandlerOptions{},
)
if err != nil {
panic(err)
}

app.SetPostHandler(postHandler)
}

// BlockedParams are params that require a hardfork to change, and cannot be changed via
// governance.
func (*App) BlockedParams() [][2]string {
Expand Down
12 changes: 12 additions & 0 deletions app/posthandler/posthandler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package posthandler

import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

// New returns a new posthandler chain. Note: the Cosmos SDK does not export a
// type for PostHandler so the AnteHandler type is used.
func New() sdk.AnteHandler {
postDecorators := []sdk.AnteDecorator{}
return sdk.ChainAnteDecorators(postDecorators...)
}

0 comments on commit ef3c0d5

Please sign in to comment.