Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Commit

Permalink
[v15 (previously v14.2.0)] Upgrade (CosmosContracts#693)
Browse files Browse the repository at this point in the history
* Adds coordinated v14.2.0 upgrade handler

* lint

* Adds NewDenomCreationGasConsume

* gofmt

* v15 handler + upgrade

* Rename all namespace to v15

* Fix ICtest for new v15 namespace

* go.sum

* Comment
  • Loading branch information
Reecepbcups authored May 24, 2023
1 parent 8ad6665 commit b7901a7
Show file tree
Hide file tree
Showing 68 changed files with 258 additions and 180 deletions.
6 changes: 3 additions & 3 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"

wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
decorators "github.com/CosmosContracts/juno/v14/app/decorators"
decorators "github.com/CosmosContracts/juno/v15/app/decorators"

feeshareante "github.com/CosmosContracts/juno/v14/x/feeshare/ante"
feesharekeeper "github.com/CosmosContracts/juno/v14/x/feeshare/keeper"
feeshareante "github.com/CosmosContracts/juno/v15/x/feeshare/ante"
feesharekeeper "github.com/CosmosContracts/juno/v15/x/feeshare/keeper"

gaiafeeante "github.com/cosmos/gaia/v9/x/globalfee/ante"
)
Expand Down
23 changes: 12 additions & 11 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strconv"
"strings"

"github.com/CosmosContracts/juno/v14/app/openapiconsole"
"github.com/CosmosContracts/juno/v14/docs"
"github.com/CosmosContracts/juno/v15/app/openapiconsole"
"github.com/CosmosContracts/juno/v15/docs"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
Expand Down Expand Up @@ -55,14 +55,15 @@ import (

"github.com/cosmos/gaia/v9/x/globalfee"

"github.com/CosmosContracts/juno/v14/app/keepers"
encparams "github.com/CosmosContracts/juno/v14/app/params"
upgrades "github.com/CosmosContracts/juno/v14/app/upgrades"
v10 "github.com/CosmosContracts/juno/v14/app/upgrades/v10"
v11 "github.com/CosmosContracts/juno/v14/app/upgrades/v11"
v12 "github.com/CosmosContracts/juno/v14/app/upgrades/v12"
v13 "github.com/CosmosContracts/juno/v14/app/upgrades/v13"
v14 "github.com/CosmosContracts/juno/v14/app/upgrades/v14"
"github.com/CosmosContracts/juno/v15/app/keepers"
encparams "github.com/CosmosContracts/juno/v15/app/params"
upgrades "github.com/CosmosContracts/juno/v15/app/upgrades"
v10 "github.com/CosmosContracts/juno/v15/app/upgrades/v10"
v11 "github.com/CosmosContracts/juno/v15/app/upgrades/v11"
v12 "github.com/CosmosContracts/juno/v15/app/upgrades/v12"
v13 "github.com/CosmosContracts/juno/v15/app/upgrades/v13"
v14 "github.com/CosmosContracts/juno/v15/app/upgrades/v14"
v15 "github.com/CosmosContracts/juno/v15/app/upgrades/v15"
)

