Skip to content

Commit

Permalink
v17 Upgrade Base Branch (#767)
Browse files Browse the repository at this point in the history
* Base v17 Upgrade (namespace, handler, ictest)

* `versions`: bump x/pob, grpc

* wasmd 0.41 + wasmvm 1.3 (no more type/keeper alias)

* [v17] Refactor ICTest e2e upgrades (#768)

* `fix` use v47 genesis for chain upgrade test & abstract

* -1 on halt height
  • Loading branch information
Reecepbcups authored Aug 8, 2023
1 parent 5cca8c5 commit b34af55
Show file tree
Hide file tree
Showing 137 changed files with 569 additions and 678 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tmp-swagger-gen

heighliner*

x/**/data/wasm/*
**/data/wasm/*

# emacs editor config
\#*\#
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ BFT_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')
DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf:1.0.0-rc8
BUILDDIR ?= $(CURDIR)/build
E2E_UPGRADE_VERSION := "v14"
export GO111MODULE = on

# process build tags
Expand Down
14 changes: 7 additions & 7 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package app

import (
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
builderante "github.com/skip-mev/pob/x/builder/ante"
builderkeeper "github.com/skip-mev/pob/x/builder/keeper"

Expand All @@ -19,11 +19,11 @@ import (
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"

decorators "github.com/CosmosContracts/juno/v16/app/decorators"
feeshareante "github.com/CosmosContracts/juno/v16/x/feeshare/ante"
feesharekeeper "github.com/CosmosContracts/juno/v16/x/feeshare/keeper"
globalfeeante "github.com/CosmosContracts/juno/v16/x/globalfee/ante"
globalfeekeeper "github.com/CosmosContracts/juno/v16/x/globalfee/keeper"
decorators "github.com/CosmosContracts/juno/v17/app/decorators"
feeshareante "github.com/CosmosContracts/juno/v17/x/feeshare/ante"
feesharekeeper "github.com/CosmosContracts/juno/v17/x/feeshare/keeper"
globalfeeante "github.com/CosmosContracts/juno/v17/x/globalfee/ante"
globalfeekeeper "github.com/CosmosContracts/juno/v17/x/globalfee/keeper"
)

const maxBypassMinFeeMsgGasUsage = 1_000_000
Expand All @@ -38,7 +38,7 @@ type HandlerOptions struct {
FeeShareKeeper feesharekeeper.Keeper
BankKeeperFork feeshareante.BankKeeper
TxCounterStoreKey storetypes.StoreKey
WasmConfig wasmTypes.WasmConfig
WasmConfig wasmtypes.WasmConfig
Cdc codec.BinaryCodec

BypassMinFeeMsgTypes []string
Expand Down
45 changes: 23 additions & 22 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strconv"
"strings"

"github.com/CosmWasm/wasmd/x/wasm"
wasm "github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -63,17 +63,18 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/CosmosContracts/juno/v16/app/keepers"
"github.com/CosmosContracts/juno/v16/app/openapiconsole"
"github.com/CosmosContracts/juno/v16/app/upgrades"
v10 "github.com/CosmosContracts/juno/v16/app/upgrades/v10"
v11 "github.com/CosmosContracts/juno/v16/app/upgrades/v11"
v12 "github.com/CosmosContracts/juno/v16/app/upgrades/v12"
v13 "github.com/CosmosContracts/juno/v16/app/upgrades/v13"
v14 "github.com/CosmosContracts/juno/v16/app/upgrades/v14"
v15 "github.com/CosmosContracts/juno/v16/app/upgrades/v15"
v16 "github.com/CosmosContracts/juno/v16/app/upgrades/v16"
"github.com/CosmosContracts/juno/v16/docs"
"github.com/CosmosContracts/juno/v17/app/keepers"
"github.com/CosmosContracts/juno/v17/app/openapiconsole"
upgrades "github.com/CosmosContracts/juno/v17/app/upgrades"
v10 "github.com/CosmosContracts/juno/v17/app/upgrades/v10"
v11 "github.com/CosmosContracts/juno/v17/app/upgrades/v11"
v12 "github.com/CosmosContracts/juno/v17/app/upgrades/v12"
v13 "github.com/CosmosContracts/juno/v17/app/upgrades/v13"
v14 "github.com/CosmosContracts/juno/v17/app/upgrades/v14"
v15 "github.com/CosmosContracts/juno/v17/app/upgrades/v15"
v16 "github.com/CosmosContracts/juno/v17/app/upgrades/v16"
v17 "github.com/CosmosContracts/juno/v17/app/upgrades/v17"
"github.com/CosmosContracts/juno/v17/docs"
)

const (
Expand All @@ -94,7 +95,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, v15.Upgrade, v16.Upgrade}
Upgrades = []upgrades.Upgrade{v10.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade, v15.Upgrade, v16.Upgrade, v17.Upgrade}
)

// These constants are derived from the above variables.
Expand Down Expand Up @@ -151,23 +152,23 @@ func SetAddressPrefixes() {

// GetEnabledProposals parses the ProposalsEnabled / EnableSpecificProposals values to
// produce a list of enabled proposals to pass into wasmd app.
func GetEnabledProposals() []wasm.ProposalType {
func GetEnabledProposals() []wasmtypes.ProposalType {
if EnableSpecificProposals == "" {
if ProposalsEnabled == "true" {
return wasm.EnableAllProposals
return wasmtypes.EnableAllProposals
}
return wasm.DisableAllProposals
return wasmtypes.DisableAllProposals
}
chunks := strings.Split(EnableSpecificProposals, ",")
proposals, err := wasm.ConvertToProposals(chunks)
proposals, err := wasmtypes.ConvertToProposals(chunks)
if err != nil {
panic(err)
}
return proposals
}

func GetWasmOpts(appOpts servertypes.AppOptions) []wasm.Option {
var wasmOpts []wasm.Option
func GetWasmOpts(appOpts servertypes.AppOptions) []wasmkeeper.Option {
var wasmOpts []wasmkeeper.Option
if cast.ToBool(appOpts.Get("telemetry.enabled")) {
wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer))
}
Expand Down Expand Up @@ -228,9 +229,9 @@ func New(
db dbm.DB,
traceStore io.Writer,
loadLatest bool,
enabledProposals []wasm.ProposalType,
enabledProposals []wasmtypes.ProposalType,
appOpts servertypes.AppOptions,
wasmOpts []wasm.Option,
wasmOpts []wasmkeeper.Option,
baseAppOptions ...func(*baseapp.BaseApp),
) *App {
encodingConfig := MakeEncodingConfig()
Expand Down Expand Up @@ -353,7 +354,7 @@ func New(
IBCKeeper: app.AppKeepers.IBCKeeper,
FeeShareKeeper: app.AppKeepers.FeeShareKeeper,
BankKeeperFork: app.AppKeepers.BankKeeper, // since we need extra methods
TxCounterStoreKey: app.AppKeepers.GetKey(wasm.StoreKey),
TxCounterStoreKey: app.AppKeepers.GetKey(wasmtypes.StoreKey),
WasmConfig: wasmConfig,
Cdc: appCodec,

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

"github.com/CosmosContracts/juno/v16/app"
appparams "github.com/CosmosContracts/juno/v16/app/params"
"github.com/CosmosContracts/juno/v17/app"
appparams "github.com/CosmosContracts/juno/v17/app/params"
)

type KeeperTestHelper 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 app
import (
"github.com/cosmos/cosmos-sdk/std"

"github.com/CosmosContracts/juno/v16/app/params"
"github.com/CosmosContracts/juno/v17/app/params"
)

// MakeEncodingConfig creates an EncodingConfig for testing
Expand Down
45 changes: 23 additions & 22 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
builderkeeper "github.com/skip-mev/pob/x/builder/keeper"
buildertypes "github.com/skip-mev/pob/x/builder/types"
"github.com/spf13/cast"
Expand Down Expand Up @@ -80,20 +81,20 @@ import (
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

feesharekeeper "github.com/CosmosContracts/juno/v16/x/feeshare/keeper"
feesharetypes "github.com/CosmosContracts/juno/v16/x/feeshare/types"
"github.com/CosmosContracts/juno/v16/x/globalfee"
globalfeekeeper "github.com/CosmosContracts/juno/v16/x/globalfee/keeper"
globalfeetypes "github.com/CosmosContracts/juno/v16/x/globalfee/types"
mintkeeper "github.com/CosmosContracts/juno/v16/x/mint/keeper"
minttypes "github.com/CosmosContracts/juno/v16/x/mint/types"
"github.com/CosmosContracts/juno/v16/x/tokenfactory/bindings"
tokenfactorykeeper "github.com/CosmosContracts/juno/v16/x/tokenfactory/keeper"
tokenfactorytypes "github.com/CosmosContracts/juno/v16/x/tokenfactory/types"
feesharekeeper "github.com/CosmosContracts/juno/v17/x/feeshare/keeper"
feesharetypes "github.com/CosmosContracts/juno/v17/x/feeshare/types"
"github.com/CosmosContracts/juno/v17/x/globalfee"
globalfeekeeper "github.com/CosmosContracts/juno/v17/x/globalfee/keeper"
globalfeetypes "github.com/CosmosContracts/juno/v17/x/globalfee/types"
mintkeeper "github.com/CosmosContracts/juno/v17/x/mint/keeper"
minttypes "github.com/CosmosContracts/juno/v17/x/mint/types"
"github.com/CosmosContracts/juno/v17/x/tokenfactory/bindings"
tokenfactorykeeper "github.com/CosmosContracts/juno/v17/x/tokenfactory/keeper"
tokenfactorytypes "github.com/CosmosContracts/juno/v17/x/tokenfactory/types"
)

var (
wasmCapabilities = "iterator,staking,stargate,token_factory,cosmwasm_1_1,cosmwasm_1_2"
wasmCapabilities = "iterator,staking,stargate,token_factory,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3"

tokenFactoryCapabilities = []string{
tokenfactorytypes.EnableBurnFrom,
Expand All @@ -115,7 +116,7 @@ var maccPerms = map[string][]string{
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
icatypes.ModuleName: nil,
ibcfeetypes.ModuleName: nil,
wasm.ModuleName: {authtypes.Burner},
wasmtypes.ModuleName: {authtypes.Burner},
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
globalfee.ModuleName: nil,
buildertypes.ModuleName: nil,
Expand Down Expand Up @@ -167,7 +168,7 @@ type AppKeepers struct {
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper

WasmKeeper wasm.Keeper
WasmKeeper wasmkeeper.Keeper
scopedWasmKeeper capabilitykeeper.ScopedKeeper
TokenFactoryKeeper tokenfactorykeeper.Keeper

Expand All @@ -181,9 +182,9 @@ func NewAppKeepers(
bApp *baseapp.BaseApp,
cdc *codec.LegacyAmino,
maccPerms map[string][]string,
enabledProposals []wasm.ProposalType,
enabledProposals []wasmtypes.ProposalType,
appOpts servertypes.AppOptions,
wasmOpts []wasm.Option,
wasmOpts []wasmkeeper.Option,
) AppKeepers {
appKeepers := AppKeepers{}

Expand Down Expand Up @@ -218,7 +219,7 @@ func NewAppKeepers(
scopedICAHostKeeper := appKeepers.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
scopedICQKeeper := appKeepers.CapabilityKeeper.ScopeToModule(icqtypes.ModuleName)
scopedTransferKeeper := appKeepers.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedWasmKeeper := appKeepers.CapabilityKeeper.ScopeToModule(wasm.ModuleName)
scopedWasmKeeper := appKeepers.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName)

// add keepers
Bech32Prefix := "juno"
Expand Down Expand Up @@ -513,9 +514,9 @@ func NewAppKeepers(
})
wasmOpts = append(wasmOpts, querierOpts)

appKeepers.WasmKeeper = wasm.NewKeeper(
appKeepers.WasmKeeper = wasmkeeper.NewKeeper(
appCodec,
appKeepers.keys[wasm.StoreKey],
appKeepers.keys[wasmtypes.StoreKey],
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.StakingKeeper,
Expand Down Expand Up @@ -553,7 +554,7 @@ func NewAppKeepers(
// register wasm gov proposal types
// The gov proposal types can be individually enabled
if len(enabledProposals) != 0 {
govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(appKeepers.WasmKeeper, enabledProposals))
govRouter.AddRoute(wasmtypes.RouterKey, wasm.NewWasmProposalHandler(appKeepers.WasmKeeper, enabledProposals)) //nolint:staticcheck // we still need this despite the deprecation of the gov handler
}
// Set legacy router for backwards compatibility with gov v1beta1
appKeepers.GovKeeper.SetLegacyRouter(govRouter)
Expand Down Expand Up @@ -593,7 +594,7 @@ func NewAppKeepers(
// Create static IBC router, add transfer route, then set and seal it
ibcRouter := porttypes.NewRouter().
AddRoute(ibctransfertypes.ModuleName, transferStack).
AddRoute(wasm.ModuleName, wasmStack).
AddRoute(wasmtypes.ModuleName, wasmStack).
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(icahosttypes.SubModuleName, icaHostStack).
AddRoute(icqtypes.ModuleName, icqModule)
Expand Down Expand Up @@ -639,7 +640,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(globalfee.ModuleName)
paramsKeeper.Subspace(tokenfactorytypes.ModuleName)
paramsKeeper.Subspace(feesharetypes.ModuleName)
paramsKeeper.Subspace(wasm.ModuleName)
paramsKeeper.Subspace(wasmtypes.ModuleName)
paramsKeeper.Subspace(buildertypes.ModuleName)

return paramsKeeper
Expand Down Expand Up @@ -667,7 +668,7 @@ func (appKeepers *AppKeepers) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper
}

// GetWasmKeeper implements the TestingApp interface.
func (appKeepers *AppKeepers) GetWasmKeeper() wasm.Keeper {
func (appKeepers *AppKeepers) GetWasmKeeper() wasmkeeper.Keeper {
return appKeepers.WasmKeeper
}

Expand Down
12 changes: 6 additions & 6 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package keepers

import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
buildertypes "github.com/skip-mev/pob/x/builder/types"

packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types"
Expand Down Expand Up @@ -31,10 +31,10 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

feesharetypes "github.com/CosmosContracts/juno/v16/x/feeshare/types"
globalfeetypes "github.com/CosmosContracts/juno/v16/x/globalfee/types"
minttypes "github.com/CosmosContracts/juno/v16/x/mint/types"
tokenfactorytypes "github.com/CosmosContracts/juno/v16/x/tokenfactory/types"
feesharetypes "github.com/CosmosContracts/juno/v17/x/feeshare/types"
globalfeetypes "github.com/CosmosContracts/juno/v17/x/globalfee/types"
minttypes "github.com/CosmosContracts/juno/v17/x/mint/types"
tokenfactorytypes "github.com/CosmosContracts/juno/v17/x/tokenfactory/types"
)

func (appKeepers *AppKeepers) GenerateKeys() {
Expand All @@ -47,7 +47,7 @@ func (appKeepers *AppKeepers) GenerateKeys() {

// non sdk store keys
ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey,
wasm.StoreKey, icahosttypes.StoreKey,
wasmtypes.StoreKey, icahosttypes.StoreKey,
icacontrollertypes.StoreKey, icqtypes.StoreKey,
packetforwardtypes.StoreKey,
ibchookstypes.StoreKey,
Expand Down
2 changes: 1 addition & 1 deletion app/keepers/querier.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file used from osmosis, ref: https://github.com/CosmosContracts/juno/v16/blob/2ce971f4c6aa85d3ef7ba33d60e0ae74b923ab83/app/keepers/querier.go
// this file used from osmosis, ref: https://github.com/CosmosContracts/juno/v17/blob/2ce971f4c6aa85d3ef7ba33d60e0ae74b923ab83/app/keepers/querier.go
// Original Author: https://github.com/nicolaslara

package keepers
Expand Down
24 changes: 12 additions & 12 deletions app/modules.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app

import (
"github.com/CosmWasm/wasmd/x/wasm"
wasm "github.com/CosmWasm/wasmd/x/wasm"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
buildermodule "github.com/skip-mev/pob/x/builder"
buildertypes "github.com/skip-mev/pob/x/builder/types"
Expand Down Expand Up @@ -59,14 +59,14 @@ import (
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

encparams "github.com/CosmosContracts/juno/v16/app/params"
feeshare "github.com/CosmosContracts/juno/v16/x/feeshare"
feesharetypes "github.com/CosmosContracts/juno/v16/x/feeshare/types"
"github.com/CosmosContracts/juno/v16/x/globalfee"
"github.com/CosmosContracts/juno/v16/x/mint"
minttypes "github.com/CosmosContracts/juno/v16/x/mint/types"
"github.com/CosmosContracts/juno/v16/x/tokenfactory"
tokenfactorytypes "github.com/CosmosContracts/juno/v16/x/tokenfactory/types"
encparams "github.com/CosmosContracts/juno/v17/app/params"
feeshare "github.com/CosmosContracts/juno/v17/x/feeshare"
feesharetypes "github.com/CosmosContracts/juno/v17/x/feeshare/types"
"github.com/CosmosContracts/juno/v17/x/globalfee"
"github.com/CosmosContracts/juno/v17/x/mint"
minttypes "github.com/CosmosContracts/juno/v17/x/mint/types"
"github.com/CosmosContracts/juno/v17/x/tokenfactory"
tokenfactorytypes "github.com/CosmosContracts/juno/v17/x/tokenfactory/types"
)

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
Expand Down Expand Up @@ -221,7 +221,7 @@ func orderBeginBlockers() []string {
tokenfactorytypes.ModuleName,
feesharetypes.ModuleName,
globalfee.ModuleName,
wasm.ModuleName,
wasmtypes.ModuleName,
ibchookstypes.ModuleName,
}
}
Expand Down Expand Up @@ -257,7 +257,7 @@ func orderEndBlockers() []string {
tokenfactorytypes.ModuleName,
feesharetypes.ModuleName,
globalfee.ModuleName,
wasm.ModuleName,
wasmtypes.ModuleName,
ibchookstypes.ModuleName,
}
}
Expand Down Expand Up @@ -293,7 +293,7 @@ func orderInitBlockers() []string {
tokenfactorytypes.ModuleName,
feesharetypes.ModuleName,
globalfee.ModuleName,
wasm.ModuleName,
wasmtypes.ModuleName,
ibchookstypes.ModuleName,
}
}
Loading

0 comments on commit b34af55

Please sign in to comment.