Skip to content

Commit

Permalink
Merge pull request #326 from comdex-official/release-make
Browse files Browse the repository at this point in the history
Release make
  • Loading branch information
dheerajkd30 authored Jul 6, 2022
2 parents 9490ee7 + 9007000 commit a3341b9
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 48 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/target/
/release/
/build/
/cover.out
/cover.out
/bin/
76 changes: 41 additions & 35 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package app
import (
"fmt"

ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts"
/*ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts"
icahost "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types"
icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types"*/

"io"
"os"
Expand Down Expand Up @@ -253,6 +253,7 @@ var (
wasm.AppModuleBasic{},
liquidity.AppModuleBasic{},
rewards.AppModuleBasic{},
//ica.AppModuleBasic{},
)
)

Expand Down Expand Up @@ -288,21 +289,21 @@ type App struct {
mkeys map[string]*sdk.MemoryStoreKey

// keepers
AccountKeeper authkeeper.AccountKeeper
FeegrantKeeper feegrantkeeper.Keeper
BankKeeper bankkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
MintKeeper mintkeeper.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
ICAHostKeeper *icahostkeeper.Keeper
AccountKeeper authkeeper.AccountKeeper
FeegrantKeeper feegrantkeeper.Keeper
BankKeeper bankkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
MintKeeper mintkeeper.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
//ICAHostKeeper *icahostkeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
IbcTransferKeeper ibctransferkeeper.Keeper

Expand All @@ -311,7 +312,7 @@ type App struct {
ScopedIBCTransferKeeper capabilitykeeper.ScopedKeeper
ScopedIBCOracleKeeper capabilitykeeper.ScopedKeeper
ScopedBandoracleKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
//ScopedICAHostKeeper capabilitykeeper.ScopedKeeper

BandoracleKeeper bandoraclemodulekeeper.Keeper
AssetKeeper assetkeeper.Keeper
Expand Down Expand Up @@ -358,7 +359,7 @@ func New(
keys = sdk.NewKVStoreKeys(
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, icahosttypes.StoreKey, upgradetypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey /*icahosttypes.StoreKey,*/, upgradetypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
vaulttypes.StoreKey, assettypes.StoreKey, collectortypes.StoreKey, liquidationtypes.StoreKey,
markettypes.StoreKey, bandoraclemoduletypes.StoreKey, lockertypes.StoreKey,
Expand Down Expand Up @@ -402,7 +403,7 @@ func New(
app.ParamsKeeper.Subspace(crisistypes.ModuleName)
app.ParamsKeeper.Subspace(ibctransfertypes.ModuleName)
app.ParamsKeeper.Subspace(ibchost.ModuleName)
app.ParamsKeeper.Subspace(icahosttypes.SubModuleName)
//app.ParamsKeeper.Subspace(icahosttypes.SubModuleName)
app.ParamsKeeper.Subspace(vaulttypes.ModuleName)
app.ParamsKeeper.Subspace(assettypes.ModuleName)
app.ParamsKeeper.Subspace(collectortypes.ModuleName)
Expand Down Expand Up @@ -434,11 +435,11 @@ func New(

// grant capabilities for the ibc and ibc-transfer modules
var (
scopedIBCKeeper = app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName)
scopedTransferKeeper = app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedIBCOracleKeeper = app.CapabilityKeeper.ScopeToModule(markettypes.ModuleName)
scopedWasmKeeper = app.CapabilityKeeper.ScopeToModule(wasm.ModuleName)
scopedICAHostKeeper = app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
scopedIBCKeeper = app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName)
scopedTransferKeeper = app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedIBCOracleKeeper = app.CapabilityKeeper.ScopeToModule(markettypes.ModuleName)
scopedWasmKeeper = app.CapabilityKeeper.ScopeToModule(wasm.ModuleName)
//scopedICAHostKeeper = app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
scopedBandoracleKeeper = app.CapabilityKeeper.ScopeToModule(bandoraclemoduletypes.ModuleName)
)

Expand Down Expand Up @@ -528,7 +529,7 @@ func New(
scopedIBCKeeper,
)

icaHostKeeper := icahostkeeper.NewKeeper(
/*icaHostKeeper := icahostkeeper.NewKeeper(
appCodec, app.keys[icahosttypes.StoreKey],
app.GetSubspace(icahosttypes.SubModuleName),
app.IbcKeeper.ChannelKeeper,
Expand All @@ -539,7 +540,7 @@ func New(
)
app.ICAHostKeeper = &icaHostKeeper
icaHostIBCModule := icahost.NewIBCModule(*app.ICAHostKeeper)
icaHostIBCModule := icahost.NewIBCModule(*app.ICAHostKeeper)*/
app.AssetKeeper = assetkeeper.NewKeeper(
app.cdc,
app.keys[assettypes.StoreKey],
Expand Down Expand Up @@ -775,7 +776,7 @@ func New(
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
ibcRouter.AddRoute(bandoraclemoduletypes.ModuleName, bandOracleIBCModule)
ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.WasmKeeper, app.IbcKeeper.ChannelKeeper))
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule)
//ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule)
app.IbcKeeper.SetRouter(ibcRouter)
// Create evidence Keeper for to register the IBC light client misbehaviour evidence route
app.EvidenceKeeper = *evidencekeeper.NewKeeper(
Expand Down Expand Up @@ -811,7 +812,7 @@ func New(
evidence.NewAppModule(app.EvidenceKeeper),
authzmodule.NewAppModule(app.cdc, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
ibc.NewAppModule(app.IbcKeeper),
ica.NewAppModule(nil, app.ICAHostKeeper),
//ica.NewAppModule(nil, app.ICAHostKeeper),
params.NewAppModule(app.ParamsKeeper),
transferModule,
asset.NewAppModule(app.cdc, app.AssetKeeper),
Expand All @@ -836,7 +837,7 @@ func New(
// NOTE: staking module is required if HistoricalEntries param > 0
app.mm.SetOrderBeginBlockers(
upgradetypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName,
evidencetypes.ModuleName, stakingtypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, icatypes.ModuleName,
evidencetypes.ModuleName, stakingtypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, /* icatypes.ModuleName,*/
bandoraclemoduletypes.ModuleName, markettypes.ModuleName, lockertypes.ModuleName,
crisistypes.ModuleName, genutiltypes.ModuleName, authtypes.ModuleName, capabilitytypes.ModuleName,
authz.ModuleName, transferModule.Name(), assettypes.ModuleName, collectortypes.ModuleName, vaulttypes.ModuleName,
Expand All @@ -849,7 +850,7 @@ func New(
crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName,
minttypes.ModuleName, bandoraclemoduletypes.ModuleName, markettypes.ModuleName, lockertypes.ModuleName,
distrtypes.ModuleName, genutiltypes.ModuleName, vesting.AppModuleBasic{}.Name(), evidencetypes.ModuleName, ibchost.ModuleName,
icatypes.ModuleName, vaulttypes.ModuleName, liquidationtypes.ModuleName, auctiontypes.ModuleName, tokenminttypes.ModuleName,
/*icatypes.ModuleName,*/ vaulttypes.ModuleName, liquidationtypes.ModuleName, auctiontypes.ModuleName, tokenminttypes.ModuleName,
wasmtypes.ModuleName, authtypes.ModuleName, slashingtypes.ModuleName, authz.ModuleName,
paramstypes.ModuleName, capabilitytypes.ModuleName, upgradetypes.ModuleName, transferModule.Name(), lendtypes.ModuleName,
assettypes.ModuleName, collectortypes.ModuleName, banktypes.ModuleName, rewardstypes.ModuleName, liquiditytypes.ModuleName, esmtypes.ModuleName,
Expand All @@ -871,7 +872,7 @@ func New(
minttypes.ModuleName,
crisistypes.ModuleName,
ibchost.ModuleName,
icatypes.ModuleName,
//icatypes.ModuleName,
genutiltypes.ModuleName,
evidencetypes.ModuleName,
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -942,17 +943,22 @@ func New(
// Note that since this reads from the store, we can only perform it when
// `loadLatest` is set to true.
ctx := app.BaseApp.NewUncachedContext(true, tmprototypes.Header{})

if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil {
tmos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err))
}
app.CapabilityKeeper.InitMemStore(ctx)
app.CapabilityKeeper.Seal()
}

app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedIBCTransferKeeper = scopedTransferKeeper
app.ScopedIBCOracleKeeper = scopedIBCOracleKeeper
app.ScopedICAHostKeeper = scopedICAHostKeeper
//app.ScopedICAHostKeeper = scopedICAHostKeeper
app.ScopedBandoracleKeeper = scopedBandoracleKeeper

app.ScopedWasmKeeper = scopedWasmKeeper

return app
}

Expand Down Expand Up @@ -1094,7 +1100,7 @@ func (a *App) ModuleAccountsPermissions() map[string][]string {
wasm.ModuleName: {authtypes.Burner},
liquiditytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
rewardstypes.ModuleName: {authtypes.Minter, authtypes.Burner},
icatypes.ModuleName: nil,
//icatypes.ModuleName: nil,
}
}

Expand Down Expand Up @@ -1144,7 +1150,7 @@ func (a *App) registerUpgradeHandlers() {
tokenminttypes.ModuleName,
vaulttypes.ModuleName,
feegrant.ModuleName,
icahosttypes.StoreKey,
//icahosttypes.StoreKey,
},
}
}
Expand Down
21 changes: 9 additions & 12 deletions app/upgrades/testnet/v2_0_0/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ package v2_0_0
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/authz"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts"
icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types"
)

// CreateUpgradeHandler creates an SDK upgrade handler for v2_0_0
Expand All @@ -21,13 +12,16 @@ func CreateUpgradeHandler(
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// Refs:
/*// Refs:
// - https://docs.cosmos.network/master/building-modules/upgrade.html#registering-migrations
// - https://docs.cosmos.network/master/migrations/chain-upgrade-guide-044.html#chain-upgrade
// Add Interchain Accounts host module
// set the ICS27 consensus version so InitGenesis is not run
fromVM[icatypes.ModuleName] = mm.Modules[icatypes.ModuleName].ConsensusVersion()
//fromVM[icatypes.ModuleName] = mm.Modules[icatypes.ModuleName].ConsensusVersion()
// save oldIcaVersion, so we can skip icahost.InitModule in longer term tests.
oldIcaVersion := fromVM[icatypes.ModuleName]
// create ICS27 Controller submodule params, controller module not enabled.
controllerParams := icacontrollertypes.Params{}
Expand Down Expand Up @@ -60,7 +54,10 @@ func CreateUpgradeHandler(
if !correctTypecast {
panic("mm.Modules[icatypes.ModuleName] is not of type ica.AppModule")
}
icamodule.InitModule(ctx, controllerParams, hostParams)
// skip InitModule in upgrade tests after the upgrade has gone through.
if oldIcaVersion != fromVM[icatypes.ModuleName] {
icamodule.InitModule(ctx, controllerParams, hostParams)
}*/

newVM, err := mm.RunMigrations(ctx, configurator, fromVM)

Expand Down

0 comments on commit a3341b9

Please sign in to comment.