Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove consensus param migration from finalizeBlock #75

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import (
"net/http"
"os"
"path/filepath"
"sync"

tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
"github.com/cosmos/gogoproto/proto"
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
Expand Down Expand Up @@ -269,7 +267,6 @@ type Canto struct {
configurator module.Configurator

tpsCounter *tpsCounter
once sync.Once
}

func init() {
Expand Down Expand Up @@ -1265,23 +1262,6 @@ func (app *Canto) GetTxConfig() client.TxConfig {
}

func (app *Canto) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) {
// when skipping sdk 47 for sdk 50, the upgrade handler is called too late in BaseApp
// this is a hack to ensure that the migration is executed when needed and not panics
app.once.Do(func() {
ctx := app.NewUncachedContext(false, tmproto.Header{})
if _, err := app.ConsensusParamsKeeper.Params(ctx, &consensusparamtypes.QueryParamsRequest{}); err != nil {
// prevents panic: consensus key is nil: collections: not found: key 'no_key' of type github.com/cosmos/gogoproto/tendermint.types.ConsensusParams
// sdk 47:
// Migrate Tendermint consensus parameters from x/params module to a dedicated x/consensus module.
// see https://github.com/cosmos/cosmos-sdk/blob/v0.47.0/simapp/upgrades.go#L66
baseAppLegacySS := app.GetSubspace(baseapp.Paramspace)
err := baseapp.MigrateParams(sdk.UnwrapSDKContext(ctx), baseAppLegacySS, app.ConsensusParamsKeeper.ParamsStore)
if err != nil {
panic(err)
}
}
})

return app.BaseApp.FinalizeBlock(req)
}

Expand Down
Loading