Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DongLieu committed Sep 18, 2024
1 parent f5049e1 commit 7532d29
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 97 deletions.
48 changes: 10 additions & 38 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,24 +225,6 @@ func NewOnomyApp( // nolint:funlen // app new cosmos func
appOpts,
)

// app.ProviderKeeper = ibcproviderkeeper.NewKeeper(
// appCodec,
// keys[providertypes.StoreKey],
// app.GetSubspace(providertypes.ModuleName),
// scopedIBCProviderKeeper,
// app.IBCKeeper.ChannelKeeper,
// &app.IBCKeeper.PortKeeper,
// app.IBCKeeper.ConnectionKeeper,
// app.IBCKeeper.ClientKeeper,
// app.StakingKeeper,
// app.SlashingKeeper,
// app.AccountKeeper,
// app.EvidenceKeeper,
// app.DistrKeeper,
// app.BankKeeper,
// authtypes.FeeCollectorName,
// )

/**** Module Options ****/

// NOTE: Any module instantiated in the module manager that is later modified
Expand Down Expand Up @@ -320,7 +302,7 @@ func NewOnomyApp( // nolint:funlen // app new cosmos func

// and storeloader
app.setupUpgradeHandlers()
// app.setupUpgradeStoreLoaders()
app.setupUpgradeStoreLoaders()

app.SetAnteHandler(anteHandler)

Expand Down Expand Up @@ -431,16 +413,6 @@ func (app *OnomyApp) InterfaceRegistry() types.InterfaceRegistry {
return app.interfaceRegistry
}

// GetKey returns the KVStoreKey for the provided store key.
func (app *OnomyApp) GetKey(storeKey string) *storetypes.KVStoreKey {
return app.AppKeepers.GetKey(storeKey)
}

// GetMemKey returns the MemoryStoreKey for the provided store key.
func (app *OnomyApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey {
return app.AppKeepers.GetMemKey(storeKey)
}

// GetSubspace returns a param subspace for a given module name.
//
// NOTE: This is solely to be used for testing purposes.
Expand Down Expand Up @@ -557,16 +529,16 @@ func (app *OnomyApp) BlockedModuleAccountAddrs(modAccAddrs map[string]bool) map[
return modAccAddrs
}

// func (app *OnomyApp) setupUpgradeStoreLoaders() {
// upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
// if err != nil {
// panic(fmt.Sprintf("failed to read upgrade info from disk %s", err))
// }
func (app *OnomyApp) setupUpgradeStoreLoaders() {
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Sprintf("failed to read upgrade info from disk %s", err))
}

// if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
// return
// }
// }
if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
return
}
}

func (app *OnomyApp) RegisterNodeService(clientCtx client.Context, cfg config.Config) {
nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg)
Expand Down
10 changes: 4 additions & 6 deletions app/keepers/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ import (
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
"github.com/cosmos/ibc-go/v8/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"

ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper"
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
icsprovider "github.com/cosmos/interchain-security/v5/x/ccv/provider"
icsproviderkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper"
providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types"
Expand Down Expand Up @@ -362,6 +361,8 @@ func NewAppKeeper(
appKeepers.AccountKeeper.AddressCodec(),
runtime.ProvideCometInfoService(),
)
// If evidence needs to be handled for the app, set routes in router here and seal
appKeepers.EvidenceKeeper = *evidenceKeeper

appKeepers.TransferKeeper = ibctransferkeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -391,9 +392,6 @@ func NewAppKeeper(
appKeepers.StakingKeeper,
)

// If evidence needs to be handled for the app, set routes in router here and seal
appKeepers.EvidenceKeeper = *evidenceKeeper

return appKeepers
}

Expand Down
15 changes: 4 additions & 11 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
package keepers

import (
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"
ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"

storetypes "cosmossdk.io/store/types"
evidencetypes "cosmossdk.io/x/evidence/types"
"cosmossdk.io/x/feegrant"
upgradetypes "cosmossdk.io/x/upgrade/types"

authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
Expand All @@ -24,7 +16,11 @@ import (
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types"

daotypes "github.com/onomyprotocol/onomy/x/dao/types"
)

Expand All @@ -45,9 +41,6 @@ func (appKeepers *AppKeepers) GenerateKeys() {
upgradetypes.StoreKey,
evidencetypes.StoreKey,
ibctransfertypes.StoreKey,
ibcfeetypes.StoreKey,
icahosttypes.StoreKey,
icacontrollertypes.StoreKey,
capabilitytypes.StoreKey,
feegrant.StoreKey,
authzkeeper.StoreKey,
Expand Down
34 changes: 12 additions & 22 deletions app/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,17 @@ package app

import (
"cosmossdk.io/x/evidence"
evidencetypes "cosmossdk.io/x/evidence/types"
"cosmossdk.io/x/feegrant"
feegrantmodule "cosmossdk.io/x/feegrant/module"
"cosmossdk.io/x/upgrade"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/ibc-go/modules/capability"
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
// "github.com/cosmos/cosmos-sdk/x/staking"
evidencetypes "cosmossdk.io/x/evidence/types"
"cosmossdk.io/x/feegrant"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/client"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
authz "github.com/cosmos/cosmos-sdk/x/authz"
Expand All @@ -34,20 +24,27 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
genutil "github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/mint"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
sdkparams "github.com/cosmos/cosmos-sdk/x/params"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/cosmos-sdk/x/slashing"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/ibc-go/modules/capability"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v8/modules/core"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types"

"github.com/onomyprotocol/onomy/x/dao"
Expand Down Expand Up @@ -142,16 +139,13 @@ func orderBeginBlockers() []string {
crisistypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
genutiltypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
providertypes.ModuleName,
// and
daotypes.ModuleName,
}
}
Expand All @@ -163,9 +157,7 @@ func orderEndBlockers() []string {
stakingtypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
icatypes.ModuleName,
capabilitytypes.ModuleName,
ibcfeetypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
distrtypes.ModuleName,
Expand Down Expand Up @@ -198,8 +190,6 @@ func orderInitBlockers() []string {
genutiltypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
evidencetypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
Expand Down
12 changes: 11 additions & 1 deletion cmd/onomyd/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
// NewRootCmd initiates the cli for onomy chain.
func NewRootCmd() *cobra.Command {
initAppOptions := viper.New()
tempDir := app.DefaultNodeHome
tempDir := tempDir()
initAppOptions.Set(flags.FlagHome, tempDir)
tempApplication := app.NewOnomyApp(
log.NewNopLogger(),
Expand Down Expand Up @@ -154,3 +154,13 @@ func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context)

return autoCliOpts
}

var tempDir = func() string {
dir, err := os.MkdirTemp("", "."+app.AppName)
if err != nil {
dir = app.DefaultNodeHome
}
defer os.RemoveAll(dir)

return dir
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,5 @@ require (
replace (
github.com/cosmos/cosmos-sdk => github.com/DongLieu/cosmos-sdk v0.50.8-onomy
github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
)
Loading

0 comments on commit 7532d29

Please sign in to comment.