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

v7 Upgrades #213

Merged
merged 3 commits into from
Jun 20, 2024
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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ test-integration-web-auth-n-abstract-account: compile_integration_tests
test-integration-upgrade:
@XION_IMAGE=$(XION_IMAGE) cd integration_tests && go test -v -run TestXionUpgradeIBC -mod=readonly -tags='ledger test_ledger_mock' ./...

test-integration-upgrade-network:
@XION_IMAGE=$(XION_IMAGE) cd integration_tests && go test -v -run TestXionUpgradeNetwork -mod=readonly -tags='ledger test_ledger_mock' ./...

test-integration-xion-mig: compile_integration_tests
@XION_IMAGE=$(XION_IMAGE) ./integration_tests/integration_tests.test -test.failfast -test.v -test.run TestAbstractAccountMigration

Expand Down
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/burnt-labs/xion/app/upgrades"
v6 "github.com/burnt-labs/xion/app/upgrades/v6"
v7 "github.com/burnt-labs/xion/app/upgrades/v7"
owasm "github.com/burnt-labs/xion/wasmbindings"
"github.com/burnt-labs/xion/x/globalfee"
"github.com/burnt-labs/xion/x/jwk"
Expand Down Expand Up @@ -171,7 +171,7 @@ var (
// of "EnableAllProposals" (takes precedence over ProposalsEnabled)
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""
Upgrades = []upgrades.Upgrade{v6.Upgrade}
Upgrades = []upgrades.Upgrade{v7.Upgrade}
)

// These constants are derived from the above variables.
Expand Down
18 changes: 18 additions & 0 deletions app/upgrades/v7/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v7

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

"github.com/burnt-labs/xion/app/upgrades"
)

const (
// UpgradeName defines the on-chain upgrade name.
UpgradeName = "v7"
)

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

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

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("Starting module migrations...")

vm, err := mm.RunMigrations(ctx, configurator, vm)
if err != nil {
return vm, err
}

ctx.Logger().Info("Upgrade v7 complete")
return vm, err
}
}
9 changes: 4 additions & 5 deletions integration_tests/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ const (
* 7- XION_IMAGE=[current version of the network] go test -run TestXionUpgrade ./...

As of Aug 17 2023 this is the necessary process to run this test, this is due to the fact that AWS & docker-hub auto deleting old images, therefore you might lose what the version currently running is image wise
current-testnet: v0.3.4
step between: v0.3.5
upgrade-version: v0.3.6
current-testnet: v6
upgrade-version: v7
*/
func TestXionUpgrade(t *testing.T) {
func TestXionUpgradeNetwork(t *testing.T) {
t.Parallel()

td := BuildXionChain(t, "0.0uxion", ModifyInterChainGenesis(ModifyInterChainGenesisFn{ModifyGenesisShortProposals, ModifyGenesisAAAllowedCodeIDs}, [][]string{{votingPeriod, maxDepositPeriod}, {votingPeriod, maxDepositPeriod}}))
CosmosChainUpgradeTest(t, &td, "xion", "upgrade", "v4")
CosmosChainUpgradeTest(t, &td, "xion", "upgrade", "v7")
}

func CosmosChainUpgradeTest(t *testing.T, td *TestData, upgradeContainerRepo, upgradeVersion string, upgradeName string) {
Expand Down
Loading