diff --git a/app/app.go b/app/app.go index 1276ae8..06634c2 100644 --- a/app/app.go +++ b/app/app.go @@ -134,6 +134,7 @@ import ( upgradeV1 "github.com/rebuschain/rebus.core/v1/app/upgrades/v1" upgradeV3 "github.com/rebuschain/rebus.core/v1/app/upgrades/v3" upgradeV4 "github.com/rebuschain/rebus.core/v1/app/upgrades/v4" + upgradeV5 "github.com/rebuschain/rebus.core/v1/app/upgrades/v5" ) func init() { @@ -979,6 +980,11 @@ func (app *Rebus) setupUpgradeHandlers() { upgradeV4.CreateUpgradeHandler(app.mm, app.configurator), ) + app.UpgradeKeeper.SetUpgradeHandler( + upgradeV5.UpgradeName, + upgradeV5.CreateUpgradeHandler(app.mm, app.configurator), + ) + var storeUpgrades *storetypes.StoreUpgrades switch upgradeInfo.Name { diff --git a/app/forks.go b/app/forks.go index 7e6dce9..5e53435 100644 --- a/app/forks.go +++ b/app/forks.go @@ -15,8 +15,8 @@ import ( // // CONTRACT: for this logic to work properly it is required to: // -// 1) Release a non-breaking patch version so that the chain can set the scheduled upgrade plan at upgrade-height. -// 2) Release the software defined in the upgrade-info +// 1. Release a non-breaking patch version so that the chain can set the scheduled upgrade plan at upgrade-height. +// 2. Release the software defined in the upgrade-info func (app *Rebus) ScheduleForkUpgrade(ctx sdk.Context) { // NOTE: there are no testnet forks for the existing versions @@ -35,6 +35,11 @@ func (app *Rebus) ScheduleForkUpgrade(ctx sdk.Context) { // handle mainnet forks switch ctx.BlockHeight() { + /* + case v5.TestNetUpgradeHeight: + upgradePlan.Name = v5.UpgradeName + upgradePlan.Info = v5.UpgradeInfo + */ default: // No-op return diff --git a/app/upgrades/v5/constants.go b/app/upgrades/v5/constants.go new file mode 100644 index 0000000..d455573 --- /dev/null +++ b/app/upgrades/v5/constants.go @@ -0,0 +1,11 @@ +package v5 + +const ( + // UpgradeName is the shared upgrade plan name for mainnet and testnet + UpgradeName = "v0.5.0" + // MainnetUpgradeHeight defines the Rebus mainnet block height on which the upgrade will take place + // TestNetUpgradeHeight = (24*60*60)/3 + 1 // 7550847 + // UpgradeInfo defines the binaries that will be used for the upgrade + TestNetUpgradeHeight = 7550847 + UpgradeInfo = "" +) diff --git a/app/upgrades/v5/upgrades.go b/app/upgrades/v5/upgrades.go new file mode 100644 index 0000000..4f54245 --- /dev/null +++ b/app/upgrades/v5/upgrades.go @@ -0,0 +1,18 @@ +package v5 + +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 creates an SDK upgrade handler for v5 +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/go.mod b/go.mod index 0dd4dc1..b196acb 100644 --- a/go.mod +++ b/go.mod @@ -177,6 +177,7 @@ require ( replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 + github.com/evmos/ethermint => github.com/rebuschain/ethermint v0.19.5 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/tendermint/tendermint => github.com/informalsystems/tendermint v0.34.24 google.golang.org/grpc => google.golang.org/grpc v1.33.2 diff --git a/go.sum b/go.sum index 88ba201..3330b3b 100644 --- a/go.sum +++ b/go.sum @@ -888,8 +888,6 @@ github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evmos/ethermint v0.19.3 h1:Tc2tIiEK9b+rp1a0aWfzzggRDgecLa8gOHyXT3tH/1A= -github.com/evmos/ethermint v0.19.3/go.mod h1:2A25AF6mes32UL6j+r0wT0FnbzN7tzGYp2URxy+ZNmY= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= @@ -2074,6 +2072,8 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rdegges/go-ipify v0.0.0-20150526035502-2d94a6a86c40/go.mod h1:j4c6zEU0eMG1oiZPUy+zD4ykX0NIpjZAEOEAviTWC18= +github.com/rebuschain/ethermint v0.19.5 h1:Lr7x3z+6TywmeyqW758F7Y7Di4Z6SISZfvEOylkWU1g= +github.com/rebuschain/ethermint v0.19.5/go.mod h1:2A25AF6mes32UL6j+r0wT0FnbzN7tzGYp2URxy+ZNmY= github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4=