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

auto: code-gen upgrade handler v16 #3

Closed
wants to merge 3 commits into from
Closed
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
8 changes: 5 additions & 3 deletions .github/workflows/gen-upgrade-on-manual-input.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# When user trigger this workflow with custom version input, this action will do 3 things:
# 1) it will create a directory with an empty upgrade handler in app/upgrades folder
# 2) will increase an E2E_UPGRADE_VERSION variable in Makefile
# 3) create a pull request with these changes to main
# 1) create a directory with an empty upgrade handler in app/upgrades folder
# 2) increase E2E_UPGRADE_VERSION variable in Makefile
# 3) update OSMOSIS_E2E_UPGRADE_VERSION variable in .vscode/launch.json
# 4) create a pull request with these changes to main

# Please note that if the given version (or release major version) is smaller than the latest
# existing upgrade handler version in `app/upgrades/`, this will be a no-op.
Expand Down Expand Up @@ -58,6 +59,7 @@ jobs:
Update report
- Created a new empty upgrade handler
- Increased E2E_UPGRADE_VERSION in Makefile by 1
- Increased OSMOSIS_E2E_UPGRADE_VERSION in .vscode/launch.json by 1
labels: |
T:auto
C:e2e
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"OSMOSIS_E2E_SKIP_UPGRADE": "false",
"OSMOSIS_E2E_SKIP_CLEANUP": "true",
"OSMOSIS_E2E_SKIP_STATE_SYNC": "false",
"OSMOSIS_E2E_UPGRADE_VERSION": "v15",
"OSMOSIS_E2E_UPGRADE_VERSION": "v16",
"OSMOSIS_E2E_DEBUG_LOG": "false",
},
"preLaunchTask": "e2e-setup"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)
DOCKER := $(shell which docker)
BUILDDIR ?= $(CURDIR)/build
E2E_UPGRADE_VERSION := "v15"
E2E_UPGRADE_VERSION := "v16"


GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
Expand Down
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import (
v13 "github.com/osmosis-labs/osmosis/v14/app/upgrades/v13"
v14 "github.com/osmosis-labs/osmosis/v14/app/upgrades/v14"
v15 "github.com/osmosis-labs/osmosis/v14/app/upgrades/v15"
v16 "github.com/osmosis-labs/osmosis/v14/app/upgrades/v16"
v3 "github.com/osmosis-labs/osmosis/v14/app/upgrades/v3"
v4 "github.com/osmosis-labs/osmosis/v14/app/upgrades/v4"
v5 "github.com/osmosis-labs/osmosis/v14/app/upgrades/v5"
Expand Down Expand Up @@ -96,7 +97,7 @@ var (

// _ sdksimapp.App = (*OsmosisApp)(nil)

Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade, v15.Upgrade}
Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade, v15.Upgrade, v16.Upgrade}
Forks = []upgrades.Fork{v3.Fork, v6.Fork, v8.Fork, v10.Fork}
)

Expand Down
19 changes: 19 additions & 0 deletions app/upgrades/v16/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package v16

import (
"github.com/osmosis-labs/osmosis/v14/app/upgrades"

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

// UpgradeName defines the on-chain upgrade name for the Osmosis v16 upgrade.
const UpgradeName = "v16"

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

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/osmosis-labs/osmosis/v14/app/keepers"
"github.com/osmosis-labs/osmosis/v14/app/upgrades"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
bpm upgrades.BaseAppParamManager,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return mm.RunMigrations(ctx, configurator, fromVM)
}
}
8 changes: 6 additions & 2 deletions scripts/empty_upgrade_handler_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

# 1) this script creates an empty directory in app/upgrades called "vX" where X is a previous version + 1 with an empty upgrade handler.
# 2) adds new version to app.go
# 3) increases E2E_UPGRADE_VERSION in makefile by 1
# 4) bumps up previous e2e-init version in tests/e2e/containers/config.go
# 3) update OSMOSIS_E2E_UPGRADE_VERSION variable in .vscode/launch.json
# 4) increases E2E_UPGRADE_VERSION in makefile by 1
# 5) bumps up previous e2e-init version in tests/e2e/containers/config.go

# Also insures that all the imports make use of a current module version from go mod:
# (see: module=$(go mod edit -json | jq ".Module.Path") in this script)
Expand Down Expand Up @@ -119,3 +120,6 @@ else
echo "Using pre-defined osmosis-e2e-init-chain tag: $PREV_OSMOSIS_E2E_TAG"
sed -i '/previousVersionInitTag/s/".*"/'"\"$PREV_OSMOSIS_E2E_TAG\""'/' $e2e_file
fi

# update OSMOSIS_E2E_UPGRADE_VERSION in launch.json
sed -i "s/${bracks}OSMOSIS_E2E_UPGRADE_VERSION${bracks}: ${bracks}v$latest_version${bracks}/${bracks}OSMOSIS_E2E_UPGRADE_VERSION${bracks}: ${bracks}$version_create${bracks}/" ./.vscode/launch.json
4 changes: 2 additions & 2 deletions tests/e2e/containers/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ const (
// It should be uploaded to Docker Hub. OSMOSIS_E2E_SKIP_UPGRADE should be unset
// for this functionality to be used.
previousVersionOsmoRepository = "osmolabs/osmosis-dev"
previousVersionOsmoTag = "v14.x-de392d2b-1674667154"
previousVersionOsmoTag = "v15.0.0"
// Pre-upgrade repo/tag for osmosis initialization (this should be one version below upgradeVersion)
previousVersionInitRepository = "osmolabs/osmosis-e2e-init-chain"
previousVersionInitTag = "v14.x-f6813bcb-1674140667-manual"
previousVersionInitTag = "v15.0.0"
// Hermes repo/version for relayer
relayerRepository = "osmolabs/hermes"
relayerTag = "0.13.0"
Expand Down