Skip to content

Commit

Permalink
refactor!: remove OverrideUpgradeHeightDelayStr
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Nov 27, 2024
1 parent 758a9fe commit b9e1043
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@ PACKAGE_NAME := github.com/celestiaorg/celestia-app/v3
GOLANG_CROSS_VERSION ?= v1.23.1
# Set this to override the max square size of the binary
OVERRIDE_MAX_SQUARE_SIZE ?=
# Set this to override the upgrade height delay of the binary
OVERRIDE_UPGRADE_HEIGHT_DELAY ?=

# process linker flags
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=celestia-app \
-X github.com/cosmos/cosmos-sdk/version.AppName=celestia-appd \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/celestiaorg/celestia-app/v3/pkg/appconsts.OverrideSquareSizeUpperBoundStr=$(OVERRIDE_MAX_SQUARE_SIZE) \
-X github.com/celestiaorg/celestia-app/v3/pkg/appconsts.OverrideUpgradeHeightDelayStr=$(OVERRIDE_UPGRADE_HEIGHT_DELAY)
-X github.com/celestiaorg/celestia-app/v3/pkg/appconsts.OverrideSquareSizeUpperBoundStr=$(OVERRIDE_MAX_SQUARE_SIZE)

BUILD_FLAGS := -tags "ledger" -ldflags '$(ldflags)'

Expand Down
4 changes: 1 addition & 3 deletions app/test/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ func TestAppUpgradeV3(t *testing.T) {
t.Skip("skipping TestAppUpgradeV3 in short mode")
}

appconsts.OverrideUpgradeHeightDelayStr = "1"
defer func() { appconsts.OverrideUpgradeHeightDelayStr = "" }()

testApp, genesis := SetupTestAppWithUpgradeHeight(t, 3)
upgradeFromV1ToV2(t, testApp)

Expand Down Expand Up @@ -258,6 +255,7 @@ func SetupTestAppWithUpgradeHeight(t *testing.T, upgradeHeight int64) (*app.App,
encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...)
testApp := app.New(log.NewNopLogger(), db, nil, 0, encCfg, upgradeHeight, util.EmptyAppOptions{})
genesis := genesis.NewDefaultGenesis().
WithChainID("test").
WithValidators(genesis.NewDefaultValidator(testnode.DefaultValidatorAccountName)).
WithConsensusParams(app.DefaultInitialConsensusParams())
genDoc, err := genesis.Export()
Expand Down
1 change: 0 additions & 1 deletion pkg/appconsts/overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ package appconsts
// Look at the Makefile to see how these are set.
var (
OverrideSquareSizeUpperBoundStr string
OverrideUpgradeHeightDelayStr string
)
7 changes: 0 additions & 7 deletions pkg/appconsts/versioned_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ func GetTimeoutCommit(v uint64) time.Duration {

// UpgradeHeightDelay returns the delay in blocks after a quorum has been reached that the chain should upgrade to the new version.
func UpgradeHeightDelay(chainID string, v uint64) int64 {
if OverrideUpgradeHeightDelayStr != "" {
parsedValue, err := strconv.ParseInt(OverrideUpgradeHeightDelayStr, 10, 64)
if err != nil {
panic("Invalid OverrideUpgradeHeightDelayStr value")
}
return parsedValue
}
if chainID == "test" {
return 3
}
Expand Down

0 comments on commit b9e1043

Please sign in to comment.