Skip to content

Commit

Permalink
Problem: testnet-croeseid-4 started on 0.43
Browse files Browse the repository at this point in the history
Solution: added a custom empty upgrade handler
to upgrade from 0.43 to 0.44
  • Loading branch information
tomtau committed Sep 3, 2021
1 parent c36f898 commit c7d6a43
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 38 deletions.
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Changelog

*Septeber 2, 2021*
*Septeber 3, 2021*

## v3.1.0
This version is identical to the v3.0.1, but updated the Cosmos SDK dependency to 0.44.0 which contains a consensus-breaking security patch.
*WARNING*: DO NOT upgrade to this binary yet; instructions are going to be published later
on https://crypto.org/docs/getting-started/upgrade_guide.html .
## v3.1.0-croeseid
This version is identical to the v3.0.1-croeseid, but updated the Cosmos SDK dependency to 0.44.0 which contains a consensus-breaking security patch. It contains the upgrade handler for the plan "croeseid-0.44" which is meant to signal an upgrade on the "testnet-croeseid-4" public testnet.
*WARNING*: DO NOT run this binary from "testnet-croeseid-4" genesis; you can upgrade to it after the upgrade block height has passed
as per instructions on https://crypto.org/docs/getting-started/croeseid-testnet.html .

*August 26, 2021*

Expand Down
36 changes: 3 additions & 33 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"net/http"
"os"
"path/filepath"
"time"

"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
Expand Down Expand Up @@ -63,7 +62,6 @@ import (
ibcclient "github.com/cosmos/ibc-go/modules/core/02-client"
ibcclientclient "github.com/cosmos/ibc-go/modules/core/02-client/client"
ibcclienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
ibcconnectiontypes "github.com/cosmos/ibc-go/modules/core/03-connection/types"
porttypes "github.com/cosmos/ibc-go/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/modules/core/keeper"
Expand Down Expand Up @@ -459,34 +457,8 @@ func New(
app.SetAnteHandler(anteHandler)
app.SetEndBlocker(app.EndBlocker)

// FIXME: upgrade plan to v0.43 https://github.com/cosmos/cosmos-sdk/pull/9567/files
planName := "v3.0.0"
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, plan upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) {
// a new param in 1.0.0 -- set to roundup(5x 7secs) as a safe choice
app.IBCKeeper.ConnectionKeeper.SetParams(ctx, ibcconnectiontypes.NewParams(uint64(40*time.Second)))
// 1st-time running in-store migrations, using 1 as fromVersion to
// avoid running InitGenesis.
fromVM := map[string]uint64{
"auth": 1,
"bank": 1,
"capability": 1,
"crisis": 1,
"distribution": 1,
"evidence": 1,
"gov": 1,
"mint": 1,
"params": 1,
"slashing": 1,
"staking": 1,
"upgrade": 1,
"vesting": 1,
"ibc": 1,
"genutil": 1,
"transfer": 1,
"chainmain": 1,
"nft": 1,
"supply": 1,
}
planName := "croeseid-0.44"
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {

return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})
Expand All @@ -497,9 +469,7 @@ func New(
}

if upgradeInfo.Name == planName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{"authz", "feegrant"},
}
storeUpgrades := storetypes.StoreUpgrades{}

// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
Expand Down
2 changes: 2 additions & 0 deletions integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def propose_and_pass(cluster, kind, proposal):
return proposal


@pytest.mark.skip(reason="croeseid-4 started off 0.43")
def test_manual_upgrade(cosmovisor_cluster):
"""
- do the upgrade test by replacing binary manually
Expand Down Expand Up @@ -251,6 +252,7 @@ def test_manual_upgrade(cosmovisor_cluster):
wait_for_block(cluster, target_height + 2, 600)


@pytest.mark.skip(reason="croeseid-4 started off 0.43")
def test_manual_upgrade_all(cosmovisor_cluster):
test_manual_upgrade(cosmovisor_cluster)
cluster = cosmovisor_cluster
Expand Down

0 comments on commit c7d6a43

Please sign in to comment.