Skip to content

Commit

Permalink
rebase and change conflict version
Browse files Browse the repository at this point in the history
  • Loading branch information
tungleanh0902 committed Mar 18, 2024
1 parent 951fa1b commit 85da880
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 17 deletions.
4 changes: 2 additions & 2 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_7"
"github.com/notional-labs/composable/v6/app/upgrades/v6_4_8"

// 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_7.Upgrade}
Upgrades = []upgrades.Upgrade{v6_4_8.Upgrade}
Forks = []upgrades.Fork{}
)

Expand Down
5 changes: 0 additions & 5 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,7 @@ func setup(tb testing.TB, withGenesis bool, invCheckPeriod uint) (*ComposableApp
invCheckPeriod,
MakeEncodingConfig(),
EmptyBaseAppOptions{},
<<<<<<< HEAD
wasmOpts,
baseAppOpts...)
=======
wasmOpts, nil)
>>>>>>> 828e70a1 (refactor: update test)
if withGenesis {
return app, NewDefaultGenesisState()
}
Expand Down
22 changes: 22 additions & 0 deletions app/upgrades/v6_4_6/contants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package v6_4_6

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

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

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

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

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"
ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types"
)

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) {
// Add params for custom middleware
custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState()
keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params)

return mm.RunMigrations(ctx, configurator, vm)
}
}
2 changes: 1 addition & 1 deletion app/upgrades/v6_4_7/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

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

var Upgrade = upgrades.Upgrade{
Expand Down
15 changes: 15 additions & 0 deletions app/upgrades/v6_4_8/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package v6_4_8

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

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

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
}
50 changes: 50 additions & 0 deletions app/upgrades/v6_4_8/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package v6_4_8

import (
"github.com/CosmWasm/wasmd/x/wasm"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
"github.com/notional-labs/composable/v6/app/keepers"
"github.com/notional-labs/composable/v6/app/upgrades"
bech32authmigration "github.com/notional-labs/composable/v6/bech32-migration/auth"
bech32govmigration "github.com/notional-labs/composable/v6/bech32-migration/gov"
bech32icamigration "github.com/notional-labs/composable/v6/bech32-migration/ica"
bech32mintmigration "github.com/notional-labs/composable/v6/bech32-migration/mint"
bech32slashingmigration "github.com/notional-labs/composable/v6/bech32-migration/slashing"
bech32stakingmigration "github.com/notional-labs/composable/v6/bech32-migration/staking"
bech32transfermiddlewaremigration "github.com/notional-labs/composable/v6/bech32-migration/transfermiddleware"
bech32WasmMigration "github.com/notional-labs/composable/v6/bech32-migration/wasm"
transfermiddlewaretypes "github.com/notional-labs/composable/v6/x/transfermiddleware/types"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
_ upgrades.BaseAppParamManager,
codec codec.Codec,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
keys := keepers.GetKVStoreKey()
// Migration prefix
ctx.Logger().Info("First step: Migrate addresses stored in bech32 form to use new prefix")
bech32stakingmigration.MigrateAddressBech32(ctx, keys[stakingtypes.StoreKey], codec)
bech32stakingmigration.MigrateUnbonding(ctx, keys[stakingtypes.StoreKey], codec)
bech32slashingmigration.MigrateAddressBech32(ctx, keys[slashingtypes.StoreKey], codec)
bech32govmigration.MigrateAddressBech32(ctx, keys[govtypes.StoreKey], codec)
bech32authmigration.MigrateAddressBech32(ctx, keys[authtypes.StoreKey], codec)
bech32icamigration.MigrateAddressBech32(ctx, keys[icahosttypes.StoreKey], codec)
bech32mintmigration.MigrateAddressBech32(ctx, keys[minttypes.StoreKey], codec)
bech32transfermiddlewaremigration.MigrateAddressBech32(ctx, keys[transfermiddlewaretypes.StoreKey], codec)
bech32WasmMigration.MigrateAddressBech32(ctx, keys[wasm.StoreKey], codec)
return mm.RunMigrations(ctx, configurator, vm)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v6_4_7_test
package v6_4_8_test

import (
"encoding/json"
Expand Down
10 changes: 5 additions & 5 deletions scripts/test-upgrade-cosmos-chains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ HOME=mytestnet
ROOT=$(pwd)
DENOM=stake
CHAIN_ID1=test-1
SOFTWARE_UPGRADE_NAME="v6_4_6"
ADDITIONAL_PRE_SCRIPTS="./scripts/upgrade/v_6_4_7/pre-script-ibc-transfer.sh"
ADDITIONAL_AFTER_SCRIPTS="./scripts/upgrade/v_6_4_7/post-script-ibc-transfer.sh"
SOFTWARE_UPGRADE_NAME="v6_4_8"
ADDITIONAL_PRE_SCRIPTS="./scripts/upgrade/v_6_4_8/pre-script-ibc-transfer.sh"
ADDITIONAL_AFTER_SCRIPTS="./scripts/upgrade/v_6_4_8/post-script-ibc-transfer.sh"
SETUP_RELAYER_SCRIPTS="./scripts/relayer/relayer-init.sh"

CHAIN_DIR=$(pwd)/data
Expand Down Expand Up @@ -61,7 +61,7 @@ source $SETUP_RELAYER_SCRIPTS

# Transfer from chain 1 to chain 2 and return balance of sender on chain 1
echo "executing additional pre scripts from $ADDITIONAL_PRE_SCRIPTS"
bash ./scripts/upgrade/v_6_4_7/pre-script-ibc-transfer.sh
bash ./scripts/upgrade/v_6_4_8/pre-script-ibc-transfer.sh

run_fork () {
echo "forking"
Expand Down Expand Up @@ -148,7 +148,7 @@ CONTINUE="true" bash scripts/two-testnodes.sh _build/new/picad
sleep 5

echo "executing additional post scripts from $ADDITIONAL_AFTER_SCRIPTS"
bash ./scripts/upgrade/v_6_4_7/post-script-ibc-transfer.sh
bash ./scripts/upgrade/v_6_4_8/post-script-ibc-transfer.sh

echo ""
echo "#########################################################"
Expand Down
6 changes: 3 additions & 3 deletions scripts/test-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ HOME=mytestnet
ROOT=$(pwd)
DENOM=upica
CHAIN_ID=localpica
SOFTWARE_UPGRADE_NAME="v6_4_7"
ADDITIONAL_PRE_SCRIPTS="./scripts/upgrade/v_6_4_7/pre-script.sh"
ADDITIONAL_AFTER_SCRIPTS="./scripts/upgrade/v_6_4_7/post-script.sh"
SOFTWARE_UPGRADE_NAME="v6_4_8"
ADDITIONAL_PRE_SCRIPTS="./scripts/upgrade/v_6_4_8/pre-script.sh"
ADDITIONAL_AFTER_SCRIPTS="./scripts/upgrade/v_6_4_8/post-script.sh"

SLEEP_TIME=1

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 85da880

Please sign in to comment.