Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: set defaults for --v2-upgrade-height #4091

Merged
merged 10 commits into from
Dec 9, 2024
Merged
15 changes: 15 additions & 0 deletions cmd/celestia-appd/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -117,6 +118,20 @@ is performed. Note, when enabled, gRPC will also be automatically enabled.
return err
}

switch clientCtx.ChainID {
rootulp marked this conversation as resolved.
Show resolved Hide resolved
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")
Expand Down
2 changes: 2 additions & 0 deletions pkg/appconsts/chain_ids.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package appconsts

const (
ArabicaChainID = "arabica-11"
MochaChainID = "mocha-4"
MainnetChainID = "celestia"
)
13 changes: 13 additions & 0 deletions pkg/appconsts/upgrade_heights.go
Original file line number Diff line number Diff line change
@@ -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
)
Loading