Skip to content

Commit

Permalink
Merge pull request #462 from ComposableFi/revert-gov
Browse files Browse the repository at this point in the history
Revert gov is the latest testnet version so it should be in develop branch.
  • Loading branch information
RustNinja committed Mar 11, 2024
2 parents be3b7ff + fcdbe5d commit 3bcb8c6
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 1,666 deletions.
6 changes: 2 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/bank"

"github.com/notional-labs/composable/v6/app/keepers"
"github.com/notional-labs/composable/v6/app/upgrades/v6_4_6"
"github.com/notional-labs/composable/v6/app/upgrades/v6_4_7"

// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"

Expand Down Expand Up @@ -147,7 +147,7 @@ var (
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""

Upgrades = []upgrades.Upgrade{v6_4_6.Upgrade}
Upgrades = []upgrades.Upgrade{v6_4_7.Upgrade}
Forks = []upgrades.Fork{}
)

Expand Down Expand Up @@ -296,7 +296,6 @@ func NewComposableApp(
encodingConfig EncodingConfig,
appOpts servertypes.AppOptions,
wasmOpts []wasm.Option,
devnetGov *string,
baseAppOptions ...func(*baseapp.BaseApp),
) *ComposableApp {
appCodec := encodingConfig.Marshaler
Expand Down Expand Up @@ -337,7 +336,6 @@ func NewComposableApp(
appOpts,
wasmOpts,
enabledProposals,
devnetGov,
)

// transferModule := transfer.NewAppModule(app.TransferKeeper)
Expand Down
1 change: 0 additions & 1 deletion app/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ func setup(withGenesis bool, invCheckPeriod uint, opts ...wasm.Option) (*composa
encCdc,
EmptyAppOptions{},
opts,
nil,
)
if withGenesis {
return app, composable.NewDefaultGenesisState()
Expand Down
10 changes: 2 additions & 8 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appOpts servertypes.AppOptions,
wasmOpts []wasm.Option,
enabledProposals []wasm.ProposalType,
devnetGov *string,
) {
// add keepers
appKeepers.AccountKeeper = authkeeper.NewAccountKeeper(
Expand Down Expand Up @@ -259,12 +258,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appCodec, appKeepers.keys[ibchost.StoreKey], appKeepers.GetSubspace(ibchost.ModuleName), appKeepers.StakingKeeper, appKeepers.UpgradeKeeper, appKeepers.ScopedIBCKeeper,
)

govModuleAuthority := authtypes.NewModuleAddress(govtypes.ModuleName).String()
if devnetGov != nil {
govModuleAuthority = *devnetGov
}

appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasm08types.StoreKey], govModuleAuthority, homePath, &appKeepers.IBCKeeper.ClientKeeper)
appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasm08types.StoreKey], authorityAddress, homePath, &appKeepers.IBCKeeper.ClientKeeper)

// ICA Host keeper
appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper(
Expand Down Expand Up @@ -408,7 +402,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
wasmDir,
wasmConfig,
availableCapabilities,
govModuleAuthority,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
wasmOpts...,
)

Expand Down
1 change: 0 additions & 1 deletion app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func setup(tb testing.TB, withGenesis bool, invCheckPeriod uint) (*ComposableApp
MakeEncodingConfig(),
EmptyBaseAppOptions{},
wasmOpts,
nil,
baseAppOpts...)
if withGenesis {
return app, NewDefaultGenesisState()
Expand Down
21 changes: 21 additions & 0 deletions app/upgrades/v6_4_7/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package v6_4_7

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

"github.com/notional-labs/composable/v6/app/upgrades"
)

const (
// UpgradeName defines the on-chain upgrade name for the composable upgrade.
UpgradeName = "v6_4_6"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{},
Deleted: []string{},
},
}
23 changes: 23 additions & 0 deletions app/upgrades/v6_4_7/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package v6_4_7

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/notional-labs/composable/v6/app/keepers"
"github.com/notional-labs/composable/v6/app/upgrades"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
_ upgrades.BaseAppParamManager,
_ codec.Codec,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return mm.RunMigrations(ctx, configurator, vm)
}
}
19 changes: 3 additions & 16 deletions cmd/centaurid/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ import (
// this line is used by starport scaffolding # stargate/root/import
)

const (
// if set, than uses specific key for governance instead of default (default is production; this override for local devtest)
flagDevnetGov = "devnet-gov"
)

var ChainID string

// NewRootCmd creates a new root command for simd. It is called once in the
Expand Down Expand Up @@ -80,6 +75,7 @@ func NewRootCmd() (*cobra.Command, app.EncodingConfig) {
if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
return err
}

customAppTemplate, customAppConfig := initAppConfig()

customTMConfig := initTendermintConfig()
Expand Down Expand Up @@ -188,8 +184,8 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig app.EncodingConfig) {
// this line is used by starport scaffolding # stargate/root/commands
)

appCreator := appCreator{encodingConfig}
server.AddCommands(rootCmd, app.DefaultNodeHome, appCreator.newApp, appCreator.appExport, addModuleInitFlags)
a := appCreator{encodingConfig}
server.AddCommands(rootCmd, app.DefaultNodeHome, a.newApp, a.appExport, addModuleInitFlags)

// add keybase, auxiliary RPC, query, and tx child commands
rootCmd.AddCommand(
Expand All @@ -202,7 +198,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig app.EncodingConfig) {

func addModuleInitFlags(startCmd *cobra.Command) {
crisis.AddModuleInitFlags(startCmd)
startCmd.Flags().String(flagDevnetGov, "", "Sets the devnet governance key (if not set, uses the default production key)")
// this line is used by starport scaffolding # stargate/root/initFlags
}

Expand Down Expand Up @@ -272,11 +267,6 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a
skipUpgradeHeights[h] = true
}

var devnetGov *string
devnetGovOption, _ := appOpts.Get(flagDevnetGov).(string)
if devnetGovOption != "" {
devnetGov = &devnetGovOption
}
baseappOptions := server.DefaultBaseappOptions(appOpts)

var emptyWasmOpts []wasm.Option
Expand All @@ -290,7 +280,6 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a
// this line is used by starport scaffolding # stargate/root/appArgument
appOpts,
emptyWasmOpts,
devnetGov,
baseappOptions...,
)

Expand Down Expand Up @@ -323,7 +312,6 @@ func (a appCreator) appExport(
a.encCfg,
appOpts,
emptyWasmOpts,
nil,
)

if err := anApp.LoadHeight(height); err != nil {
Expand All @@ -342,7 +330,6 @@ func (a appCreator) appExport(
a.encCfg,
appOpts,
emptyWasmOpts,
nil,
)
}

Expand Down
Loading

0 comments on commit 3bcb8c6

Please sign in to comment.