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

Backport 1.13: Bump Cosmos-SDK to v0.46.6-pio-1 (from v0.46.4-pio-1) (#1235) #1238

Merged
merged 1 commit into from
Nov 22, 2022
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* Updated Cosmos-SDK to [v0.46.6-pio-1](https://github.com/provenance-io/cosmos-sdk/blob/v0.46.6-pio-1/RELEASE_NOTES.md) (from v0.46.4-pio-1) [PR 1235](https://github.com/provenance-io/provenance/pull/1235).
* Alias the `config unpack` command to `config update`. It can be used to update config files to include new fields [PR 1233](https://github.com/provenance-io/provenance/pull/1233).
* When loading the unpacked configs, always load the defaults before reading the files (instead of only loading the defaults if the file doesn't exist) [PR 1233](https://github.com/provenance-io/provenance/pull/1233).

Expand Down
38 changes: 37 additions & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/cosmos/cosmos-sdk/x/group"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

Expand Down Expand Up @@ -37,7 +38,7 @@ type appUpgrade struct {
var handlers = map[string]appUpgrade{
"neoncarrot-rc1": {}, // upgrade for 1.12.0-rc1
"neoncarrot": {}, // upgrade for 1.12.0
"ochre-rc1": { // upgrade for 1.13.0-rc1
"ochre-rc1": { // upgrade for 1.13.0-rc3
Added: []string{group.ModuleName, rewardtypes.ModuleName, icacontrollertypes.StoreKey, icahosttypes.StoreKey},
Handler: func(ctx sdk.Context, app *App, plan upgradetypes.Plan) (module.VersionMap, error) {
versionMap := app.UpgradeKeeper.GetModuleVersionMap(ctx)
Expand All @@ -46,6 +47,41 @@ var handlers = map[string]appUpgrade{
return app.mm.RunMigrations(ctx, app.configurator, versionMap)
},
},
"ochre-rc2": { // upgrade for 1.13.0-rc5
Added: []string{group.ModuleName, rewardtypes.ModuleName, icacontrollertypes.StoreKey, icahosttypes.StoreKey},
Handler: func(ctx sdk.Context, app *App, plan upgradetypes.Plan) (module.VersionMap, error) {
versionMap := app.UpgradeKeeper.GetModuleVersionMap(ctx)

// We need to run Migrate3_V046_4_To_V046_5 here because testnet already upgraded to v0.46.x.
// But we don't need to run it in the ochre upgrade plan because mainnet hasn't upgraded to v0.46.x yet, so it doesn't need fixing.
bankBaseKeeper, ok := app.BankKeeper.(bankkeeper.BaseKeeper)
if !ok {
return versionMap, fmt.Errorf("could not cast app.BankKeeper (type bankkeeper.Keeper) to bankkeeper.BaseKeeper")
}
bankMigrator := bankkeeper.NewMigrator(bankBaseKeeper)
err := bankMigrator.Migrate3_V046_4_To_V046_5(ctx)
if err != nil {
return versionMap, err
}

ctx.Logger().Info("Starting migrations. This may take a significant amount of time to complete. Do not restart node.")
return app.mm.RunMigrations(ctx, app.configurator, versionMap)
},
},
"ochre": {
Added: []string{group.ModuleName, rewardtypes.ModuleName, icacontrollertypes.StoreKey, icahosttypes.StoreKey},
Handler: func(ctx sdk.Context, app *App, plan upgradetypes.Plan) (module.VersionMap, error) {
versionMap := app.UpgradeKeeper.GetModuleVersionMap(ctx)

// This params fix was handled in testnet via gov prop. For mainnet, we want it done in here though.
params := app.MsgFeesKeeper.GetParams(ctx)
app.MsgFeesKeeper.SetParams(ctx, params)

UpgradeICA(ctx, app, &versionMap)
ctx.Logger().Info("Starting migrations. This may take a significant amount of time to complete. Do not restart node.")
return app.mm.RunMigrations(ctx, app.configurator, versionMap)
},
},
// TODO - Add new upgrade definitions here.
}

Expand Down
44 changes: 6 additions & 38 deletions cmd/provenanced/config/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,44 +195,10 @@ func (s *ConfigManagerTestSuite) TestUnmanagedConfig() {
})
}

func (s *ConfigManagerTestSuite) TestServerGetConfigGlobalLabelsCanary() {
// This test checks to see if the special handling of the telemetry.global-labels
// field in the config map is still needed.
//
// As of writing this, the serverconfig.GetConfig function requires viper to return it as a []interface{}
// with each element itself being a []interface{}. The main branch of the sdk has been updated to not
// care though, so eventually we can clean up our stuff.
//
// If this test fails, remove the s.T().Skip() line from TestServerGetConfigGlobalLabels and run that.
globalLabels := [][]string{
{"keya", "valuea"},
{"keyb", "valueb"},
{"keyc", "valuec"},
}
telemetry := map[string]interface{}{
"global-labels": globalLabels,
}
cfgMap := map[string]interface{}{
"telemetry": telemetry,
}

vpr := viper.New()
s.Require().NoError(vpr.MergeConfigMap(cfgMap), "MergeConfigMap")
expErr := "failed to parse global-labels config"
_, err := serverconfig.GetConfig(vpr)
s.Require().ErrorContains(err, expErr, "GetConfig")
}

func (s *ConfigManagerTestSuite) TestServerGetConfigGlobalLabels() {
// If TestServerGetConfigGlobalLabels fails, remove the s.T().Skip line and run this test.
// If this then passes:
// 1. Remove the now-unneeded special handling of telemetry.global-labels.
// 2. Delete the TestServerGetConfigGlobalLabelsCanary test.
// 3. Remove this whole set of comments.
//
// As of writing this, that special handling is in reflector.go: FieldValueMap.AsConfigMap.
// Note that the special handling in setValueFromString is probably still needed though, so leave that.
s.T().Skip("This cannot pass until TestServerGetConfigCanary fails.")
// This test exists because the telemetry.global-labels field used to be handled specially in
// serverconfig.GetConfig, so we had to have some work-around special handling for that field
// in the reflector. Now it exists to make sure it doesn't break again.
globalLabels := [][]string{
{"keya", "valuea"},
{"keyb", "valueb"},
Expand All @@ -247,8 +213,10 @@ func (s *ConfigManagerTestSuite) TestServerGetConfigGlobalLabels() {

vpr := viper.New()
s.Require().NoError(vpr.MergeConfigMap(cfgMap), "MergeConfigMap")
_, err := serverconfig.GetConfig(vpr)
cfg, err := serverconfig.GetConfig(vpr)
s.Require().NoError(err, "GetConfig")
actual := cfg.Telemetry.GlobalLabels
s.Assert().Equal(globalLabels, actual, "cfg.Telemetry.GlobalLabels")
}

func (s *ConfigManagerTestSuite) TestConfigMinGasPrices() {
Expand Down
21 changes: 0 additions & 21 deletions cmd/provenanced/config/reflector.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,27 +258,6 @@ func (m FieldValueMap) AsConfigMap() (map[string]interface{}, error) {
}
valueI := value.Interface()
secMap[justKey] = valueI

// The telemetry.global-labels field in the app config struct is a `[][]string`.
// But serverconfig.GetConfig expects viper to return it as a `[]interface{}`.
// Then each element of that is expected to also be a `[]interface{}`.
// So we need to convert that field so that it's as expected.
// In the SDK's main branch, they fixed that function, so eventually we can remove this.
if key == "telemetry.global-labels" {
newv := make([]interface{}, 0)
if valueI != nil {
if gl, ok := valueI.([][]string); ok {
for _, p := range gl {
var newp []interface{}
for _, k := range p {
newp = append(newp, k)
}
newv = append(newv, newp)
}
}
}
secMap[justKey] = newv
}
}

return rv, nil
Expand Down
43 changes: 22 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,25 @@ require (
github.com/spf13/cast v1.5.0
github.com/spf13/cobra v1.6.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.13.0
github.com/stretchr/testify v1.8.0
github.com/tendermint/tendermint v0.34.22
github.com/spf13/viper v1.14.0
github.com/stretchr/testify v1.8.1
github.com/tendermint/tendermint v0.34.23
github.com/tendermint/tm-db v0.6.7
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
golang.org/x/text v0.4.0
google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e
google.golang.org/grpc v1.50.1
google.golang.org/protobuf v1.28.1
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8
gopkg.in/yaml.v2 v2.4.0

)

require (
cloud.google.com/go v0.102.1 // indirect
cloud.google.com/go/compute v1.7.0 // indirect
cloud.google.com/go v0.104.0 // indirect
cloud.google.com/go/compute v1.12.1 // indirect
cloud.google.com/go/compute/metadata v0.2.1 // indirect
cloud.google.com/go/iam v0.4.0 // indirect
cloud.google.com/go/storage v1.22.1 // indirect
cloud.google.com/go/storage v1.23.0 // indirect
filippo.io/edwards25519 v1.0.0-rc.1 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
Expand Down Expand Up @@ -75,7 +76,7 @@ require (
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
Expand All @@ -89,8 +90,8 @@ require (
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.6.0 // indirect
github.com/googleapis/go-type-adapters v1.0.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
Expand All @@ -111,7 +112,7 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/lib/pq v1.10.6 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
Expand All @@ -136,7 +137,7 @@ require (
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
Expand All @@ -147,13 +148,13 @@ require (
github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect
golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 // indirect
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
google.golang.org/api v0.93.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/term v0.1.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.102.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand All @@ -163,7 +164,7 @@ require (

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

replace github.com/cosmos/cosmos-sdk => github.com/provenance-io/cosmos-sdk v0.46.4-pio-1
replace github.com/cosmos/cosmos-sdk => github.com/provenance-io/cosmos-sdk v0.46.6-pio-1

// Part of dragonberry fix.
// TODO: Remove (and bump ics23 above) once github.com/confio/ics23/go releases a fixed version.
Expand Down
Loading