diff --git a/cmd/celestia-appd/cmd/start.go b/cmd/celestia-appd/cmd/start.go index de97d4dfa0..c43e5f3d75 100644 --- a/cmd/celestia-appd/cmd/start.go +++ b/cmd/celestia-appd/cmd/start.go @@ -14,6 +14,7 @@ import ( "strings" "time" + "github.com/celestiaorg/celestia-app/v3/pkg/appconsts" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" @@ -117,6 +118,20 @@ is performed. Note, when enabled, gRPC will also be automatically enabled. return err } + switch clientCtx.ChainID { + case appconsts.ArabicaChainID: + serverCtx.Logger.Info(fmt.Sprintf("Since the chainID is %v, configuring the default v2 upgrade height to %v", appconsts.ArabicaChainID, appconsts.ArabicaUpgradeHeightV2)) + serverCtx.Viper.SetDefault(UpgradeHeightFlag, appconsts.ArabicaUpgradeHeightV2) + case appconsts.MochaChainID: + serverCtx.Logger.Info(fmt.Sprintf("Since the chainID is %v, configuring the default v2 upgrade height to %v", appconsts.MochaChainID, appconsts.MochaUpgradeHeightV2)) + serverCtx.Viper.SetDefault(UpgradeHeightFlag, appconsts.MochaUpgradeHeightV2) + case appconsts.MainnetChainID: + serverCtx.Logger.Info(fmt.Sprintf("Since the chainID is %v, configuring the default v2 upgrade height to %v", appconsts.MainnetChainID, appconsts.MainnetUpgradeHeightV2)) + serverCtx.Viper.SetDefault(UpgradeHeightFlag, appconsts.MainnetUpgradeHeightV2) + default: + serverCtx.Logger.Info(fmt.Sprintf("No default value exists for the v2 upgrade height when the chainID is %v", clientCtx.ChainID)) + } + withTM, _ := cmd.Flags().GetBool(flagWithTendermint) if !withTM { serverCtx.Logger.Info("starting ABCI without Tendermint") diff --git a/pkg/appconsts/chain_ids.go b/pkg/appconsts/chain_ids.go index 50c26932f9..056bc2606e 100644 --- a/pkg/appconsts/chain_ids.go +++ b/pkg/appconsts/chain_ids.go @@ -2,4 +2,6 @@ package appconsts const ( ArabicaChainID = "arabica-11" + MochaChainID = "mocha-4" + MainnetChainID = "celestia" ) diff --git a/pkg/appconsts/upgrade_heights.go b/pkg/appconsts/upgrade_heights.go new file mode 100644 index 0000000000..13ee0963f0 --- /dev/null +++ b/pkg/appconsts/upgrade_heights.go @@ -0,0 +1,13 @@ +package appconsts + +const ( + // ArabicaUpgradeHeightV2 is the block height at which the arabica-11 + // upgraded from app version 1 to 2. + ArabicaUpgradeHeightV2 = 1751707 + // MochaUpgradeHeightV2 is the block height at which the mocha-4 upgraded + // from app version 1 to 2. + MochaUpgradeHeightV2 = 2585031 + // MainnetUpgradeHeightV2 is the block height at which the celestia upgraded + // from app version 1 to 2. + MainnetUpgradeHeightV2 = 2371495 +)