Skip to content

Commit

Permalink
new EVM chain id for testnet and mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
pierstab committed May 28, 2024
1 parent 224ecc8 commit 894ad07
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 4 deletions.
6 changes: 6 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 7 additions & 2 deletions app/forks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
11 changes: 11 additions & 0 deletions app/upgrades/v5/constants.go
Original file line number Diff line number Diff line change
@@ -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 = ""
)
18 changes: 18 additions & 0 deletions app/upgrades/v5/upgrades.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down

0 comments on commit 894ad07

Please sign in to comment.