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

Problem: fixes in ibc-go v5.1 are not included #765

Merged
merged 11 commits into from
Nov 13, 2022
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

*Nov 9, 2022*
## UNRELEASED
yihuang marked this conversation as resolved.
Show resolved Hide resolved

### State Machine Breaking

- [#765](https://github.com/crypto-org-chain/cronos/pull/765) Upgrade ibc-go to [v5.1.0](https://github.com/cosmos/ibc-go/releases/tag/v5.1.0).
yihuang marked this conversation as resolved.
Show resolved Hide resolved

*Nov 10, 2022*

## v1.0.0-rc2

Expand Down
19 changes: 9 additions & 10 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
icacontrollertypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types"
ibcfeetypes "github.com/cosmos/ibc-go/v5/modules/apps/29-fee/types"

"github.com/crypto-org-chain/cronos/cmd/cronosd/config"
)

func (app *App) RegisterUpgradeHandlers(experimental bool) {
// `v0.9.0` is only used for testnet upgrade, skipped for dry-run and mainnet upgrade.
planNameTestnet := "v0.9.0"
app.UpgradeKeeper.SetUpgradeHandler(planNameTestnet, func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})

// dry-run and mainnet will use `v1.0.0` upgrade plan directly, which will clears the `extra_eips` parameters.
planNameMainnet := "v1.0.0"
app.UpgradeKeeper.SetUpgradeHandler(planNameMainnet, func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// `v1.0.0` upgrade plan will clear the `extra_eips` parameters, and upgrade ibc-go to v5.1.
// dry-run and mainnet will upgrade to `v1.0.0` directly, skipping the `v0.9.0`.
// testnet can also upgrade to `v1.0.0` after `v0.9.0`.
planName := "v1.0.0"
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
m, err := app.mm.RunMigrations(ctx, app.configurator, fromVM)
if err != nil {
return m, err
Expand All @@ -46,7 +44,8 @@ func (app *App) RegisterUpgradeHandlers(experimental bool) {
}

if !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
if upgradeInfo.Name == planNameTestnet || upgradeInfo.Name == planNameMainnet {
// testnet has added the ibcfee store in `v0.9.0`, skip this time.
if upgradeInfo.Name == planName && config.CurrentNetwork() != config.NetworkTestnet {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{ibcfeetypes.StoreKey},
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/cronosd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ package config

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

const (
NetworkMainet = iota + 1
yihuang marked this conversation as resolved.
Show resolved Hide resolved
NetworkTestnet
yihuang marked this conversation as resolved.
Show resolved Hide resolved
)

// SetBech32Prefixes sets the global prefixes to be used when serializing addresses and public keys to Bech32 strings.
func SetBech32Prefixes(config *sdk.Config) {
config.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub)
Expand Down
4 changes: 4 additions & 0 deletions cmd/cronosd/config/prefix_mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ const (
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
)

func CurrentNetwork() int {
return NetworkMainet
}
4 changes: 4 additions & 0 deletions cmd/cronosd/config/prefix_testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ const (
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
)

func CurrentNetwork() int {
return NetworkTestnet
}
29 changes: 15 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.18
require (
cosmossdk.io/math v1.0.0-beta.3
github.com/armon/go-metrics v0.4.1
github.com/cosmos/cosmos-sdk v0.46.5-0.20221109093801-2899dcf82f16
github.com/cosmos/ibc-go/v5 v5.0.1
github.com/cosmos/cosmos-sdk v0.46.5-0.20221111074045-68e54fa5b868
github.com/cosmos/ibc-go/v5 v5.1.0
github.com/ethereum/go-ethereum v1.10.19
github.com/evmos/ethermint v0.6.1-0.20221101220534-a8ea4eceb6d9
github.com/gogo/protobuf v1.3.3
Expand All @@ -19,19 +19,19 @@ require (
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.1
github.com/tendermint/tendermint v0.34.22
github.com/tendermint/tendermint v0.34.23
github.com/tendermint/tm-db v0.6.7
google.golang.org/genproto v0.0.0-20221018160656-63c7b68cfc55
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 v0.104.0 // indirect
cloud.google.com/go/compute v1.7.0 // 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
cosmossdk.io/errors v1.0.0-beta.7 // indirect
filippo.io/edwards25519 v1.0.0-rc.1 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
Expand Down Expand Up @@ -96,7 +96,7 @@ require (
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/googleapis/gax-go/v2 v2.5.1 // 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 @@ -121,7 +121,7 @@ require (
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // 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 @@ -145,7 +145,7 @@ require (
github.com/prometheus/client_golang v1.12.2 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.34.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/tsdb v0.7.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/regen-network/cosmos-proto v0.3.1 // indirect
Expand Down Expand Up @@ -173,13 +173,13 @@ require (
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 // indirect
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/term v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.93.0 // indirect
google.golang.org/api v0.97.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
Expand All @@ -191,8 +191,8 @@ require (
replace (
// ics23 patch for dragonberry
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.46.5-0.20221109093801-2899dcf82f16
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.13-0.20221108065429-afacc02b8738
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.46.5-0.20221111074045-68e54fa5b868
yihuang marked this conversation as resolved.
Show resolved Hide resolved
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.19-deepcopy-jumptable
yihuang marked this conversation as resolved.
Show resolved Hide resolved
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.20.1-cronos

// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
Expand All @@ -202,6 +202,7 @@ replace (

// TODO: remove when gravity update dependencies
github.com/peggyjv/gravity-bridge/module/v2 => github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.1-0.20220815102151-48275db7e1ee
github.com/tendermint/tendermint => github.com/tendermint/tendermint v0.34.24-0.20221110131553-ec471ba27efd
yihuang marked this conversation as resolved.
Show resolved Hide resolved

// TODO: remove after fixed https://github.com/cosmos/cosmos-sdk/issues/11364
github.com/zondax/hid => github.com/zondax/hid v0.9.0
Expand Down
Loading