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

feat : upgraded the app with gravity module to SDK v0.50.0 #1041

Merged
merged 7 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
89 changes: 63 additions & 26 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,16 @@ import (
consensusmodulekeeper "github.com/palomachain/paloma/x/consensus/keeper"
consensusmoduletypes "github.com/palomachain/paloma/x/consensus/types"

gravitymodule "github.com/palomachain/paloma/x/gravity"
gravityclient "github.com/palomachain/paloma/x/gravity/client"
gravitymodulekeeper "github.com/palomachain/paloma/x/gravity/keeper"
gravitymoduletypes "github.com/palomachain/paloma/x/gravity/types"

"github.com/palomachain/paloma/x/evm"
evmclient "github.com/palomachain/paloma/x/evm/client"
evmmodulekeeper "github.com/palomachain/paloma/x/evm/keeper"
evmmoduletypes "github.com/palomachain/paloma/x/evm/types"

// gravitymodule "github.com/palomachain/paloma/x/gravity"
// gravityclient "github.com/palomachain/paloma/x/gravity/client"
// gravitymodulekeeper "github.com/palomachain/paloma/x/gravity/keeper"
// gravitymoduletypes "github.com/palomachain/paloma/x/gravity/types"
// palomamodule "github.com/palomachain/paloma/x/paloma"
// palomamodulekeeper "github.com/palomachain/paloma/x/paloma/keeper"
// palomamoduletypes "github.com/palomachain/paloma/x/paloma/types"
Expand Down Expand Up @@ -169,6 +170,8 @@ const (
func getGovProposalHandlers() []govclient.ProposalHandler {
return []govclient.ProposalHandler{
paramsclient.ProposalHandler,
gravityclient.ProposalHandler,
// treasuryclient.ProposalHandler,
evmclient.ProposalHandler,
treasuryclient.ProposalHandler,
}
Expand All @@ -178,6 +181,40 @@ var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
// and genesis verification.
ModuleBasics = module.NewBasicManager(
auth.AppModuleBasic{},
genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
bank.AppModule{},
capability.AppModuleBasic{},
staking.AppModule{},
mint.AppModule{},
distr.AppModuleBasic{},
gov.AppModule{AppModuleBasic: gov.NewAppModuleBasic(getGovProposalHandlers())},
params.AppModuleBasic{},
crisis.AppModule{},
slashing.AppModule{},
feegrantmodule.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
vesting.AppModuleBasic{},
schedulermodule.AppModuleBasic{},
consensusmodule.AppModuleBasic{},
// valsetmodule.AppModuleBasic{},
wasm.AppModuleBasic{},
evm.AppModuleBasic{},
gravitymodule.AppModuleBasic{},
// palomamodule.AppModuleBasic{},
// treasurymodule.AppModuleBasic{},
consensus.AppModuleBasic{},
transfer.AppModuleBasic{},
ibc.AppModuleBasic{},
ica.AppModuleBasic{},
ibcfee.AppModuleBasic{},
)

// module account permissions
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
Expand All @@ -186,7 +223,7 @@ var (
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
// gravitymoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner},
gravitymoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: nil,
icatypes.ModuleName: nil,
Expand Down Expand Up @@ -256,8 +293,8 @@ type App struct {
// PalomaKeeper palomamodulekeeper.Keeper
TreasuryKeeper treasurymodulekeeper.Keeper
EvmKeeper evmmodulekeeper.Keeper
// GravityKeeper gravitymodulekeeper.Keeper
wasmKeeper wasmkeeper.Keeper
GravityKeeper gravitymodulekeeper.Keeper
wasmKeeper wasmkeeper.Keeper

// ModuleManager is the module manager
ModuleManager *module.Manager
Expand Down Expand Up @@ -333,7 +370,7 @@ func New(
treasurymoduletypes.StoreKey,
wasmtypes.StoreKey,
evmmoduletypes.StoreKey,
// gravitymoduletypes.StoreKey,
gravitymoduletypes.StoreKey,
consensusparamtypes.StoreKey,
crisistypes.StoreKey,
)
Expand Down Expand Up @@ -562,18 +599,18 @@ func New(
// }
// app.ValsetKeeper.EvmKeeper = app.EvmKeeper

// app.GravityKeeper = gravitymodulekeeper.NewKeeper(
// appCodec,
// app.GetSubspace(gravitymoduletypes.ModuleName),
// app.AccountKeeper,
// app.StakingKeeper,
// app.BankKeeper,
// app.SlashingKeeper,
// app.DistrKeeper,
// app.EvmKeeper,
// app.TransferKeeper,
// gravitymodulekeeper.NewGravityStoreGetter(keys[gravitymoduletypes.StoreKey]),
// )
app.GravityKeeper = gravitymodulekeeper.NewKeeper(
appCodec,
app.GetSubspace(gravitymoduletypes.ModuleName),
app.AccountKeeper,
app.StakingKeeper,
app.BankKeeper,
app.SlashingKeeper,
app.DistrKeeper,
app.TransferKeeper,
app.EvmKeeper,
gravitymodulekeeper.NewGravityStoreGetter(keys[gravitymoduletypes.StoreKey]),
)

// app.PalomaKeeper = *palomamodulekeeper.NewKeeper(
// appCodec,
Expand Down Expand Up @@ -743,7 +780,7 @@ func New(
// valsetModule := valsetmodule.NewAppModule(appCodec, app.ValsetKeeper, app.AccountKeeper, app.BankKeeper)
schedulerModule := schedulermodule.NewAppModule(appCodec, app.SchedulerKeeper, app.AccountKeeper, app.BankKeeper)
// palomaModule := palomamodule.NewAppModule(appCodec, app.PalomaKeeper, app.AccountKeeper, app.BankKeeper)
// gravityModule := gravitymodule.NewAppModule(appCodec, app.GravityKeeper, app.BankKeeper)
gravityModule := gravitymodule.NewAppModule(appCodec, app.GravityKeeper, app.BankKeeper)
treasuryModule := treasurymodule.NewAppModule(appCodec, app.TreasuryKeeper, app.AccountKeeper, app.BankKeeper)
app.ModuleManager = module.NewManager(
genutil.NewAppModule(
Expand All @@ -770,7 +807,7 @@ func New(
consensusModule,
// valsetModule,
evmModule,
// gravityModule,
gravityModule,
// palomaModule,
treasuryModule,
wasm.NewAppModule(appCodec, &app.wasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasm.ModuleName)),
Expand Down Expand Up @@ -820,7 +857,7 @@ func New(
// palomamoduletypes.ModuleName,
evmmoduletypes.ModuleName,
wasmtypes.ModuleName,
// gravitymoduletypes.ModuleName,
gravitymoduletypes.ModuleName,
treasurymoduletypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
Expand Down Expand Up @@ -852,7 +889,7 @@ func New(
// palomamoduletypes.ModuleName,
evmmoduletypes.ModuleName,
wasmtypes.ModuleName,
// gravitymoduletypes.ModuleName,
gravitymoduletypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
Expand Down Expand Up @@ -893,7 +930,7 @@ func New(
ibcfeetypes.ModuleName,
evmmoduletypes.ModuleName,
wasmtypes.ModuleName,
// gravitymoduletypes.ModuleName,
gravitymoduletypes.ModuleName,
treasurymoduletypes.ModuleName,
consensusparamtypes.ModuleName,
)
Expand Down Expand Up @@ -1142,7 +1179,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
// paramsKeeper.Subspace(valsetmoduletypes.ModuleName)
paramsKeeper.Subspace(wasmtypes.ModuleName)
paramsKeeper.Subspace(evmmoduletypes.ModuleName)
// paramsKeeper.Subspace(gravitymoduletypes.ModuleName)
paramsKeeper.Subspace(gravitymoduletypes.ModuleName)

return paramsKeeper
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/palomad/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func NewRootCmd() *cobra.Command {
// set Bech32 address configuration
params.SetAddressConfig()
encCfg := palomaapp.MakeEncodingConfig()

tempApp := palomaapp.New(cosmoslog.NewNopLogger(), db.NewMemDB(), io.MultiWriter(), true, encCfg, db.OptionsMap{})
initClientCtx := client.Context{}.
WithCodec(encCfg.Codec).
Expand Down Expand Up @@ -66,6 +67,7 @@ func NewRootCmd() *cobra.Command {

customAppTemplate, customAppConfig := initAppConfig()
customTMConfig := initCometBFTConfig()

if err := server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customTMConfig); err != nil {
return err
}
Expand Down
Loading
Loading