Skip to content

Commit

Permalink
chore: update to v13 (#2707)
Browse files Browse the repository at this point in the history
* update to v13

* update upgrade script

* update test upgrade script

* update sed command

* update app.go

* update upgradeFrom version
  • Loading branch information
yaruwangway authored Aug 24, 2023
1 parent 696ab38 commit ae64d50
Show file tree
Hide file tree
Showing 54 changed files with 128 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:
# the old gaiad binary version is hardcoded, need to be updated each major release.
- name: Install Old Gaiad
run: |
git checkout v11.0.0
git checkout v12.0.0
make build
cp ./build/gaiad ./build/gaiadold
go clean -modcache
Expand Down
4 changes: 2 additions & 2 deletions ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"

gaiaerrors "github.com/cosmos/gaia/v12/types/errors"
gaiafeeante "github.com/cosmos/gaia/v12/x/globalfee/ante"
gaiaerrors "github.com/cosmos/gaia/v13/types/errors"
gaiafeeante "github.com/cosmos/gaia/v13/x/globalfee/ante"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand Down
2 changes: 1 addition & 1 deletion ante/gov_ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

gaiaerrors "github.com/cosmos/gaia/v12/types/errors"
gaiaerrors "github.com/cosmos/gaia/v13/types/errors"
)

// initial deposit must be greater than or equal to 10% of the minimum deposit
Expand Down
6 changes: 3 additions & 3 deletions ante/gov_ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

"github.com/cosmos/gaia/v12/ante"
gaiaapp "github.com/cosmos/gaia/v12/app"
gaiahelpers "github.com/cosmos/gaia/v12/app/helpers"
"github.com/cosmos/gaia/v13/ante"
gaiaapp "github.com/cosmos/gaia/v13/app"
gaiahelpers "github.com/cosmos/gaia/v13/app/helpers"
)

var (
Expand Down
14 changes: 7 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

gaiaante "github.com/cosmos/gaia/v12/ante"
"github.com/cosmos/gaia/v12/app/keepers"
gaiaappparams "github.com/cosmos/gaia/v12/app/params"
"github.com/cosmos/gaia/v12/app/upgrades"
v12 "github.com/cosmos/gaia/v12/app/upgrades/v12"
"github.com/cosmos/gaia/v12/x/globalfee"
gaiaante "github.com/cosmos/gaia/v13/ante"
"github.com/cosmos/gaia/v13/app/keepers"
gaiaappparams "github.com/cosmos/gaia/v13/app/params"
"github.com/cosmos/gaia/v13/app/upgrades"
v13 "github.com/cosmos/gaia/v13/app/upgrades/v13"
"github.com/cosmos/gaia/v13/x/globalfee"
)

var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

Upgrades = []upgrades.Upgrade{v12.Upgrade}
Upgrades = []upgrades.Upgrade{v13.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 @@ -10,8 +10,8 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

gaia "github.com/cosmos/gaia/v12/app"
gaiahelpers "github.com/cosmos/gaia/v12/app/helpers"
gaia "github.com/cosmos/gaia/v13/app"
gaiahelpers "github.com/cosmos/gaia/v13/app/helpers"
)

type EmptyAppOptions struct{}
Expand Down
2 changes: 1 addition & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gaia
import (
"github.com/cosmos/cosmos-sdk/std"

"github.com/cosmos/gaia/v12/app/params"
"github.com/cosmos/gaia/v13/app/params"
)

// MakeTestEncodingConfig creates an EncodingConfig for testing. This function
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 @@ -22,7 +22,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

gaiaapp "github.com/cosmos/gaia/v12/app"
gaiaapp "github.com/cosmos/gaia/v13/app"
)

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

"github.com/cosmos/gaia/v12/x/globalfee"
"github.com/cosmos/gaia/v13/x/globalfee"
)

type AppKeepers struct {
Expand Down
4 changes: 2 additions & 2 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

gaiaappparams "github.com/cosmos/gaia/v12/app/params"
"github.com/cosmos/gaia/v12/x/globalfee"
gaiaappparams "github.com/cosmos/gaia/v13/app/params"
"github.com/cosmos/gaia/v13/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 @@ -21,7 +21,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

gaia "github.com/cosmos/gaia/v12/app"
gaia "github.com/cosmos/gaia/v13/app"
)

// AppStateFn returns the initial application state using a genesis or the simulation parameters.
Expand Down
2 changes: 1 addition & 1 deletion app/sim/sim_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"

gaia "github.com/cosmos/gaia/v12/app"
gaia "github.com/cosmos/gaia/v13/app"
)

// SetupSimulation creates the config, db (levelDB), temporary directory and logger for
Expand Down
8 changes: 4 additions & 4 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
simulation2 "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"

gaia "github.com/cosmos/gaia/v12/app"
"github.com/cosmos/gaia/v12/app/helpers"
"github.com/cosmos/gaia/v12/app/params"
"github.com/cosmos/gaia/v12/app/sim"
gaia "github.com/cosmos/gaia/v13/app"
"github.com/cosmos/gaia/v13/app/helpers"
"github.com/cosmos/gaia/v13/app/params"
"github.com/cosmos/gaia/v13/app/sim"
)

