Skip to content

Commit

Permalink
feat: remove upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
duvbell committed Mar 28, 2024
1 parent 44e2d71 commit b6e8f6e
Show file tree
Hide file tree
Showing 44 changed files with 28 additions and 1,168 deletions.
7 changes: 1 addition & 6 deletions app/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package helpers

import (
"encoding/json"
"fmt"
"testing"
"time"

Expand All @@ -12,7 +11,6 @@ import (
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
tmrand "github.com/cometbft/cometbft/libs/rand"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmtypes "github.com/cometbft/cometbft/types"
"github.com/cosmos/cosmos-sdk/baseapp"
Expand Down Expand Up @@ -59,10 +57,7 @@ type EmptyAppOptions struct{}
func (EmptyAppOptions) Get(_ string) interface{} { return nil }

func NewContextForApp(app composable.ComposableApp) sdk.Context {
ctx := app.BaseApp.NewContext(false, tmproto.Header{
ChainID: fmt.Sprintf("test-chain-%s", tmrand.Str(4)),
Height: 1,
})
ctx := app.BaseApp.NewContext(false)
return ctx
}

Expand Down
6 changes: 5 additions & 1 deletion app/ibctesting/simapp/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ func (app *SimApp) ExportAppStateAndValidators(
app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs)
}

genState := app.mm.ExportGenesis(ctx, app.appCodec)
genState, err := app.mm.ExportGenesis(ctx, app.appCodec)
if err != nil {
return servertypes.ExportedApp{}, err
}

appState, err := json.MarshalIndent(genState, "", " ")
if err != nil {
return servertypes.ExportedApp{}, err
Expand Down
2 changes: 1 addition & 1 deletion app/ibctesting/simapp/simd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func main() {
rootCmd, _ := cmd.NewRootCmd()
rootCmd := cmd.NewRootCmd()

if err := svrcmd.Execute(rootCmd, "simd", simapp.DefaultNodeHome); err != nil {
switch e := err.(type) {
Expand Down
7 changes: 4 additions & 3 deletions app/ibctesting/simapp/upgrades/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package upgrades

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"context"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/types/module"
)

const (
Expand All @@ -17,7 +18,7 @@ func CreateDefaultUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return mm.RunMigrations(ctx, configurator, vm)
}
}
9 changes: 6 additions & 3 deletions app/ibctesting/simapp/upgrades/v6/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package v6

import (
"context"

storetypes "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"

sdk "github.com/cosmos/cosmos-sdk/types"
v6 "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/migrations/v6"
)

Expand All @@ -26,8 +28,9 @@ func CreateUpgradeHandler(
capabilityKeeper *capabilitykeeper.Keeper,
moduleName string,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
if err := v6.MigrateICS27ChannelCapability(ctx, cdc, capabilityStoreKey, capabilityKeeper, moduleName); err != nil {
return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
sdkctx := sdk.UnwrapSDKContext(ctx)
if err := v6.MigrateICS27ChannelCapability(sdkctx, cdc, capabilityStoreKey, capabilityKeeper, moduleName); err != nil {
return nil, err
}

Expand Down
12 changes: 8 additions & 4 deletions app/ibctesting/simapp/upgrades/v7/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package v7

import (
"context"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
consensusparamskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"

clientkeeper "github.com/cosmos/ibc-go/v8/modules/core/02-client/keeper"
ibctmmigrations "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint/migrations"

sdk "github.com/cosmos/cosmos-sdk/types"
)

const (
Expand All @@ -28,14 +31,15 @@ func CreateUpgradeHandler(
consensusParamsKeeper consensusparamskeeper.Keeper,
paramsKeeper paramskeeper.Keeper,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
// OPTIONAL: prune expired tendermint consensus states to save storage space
if _, err := ibctmmigrations.PruneExpiredConsensusStates(ctx, cdc, clientKeeper); err != nil {
sdkctx := sdk.UnwrapSDKContext(ctx)
if _, err := ibctmmigrations.PruneExpiredConsensusStates(sdkctx, cdc, clientKeeper); err != nil {
return nil, err
}

legacyBaseAppSubspace := paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())
baseapp.MigrateParams(ctx, legacyBaseAppSubspace, &consensusParamsKeeper)
baseapp.MigrateParams(sdkctx, legacyBaseAppSubspace, &consensusParamsKeeper.ParamsStore)

return mm.RunMigrations(ctx, configurator, vm)
}
Expand Down
6 changes: 0 additions & 6 deletions app/upgrades/centauri/constants.go

This file was deleted.

11 changes: 0 additions & 11 deletions app/upgrades/centauri/readme.md

This file was deleted.

52 changes: 0 additions & 52 deletions app/upgrades/centauri/upgrade.go

This file was deleted.

6 changes: 0 additions & 6 deletions app/upgrades/reward/constants.go

This file was deleted.

46 changes: 0 additions & 46 deletions app/upgrades/reward/upgrade.go

This file was deleted.

6 changes: 3 additions & 3 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ package upgrades

import (
store "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"
types "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "cosmossdk.io/x/upgrade/types"

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

// BaseAppParamManager defines an interrace that BaseApp is expected to fullfil
// that allows upgrade handlers to modify BaseApp parameters.
type BaseAppParamManager interface {
GetConsensusParams(ctx sdk.Context) *types.ConsensusParams
StoreConsensusParams(ctx sdk.Context, cp *types.ConsensusParams)
GetConsensusParams(ctx sdk.Context) types.ConsensusParams
StoreConsensusParams(ctx sdk.Context, cp types.ConsensusParams) error
}

// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal
Expand Down
25 changes: 0 additions & 25 deletions app/upgrades/v4/constants.go

This file was deleted.

35 changes: 0 additions & 35 deletions app/upgrades/v4/upgrade.go

This file was deleted.

15 changes: 0 additions & 15 deletions app/upgrades/v4_5/constants.go

This file was deleted.

Loading

0 comments on commit b6e8f6e

Please sign in to comment.