Skip to content

Commit

Permalink
chore: update module to gaia v11 (#2515)
Browse files Browse the repository at this point in the history
* update module to gaia v11

* update go.mod

* update globalfee.md

* fix: provider keeper

* fix: upgrade test in CI

* revert to ics v1.1.1

* tidy CI upgrade test scripts

* chore: add v10 upgrades

* fix: lint

* fix: version in app.go

* test: improve test
  • Loading branch information
yaruwangway authored and sainoe committed Jun 23, 2023
1 parent e6aef55 commit 0d2c742
Show file tree
Hide file tree
Showing 56 changed files with 2,961 additions and 2,769 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,41 +124,37 @@ jobs:
go.sum
- uses: actions/setup-go@v4
with:
go-version: 1.18
- name: Install GaiaV9
go-version: 1.20.x
- name: Install GaiaV10
run: |
git checkout v9.1.0
git checkout v10.0.0
make build
cp ./build/gaiad ./build/gaiad9
cp ./build/gaiad ./build/gaiad10
go clean -modcache
if: env.GIT_DIFF
- uses: actions/setup-go@v4
with:
go-version: 1.20.x
- name: Install GaiaV10
- name: Install GaiaV11
run: |
git checkout -
make build
cp ./build/gaiad ./build/gaiad10
cp ./build/gaiad ./build/gaiad11
if: env.GIT_DIFF
- name: Install Cosmovisor
run: |
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@latest
if: env.GIT_DIFF
- name: Start GaiaV9
- name: Start GaiaV10
run: |
go env GOPATH
./contrib/scripts/run-gaia-v9.sh
./contrib/scripts/upgrade_test_scripts/v11/run_gaia_v10.sh
if: env.GIT_DIFF
- name: Submit Upgrade Commands
run: |
./contrib/scripts/run-upgrade-commands-v10.sh 15
./contrib/scripts/upgrade_test_scripts/v11/run_upgrade_commands_v11.sh 15
if: env.GIT_DIFF
- name: Check for successful upgrade
run: |
./contrib/scripts/test_upgrade.sh 20 5 16 localhost
./contrib/scripts/upgrade_test_scripts/test_upgrade.sh 20 5 16 localhost
if: env.GIT_DIFF
- name: Check for successful migration
run: |
./contrib/scripts/test_migration.sh localhost
if: env.GIT_DIFF
./contrib/scripts/upgrade_test_scripts/v11/test_migration_v11.sh localhost
5 changes: 3 additions & 2 deletions ante/gov_ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/testutil/testdata"

gaiahelpers "github.com/cosmos/gaia/v10/app/helpers"
// "github.com/cosmos/gaia/v11/ante"
gaiahelpers "github.com/cosmos/gaia/v11/app/helpers"

gaiaapp "github.com/cosmos/gaia/v10/app"
gaiaapp "github.com/cosmos/gaia/v11/app"
)

// var (
Expand Down
13 changes: 6 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ import (
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"

gaiaante "github.com/cosmos/gaia/v10/ante"
"github.com/cosmos/gaia/v10/app/keepers"
"github.com/cosmos/gaia/v10/app/upgrades"
v10 "github.com/cosmos/gaia/v10/app/upgrades/v10"
gaiaante "github.com/cosmos/gaia/v11/ante"
"github.com/cosmos/gaia/v11/app/keepers"
"github.com/cosmos/gaia/v11/app/upgrades"
v11 "github.com/cosmos/gaia/v11/app/upgrades/v11"

// TODO: Enable with GlobalFee
// "github.com/cosmos/gaia/v10/x/globalfee"
// "github.com/cosmos/gaia/v11/x/globalfee"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"
Expand All @@ -62,7 +61,7 @@ var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

Upgrades = []upgrades.Upgrade{v10.Upgrade}
Upgrades = []upgrades.Upgrade{v11.Upgrade}
)

var (
Expand Down
4 changes: 2 additions & 2 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/stretchr/testify/require"

gaia "github.com/cosmos/gaia/v10/app"
gaiahelpers "github.com/cosmos/gaia/v10/app/helpers"
gaia "github.com/cosmos/gaia/v11/app"
gaiahelpers "github.com/cosmos/gaia/v11/app/helpers"
)

type EmptyAppOptions struct{}
Expand Down
3 changes: 2 additions & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package gaia

import (
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/gaia/v10/app/params"

"github.com/cosmos/gaia/v11/app/params"
)

func RegisterEncodingConfig() params.EncodingConfig {
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"

gaiaapp "github.com/cosmos/gaia/v10/app"
gaiaapp "github.com/cosmos/gaia/v11/app"
)

// DefaultConsensusParams defines the default Tendermint consensus params used
Expand Down
4 changes: 4 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ import (
porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
ibcprovider "github.com/cosmos/interchain-security/x/ccv/provider"
ibcproviderkeeper "github.com/cosmos/interchain-security/x/ccv/provider/keeper"
pfmrouter "github.com/strangelove-ventures/packet-forward-middleware/v7/router"
pfmrouterkeeper "github.com/strangelove-ventures/packet-forward-middleware/v7/router/keeper"
pfmroutertypes "github.com/strangelove-ventures/packet-forward-middleware/v7/router/types"

// liquiditykeeper "github.com/gravity-devs/liquidity/x/liquidity/keeper"
// liquiditytypes "github.com/gravity-devs/liquidity/x/liquidity/types"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"
)
Expand Down
3 changes: 2 additions & 1 deletion app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ import (
"github.com/strangelove-ventures/packet-forward-middleware/v7/router"
routertypes "github.com/strangelove-ventures/packet-forward-middleware/v7/router/types"

gaiaparams "github.com/cosmos/gaia/v10/app/params"
gaiaappparams "github.com/cosmos/gaia/v11/app/params"
// "github.com/cosmos/gaia/v11/x/globalfee"
)