func init() {
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/v12/app/keepers"
"github.com/cosmos/gaia/v13/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/v12/app/upgrades"
"github.com/cosmos/gaia/v13/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/v12/app/keepers"
"github.com/cosmos/gaia/v13/app/keepers"
)

func CreateUpgradeHandler(
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v11/constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package v11

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

const (
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v11/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/v12/app/keepers"
"github.com/cosmos/gaia/v13/app/keepers"
)

func CreateUpgradeHandler(
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v12/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package v12
import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/cosmos/gaia/v12/app/upgrades"
"github.com/cosmos/gaia/v13/app/upgrades"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v12/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/v12/app/keepers"
"github.com/cosmos/gaia/v13/app/keepers"
)

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

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

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

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

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/v13/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 @@ -5,7 +5,7 @@ import (

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

"github.com/cosmos/gaia/v12/app/upgrades"
"github.com/cosmos/gaia/v13/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 @@ -10,7 +10,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/cosmos/gaia/v12/app/keepers"
"github.com/cosmos/gaia/v13/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 @@ -3,8 +3,8 @@ package v8
import (
store "github.com/cosmos/cosmos-sdk/store/types"

"github.com/cosmos/gaia/v12/app/upgrades"
"github.com/cosmos/gaia/v12/x/globalfee"
"github.com/cosmos/gaia/v13/app/upgrades"
"github.com/cosmos/gaia/v13/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 @@ -14,7 +14,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/cosmos/gaia/v12/app/keepers"
"github.com/cosmos/gaia/v13/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 @@ -5,7 +5,7 @@ import (

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

"github.com/cosmos/gaia/v12/app/upgrades"
"github.com/cosmos/gaia/v13/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 @@ -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/v12/app/keepers"
"github.com/cosmos/gaia/v13/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 @@ -5,7 +5,7 @@ import (

"github.com/spf13/cobra"

addressutil "github.com/cosmos/gaia/v12/pkg/address"
addressutil "github.com/cosmos/gaia/v13/pkg/address"
)

var flagBech32Prefix = "prefix"
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 @@ -31,8 +31,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"

gaia "github.com/cosmos/gaia/v12/app"
"github.com/cosmos/gaia/v12/app/params"
gaia "github.com/cosmos/gaia/v13/app"
"github.com/cosmos/gaia/v13/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 @@ -7,8 +7,8 @@ import (

svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"

app "github.com/cosmos/gaia/v12/app"
"github.com/cosmos/gaia/v12/cmd/gaiad/cmd"
app "github.com/cosmos/gaia/v13/app"
"github.com/cosmos/gaia/v13/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/v12/app"
"github.com/cosmos/gaia/v12/cmd/gaiad/cmd"
app "github.com/cosmos/gaia/v13/app"
"github.com/cosmos/gaia/v13/cmd/gaiad/cmd"
)

func main() {
Expand Down
11 changes: 6 additions & 5 deletions contrib/scripts/upgrade_test_scripts/run_gaia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,16 @@ tmp=$(mktemp)
jq --argjson foo "$(jq -c '.' contrib/denom.json)" '.app_state.bank.denom_metadata = $foo' $NODE_HOME/config/genesis.json >"$tmp" && mv "$tmp" $NODE_HOME/config/genesis.json

# replace default stake token with uatom
sed -i -e 's/stake/uatom/g' $NODE_HOME/config/genesis.json
sed -i -e '/total_liquid_staked_tokens/!s/stake/uatom/g' $NODE_HOME/config/genesis.json

# min deposition amount (this one isn't working)
sed -i -e 's%"amount": "10000000",%"amount": "1",%g' $NODE_HOME/config/genesis.json
sed -i -e 's/"amount": "10000000",/"amount": "1",/g' $NODE_HOME/config/genesis.json
# min voting power that a proposal requires in order to be a valid proposal
sed -i -e 's%"quorum": "0.334000000000000000",%"quorum": "0.000000000000000001",%g' $NODE_HOME/config/genesis.json
sed -i -e 's/"quorum": "0.334000000000000000",/"quorum": "0.000000000000000001",/g' $NODE_HOME/config/genesis.json
# the minimum proportion of "yes" votes requires for the proposal to pass
sed -i -e 's%"threshold": "0.500000000000000000",%"threshold": "0.000000000000000001",%g' $NODE_HOME/config/genesis.json
sed -i -e 's/"threshold": "0.500000000000000000",/"threshold": "0.000000000000000001",/g' $NODE_HOME/config/genesis.json
# voting period to 30s
sed -i -e 's%"voting_period": "172800s"%"voting_period": "30s"%g' $NODE_HOME/config/genesis.json
sed -i -e 's/"voting_period": "172800s"/"voting_period": "30s"/g' $NODE_HOME/config/genesis.json

echo $USER_MNEMONIC | $BINARY --home $NODE_HOME keys add val --recover --keyring-backend=test
$BINARY add-genesis-account val 10000000000000000000000000uatom --home $NODE_HOME --keyring-backend test
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/cosmos/gaia/v12
module github.com/cosmos/gaia/v13

go 1.20

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

gaia "github.com/cosmos/gaia/v12/app"
"github.com/cosmos/gaia/v12/app/params"
gaia "github.com/cosmos/gaia/v13/app"
"github.com/cosmos/gaia/v13/app/params"
)

const (
Expand Down
Loading

0 comments on commit ae64d50

Please sign in to comment.