From bcc11dac236007c408f5824f95eb9b3723647173 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 22 Mar 2022 15:08:41 -0400 Subject: [PATCH 1/8] updates --- app/upgrades/v7/upgrades.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go index d34f022f7d8..8e4afa082e7 100644 --- a/app/upgrades/v7/upgrades.go +++ b/app/upgrades/v7/upgrades.go @@ -1,23 +1,23 @@ package v7 import ( + "github.com/CosmWasm/wasmd/x/wasm" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/CosmWasm/wasmd/x/wasm" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - epochskeeper "github.com/osmosis-labs/osmosis/v7/x/epochs/keeper" lockupkeeper "github.com/osmosis-labs/osmosis/v7/x/lockup/keeper" mintkeeper "github.com/osmosis-labs/osmosis/v7/x/mint/keeper" - superfluidkeeper "github.com/osmosis-labs/osmosis/v7/x/superfluid/keeper" superfluidtypes "github.com/osmosis-labs/osmosis/v7/x/superfluid/types" ) -func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, wasmKeeper *wasm.Keeper, superfluidKeeper *superfluidkeeper.Keeper, epochsKeeper *epochskeeper.Keeper, @@ -27,25 +27,26 @@ func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { // Set wasm old version to 1 if we want to call wasm's InitGenesis ourselves - // in this upgrade logic ourselves + // in this upgrade logic ourselves. + // // vm[wasm.ModuleName] = wasm.ConsensusVersion - - // otherwise we run this, which will run wasm.InitGenesis(wasm.DefaultGenesis()) - // and then override it after + // + // Otherwise we run this, which will run wasm.InitGenesis(wasm.DefaultGenesis()) + // and then override it after. newVM, err := mm.RunMigrations(ctx, configurator, vm) if err != nil { return newVM, err } - // Since we provide custom DefaultGenesis (privileges StoreCode) in app/genesis.go rather than - // the wasm module, we need to set the params here when migrating (is it is not customized). - + // Since we provide custom DefaultGenesis (privileges StoreCode) in + // app/genesis.go rather than the wasm module, we need to set the params + // here when migrating (is it is not customized). params := wasmKeeper.GetParams(ctx) params.CodeUploadAccess = wasmtypes.AllowNobody wasmKeeper.SetParams(ctx, params) - ctx.Logger().Info("Merging lockups for similar durations") // Merge similar duration lockups + ctx.Logger().Info("Merging lockups for similar durations") lockupkeeper.MergeLockupsForSimilarDurations( ctx, *lockupKeeper, accountKeeper, lockupkeeper.BaselineDurations, lockupkeeper.HourDuration, @@ -62,7 +63,6 @@ func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, // Set the supply offset from the developer vesting account mintkeeper.SetInitialSupplyOffsetDuringMigration(ctx, *mintKeeper) - // override here return newVM, err } } From adc1c983287bbe526ed6c33c2bcd173482875e96 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 22 Mar 2022 16:52:47 -0400 Subject: [PATCH 2/8] updates --- app/upgrades/v6/README.md | 2 +- app/upgrades/v6/constants.go | 10 ++++++++-- app/upgrades/v6/forks.go | 7 +++++-- app/upgrades/v7/constants.go | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/upgrades/v6/README.md b/app/upgrades/v6/README.md index 2b4e83e6ead..cd12f4f67c0 100644 --- a/app/upgrades/v6/README.md +++ b/app/upgrades/v6/README.md @@ -1 +1 @@ -# TODO: Describe bug etc here. \ No newline at end of file + diff --git a/app/upgrades/v6/constants.go b/app/upgrades/v6/constants.go index 57b8681e912..dc176889b83 100644 --- a/app/upgrades/v6/constants.go +++ b/app/upgrades/v6/constants.go @@ -1,4 +1,10 @@ package v6 -const UpgradeName = "v6" -const UpgradeHeight = 2464000 +const ( + // UpgradeName defines the on-chain upgrade name for the Osmosis v6 upgrade. + UpgradeName = "v6" + + // UpgradeHeight defines the block height at which the Osmosis v6 upgrade is + // triggered. + UpgradeHeight = 2_464_000 +) diff --git a/app/upgrades/v6/forks.go b/app/upgrades/v6/forks.go index cdaa5cd4425..2a6dece48fe 100644 --- a/app/upgrades/v6/forks.go +++ b/app/upgrades/v6/forks.go @@ -4,8 +4,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +// RunForkLogic executes height-gated on-chain fork logic for the Osmosis v6 +// upgrade. +// +// NOTE: All the height gated fork logic is actually in the Osmosis ibc-go fork. +// See: https://github.com/osmosis-labs/ibc-go/releases/tag/v2.0.2-osmo func RunForkLogic(ctx sdk.Context) { - // All the height gated fork logic is actually in our ibc-go fork. - // See: https://github.com/osmosis-labs/ibc-go/releases/tag/v2.0.2-osmo ctx.Logger().Info("Applying emergency hard fork for v6, allows IBC to create new channels.") } diff --git a/app/upgrades/v7/constants.go b/app/upgrades/v7/constants.go index 3f82cc0082a..81d7f6134bd 100644 --- a/app/upgrades/v7/constants.go +++ b/app/upgrades/v7/constants.go @@ -1,3 +1,4 @@ package v7 +// UpgradeName defines the on-chain upgrade name for the Osmosis v7 upgrade. const UpgradeName = "v7" From 19e171d53f511ae0fdd745f4082942f59474f775 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 22 Mar 2022 17:01:48 -0400 Subject: [PATCH 3/8] updates --- app/upgrades/v5/constants.go | 1 + app/upgrades/v5/upgrades.go | 50 +++++++++++++------------- app/upgrades/v5/whitelist_feetokens.go | 10 ++---- 3 files changed, 28 insertions(+), 33 deletions(-) diff --git a/app/upgrades/v5/constants.go b/app/upgrades/v5/constants.go index aa1f5f8f8df..544963ef15d 100644 --- a/app/upgrades/v5/constants.go +++ b/app/upgrades/v5/constants.go @@ -1,3 +1,4 @@ package v5 +// UpgradeName defines the on-chain upgrade name for the Osmosis v5 upgrade. const UpgradeName = "v5" diff --git a/app/upgrades/v5/upgrades.go b/app/upgrades/v5/upgrades.go index e6ea3fda904..d7cb25c5c94 100644 --- a/app/upgrades/v5/upgrades.go +++ b/app/upgrades/v5/upgrades.go @@ -3,52 +3,52 @@ package v5 import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/authz" - - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" connectionkeeper "github.com/cosmos/ibc-go/v2/modules/core/03-connection/keeper" - gammkeeper "github.com/osmosis-labs/osmosis/v7/x/gamm/keeper" - txfeeskeeper "github.com/osmosis-labs/osmosis/v7/x/txfees/keeper" - - "github.com/osmosis-labs/osmosis/v7/x/txfees" - - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ibcconnectiontypes "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types" bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types" + + gammkeeper "github.com/osmosis-labs/osmosis/v7/x/gamm/keeper" + "github.com/osmosis-labs/osmosis/v7/x/txfees" + txfeeskeeper "github.com/osmosis-labs/osmosis/v7/x/txfees/keeper" txfeestypes "github.com/osmosis-labs/osmosis/v7/x/txfees/types" ) -func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, ibcConnections *connectionkeeper.Keeper, txFeesKeeper *txfeeskeeper.Keeper, gamm *gammkeeper.Keeper, - staking *stakingkeeper.Keeper) upgradetypes.UpgradeHandler { + staking *stakingkeeper.Keeper, +) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { // Set IBC updates from {inside SDK} to v1 - // https://github.com/cosmos/ibc-go/blob/main/docs/migrations/ibc-migration-043.md#in-place-store-migrations + // + // See: https://github.com/cosmos/ibc-go/blob/main/docs/migrations/ibc-migration-043.md#in-place-store-migrations ibcConnections.SetParams(ctx, ibcconnectiontypes.DefaultParams()) - // totalLiquidity := gamm.GetLegacyTotalLiquidity(ctx) - // gamm.DeleteLegacyTotalLiquidity(ctx) - // gamm.SetTotalLiquidity(ctx, totalLiquidity) - - // Set all modules "old versions" to 1. - // Then the run migrations logic will handle running their upgrade logics + // Set all modules "old versions" to 1. Then the run migrations logic will + // handle running their upgrade logics. fromVM := make(map[string]uint64) for moduleName := range mm.Modules { fromVM[moduleName] = 1 } - // EXCEPT Auth needs to run _after_ staking (https://github.com/cosmos/cosmos-sdk/issues/10591), - // and it seems bank as well (https://github.com/provenance-io/provenance/blob/407c89a7d73854515894161e1526f9623a94c368/app/upgrades.go#L86-L122). - // So we do this by making auth run last. - // This is done by setting auth's consensus version to 2, running RunMigrations, - // then setting it back to 1, and then running migrations again. + + // EXCEPT Auth needs to run AFTER staking. + // + // See: https://github.com/cosmos/cosmos-sdk/issues/10591 + // + // So we do this by making auth run last. This is done by setting auth's + // consensus version to 2, running RunMigrations, then setting it back to 1, + // and then running migrations again. fromVM[authtypes.ModuleName] = 2 - // override versions for authz & bech32ibctypes module as to not skip their InitGenesis - // for txfees module, we will override txfees ourselves. + // Override versions for authz & bech32ibctypes module as to not skip their + // InitGenesis for txfees module, we will override txfees ourselves. delete(fromVM, authz.ModuleName) delete(fromVM, bech32ibctypes.ModuleName) diff --git a/app/upgrades/v5/whitelist_feetokens.go b/app/upgrades/v5/whitelist_feetokens.go index 3141a66709b..60189b42148 100644 --- a/app/upgrades/v5/whitelist_feetokens.go +++ b/app/upgrades/v5/whitelist_feetokens.go @@ -6,6 +6,7 @@ import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" + gammkeeper "github.com/osmosis-labs/osmosis/v7/x/gamm/keeper" "github.com/osmosis-labs/osmosis/v7/x/txfees/types" ) @@ -60,14 +61,6 @@ func InitialWhitelistedFeetokens(ctx sdk.Context, gamm *gammkeeper.Keeper) []typ if poolExistsErr != nil { continue } - // _, assetExistsErr := pool.GetPoolAsset(asset[1]) - // if assetExistsErr != nil { - // continue - // } - // _, osmoExistsErr := pool.GetPoolAsset("uosmo") - // if osmoExistsErr != nil { - // continue - // } feeToken := types.FeeToken{ Denom: asset[1], @@ -76,5 +69,6 @@ func InitialWhitelistedFeetokens(ctx sdk.Context, gamm *gammkeeper.Keeper) []typ feeTokens = append(feeTokens, feeToken) } + return feeTokens } From c8d75ad60651548bb1b524d1ba656c4df3dfda03 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 22 Mar 2022 17:31:28 -0400 Subject: [PATCH 4/8] updates --- app/upgrades/v3/README.md | 2 +- app/upgrades/v3/constants.go | 10 ++++++++-- app/upgrades/v3/forks.go | 15 ++++++++------- app/upgrades/v4/constants.go | 1 + app/upgrades/v4/prop12.go | 5 +++-- app/upgrades/v4/upgrades.go | 36 +++++++++++++++--------------------- 6 files changed, 36 insertions(+), 33 deletions(-) diff --git a/app/upgrades/v3/README.md b/app/upgrades/v3/README.md index 7187aa1376a..6d2bfb01b5a 100644 --- a/app/upgrades/v3/README.md +++ b/app/upgrades/v3/README.md @@ -1,3 +1,3 @@ # TODO Write stuff -Should include description about this version, compatibility with v1 until height {...}, and fork code here. \ No newline at end of file +Should include description about this version, compatibility with v1 until height {...}, and fork code here. diff --git a/app/upgrades/v3/constants.go b/app/upgrades/v3/constants.go index 8a0e9c62217..bf2c87dbb6c 100644 --- a/app/upgrades/v3/constants.go +++ b/app/upgrades/v3/constants.go @@ -1,4 +1,10 @@ package v3 -const UpgradeName = "v3" -const UpgradeHeight = 712000 +const ( + // UpgradeName defines the on-chain upgrade name for the Osmosis v3 upgrade. + UpgradeName = "v3" + + // UpgradeHeight defines the block height at which the Osmosis v3 upgrade is + // triggered. + UpgradeHeight = 712_000 +) diff --git a/app/upgrades/v3/forks.go b/app/upgrades/v3/forks.go index a22955ac55f..4ce73f893c1 100644 --- a/app/upgrades/v3/forks.go +++ b/app/upgrades/v3/forks.go @@ -6,6 +6,8 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" ) +// RunForkLogic executes height-gated on-chain fork logic for the Osmosis v3 +// upgrade. func RunForkLogic(ctx sdk.Context, gov *govkeeper.Keeper, staking *stakingkeeper.Keeper) { ctx.Logger().Info("Applying Osmosis v3 upgrade." + " Fixing governance deposit so proposals can be voted upon," + @@ -14,32 +16,31 @@ func RunForkLogic(ctx sdk.Context, gov *govkeeper.Keeper, staking *stakingkeeper FixMinCommisionRate(ctx, staking) } -// Fixes an error where minimum deposit was set to "500 osmo" -// This denom does not exist, which makes it impossible for a proposal to go to a vote +// Fixes an error where minimum deposit was set to "500 osmo". This denom does +// not exist, which makes it impossible for a proposal to go to a vote. func FixMinDepositDenom(ctx sdk.Context, gov *govkeeper.Keeper) { var params = gov.GetDepositParams(ctx) params.MinDeposit = sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(500000000))) gov.SetDepositParams(ctx, params) } -// Fixes an error where validators can be created with a commission rate -// less than the network minimum rate. +// Fixes an error where validators can be created with a commission rate less +// than the network minimum rate. func FixMinCommisionRate(ctx sdk.Context, staking *stakingkeeper.Keeper) { // Upgrade every validators min-commission rate validators := staking.GetAllValidators(ctx) minCommissionRate := staking.GetParams(ctx).MinCommissionRate for _, v := range validators { if v.Commission.Rate.LT(minCommissionRate) { - comm, err := staking.MustUpdateValidatorCommission( - ctx, v, minCommissionRate) + comm, err := staking.MustUpdateValidatorCommission(ctx, v, minCommissionRate) if err != nil { panic(err) } + v.Commission = comm // call the before-modification hook since we're about to update the commission staking.BeforeValidatorModified(ctx, v.GetOperator()) - staking.SetValidator(ctx, v) } } diff --git a/app/upgrades/v4/constants.go b/app/upgrades/v4/constants.go index ada73308424..035420b1636 100644 --- a/app/upgrades/v4/constants.go +++ b/app/upgrades/v4/constants.go @@ -1,3 +1,4 @@ package v4 +// UpgradeName defines the on-chain upgrade name for the Osmosis v4 upgrade. const UpgradeName = "v4" diff --git a/app/upgrades/v4/prop12.go b/app/upgrades/v4/prop12.go index 6d5eec4f53e..5973a81d56a 100644 --- a/app/upgrades/v4/prop12.go +++ b/app/upgrades/v4/prop12.go @@ -20,10 +20,12 @@ func Prop12(ctx sdk.Context, bank bankkeeper.Keeper, distr *distrkeeper.Keeper) if err != nil { panic(err) } + amount, err := strconv.ParseInt(strings.TrimSpace(payment[1]), 10, 64) if err != nil { panic(err) } + coins := sdk.NewCoins(sdk.NewInt64Coin("uosmo", amount)) if err := bank.SendCoinsFromModuleToAccount(ctx, "distribution", addr, coins); err != nil { panic(err) @@ -31,9 +33,8 @@ func Prop12(ctx sdk.Context, bank bankkeeper.Keeper, distr *distrkeeper.Keeper) total += amount } - //deduct from the feePool tracker + // deduct from the feePool tracker feePool := distr.GetFeePool(ctx) feePool.CommunityPool = feePool.CommunityPool.Sub(sdk.NewDecCoins(sdk.NewInt64DecCoin("uosmo", total))) distr.SetFeePool(ctx, feePool) - } diff --git a/app/upgrades/v4/upgrades.go b/app/upgrades/v4/upgrades.go index 42bd913b96a..1ff1474681e 100644 --- a/app/upgrades/v4/upgrades.go +++ b/app/upgrades/v4/upgrades.go @@ -3,38 +3,32 @@ package v4 import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - gammkeeper "github.com/osmosis-labs/osmosis/v7/x/gamm/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + gammkeeper "github.com/osmosis-labs/osmosis/v7/x/gamm/keeper" gammtypes "github.com/osmosis-labs/osmosis/v7/x/gamm/types" ) -func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, +// CreateUpgradeHandler returns an x/upgrade handler for the Osmosis v4 on-chain +// upgrade. Namely, it executes: +// +// 1. Setting x/gamm parameters for pool creation +// 2. Executing prop 12 +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, bank bankkeeper.Keeper, distr *distrkeeper.Keeper, - gamm *gammkeeper.Keeper) upgradetypes.UpgradeHandler { + gamm *gammkeeper.Keeper, +) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - // // Upgrade all of the lock storages - // locks, err := app.LockupKeeper.GetLegacyPeriodLocks(ctx) - // if err != nil { - // panic(err) - // } - // // clear all lockup module locking / unlocking queue items - // app.LockupKeeper.ClearAllLockRefKeys(ctx) - // app.LockupKeeper.ClearAllAccumulationStores(ctx) - - // // reset all lock and references - // if err := app.LockupKeeper.ResetAllLocks(ctx, locks); err != nil { - // panic(err) - // } - - // configure upgrade for gamm module's pool creation fee param add + // configure upgrade for x/gamm module pool creation fee param gamm.SetParams(ctx, gammtypes.NewParams(sdk.Coins{sdk.NewInt64Coin("uosmo", 1)})) // 1 uOSMO - // execute prop12. See implementation in + Prop12(ctx, bank, distr) + return vm, nil } } From 1e8c47f26d9de8683ba74e6c9374b94c70beb592 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 22 Mar 2022 17:39:02 -0400 Subject: [PATCH 5/8] updates --- app/ante.go | 13 +++--- app/app.go | 131 +++++++++++++++++++--------------------------------- 2 files changed, 55 insertions(+), 89 deletions(-) diff --git a/app/ante.go b/app/ante.go index 45ace867c52..ce6bc621e41 100644 --- a/app/ante.go +++ b/app/ante.go @@ -1,18 +1,16 @@ package app import ( + wasm "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" ante "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/cosmos/cosmos-sdk/x/auth/signing" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - channelkeeper "github.com/cosmos/ibc-go/v2/modules/core/04-channel/keeper" ibcante "github.com/cosmos/ibc-go/v2/modules/core/ante" - wasm "github.com/CosmWasm/wasmd/x/wasm" - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - txfeeskeeper "github.com/osmosis-labs/osmosis/v7/x/txfees/keeper" txfeestypes "github.com/osmosis-labs/osmosis/v7/x/txfees/types" ) @@ -23,14 +21,17 @@ func NewAnteHandler( appOpts servertypes.AppOptions, wasmConfig wasm.Config, txCounterStoreKey sdk.StoreKey, - ak ante.AccountKeeper, bankKeeper authtypes.BankKeeper, - txFeesKeeper *txfeeskeeper.Keeper, spotPriceCalculator txfeestypes.SpotPriceCalculator, + ak ante.AccountKeeper, + bankKeeper authtypes.BankKeeper, + txFeesKeeper *txfeeskeeper.Keeper, + spotPriceCalculator txfeestypes.SpotPriceCalculator, sigGasConsumer ante.SignatureVerificationGasConsumer, signModeHandler signing.SignModeHandler, channelKeeper channelkeeper.Keeper, ) sdk.AnteHandler { mempoolFeeOptions := txfeestypes.NewMempoolFeeOptions(appOpts) mempoolFeeDecorator := txfeeskeeper.NewMempoolFeeDecorator(*txFeesKeeper, mempoolFeeOptions) + return sdk.ChainAnteDecorators( ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first wasmkeeper.NewLimitSimulationGasDecorator(wasmConfig.SimulationGasLimit), diff --git a/app/app.go b/app/app.go index 965094323e4..d9be5dd96ee 100644 --- a/app/app.go +++ b/app/app.go @@ -1,7 +1,6 @@ package app import ( - // Imports from the Go Standard Library "fmt" "io" "net/http" @@ -9,24 +8,7 @@ import ( "path/filepath" "strings" - // HTTP Router - "github.com/gorilla/mux" - - // Used to serve OpenAPI information - "github.com/rakyll/statik/fs" - - // A CLI helper - "github.com/spf13/cast" - - // Imports from Tendermint, Osmosis' consensus protocol - abci "github.com/tendermint/tendermint/abci/types" - tmjson "github.com/tendermint/tendermint/libs/json" - "github.com/tendermint/tendermint/libs/log" - tmos "github.com/tendermint/tendermint/libs/os" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" - - // Utilities from the Cosmos-SDK other than Cosmos modules + "github.com/CosmWasm/wasmd/x/wasm" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" @@ -41,112 +23,100 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" - - // Cosmos-SDK Modules - // https://github.com/cosmos/cosmos-sdk/tree/master/x - // NB: Osmosis uses a fork of the cosmos-sdk which can be found at: https://github.com/osmosis-labs/cosmos-sdk - - // Auth: Authentication of accounts and transactions for Cosmos SDK applications. "github.com/cosmos/cosmos-sdk/x/auth/ante" authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - - // Capability: allows developers to atomically define what a module can and cannot do capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - - // Crisis: Halting the blockchain under certain circumstances (e.g. if an invariant is broken). "github.com/cosmos/cosmos-sdk/x/crisis" - - // Evidence handling for double signing, misbehaviour, etc. - - // Params: Parameters that are always available paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - - // Upgrade: Software upgrades handling and coordination. upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - // IBC Transfer: Defines the "transfer" IBC port transfer "github.com/cosmos/ibc-go/v2/modules/apps/transfer" + "github.com/gorilla/mux" + "github.com/rakyll/statik/fs" + "github.com/spf13/cast" + abci "github.com/tendermint/tendermint/abci/types" + tmjson "github.com/tendermint/tendermint/libs/json" + "github.com/tendermint/tendermint/libs/log" + tmos "github.com/tendermint/tendermint/libs/os" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + dbm "github.com/tendermint/tm-db" - // Osmosis application prarmeters appparams "github.com/osmosis-labs/osmosis/v7/app/params" - - // Upgrades from earlier versions of Osmosis v4 "github.com/osmosis-labs/osmosis/v7/app/upgrades/v4" v5 "github.com/osmosis-labs/osmosis/v7/app/upgrades/v5" v7 "github.com/osmosis-labs/osmosis/v7/app/upgrades/v7" _ "github.com/osmosis-labs/osmosis/v7/client/docs/statik" - - // Superfluid: Allows users to stake gamm (bonded liquidity) superfluidtypes "github.com/osmosis-labs/osmosis/v7/x/superfluid/types" - - // Wasm: Allows Osmosis to interact with web assembly smart contracts - "github.com/CosmWasm/wasmd/x/wasm" ) const appName = "OsmosisApp" var ( - // If EnableSpecificWasmProposals is "", and this is "true", then enable all x/wasm proposals. - // If EnableSpecificWasmProposals is "", and this is not "true", then disable all x/wasm proposals. + // 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(appModuleBasics...) + + // module account permissions + maccPerms = moduleAaccountPermissions + + // module accounts that are allowed to receive tokens + allowedReceivingModAcc = map[string]bool{} + + // WasmProposalsEnabled enables all x/wasm proposals when it's value is "true" + // and EnableSpecificWasmProposals is empty. Otherwise, all x/wasm proposals + // are disabled. WasmProposalsEnabled = "true" - // If set to non-empty string it must be comma-separated list of values that are all a subset - // of "EnableAllProposals" (takes precedence over WasmProposalsEnabled) - // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 + + // EnableSpecificWasmProposals, if set, must be comma-separated list of values + // that are all a subset of "EnableAllProposals", which takes precedence over + // WasmProposalsEnabled. + // + // See: https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificWasmProposals = "" - // use this for clarity in argument list + // EmptyWasmOpts defines a type alias for a list of wasm options. EmptyWasmOpts []wasm.Option + + _ App = (*OsmosisApp)(nil) ) -// GetWasmEnabledProposals parses the WasmProposalsEnabled / EnableSpecificWasmProposals values to -// produce a list of enabled proposals to pass into wasmd app. +// GetWasmEnabledProposals parses the WasmProposalsEnabled and +// EnableSpecificWasmProposals values to produce a list of enabled proposals to +// pass into the application. func GetWasmEnabledProposals() []wasm.ProposalType { if EnableSpecificWasmProposals == "" { if WasmProposalsEnabled == "true" { return wasm.EnableAllProposals } + return wasm.DisableAllProposals } + chunks := strings.Split(EnableSpecificWasmProposals, ",") + proposals, err := wasm.ConvertToProposals(chunks) if err != nil { panic(err) } + return proposals } -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(appModuleBasics...) - - // module account permissions - maccPerms = moduleAaccountPermissions - - // module accounts that are allowed to receive tokens - allowedReceivingModAcc = map[string]bool{} -) - -var _ App = (*OsmosisApp)(nil) - -// Osmosis extends an ABCI application, but with most of its parameters exported. +// OsmosisApp extends an ABCI application, but with most of its parameters exported. // They are exported for convenience in creating helper functions, as object // capabilities aren't needed for testing. type OsmosisApp struct { *baseapp.BaseApp - appKeepers cdc *codec.LegacyAmino appCodec codec.Codec interfaceRegistry types.InterfaceRegistry - - invCheckPeriod uint + invCheckPeriod uint // keys to access the substores keys map[string]*sdk.KVStoreKey @@ -154,14 +124,9 @@ type OsmosisApp struct { memKeys map[string]*sdk.MemoryStoreKey transferModule transfer.AppModule - // the module manager - mm *module.Manager - - // simulation manager - sm *module.SimulationManager - - // module migration manager - configurator module.Configurator + mm *module.Manager + sm *module.SimulationManager + configurator module.Configurator } func init() { From eee9e4ec297bbb2cd25ea31a1245dec717a45949 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 22 Mar 2022 17:42:53 -0400 Subject: [PATCH 6/8] updates --- app/app.go | 52 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/app/app.go b/app/app.go index d9be5dd96ee..88ba55ed3ca 100644 --- a/app/app.go +++ b/app/app.go @@ -290,29 +290,27 @@ func NewOsmosisApp( return app } -// MakeCodecs constructs the *std.Codec and *codec.LegacyAmino instances used by -// simapp. It is useful for tests and clients who do not want to construct the -// full simapp +// MakeCodecs returns the application codec and a legacy Amino codec. func MakeCodecs() (codec.Codec, *codec.LegacyAmino) { config := MakeEncodingConfig() return config.Marshaler, config.Amino } -// Name returns the name of the App +// Name returns the name of the App. func (app *OsmosisApp) Name() string { return app.BaseApp.Name() } -// BeginBlocker application updates every begin block +// BeginBlocker application updates every begin block. func (app *OsmosisApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { BeginBlockForks(ctx, app) return app.mm.BeginBlock(ctx, req) } -// EndBlocker application updates every end block +// EndBlocker application updates every end block. func (app *OsmosisApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { return app.mm.EndBlock(ctx, req) } -// InitChainer application update at chain initialization +// InitChainer application update at chain initialization. func (app *OsmosisApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { var genesisState GenesisState if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { @@ -379,7 +377,7 @@ func (app *OsmosisApp) GetSubspace(moduleName string) paramstypes.Subspace { return subspace } -// SimulationManager implements the SimulationApp interface +// SimulationManager implements the SimulationApp interface. func (app *OsmosisApp) SimulationManager() *module.SimulationManager { return app.sm } @@ -411,7 +409,8 @@ func (app *OsmosisApp) RegisterTxService(clientCtx client.Context) { authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) } -// RegisterTendermintService implements the Application.RegisterTendermintService method. +// RegisterTendermintService implements the Application.RegisterTendermintService +// method. func (app *OsmosisApp) RegisterTendermintService(clientCtx client.Context) { tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) } @@ -437,30 +436,44 @@ func (app *OsmosisApp) setupUpgradeHandlers() { // this configures a no-op upgrade handler for the v4 upgrade, // which improves the lockup module's store management. app.UpgradeKeeper.SetUpgradeHandler( - v4.UpgradeName, v4.CreateUpgradeHandler( - app.mm, app.configurator, - *app.BankKeeper, app.DistrKeeper, app.GAMMKeeper)) + v4.UpgradeName, + v4.CreateUpgradeHandler( + app.mm, + app.configurator, + *app.BankKeeper, + app.DistrKeeper, + app.GAMMKeeper, + ), + ) app.UpgradeKeeper.SetUpgradeHandler( v5.UpgradeName, v5.CreateUpgradeHandler( - app.mm, app.configurator, - &app.IBCKeeper.ConnectionKeeper, app.TxFeesKeeper, - app.GAMMKeeper, app.StakingKeeper)) + app.mm, + app.configurator, + &app.IBCKeeper.ConnectionKeeper, + app.TxFeesKeeper, + app.GAMMKeeper, + app.StakingKeeper, + ), + ) app.UpgradeKeeper.SetUpgradeHandler( v7.UpgradeName, v7.CreateUpgradeHandler( - app.mm, app.configurator, + app.mm, + app.configurator, app.WasmKeeper, app.SuperfluidKeeper, app.EpochsKeeper, app.LockupKeeper, app.MintKeeper, - app.AccountKeeper)) + app.AccountKeeper, + ), + ) } -// RegisterSwaggerAPI registers swagger route with API Server +// RegisterSwaggerAPI registers swagger route with API Server. func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) { statikFS, err := fs.New() if err != nil { @@ -472,11 +485,12 @@ func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) { rtr.PathPrefix("/swagger/").Handler(staticServer) } -// GetMaccPerms returns a copy of the module account permissions +// GetMaccPerms returns a copy of the module account permissions. func GetMaccPerms() map[string][]string { dupMaccPerms := make(map[string][]string) for k, v := range maccPerms { dupMaccPerms[k] = v } + return dupMaccPerms } From a8cbbec318e0a4314fc1f04101a1dd825db65752 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 22 Mar 2022 17:43:26 -0400 Subject: [PATCH 7/8] updates --- app/forks.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/forks.go b/app/forks.go index 136afbed8f0..b5a367ab2be 100644 --- a/app/forks.go +++ b/app/forks.go @@ -2,6 +2,7 @@ package app import ( sdk "github.com/cosmos/cosmos-sdk/types" + v3 "github.com/osmosis-labs/osmosis/v7/app/upgrades/v3" v6 "github.com/osmosis-labs/osmosis/v7/app/upgrades/v6" ) @@ -11,8 +12,10 @@ func BeginBlockForks(ctx sdk.Context, app *OsmosisApp) { switch ctx.BlockHeight() { case v3.UpgradeHeight: v3.RunForkLogic(ctx, app.GovKeeper, app.StakingKeeper) + case v6.UpgradeHeight: v6.RunForkLogic(ctx) + default: // do nothing return From a6857d89448389de8a9197222ecf6b91374ae4b2 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 23 Mar 2022 09:42:50 -0400 Subject: [PATCH 8/8] updates --- app/app.go | 2 +- app/modules.go | 182 ++++++++++++++++++++++++------------------------- 2 files changed, 89 insertions(+), 95 deletions(-) diff --git a/app/app.go b/app/app.go index 88ba55ed3ca..db35370d789 100644 --- a/app/app.go +++ b/app/app.go @@ -61,7 +61,7 @@ var ( ModuleBasics = module.NewBasicManager(appModuleBasics...) // module account permissions - maccPerms = moduleAaccountPermissions + maccPerms = moduleAccountPermissions // module accounts that are allowed to receive tokens allowedReceivingModAcc = map[string]bool{} diff --git a/app/modules.go b/app/modules.go index dca13f8c79c..05bf93b0bf3 100644 --- a/app/modules.go +++ b/app/modules.go @@ -1,134 +1,72 @@ package app import ( - // Utilities from the Cosmos-SDK other than Cosmos modules + "github.com/CosmWasm/wasmd/x/wasm" + wasmclient "github.com/CosmWasm/wasmd/x/wasm/client" "github.com/cosmos/cosmos-sdk/types/module" - - // Cosmos-SDK Modules - // https://github.com/cosmos/cosmos-sdk/tree/master/x - // NB: Osmosis uses a fork of the cosmos-sdk which can be found at: https://github.com/osmosis-labs/cosmos-sdk - - // Auth: Authentication of accounts and transactions for Cosmos SDK applications. "github.com/cosmos/cosmos-sdk/x/auth" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - - // Vesting: Allows the lock and periodic release of tokens "github.com/cosmos/cosmos-sdk/x/auth/vesting" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - - // Authz: Authorization for accounts to perform actions on behalf of other accounts. "github.com/cosmos/cosmos-sdk/x/authz" authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - - // Bank: allows users to transfer tokens "github.com/cosmos/cosmos-sdk/x/bank" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - // Capability: allows developers to atomically define what a module can and cannot do "github.com/cosmos/cosmos-sdk/x/capability" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - - // Crisis: Halting the blockchain under certain circumstances (e.g. if an invariant is broken). "github.com/cosmos/cosmos-sdk/x/crisis" crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - - // Distribution: Fee distribution, and staking token provision distribution. distr "github.com/cosmos/cosmos-sdk/x/distribution" distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - - // Evidence handling for double signing, misbehaviour, etc. "github.com/cosmos/cosmos-sdk/x/evidence" evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - - // Genesis Utilities: Used for evertything to do with the very first block of a chain "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - - // Governance: Allows stakeholders to make decisions concering a Cosmos-SDK blockchain's economy and development "github.com/cosmos/cosmos-sdk/x/gov" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - - // Params: Parameters that are always available "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" - - // Slashing: "github.com/cosmos/cosmos-sdk/x/slashing" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - - // Staking: Allows the Tendermint validator set to be chosen based on bonded stake. "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - // Upgrade: Software upgrades handling and coordination. "github.com/cosmos/cosmos-sdk/x/upgrade" upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - // IBC Transfer: Defines the "transfer" IBC port transfer "github.com/cosmos/ibc-go/v2/modules/apps/transfer" ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - - // IBC: Inter-blockchain communication ibc "github.com/cosmos/ibc-go/v2/modules/core" ibcclientclient "github.com/cosmos/ibc-go/v2/modules/core/02-client/client" ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host" + "github.com/osmosis-labs/bech32-ibc/x/bech32ibc" + bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types" + "github.com/osmosis-labs/bech32-ibc/x/bech32ics20" - // Osmosis application prarmeters appparams "github.com/osmosis-labs/osmosis/v7/app/params" - - // Upgrades from earlier versions of Osmosis _ "github.com/osmosis-labs/osmosis/v7/client/docs/statik" - - // Modules that live in the Osmosis repository and are specific to Osmosis "github.com/osmosis-labs/osmosis/v7/x/claim" claimtypes "github.com/osmosis-labs/osmosis/v7/x/claim/types" - - // Epochs: gives Osmosis a sense of "clock time" so that events can be based on days instead of "number of blocks" "github.com/osmosis-labs/osmosis/v7/x/epochs" epochstypes "github.com/osmosis-labs/osmosis/v7/x/epochs/types" - - // Generalized Automated Market Maker "github.com/osmosis-labs/osmosis/v7/x/gamm" gammtypes "github.com/osmosis-labs/osmosis/v7/x/gamm/types" - - // Incentives: Allows Osmosis and foriegn chain communities to incentivize users to provide liquidity "github.com/osmosis-labs/osmosis/v7/x/incentives" incentivestypes "github.com/osmosis-labs/osmosis/v7/x/incentives/types" - - // Lockup: allows tokens to be locked (made non-transferrable) "github.com/osmosis-labs/osmosis/v7/x/lockup" lockuptypes "github.com/osmosis-labs/osmosis/v7/x/lockup/types" - - // Mint: Our modified version of github.com/cosmos/cosmos-sdk/x/mint "github.com/osmosis-labs/osmosis/v7/x/mint" minttypes "github.com/osmosis-labs/osmosis/v7/x/mint/types" - - // Pool incentives: poolincentives "github.com/osmosis-labs/osmosis/v7/x/pool-incentives" poolincentivesclient "github.com/osmosis-labs/osmosis/v7/x/pool-incentives/client" poolincentivestypes "github.com/osmosis-labs/osmosis/v7/x/pool-incentives/types" - - // Superfluid: Allows users to stake gamm (bonded liquidity) superfluid "github.com/osmosis-labs/osmosis/v7/x/superfluid" superfluidclient "github.com/osmosis-labs/osmosis/v7/x/superfluid/client" superfluidtypes "github.com/osmosis-labs/osmosis/v7/x/superfluid/types" - - // txfees: Allows Osmosis to charge transaction fees without harming IBC user experience "github.com/osmosis-labs/osmosis/v7/x/txfees" txfeestypes "github.com/osmosis-labs/osmosis/v7/x/txfees/types" - - // Wasm: Allows Osmosis to interact with web assembly smart contracts - "github.com/CosmWasm/wasmd/x/wasm" - wasmclient "github.com/CosmWasm/wasmd/x/wasm/client" - - // Modules related to bech32-ibc, which allows new ibc funcationality based on the bech32 prefix of addresses - "github.com/osmosis-labs/bech32-ibc/x/bech32ibc" - bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types" - "github.com/osmosis-labs/bech32-ibc/x/bech32ics20" ) // appModuleBasics returns ModuleBasics for the module BasicManager. @@ -143,10 +81,16 @@ var appModuleBasics = []module.AppModuleBasic{ gov.NewAppModuleBasic( append( wasmclient.ProposalHandlers, - paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, + paramsclient.ProposalHandler, + distrclient.ProposalHandler, + upgradeclient.ProposalHandler, + upgradeclient.CancelProposalHandler, poolincentivesclient.UpdatePoolIncentivesHandler, - ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler, - superfluidclient.SetSuperfluidAssetsProposalHandler, superfluidclient.RemoveSuperfluidAssetsProposalHandler)..., + ibcclientclient.UpdateClientProposalHandler, + ibcclientclient.UpgradeProposalHandler, + superfluidclient.SetSuperfluidAssetsProposalHandler, + superfluidclient.RemoveSuperfluidAssetsProposalHandler, + )..., ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, @@ -169,8 +113,8 @@ var appModuleBasics = []module.AppModuleBasic{ wasm.AppModuleBasic{}, } -// module account permissions -var moduleAaccountPermissions = map[string][]string{ +// moduleAccountPermissions defines module account permissions +var moduleAccountPermissions = map[string][]string{ authtypes.FeeCollectorName: nil, distrtypes.ModuleName: nil, minttypes.ModuleName: {authtypes.Minter, authtypes.Burner}, @@ -189,13 +133,19 @@ var moduleAaccountPermissions = map[string][]string{ wasm.ModuleName: {authtypes.Burner}, } -// appModules return modules to initlize module manager -func appModules(app *OsmosisApp, encodingConfig appparams.EncodingConfig, skipGenesisInvariants bool) []module.AppModule { +// appModules return modules to initialize module manager. +func appModules( + app *OsmosisApp, + encodingConfig appparams.EncodingConfig, + skipGenesisInvariants bool, +) []module.AppModule { appCodec := encodingConfig.Marshaler return []module.AppModule{ genutil.NewAppModule( - app.AccountKeeper, app.StakingKeeper, app.BaseApp.DeliverTx, + app.AccountKeeper, + app.StakingKeeper, + app.BaseApp.DeliverTx, encodingConfig.TxConfig, ), auth.NewAppModule(appCodec, *app.AccountKeeper, nil), @@ -222,16 +172,25 @@ func appModules(app *OsmosisApp, encodingConfig appparams.EncodingConfig, skipGe lockup.NewAppModule(appCodec, *app.LockupKeeper, app.AccountKeeper, app.BankKeeper), poolincentives.NewAppModule(appCodec, *app.PoolIncentivesKeeper), epochs.NewAppModule(appCodec, *app.EpochsKeeper), - superfluid.NewAppModule(appCodec, *app.SuperfluidKeeper, app.AccountKeeper, app.BankKeeper, - app.StakingKeeper, app.LockupKeeper, app.GAMMKeeper, app.EpochsKeeper), + superfluid.NewAppModule( + appCodec, + *app.SuperfluidKeeper, + app.AccountKeeper, + app.BankKeeper, + app.StakingKeeper, + app.LockupKeeper, + app.GAMMKeeper, + app.EpochsKeeper, + ), bech32ibc.NewAppModule(appCodec, *app.Bech32IBCKeeper), } } -// orderBeginBlockers Tell the app's module manager how to set the order of BeginBlockers, which are run at the beginning of every block. +// orderBeginBlockers Tell the app's module manager how to set the order of +// BeginBlockers, which are run at the beginning of every block. func orderBeginBlockers() []string { return []string{ - // Upgrades should be run _very_ first + // Upgrades should be run VERY first upgradetypes.ModuleName, // Note: epochs' begin should be "real" start of epochs, we keep epochs beginblock at the beginning epochstypes.ModuleName, @@ -250,27 +209,50 @@ func orderBeginBlockers() []string { crisistypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, - paramstypes.ModuleName, vestingtypes.ModuleName, - gammtypes.ModuleName, incentivestypes.ModuleName, lockuptypes.ModuleName, claimtypes.ModuleName, + paramstypes.ModuleName, + vestingtypes.ModuleName, + gammtypes.ModuleName, + incentivestypes.ModuleName, + lockuptypes.ModuleName, + claimtypes.ModuleName, poolincentivestypes.ModuleName, // superfluid must come after distribution and epochs superfluidtypes.ModuleName, - bech32ibctypes.ModuleName, txfeestypes.ModuleName, + bech32ibctypes.ModuleName, + txfeestypes.ModuleName, wasm.ModuleName, } } -// orderEndBlockers Tell the app's module manager how to set the order of EndBlockers, which are run at the end of every block. +// orderEndBlockers Tell the app's module manager how to set the order of +// EndBlockers, which are run at the end of every block. var orderEndBlockers = []string{ lockuptypes.ModuleName, - crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, claimtypes.ModuleName, - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, - slashingtypes.ModuleName, minttypes.ModuleName, - genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, - paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, - ibchost.ModuleName, ibctransfertypes.ModuleName, - gammtypes.ModuleName, incentivestypes.ModuleName, lockuptypes.ModuleName, - poolincentivestypes.ModuleName, superfluidtypes.ModuleName, bech32ibctypes.ModuleName, txfeestypes.ModuleName, + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + claimtypes.ModuleName, + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + minttypes.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + ibchost.ModuleName, + ibctransfertypes.ModuleName, + gammtypes.ModuleName, + incentivestypes.ModuleName, + lockuptypes.ModuleName, + poolincentivestypes.ModuleName, + superfluidtypes.ModuleName, + bech32ibctypes.ModuleName, + txfeestypes.ModuleName, // Note: epochs' endblock should be "real" end of epochs, we keep epochs endblock at the end epochstypes.ModuleName, wasm.ModuleName, @@ -309,7 +291,11 @@ var modulesOrderInitGenesis = []string{ } // simulationModules returns modules for simulation manager -func simulationModules(app *OsmosisApp, encodingConfig appparams.EncodingConfig, skipGenesisInvariants bool) []module.AppModuleSimulation { +func simulationModules( + app *OsmosisApp, + encodingConfig appparams.EncodingConfig, + skipGenesisInvariants bool, +) []module.AppModuleSimulation { appCodec := encodingConfig.Marshaler return []module.AppModuleSimulation{ @@ -332,8 +318,16 @@ func simulationModules(app *OsmosisApp, encodingConfig appparams.EncodingConfig, lockup.NewAppModule(appCodec, *app.LockupKeeper, app.AccountKeeper, app.BankKeeper), poolincentives.NewAppModule(appCodec, *app.PoolIncentivesKeeper), epochs.NewAppModule(appCodec, *app.EpochsKeeper), - superfluid.NewAppModule(appCodec, *app.SuperfluidKeeper, app.AccountKeeper, app.BankKeeper, - app.StakingKeeper, app.LockupKeeper, app.GAMMKeeper, app.EpochsKeeper), + superfluid.NewAppModule( + appCodec, + *app.SuperfluidKeeper, + app.AccountKeeper, + app.BankKeeper, + app.StakingKeeper, + app.LockupKeeper, + app.GAMMKeeper, + app.EpochsKeeper, + ), app.transferModule, } }