Skip to content

Commit

Permalink
fix(app): add consensus param keeper, new from SDK v0.47
Browse files Browse the repository at this point in the history
  • Loading branch information
tuantran1702 committed Jan 25, 2024
1 parent 0af98d6 commit f8e9c60
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
10 changes: 8 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"os"
"path/filepath"

ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"

"github.com/CosmWasm/wasmd/x/wasm"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/cosmos/cosmos-sdk/x/consensus"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
"github.com/spf13/cast"

dbm "github.com/cometbft/cometbft-db"
Expand Down Expand Up @@ -119,6 +120,7 @@ func New(
slashingtypes.StoreKey,
govtypes.StoreKey,
paramstypes.StoreKey,
consensusparamtypes.StoreKey,
ibcexported.StoreKey,
upgradetypes.StoreKey,
evidencetypes.StoreKey,
Expand Down Expand Up @@ -179,6 +181,7 @@ func New(
evidence.NewAppModule(app.EvidenceKeeper),
ibc.NewAppModule(app.IBCKeeper),
params.NewAppModule(app.ParamsKeeper),
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
transferModule,
wasm.NewAppModule(appCodec, &app.wasmKeeper, app.StakingKeeper),
admin.NewAppModule(appCodec, app.adminKeeper),
Expand Down Expand Up @@ -207,6 +210,7 @@ func New(
genutiltypes.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
consensusparamtypes.ModuleName,
admintypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
Expand All @@ -228,6 +232,7 @@ func New(
evidencetypes.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
consensusparamtypes.ModuleName,
upgradetypes.ModuleName,
admintypes.ModuleName,
ibcexported.ModuleName,
Expand All @@ -254,6 +259,7 @@ func New(
evidencetypes.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
consensusparamtypes.ModuleName,
upgradetypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
Expand Down
34 changes: 18 additions & 16 deletions app/app_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec/types"
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"

"github.com/CudoVentures/cudos-node/x/admin"
adminkeeper "github.com/CudoVentures/cudos-node/x/admin/keeper"
Expand Down Expand Up @@ -175,22 +176,23 @@ type App struct {
memKeys map[string]*sdk.MemoryStoreKey

// keepers
AccountKeeper authkeeper.AccountKeeper
AuthzKeeper authzkeeper.Keeper
BankKeeper custombankkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper govkeeper.Keeper
CrisisKeeper crisiskeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
AccountKeeper authkeeper.AccountKeeper
AuthzKeeper authzkeeper.Keeper
BankKeeper custombankkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper govkeeper.Keeper
CrisisKeeper crisiskeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
ConsensusParamsKeeper consensusparamkeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper

wasmKeeper wasm.Keeper
adminKeeper adminkeeper.Keeper
Expand Down
9 changes: 5 additions & 4 deletions app/app_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"path/filepath"

"github.com/CosmWasm/wasmd/x/wasm"

adminkeeper "github.com/CudoVentures/cudos-node/x/admin/keeper"
admintypes "github.com/CudoVentures/cudos-node/x/admin/types"
"github.com/cosmos/cosmos-sdk/baseapp"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
"github.com/cosmos/cosmos-sdk/x/params"
"github.com/cosmos/cosmos-sdk/x/upgrade"

Expand All @@ -32,7 +32,6 @@ import (
feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
Expand All @@ -58,7 +57,9 @@ func (app *App) AddKeepers(skipUpgradeHeights map[int64]bool, homePath string, a
app.ParamsKeeper = InitParamsKeeper(app.appCodec, app.cdc, app.keys[paramstypes.StoreKey], app.tkeys[paramstypes.TStoreKey])

// set the BaseApp's parameter store
app.BaseApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable()))
app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(app.appCodec, app.keys[consensusparamtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String())

app.BaseApp.SetParamStore(&app.ConsensusParamsKeeper)

// add capability keeper and ScopeToModule for ibc module
app.CapabilityKeeper = capabilitykeeper.NewKeeper(app.appCodec, app.keys[capabilitytypes.StoreKey], app.memKeys[capabilitytypes.MemStoreKey])
Expand Down

0 comments on commit f8e9c60

Please sign in to comment.