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

chore: upgrades merge #318

Merged
merged 3 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
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
63 changes: 37 additions & 26 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ var (
buildertypes.ModuleName: nil,
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
icatypes.ModuleName: nil,
wasm.ModuleName: {authtypes.Burner},
wasmtypes.ModuleName: {authtypes.Burner},
interchainqueriesmoduletypes.ModuleName: nil,
feetypes.ModuleName: nil,
feeburnertypes.ModuleName: nil,
Expand Down Expand Up @@ -307,7 +307,7 @@ type App struct {

ConsensusParamsKeeper consensusparamkeeper.Keeper

WasmKeeper wasm.Keeper
WasmKeeper wasmkeeper.Keeper

// mm is the module manager
mm *module.Manager
Expand Down Expand Up @@ -347,30 +347,30 @@ func New(
invCheckPeriod uint,
encodingConfig appparams.EncodingConfig,
appOpts servertypes.AppOptions,
wasmOpts []wasm.Option,
wasmOpts []wasmkeeper.Option,
baseAppOptions ...func(*baseapp.BaseApp),
) *App {
appCodec := encodingConfig.Marshaler
legacyAmino := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

config := mempool.NewDefaultAuctionFactory(encodingConfig.TxConfig.TxDecoder())
cfg := mempool.NewDefaultAuctionFactory(encodingConfig.TxConfig.TxDecoder())
// 0 - unlimited amount of txs
maxTx := 0
mempool := mempool.NewAuctionMempool(encodingConfig.TxConfig.TxDecoder(), encodingConfig.TxConfig.TxEncoder(), maxTx, config)
memPool := mempool.NewAuctionMempool(encodingConfig.TxConfig.TxDecoder(), encodingConfig.TxConfig.TxEncoder(), maxTx, cfg)

bApp := baseapp.NewBaseApp(Name, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
bApp.SetVersion(version.Version)
bApp.SetInterfaceRegistry(interfaceRegistry)
bApp.SetMempool(mempool)
bApp.SetMempool(memPool)

keys := sdk.NewKVStoreKeys(
authzkeeper.StoreKey, authtypes.StoreKey, banktypes.StoreKey, slashingtypes.StoreKey,
paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey,
icahosttypes.StoreKey, capabilitytypes.StoreKey,
interchainqueriesmoduletypes.StoreKey, contractmanagermoduletypes.StoreKey, interchaintxstypes.StoreKey, wasm.StoreKey, feetypes.StoreKey,
interchainqueriesmoduletypes.StoreKey, contractmanagermoduletypes.StoreKey, interchaintxstypes.StoreKey, wasmtypes.StoreKey, feetypes.StoreKey,
feeburnertypes.StoreKey, adminmoduletypes.StoreKey, ccvconsumertypes.StoreKey, tokenfactorytypes.StoreKey, routertypes.StoreKey,
crontypes.StoreKey, ibchookstypes.StoreKey, consensusparamtypes.StoreKey, crisistypes.StoreKey, buildertypes.StoreKey,
)
Expand Down Expand Up @@ -403,7 +403,7 @@ func New(
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasm.ModuleName)
scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName)
scopedInterTxKeeper := app.CapabilityKeeper.ScopeToModule(interchaintxstypes.ModuleName)
scopedCCVConsumerKeeper := app.CapabilityKeeper.ScopeToModule(ccvconsumertypes.ModuleName)

Expand Down Expand Up @@ -598,7 +598,7 @@ func New(
wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
panic(fmt.Sprintf("error while reading wasm config: %s", err))
panic(fmt.Sprintf("error while reading wasm cfg: %s", err))
}

// The last arguments can contain custom message handlers, and custom query handlers,
Expand Down Expand Up @@ -657,9 +657,9 @@ func New(
&wasmkeeper.QueryPlugins{Stargate: wasmkeeper.AcceptListStargateQuerier(wasmbinding.AcceptedStargateQueries(), app.GRPCQueryRouter(), appCodec)})
wasmOpts = append(wasmOpts, queryPlugins)

app.WasmKeeper = wasm.NewKeeper(
app.WasmKeeper = wasmkeeper.NewKeeper(
appCodec,
keys[wasm.StoreKey],
keys[wasmtypes.StoreKey],
app.AccountKeeper,
&app.BankKeeper,
nil,
Expand Down Expand Up @@ -721,7 +721,7 @@ func New(
AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
AddRoute(ibctransfertypes.ModuleName, ibcStack).
AddRoute(interchaintxstypes.ModuleName, icaControllerStack).
AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper)).
AddRoute(wasmtypes.ModuleName, wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper)).
AddRoute(ccvconsumertypes.ModuleName, consumerModule)
app.IBCKeeper.SetRouter(ibcRouter)

Expand Down Expand Up @@ -792,7 +792,7 @@ func New(
interchainqueriesmoduletypes.ModuleName,
interchaintxstypes.ModuleName,
contractmanagermoduletypes.ModuleName,
wasm.ModuleName,
wasmtypes.ModuleName,
feetypes.ModuleName,
feeburnertypes.ModuleName,
adminmoduletypes.ModuleName,
Expand Down Expand Up @@ -823,7 +823,7 @@ func New(
interchainqueriesmoduletypes.ModuleName,
interchaintxstypes.ModuleName,
contractmanagermoduletypes.ModuleName,
wasm.ModuleName,
wasmtypes.ModuleName,
feetypes.ModuleName,
feeburnertypes.ModuleName,
adminmoduletypes.ModuleName,
Expand Down Expand Up @@ -859,7 +859,7 @@ func New(
interchainqueriesmoduletypes.ModuleName,
interchaintxstypes.ModuleName,
contractmanagermoduletypes.ModuleName,
wasm.ModuleName,
wasmtypes.ModuleName,
feetypes.ModuleName,
feeburnertypes.ModuleName,
adminmoduletypes.ModuleName,
Expand Down Expand Up @@ -918,10 +918,10 @@ func New(
},
IBCKeeper: app.IBCKeeper,
WasmConfig: &wasmConfig,
TXCounterStoreKey: keys[wasm.StoreKey],
TXCounterStoreKey: keys[wasmtypes.StoreKey],
ConsumerKeeper: app.ConsumerKeeper,
buildKeeper: app.BuilderKeeper,
mempool: mempool,
mempool: memPool,
GlobalFeeSubspace: app.GetSubspace(globalfee.ModuleName),
},
app.Logger(),
Expand All @@ -934,7 +934,7 @@ func New(
app.SetEndBlocker(app.EndBlocker)

handler := proposalhandler.NewProposalHandler(
mempool,
memPool,
bApp.Logger(),
anteHandler,
encodingConfig.TxConfig.TxEncoder(),
Expand All @@ -946,7 +946,7 @@ func New(
checkTxHandler := proposalhandler.NewCheckTxHandler(
app.BaseApp,
encodingConfig.TxConfig.TxDecoder(),
mempool,
memPool,
anteHandler,
chainID,
)
Expand Down Expand Up @@ -989,25 +989,25 @@ func New(
func (app *App) setupUpgradeStoreLoaders() {
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Sprintf("failed to read upgrade info from disk %s", err))
panic(fmt.Sprintf("failed to read upgrd info from disk %s", err))
}

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

for _, upgrade := range Upgrades {
if upgradeInfo.Name == upgrade.UpgradeName {
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrade.StoreUpgrades))
for _, upgrd := range Upgrades {
if upgradeInfo.Name == upgrd.UpgradeName {
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrd.StoreUpgrades))
}
}
}

func (app *App) setupUpgradeHandlers() {
for _, upgrade := range Upgrades {
for _, upgrd := range Upgrades {
app.UpgradeKeeper.SetUpgradeHandler(
upgrade.UpgradeName,
upgrade.CreateUpgradeHandler(
upgrd.UpgradeName,
upgrd.CreateUpgradeHandler(
app.mm,
app.configurator,
&upgrades.UpgradeKeepers{
Expand All @@ -1018,6 +1018,8 @@ func (app *App) setupUpgradeHandlers() {
SlashingKeeper: app.SlashingKeeper,
ParamsKeeper: app.ParamsKeeper,
CapabilityKeeper: app.CapabilityKeeper,
BuilderKeeper: app.BuilderKeeper,
ContractManager: app.ContractManagerKeeper,
GlobalFeeSubspace: app.GetSubspace(globalfee.ModuleName),
CcvConsumerSubspace: app.GetSubspace(ccvconsumertypes.ModuleName),
},
Expand Down Expand Up @@ -1184,6 +1186,15 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(globalfee.ModuleName)

paramsKeeper.Subspace(ccvconsumertypes.ModuleName)

// MOTE: legacy subspaces for migration sdk47 only
paramsKeeper.Subspace(crontypes.StoreKey).WithKeyTable(crontypes.ParamKeyTable())
paramsKeeper.Subspace(feeburnertypes.StoreKey).WithKeyTable(feeburnertypes.ParamKeyTable())
paramsKeeper.Subspace(feetypes.StoreKey).WithKeyTable(feetypes.ParamKeyTable())
paramsKeeper.Subspace(tokenfactorytypes.StoreKey).WithKeyTable(tokenfactorytypes.ParamKeyTable())
paramsKeeper.Subspace(interchainqueriesmoduletypes.StoreKey).WithKeyTable(interchainqueriesmoduletypes.ParamKeyTable())
paramsKeeper.Subspace(interchaintxstypes.StoreKey).WithKeyTable(interchaintxstypes.ParamKeyTable())

return paramsKeeper
}

Expand Down
4 changes: 2 additions & 2 deletions app/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ package app_test
// simapp.GetSimulatorFlags()
// }
//
//type SimApp interface {
// type SimApp interface {
// GetBaseApp() *baseapp.BaseApp
// AppCodec() codec.Codec
// SimulationManager() *module.SimulationManager
Expand All @@ -51,7 +51,7 @@ package app_test
//// `starport chain simulate -v --numBlocks 200 --blockSize 50`
//// Running as go benchmark test:
//// `go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true`
//func BenchmarkSimulation(b *testing.B) {
// func BenchmarkSimulation(b *testing.B) {
// simapp.FlagEnabledValue = true
// simapp.FlagCommitValue = true
//
Expand Down
8 changes: 0 additions & 8 deletions app/upgrades/nextupgrade/constants.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package nextupgrade

import (
store "github.com/cosmos/cosmos-sdk/store/types"

"github.com/cosmos/gaia/v11/x/globalfee"
"github.com/neutron-org/neutron/app/upgrades"
)

Expand All @@ -15,9 +12,4 @@ const (
var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{
globalfee.ModuleName,
},
},
}
Loading