var maccPerms = map[string][]string{
Expand Down
2 changes: 1 addition & 1 deletion app/sim/sim_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
tmjson "github.com/cometbft/cometbft/libs/json"
tmtypes "github.com/cometbft/cometbft/types"

gaia "github.com/cosmos/gaia/v10/app"
gaia "github.com/cosmos/gaia/v11/app"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
Expand Down
3 changes: 2 additions & 1 deletion app/sim/sim_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (
"github.com/cosmos/cosmos-sdk/runtime"

dbm "github.com/cometbft/cometbft-db"
gaia "github.com/cosmos/gaia/v10/app"

gaia "github.com/cosmos/gaia/v11/app"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/types/module"
Expand Down
6 changes: 4 additions & 2 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ import (
simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli"
"github.com/stretchr/testify/require"

gaia "github.com/cosmos/gaia/v10/app"
"github.com/cosmos/gaia/v10/app/sim"
gaia "github.com/cosmos/gaia/v11/app"
// "github.com/cosmos/gaia/v11/app/helpers"
// "github.com/cosmos/gaia/v11/app/params"
"github.com/cosmos/gaia/v11/app/sim"
)

// AppChainID hardcoded chainID for simulation
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/cosmos/gaia/v10/app/keepers"
"github.com/cosmos/gaia/v11/app/keepers"
)

// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v10/constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package v10

import (
"github.com/cosmos/gaia/v10/app/upgrades"
"github.com/cosmos/gaia/v11/app/upgrades"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v10/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/cosmos/gaia/v10/app/keepers"
"github.com/cosmos/gaia/v11/app/keepers"
)

func CreateUpgradeHandler(
Expand Down
15 changes: 15 additions & 0 deletions app/upgrades/v11/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package v11

import (
"github.com/cosmos/gaia/v11/app/upgrades"
)

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

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

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/gaia/v11/app/keepers"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan 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 complete")
return vm, err
}
}
2 changes: 1 addition & 1 deletion app/upgrades/v7/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
store "github.com/cosmos/cosmos-sdk/store/types"
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"

"github.com/cosmos/gaia/v10/app/upgrades"
"github.com/cosmos/gaia/v11/app/upgrades"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v7/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"

"github.com/cosmos/gaia/v10/app/keepers"
"github.com/cosmos/gaia/v11/app/keepers"
)

func CreateUpgradeHandler(
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v8/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package v8
import (
store "github.com/cosmos/cosmos-sdk/store/types"

"github.com/cosmos/gaia/v10/app/upgrades"
"github.com/cosmos/gaia/v10/x/globalfee"
"github.com/cosmos/gaia/v11/app/upgrades"
"github.com/cosmos/gaia/v11/x/globalfee"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v8/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"
ibcchanneltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"

"github.com/cosmos/gaia/v10/app/keepers"
"github.com/cosmos/gaia/v11/app/keepers"
)

func FixBankMetadata(ctx sdk.Context, keepers *keepers.AppKeepers) error {
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v9/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
store "github.com/cosmos/cosmos-sdk/store/types"
ccvprovider "github.com/cosmos/interchain-security/x/ccv/provider/types"

"github.com/cosmos/gaia/v10/app/upgrades"
"github.com/cosmos/gaia/v11/app/upgrades"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v9/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/cosmos/gaia/v10/app/keepers"
"github.com/cosmos/gaia/v11/app/keepers"
)

func CreateUpgradeHandler(
Expand Down
2 changes: 1 addition & 1 deletion cmd/gaiad/cmd/bech32_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"fmt"

addressutil "github.com/cosmos/gaia/v10/pkg/address"
addressutil "github.com/cosmos/gaia/v11/pkg/address"

"github.com/spf13/cobra"
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/gaiad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import (
"github.com/spf13/cast"
"github.com/spf13/cobra"

gaia "github.com/cosmos/gaia/v10/app"
params "github.com/cosmos/gaia/v10/app/params"
gaia "github.com/cosmos/gaia/v11/app"
"github.com/cosmos/gaia/v11/app/params"
)

// NewRootCmd creates a new root command for simd. It is called once in the
Expand Down
4 changes: 2 additions & 2 deletions cmd/gaiad/cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/stretchr/testify/require"

app "github.com/cosmos/gaia/v10/app"
"github.com/cosmos/gaia/v10/cmd/gaiad/cmd"
app "github.com/cosmos/gaia/v11/app"
"github.com/cosmos/gaia/v11/cmd/gaiad/cmd"
)

func TestRootCmdConfig(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/gaiad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"

app "github.com/cosmos/gaia/v10/app"
"github.com/cosmos/gaia/v10/cmd/gaiad/cmd"
app "github.com/cosmos/gaia/v11/app"
"github.com/cosmos/gaia/v11/cmd/gaiad/cmd"
)

func main() {
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion contrib/scripts/run-gaia-v9.sh → ...s/upgrade_test_scripts/v10/run_gaia_v9.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,3 @@ pwd
ls $NODE_HOME

$COSMOVISOR run start --home $NODE_HOME --x-crisis-skip-assert-invariants > v9.out 2>&1 &

Loading

0 comments on commit 0d2c742

Please sign in to comment.