From 65dc5ecdd5d4d0453f860ebf725c0cd0bbfd0710 Mon Sep 17 00:00:00 2001 From: John Letey Date: Wed, 25 Oct 2023 16:52:00 +0200 Subject: [PATCH 1/6] chore: prepare `v4.0.0-rc0` --- app/upgrades/argon/store.go | 6 ++---- app/upgrades/v4.0.0-rc0/constants.go | 7 +++++++ app/upgrades/v4.0.0-rc0/store.go | 15 +++++++++++++++ app/upgrades/v4.0.0-rc0/upgrade.go | 24 ++++++++++++++++++++++++ interchaintest/upgrade_grand-1_test.go | 6 +++++- interchaintest/upgrade_noble-1_test.go | 2 +- 6 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 app/upgrades/v4.0.0-rc0/constants.go create mode 100644 app/upgrades/v4.0.0-rc0/store.go create mode 100644 app/upgrades/v4.0.0-rc0/upgrade.go diff --git a/app/upgrades/argon/store.go b/app/upgrades/argon/store.go index ded691c6..73fbfca9 100644 --- a/app/upgrades/argon/store.go +++ b/app/upgrades/argon/store.go @@ -1,7 +1,7 @@ package argon import ( - cctptypes "github.com/circlefin/noble-cctp/x/cctp/types" + cctpTypes "github.com/circlefin/noble-cctp/x/cctp/types" "github.com/cosmos/cosmos-sdk/baseapp" storeTypes "github.com/cosmos/cosmos-sdk/store/types" upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" @@ -9,9 +9,7 @@ import ( func CreateStoreLoader(upgradeHeight int64) baseapp.StoreLoader { storeUpgrades := storeTypes.StoreUpgrades{ - Added: []string{ - cctptypes.ModuleName, - }, + Added: []string{cctpTypes.ModuleName}, } return upgradeTypes.UpgradeStoreLoader(upgradeHeight, &storeUpgrades) diff --git a/app/upgrades/v4.0.0-rc0/constants.go b/app/upgrades/v4.0.0-rc0/constants.go new file mode 100644 index 00000000..a03fbe87 --- /dev/null +++ b/app/upgrades/v4.0.0-rc0/constants.go @@ -0,0 +1,7 @@ +package v4m0p0rc0 + +// UpgradeName is the name of this specific software upgrade used on-chain. +const UpgradeName = "v4.0.0-rc0" + +// TestnetChainID is the Chain ID of the Noble testnet (Grand). +const TestnetChainID = "grand-1" diff --git a/app/upgrades/v4.0.0-rc0/store.go b/app/upgrades/v4.0.0-rc0/store.go new file mode 100644 index 00000000..25f46223 --- /dev/null +++ b/app/upgrades/v4.0.0-rc0/store.go @@ -0,0 +1,15 @@ +package v4m0p0rc0 + +import ( + "github.com/cosmos/cosmos-sdk/baseapp" + storeTypes "github.com/cosmos/cosmos-sdk/store/types" + upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func CreateStoreLoader(upgradeHeight int64) baseapp.StoreLoader { + storeUpgrades := storeTypes.StoreUpgrades{ + Deleted: []string{"router"}, + } + + return upgradeTypes.UpgradeStoreLoader(upgradeHeight, &storeUpgrades) +} diff --git a/app/upgrades/v4.0.0-rc0/upgrade.go b/app/upgrades/v4.0.0-rc0/upgrade.go new file mode 100644 index 00000000..f6058bca --- /dev/null +++ b/app/upgrades/v4.0.0-rc0/upgrade.go @@ -0,0 +1,24 @@ +package v4m0p0rc0 + +import ( + "errors" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func CreateUpgradeHandler( + mm *module.Manager, + cfg module.Configurator, +) upgradeTypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + // Ensure that this upgrade is only run on Noble's testnet. + if ctx.ChainID() != TestnetChainID { + return vm, errors.New(fmt.Sprintf("%s upgrade not allowed to execute on %s chain", UpgradeName, ctx.ChainID())) + } + + return mm.RunMigrations(ctx, cfg, vm) + } +} diff --git a/interchaintest/upgrade_grand-1_test.go b/interchaintest/upgrade_grand-1_test.go index d258adea..eb4cf718 100644 --- a/interchaintest/upgrade_grand-1_test.go +++ b/interchaintest/upgrade_grand-1_test.go @@ -55,9 +55,13 @@ func TestGrand1ChainUpgrade(t *testing.T) { { // This upgrade is only relevant to the grand-1 testnet upgradeName: "v4.0.0-beta2", - image: nobleImageInfo[0], + image: ghcrImage("v4.0.0-beta2"), postUpgrade: testPostArgonUpgradeTestnet, }, + { + upgradeName: "v4.0.0-rc0", + image: nobleImageInfo[0], + }, } testNobleChainUpgrade(t, grand1ChainID, grand1Genesis, denomMetadataDrachma, numVals, numFullNodes, grand1Upgrades) diff --git a/interchaintest/upgrade_noble-1_test.go b/interchaintest/upgrade_noble-1_test.go index 8376b88c..1dd394cf 100644 --- a/interchaintest/upgrade_noble-1_test.go +++ b/interchaintest/upgrade_noble-1_test.go @@ -27,11 +27,11 @@ func TestNoble1ChainUpgrade(t *testing.T) { { upgradeName: "radon", image: ghcrImage("v3.0.0"), + postUpgrade: testPostRadonUpgrade, }, { upgradeName: "v3.1.0", image: ghcrImage("v3.1.0"), - postUpgrade: testPostRadonUpgrade, }, { upgradeName: "argon", From 7423b0cd05979bc5f5372e3f61816a3abc59e56e Mon Sep 17 00:00:00 2001 From: John Letey Date: Fri, 27 Oct 2023 12:52:00 +0200 Subject: [PATCH 2/6] fix: register upgrade --- app/app.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/app.go b/app/app.go index b07b4c1e..d6998528 100644 --- a/app/app.go +++ b/app/app.go @@ -2,6 +2,7 @@ package app import ( "fmt" + v4m0p0rc0 "github.com/strangelove-ventures/noble/app/upgrades/v4.0.0-rc0" "io" "net/http" "os" @@ -906,6 +907,15 @@ func (app *App) setupUpgradeHandlers() { ), ) + // v4.0.0-rc0 upgrade + app.UpgradeKeeper.SetUpgradeHandler( + v4m0p0rc0.UpgradeName, + v4m0p0rc0.CreateUpgradeHandler( + app.mm, + app.configurator, + ), + ) + upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() if err != nil { panic(fmt.Errorf("failed to read upgrade info from disk: %w", err)) @@ -927,6 +937,8 @@ func (app *App) setupUpgradeHandlers() { storeLoader = argon.CreateStoreLoader(upgradeInfo.Height) case argon4.UpgradeName: storeLoader = argon4.CreateStoreLoader(upgradeInfo.Height) + case v4m0p0rc0.UpgradeName: + storeLoader = v4m0p0rc0.CreateStoreLoader(upgradeInfo.Height) } if storeLoader != nil { From 9ac4e01241168cd005608092c0a5c0707cc92526 Mon Sep 17 00:00:00 2001 From: John Letey Date: Wed, 1 Nov 2023 11:50:11 +0100 Subject: [PATCH 3/6] chore: small test cleanup --- interchaintest/go.mod | 2 +- interchaintest/go.sum | 2 ++ interchaintest/upgrade_argon_test.go | 2 +- interchaintest/upgrade_grand-1_test.go | 2 +- interchaintest/upgrade_noble-1_test.go | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/interchaintest/go.mod b/interchaintest/go.mod index bdd09ed1..5bae2913 100644 --- a/interchaintest/go.mod +++ b/interchaintest/go.mod @@ -10,7 +10,7 @@ require ( github.com/ethereum/go-ethereum v1.12.2 github.com/gogo/protobuf v1.3.3 github.com/icza/dyno v0.0.0-20220812133438-f0b6f8a18845 - github.com/strangelove-ventures/interchaintest/v4 v4.0.0-20231020192006-848acaeab959 + github.com/strangelove-ventures/interchaintest/v4 v4.0.0-20231026153934-334934f17a68 github.com/strangelove-ventures/noble v1.0.1-0.20230717234609-400609f26a31 github.com/strangelove-ventures/paramauthority v1.1.0 github.com/stretchr/testify v1.8.4 diff --git a/interchaintest/go.sum b/interchaintest/go.sum index cc09f51f..bc444280 100644 --- a/interchaintest/go.sum +++ b/interchaintest/go.sum @@ -1003,6 +1003,8 @@ github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jH github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/strangelove-ventures/interchaintest/v4 v4.0.0-20231020192006-848acaeab959 h1:GuprrfXjcoHpwM7avAL5AmxzDc/4/t1lPtSOKtKdAOk= github.com/strangelove-ventures/interchaintest/v4 v4.0.0-20231020192006-848acaeab959/go.mod h1:j7cgQsflU8OWa0GNM0ZtNANlT20oQeYw2PS/gfZrN3Y= +github.com/strangelove-ventures/interchaintest/v4 v4.0.0-20231026153934-334934f17a68 h1:f16Xo7gvZ/g3YyXsmUQBwvUcq0orQeBrIcdsyVrMrjU= +github.com/strangelove-ventures/interchaintest/v4 v4.0.0-20231026153934-334934f17a68/go.mod h1:oEYorKX6XBoQOrkVv9uhq4X0azZbEf5Jq6h3GN8jJ2w= github.com/strangelove-ventures/paramauthority v1.1.0 h1:SMeG2NvoWC1sP09ouszukck7ufSu+3gv98Apd+ytQHQ= github.com/strangelove-ventures/paramauthority v1.1.0/go.mod h1:WZltb3MpbQo40z4eQD6oNZRpCXtxr5/7j8lbMleDFIY= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= diff --git a/interchaintest/upgrade_argon_test.go b/interchaintest/upgrade_argon_test.go index a6fd8789..77d09120 100644 --- a/interchaintest/upgrade_argon_test.go +++ b/interchaintest/upgrade_argon_test.go @@ -27,7 +27,7 @@ import ( "github.com/stretchr/testify/require" ) -func testPostArgonUpgradeTestnet( +func testPostArgonUpgrade( t *testing.T, ctx context.Context, noble *cosmos.CosmosChain, diff --git a/interchaintest/upgrade_grand-1_test.go b/interchaintest/upgrade_grand-1_test.go index eb4cf718..01185514 100644 --- a/interchaintest/upgrade_grand-1_test.go +++ b/interchaintest/upgrade_grand-1_test.go @@ -56,11 +56,11 @@ func TestGrand1ChainUpgrade(t *testing.T) { // This upgrade is only relevant to the grand-1 testnet upgradeName: "v4.0.0-beta2", image: ghcrImage("v4.0.0-beta2"), - postUpgrade: testPostArgonUpgradeTestnet, }, { upgradeName: "v4.0.0-rc0", image: nobleImageInfo[0], + postUpgrade: testPostArgonUpgrade, }, } diff --git a/interchaintest/upgrade_noble-1_test.go b/interchaintest/upgrade_noble-1_test.go index 1dd394cf..0724d0b6 100644 --- a/interchaintest/upgrade_noble-1_test.go +++ b/interchaintest/upgrade_noble-1_test.go @@ -36,7 +36,7 @@ func TestNoble1ChainUpgrade(t *testing.T) { { upgradeName: "argon", image: nobleImageInfo[0], - // postUpgrade: testPostArgonUpgradeMainnet, + postUpgrade: testPostArgonUpgrade, }, } From 1b4edd6ed981a8b2be698f80b67f6874237b599f Mon Sep 17 00:00:00 2001 From: John Letey Date: Wed, 1 Nov 2023 11:51:30 +0100 Subject: [PATCH 4/6] chore: small nit --- app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index d6998528..a1846419 100644 --- a/app/app.go +++ b/app/app.go @@ -2,7 +2,6 @@ package app import ( "fmt" - v4m0p0rc0 "github.com/strangelove-ventures/noble/app/upgrades/v4.0.0-rc0" "io" "net/http" "os" @@ -96,6 +95,7 @@ import ( "github.com/strangelove-ventures/noble/app/upgrades/neon" "github.com/strangelove-ventures/noble/app/upgrades/radon" v3m1p0 "github.com/strangelove-ventures/noble/app/upgrades/v3.1.0" + v4m0p0rc0 "github.com/strangelove-ventures/noble/app/upgrades/v4.0.0-rc0" "github.com/strangelove-ventures/noble/cmd" "github.com/strangelove-ventures/noble/docs" "github.com/strangelove-ventures/noble/x/blockibc" From f62abcf5096cb4a79db7269975a0e99ce8239203 Mon Sep 17 00:00:00 2001 From: John Letey Date: Wed, 1 Nov 2023 18:10:00 +0100 Subject: [PATCH 5/6] chore: revert post upgrade change --- interchaintest/upgrade_argon_test.go | 2 +- interchaintest/upgrade_grand-1_test.go | 2 +- interchaintest/upgrade_noble-1_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interchaintest/upgrade_argon_test.go b/interchaintest/upgrade_argon_test.go index 77d09120..a6fd8789 100644 --- a/interchaintest/upgrade_argon_test.go +++ b/interchaintest/upgrade_argon_test.go @@ -27,7 +27,7 @@ import ( "github.com/stretchr/testify/require" ) -func testPostArgonUpgrade( +func testPostArgonUpgradeTestnet( t *testing.T, ctx context.Context, noble *cosmos.CosmosChain, diff --git a/interchaintest/upgrade_grand-1_test.go b/interchaintest/upgrade_grand-1_test.go index 01185514..aa424600 100644 --- a/interchaintest/upgrade_grand-1_test.go +++ b/interchaintest/upgrade_grand-1_test.go @@ -60,7 +60,7 @@ func TestGrand1ChainUpgrade(t *testing.T) { { upgradeName: "v4.0.0-rc0", image: nobleImageInfo[0], - postUpgrade: testPostArgonUpgrade, + postUpgrade: testPostArgonUpgradeTestnet, }, } diff --git a/interchaintest/upgrade_noble-1_test.go b/interchaintest/upgrade_noble-1_test.go index 0724d0b6..dd87fd32 100644 --- a/interchaintest/upgrade_noble-1_test.go +++ b/interchaintest/upgrade_noble-1_test.go @@ -36,7 +36,7 @@ func TestNoble1ChainUpgrade(t *testing.T) { { upgradeName: "argon", image: nobleImageInfo[0], - postUpgrade: testPostArgonUpgrade, + // NOTE: Add postUpgrade task once Neon mock image is created. }, } From fdd64da609c27bf8dde2383ee70f88542e97f1ae Mon Sep 17 00:00:00 2001 From: John Letey Date: Wed, 1 Nov 2023 18:12:42 +0100 Subject: [PATCH 6/6] chore: small nits --- app/upgrades/argon/store.go | 12 ++++++------ app/upgrades/v4.0.0-rc0/store.go | 8 ++++---- app/upgrades/v4.0.0-rc0/upgrade.go | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/upgrades/argon/store.go b/app/upgrades/argon/store.go index 73fbfca9..71fcf3c3 100644 --- a/app/upgrades/argon/store.go +++ b/app/upgrades/argon/store.go @@ -1,16 +1,16 @@ package argon import ( - cctpTypes "github.com/circlefin/noble-cctp/x/cctp/types" + cctptypes "github.com/circlefin/noble-cctp/x/cctp/types" "github.com/cosmos/cosmos-sdk/baseapp" - storeTypes "github.com/cosmos/cosmos-sdk/store/types" - upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) func CreateStoreLoader(upgradeHeight int64) baseapp.StoreLoader { - storeUpgrades := storeTypes.StoreUpgrades{ - Added: []string{cctpTypes.ModuleName}, + storeUpgrades := storetypes.StoreUpgrades{ + Added: []string{cctptypes.ModuleName}, } - return upgradeTypes.UpgradeStoreLoader(upgradeHeight, &storeUpgrades) + return upgradetypes.UpgradeStoreLoader(upgradeHeight, &storeUpgrades) } diff --git a/app/upgrades/v4.0.0-rc0/store.go b/app/upgrades/v4.0.0-rc0/store.go index 25f46223..ea0f2318 100644 --- a/app/upgrades/v4.0.0-rc0/store.go +++ b/app/upgrades/v4.0.0-rc0/store.go @@ -2,14 +2,14 @@ package v4m0p0rc0 import ( "github.com/cosmos/cosmos-sdk/baseapp" - storeTypes "github.com/cosmos/cosmos-sdk/store/types" - upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) func CreateStoreLoader(upgradeHeight int64) baseapp.StoreLoader { - storeUpgrades := storeTypes.StoreUpgrades{ + storeUpgrades := storetypes.StoreUpgrades{ Deleted: []string{"router"}, } - return upgradeTypes.UpgradeStoreLoader(upgradeHeight, &storeUpgrades) + return upgradetypes.UpgradeStoreLoader(upgradeHeight, &storeUpgrades) } diff --git a/app/upgrades/v4.0.0-rc0/upgrade.go b/app/upgrades/v4.0.0-rc0/upgrade.go index f6058bca..8503d8c5 100644 --- a/app/upgrades/v4.0.0-rc0/upgrade.go +++ b/app/upgrades/v4.0.0-rc0/upgrade.go @@ -6,14 +6,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) func CreateUpgradeHandler( mm *module.Manager, cfg module.Configurator, -) upgradeTypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) { +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { // Ensure that this upgrade is only run on Noble's testnet. if ctx.ChainID() != TestnetChainID { return vm, errors.New(fmt.Sprintf("%s upgrade not allowed to execute on %s chain", UpgradeName, ctx.ChainID()))