const (
Expand All @@ -83,7 +84,7 @@ var (
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""

Upgrades = []upgrades.Upgrade{v10.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade}
Upgrades = []upgrades.Upgrade{v10.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade, v15.Upgrade}
)

// These constants are derived from the above variables.
Expand Down
2 changes: 1 addition & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app

import (
"github.com/CosmosContracts/juno/v14/app/params"
"github.com/CosmosContracts/juno/v15/app/params"

"github.com/cosmos/cosmos-sdk/std"
)
Expand Down
15 changes: 11 additions & 4 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
mintkeeper "github.com/CosmosContracts/juno/v14/x/mint/keeper"
minttypes "github.com/CosmosContracts/juno/v14/x/mint/types"
mintkeeper "github.com/CosmosContracts/juno/v15/x/mint/keeper"
minttypes "github.com/CosmosContracts/juno/v15/x/mint/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
Expand Down Expand Up @@ -69,8 +69,8 @@ import (
icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"

feesharekeeper "github.com/CosmosContracts/juno/v14/x/feeshare/keeper"
feesharetypes "github.com/CosmosContracts/juno/v14/x/feeshare/types"
feesharekeeper "github.com/CosmosContracts/juno/v15/x/feeshare/keeper"
feesharetypes "github.com/CosmosContracts/juno/v15/x/feeshare/types"

// ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
icacontroller "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller"
Expand All @@ -80,6 +80,12 @@ import (
"github.com/cosmos/gaia/v9/x/globalfee"
)

var EnabledCapabilities = []string{
tokenfactorytypes.EnableBurnFrom,
tokenfactorytypes.EnableForceTransfer,
tokenfactorytypes.EnableSetMetadata,
}

type AppKeepers struct {
// keys to access the substores
keys map[string]*sdk.KVStoreKey
Expand Down Expand Up @@ -357,6 +363,7 @@ func NewAppKeepers(
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.DistrKeeper,
EnabledCapabilities,
)

wasmDir := filepath.Join(homePath, "data")
Expand Down
4 changes: 2 additions & 2 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package keepers
import (
tokenfactorytypes "github.com/CosmWasm/token-factory/x/tokenfactory/types"
"github.com/CosmWasm/wasmd/x/wasm"
feesharetypes "github.com/CosmosContracts/juno/v14/x/feeshare/types"
minttypes "github.com/CosmosContracts/juno/v14/x/mint/types"
feesharetypes "github.com/CosmosContracts/juno/v15/x/feeshare/types"
minttypes "github.com/CosmosContracts/juno/v15/x/mint/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down
10 changes: 5 additions & 5 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"github.com/CosmWasm/token-factory/x/tokenfactory"
tokenfactorytypes "github.com/CosmWasm/token-factory/x/tokenfactory/types"
"github.com/CosmWasm/wasmd/x/wasm"
encparams "github.com/CosmosContracts/juno/v14/app/params"
feeshare "github.com/CosmosContracts/juno/v14/x/feeshare"
feesharetypes "github.com/CosmosContracts/juno/v14/x/feeshare/types"
"github.com/CosmosContracts/juno/v14/x/mint"
minttypes "github.com/CosmosContracts/juno/v14/x/mint/types"
encparams "github.com/CosmosContracts/juno/v15/app/params"
feeshare "github.com/CosmosContracts/juno/v15/x/feeshare"
feesharetypes "github.com/CosmosContracts/juno/v15/x/feeshare/types"
"github.com/CosmosContracts/juno/v15/x/mint"
minttypes "github.com/CosmosContracts/juno/v15/x/mint/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
Expand Down
4 changes: 2 additions & 2 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/CosmWasm/wasmd/x/wasm"
"github.com/CosmWasm/wasmd/x/wasm/keeper"
apphelpers "github.com/CosmosContracts/juno/v14/app/helpers"
appparams "github.com/CosmosContracts/juno/v14/app/params"
apphelpers "github.com/CosmosContracts/juno/v15/app/helpers"
appparams "github.com/CosmosContracts/juno/v15/app/params"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package upgrades
import (
"strings"

"github.com/CosmosContracts/juno/v14/app/keepers"
"github.com/CosmosContracts/juno/v15/app/keepers"
store "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
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/CosmosContracts/juno/v14/app/upgrades"
"github.com/CosmosContracts/juno/v15/app/upgrades"
store "github.com/cosmos/cosmos-sdk/store/types"
icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
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 @@ -2,7 +2,7 @@ package v10

import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/CosmosContracts/juno/v14/app/keepers"
"github.com/CosmosContracts/juno/v15/app/keepers"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/authz"
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/CosmosContracts/juno/v14/app/upgrades"
"github.com/CosmosContracts/juno/v15/app/upgrades"
store "github.com/cosmos/cosmos-sdk/store/types"
icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
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 @@ -2,7 +2,7 @@ package v11

import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/CosmosContracts/juno/v14/app/keepers"
"github.com/CosmosContracts/juno/v15/app/keepers"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/authz"
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v12/constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package v12

import (
"github.com/CosmosContracts/juno/v14/app/upgrades"
"github.com/CosmosContracts/juno/v15/app/upgrades"
store "github.com/cosmos/cosmos-sdk/store/types"
)

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

import (
"github.com/CosmosContracts/juno/v14/app/keepers"
"github.com/CosmosContracts/juno/v15/app/keepers"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v13/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package v13

import (
tokenfactorytypes "github.com/CosmWasm/token-factory/x/tokenfactory/types"
"github.com/CosmosContracts/juno/v14/app/upgrades"
feesharetypes "github.com/CosmosContracts/juno/v14/x/feeshare/types"
"github.com/CosmosContracts/juno/v15/app/upgrades"
feesharetypes "github.com/CosmosContracts/juno/v15/x/feeshare/types"
store "github.com/cosmos/cosmos-sdk/store/types"
icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types"
ibcfeetypes "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"
Expand Down
6 changes: 3 additions & 3 deletions app/upgrades/v13/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package v13
import (
"fmt"

"github.com/CosmosContracts/juno/v14/app/keepers"
"github.com/CosmosContracts/juno/v15/app/keepers"

"github.com/CosmosContracts/juno/v14/app/upgrades"
"github.com/CosmosContracts/juno/v15/app/upgrades"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"

Expand All @@ -16,7 +16,7 @@ import (

// types
tokenfactorytypes "github.com/CosmWasm/token-factory/x/tokenfactory/types"
feesharetypes "github.com/CosmosContracts/juno/v14/x/feeshare/types"
feesharetypes "github.com/CosmosContracts/juno/v15/x/feeshare/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ibcfeetypes "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"

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

import (
"github.com/CosmosContracts/juno/v14/app/upgrades"
"github.com/CosmosContracts/juno/v15/app/upgrades"
store "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/gaia/v9/x/globalfee"
ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v14/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package v14
import (
"fmt"

"github.com/CosmosContracts/juno/v14/app/keepers"
"github.com/CosmosContracts/juno/v15/app/keepers"

"github.com/CosmosContracts/juno/v14/app/upgrades"
"github.com/CosmosContracts/juno/v15/app/upgrades"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"

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

import (
"github.com/CosmosContracts/juno/v15/app/upgrades"
store "github.com/cosmos/cosmos-sdk/store/types"
)

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

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

import (
"fmt"

"github.com/CosmosContracts/juno/v15/app/keepers"

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

tokenfactorytypes "github.com/CosmWasm/token-factory/x/tokenfactory/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

// We now charge 2 million gas * gas price to create a denom.
const NewDenomCreationGasConsume uint64 = 2_000_000

func CreateV15PatchUpgradeHandler(
mm *module.Manager,
cfg module.Configurator,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
logger := ctx.Logger().With("upgrade", UpgradeName)

logger.Info(fmt.Sprintf("pre migrate version map: %v", vm))
versionMap, err := mm.RunMigrations(ctx, cfg, vm)
logger.Info(fmt.Sprintf("post migrate version map: %v", versionMap))

// x/TokenFactory
// Use denom creation gas consumtion instead of fee for contract developers
updatedTf := tokenfactorytypes.Params{
DenomCreationFee: nil,
DenomCreationGasConsume: NewDenomCreationGasConsume,
}

keepers.TokenFactoryKeeper.SetParams(ctx, updatedTf)
logger.Info(fmt.Sprintf("updated tokenfactory params to %v", updatedTf))

return versionMap, err
}
}
2 changes: 1 addition & 1 deletion cmd/junod/cmd/balances_from_state_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
tmjson "github.com/tendermint/tendermint/libs/json"
tmtypes "github.com/tendermint/tendermint/types"

appparams "github.com/CosmosContracts/juno/v14/app/params"
appparams "github.com/CosmosContracts/juno/v15/app/params"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
4 changes: 2 additions & 2 deletions cmd/junod/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/CosmosContracts/juno/v14/app"
"github.com/CosmosContracts/juno/v14/app/params"
"github.com/CosmosContracts/juno/v15/app"
"github.com/CosmosContracts/juno/v15/app/params"
)

// NewRootCmd creates a new root command for junod. It is called once in the
Expand Down
4 changes: 2 additions & 2 deletions cmd/junod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"os"

"github.com/CosmosContracts/juno/v14/app"
"github.com/CosmosContracts/juno/v14/cmd/junod/cmd"
"github.com/CosmosContracts/juno/v15/app"
"github.com/CosmosContracts/juno/v15/cmd/junod/cmd"
"github.com/cosmos/cosmos-sdk/server"

svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/CosmosContracts/juno/v14
module github.com/CosmosContracts/juno/v15

go 1.19

Expand Down Expand Up @@ -160,7 +160,7 @@ replace (
// cosmos keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// token factory:
github.com/CosmWasm/token-factory => github.com/CosmosContracts/token-factory v1.2.0-juno
github.com/CosmWasm/token-factory => github.com/CosmosContracts/token-factory v1.2.1-juno.0.20230523144425-253f9b9df6a6
// TODO: Simapp dependency, review removing when updating to SDK with backported update https://github.com/cosmos/cosmos-sdk/issues/13423
github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.2 // indirect
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ github.com/CosmWasm/wasmd v0.31.0 h1:xACf6A/SkCeGWQWrKGsR4X9PQb5G4XYuNfnrl+HQ1mE
github.com/CosmWasm/wasmd v0.31.0/go.mod h1:VcyDGk/ISVlMUeW+1GGL0zdHWBS2FPwLEV2qZ86l7l8=
github.com/CosmWasm/wasmvm v1.2.3 h1:OKYlobwmVGbl0eSn0mXoAAjE5hIuXnQCLPjbNd91sVY=
github.com/CosmWasm/wasmvm v1.2.3/go.mod h1:vW/E3h8j9xBQs9bCoijDuawKo9kCtxOaS8N8J7KFtkc=
github.com/CosmosContracts/token-factory v1.2.0-juno h1:ArPEH/gg2zD3RwtB++JR4rMSgNINb5TgVJRcwbSm15g=
github.com/CosmosContracts/token-factory v1.2.0-juno/go.mod h1:REKRfNe+zunKZitx2wGCPJBBmwu8qofOxGhsgV2h4cw=
github.com/CosmosContracts/token-factory v1.2.1-juno.0.20230523144425-253f9b9df6a6 h1:2jL+sNaJoH+OMGYhOCcL6M5i3RaLGDDunZr+GeWy2xQ=
github.com/CosmosContracts/token-factory v1.2.1-juno.0.20230523144425-253f9b9df6a6/go.mod h1:REKRfNe+zunKZitx2wGCPJBBmwu8qofOxGhsgV2h4cw=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
Expand Down
Loading

0 comments on commit b7901a7

Please sign in to comment.