From ec6271401ab829a0844e84ed1a53bf7b79f14dae Mon Sep 17 00:00:00 2001 From: Khanh Hoa Date: Thu, 1 Aug 2024 21:55:10 +0700 Subject: [PATCH] add v4.2.1 handler --- app/app.go | 10 +++++++++- app/upgrades/v4_2_1/constants.go | 7 +++++++ app/upgrades/v4_2_1/upgrades.go | 17 +++++++++++++++++ go.mod | 7 ++++--- go.sum | 8 ++++---- 5 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 app/upgrades/v4_2_1/constants.go create mode 100644 app/upgrades/v4_2_1/upgrades.go diff --git a/app/app.go b/app/app.go index 97cc6da1..b7a8b8a2 100644 --- a/app/app.go +++ b/app/app.go @@ -160,6 +160,7 @@ import ( v45 "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/upgrades/v4_1_5" v46 "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/upgrades/v4_1_6" v420 "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/upgrades/v4_2_0" + v421 "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/upgrades/v4_2_1" "github.com/rakyll/statik/fs" // unnamed import of statik for swagger UI support @@ -1192,6 +1193,13 @@ func (app *MigalooApp) setupUpgradeHandlers() { app.configurator, ), ) + app.UpgradeKeeper.SetUpgradeHandler( + v421.UpgradeName, + v421.CreateUpgradeHandler( + app.mm, + app.configurator, + ), + ) // When a planned update height is reached, the old binary will panic // writing on disk the height and name of the update that triggered it @@ -1205,7 +1213,7 @@ func (app *MigalooApp) setupUpgradeHandlers() { return } - if upgradeInfo.Name == v420.UpgradeName { + if upgradeInfo.Name == v421.UpgradeName { storeUpgrades := &storetypes.StoreUpgrades{ Added: []string{}, Deleted: []string{}, diff --git a/app/upgrades/v4_2_1/constants.go b/app/upgrades/v4_2_1/constants.go new file mode 100644 index 00000000..5df08d86 --- /dev/null +++ b/app/upgrades/v4_2_1/constants.go @@ -0,0 +1,7 @@ +package v4 + +// UpgradeName defines the on-chain upgrade name for the Migaloo v4.2.1 upgrade. +// this upgrade includes the fix for pfm +const ( + UpgradeName = "v4.2.1" +) diff --git a/app/upgrades/v4_2_1/upgrades.go b/app/upgrades/v4_2_1/upgrades.go new file mode 100644 index 00000000..2966c0fe --- /dev/null +++ b/app/upgrades/v4_2_1/upgrades.go @@ -0,0 +1,17 @@ +package v4 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +// CreateUpgradeHandler that migrates the chain from v4.2.0 to v4.2.1 +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, fromVM) + } +} diff --git a/go.mod b/go.mod index 5f3b9230..8894b9e9 100644 --- a/go.mod +++ b/go.mod @@ -12,10 +12,10 @@ require ( github.com/cometbft/cometbft v0.37.8 github.com/cometbft/cometbft-db v0.12.0 github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/cosmos/cosmos-sdk v0.47.12 + github.com/cosmos/cosmos-sdk v0.47.13 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20231017170841-8fd49ec0f017 - github.com/cosmos/ibc-go/v7 v7.6.0 + github.com/cosmos/ibc-go/v7 v7.7.0 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/prometheus/client_golang v1.18.0 @@ -211,6 +211,8 @@ require ( replace ( // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 + + github.com/cosmos/cosmos-sdk => github.com/White-Whale-Defi-Platform/cosmos-sdk v0.47.13-trim-validator // dgrijalva/jwt-go is deprecated and doesn't receive security updates. // TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134 github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 @@ -225,5 +227,4 @@ replace ( golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // stick with compatible version of rapid in v0.47.x line pgregory.net/rapid => pgregory.net/rapid v0.5.5 - ) diff --git a/go.sum b/go.sum index b672ceac..29febcc8 100644 --- a/go.sum +++ b/go.sum @@ -226,6 +226,8 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/White-Whale-Defi-Platform/cosmos-sdk v0.47.13-trim-validator h1:MpXBQYbc2hYFq8w2f4uhSum8hnAgZkBqxW44SVuGoJ8= +github.com/White-Whale-Defi-Platform/cosmos-sdk v0.47.13-trim-validator/go.mod h1:pYMzhTfKFn9AJB5X64Epwe9NgYk0y3v7XN8Ks5xqWoo= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= @@ -340,8 +342,6 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.47.12 h1:KOZHAVWrcilHywBN/FabBaXbDFMzoFmtdX0hqy5Ory8= -github.com/cosmos/cosmos-sdk v0.47.12/go.mod h1:ADjORYzUQqQv/FxDi0H0K5gW/rAk1CiDR3ZKsExfJV0= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -358,8 +358,8 @@ github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.1.1 h1:02RCbih5lQ8aGdDMSvxhTn github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.1.1/go.mod h1:LvVkEXTORVgd87W2Yu7ZY3acKKeTMq/txdTworn8EZI= github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20231017170841-8fd49ec0f017 h1:/m++TlQ4CfCZs+7vGFDQNdlnkvSNKFoLbjzmWOT7m10= github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20231017170841-8fd49ec0f017/go.mod h1:JwHFbo1oX/ht4fPpnPvmhZr+dCkYK1Vihw+vZE9umR4= -github.com/cosmos/ibc-go/v7 v7.6.0 h1:S1G5hcIVe9go+jQV6F9+I9yy+hylbJeLiVHUmktQNrM= -github.com/cosmos/ibc-go/v7 v7.6.0/go.mod h1:LifBA7JHRHl95ujjHIaBEHmUqy2qCGyqDCXB7qmAsZk= +github.com/cosmos/ibc-go/v7 v7.7.0 h1:/ndLv4GiAkOaHQKpcoQyoGIZpGpT4d+9kjl5n3DsaVQ= +github.com/cosmos/ibc-go/v7 v7.7.0/go.mod h1:zzFhtp9g9RrN/UxXWrdUu5VyonBALCAHujXQCzrZSu8= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=