mirror of
https://github.com/luxfi/upgrade.git
synced 2026-10-30 15:14:01 +00:00
Etna was the upstream-Avalanche fork name. Lux ships the same flag-day as "Quasar Edition" (per ~/work/lux/migration/LLM.md institutional memory, network activation Unix 1766708400 = 2025-12-25 16:20 PST). This renames the source-of-truth identifiers without changing activation timestamps (timestamps are policy and migrate separately): - Config.EtnaTime → Config.QuasarTime - Config.IsEtnaActivated → Config.IsQuasarActivated - json:"etnaTime" → json:"quasarTime" - upgradetest.Etna (Fork) → upgradetest.Quasar No backcompat aliases — forwards-only per project convention.
79 lines
2.1 KiB
Go
79 lines
2.1 KiB
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package upgradetest
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/luxfi/upgrade"
|
|
)
|
|
|
|
// GetConfig returns an upgrade config with the provided fork scheduled to have
|
|
// been initially activated and all other forks to be unscheduled.
|
|
func GetConfig(fork Fork) upgrade.Config {
|
|
return GetConfigWithUpgradeTime(fork, upgrade.InitiallyActiveTime)
|
|
}
|
|
|
|
// GetConfigWithUpgradeTime returns an upgrade config with the provided fork
|
|
// scheduled to be activated at the provided upgradeTime and all other forks to
|
|
// be unscheduled.
|
|
func GetConfigWithUpgradeTime(fork Fork, upgradeTime time.Time) upgrade.Config {
|
|
c := upgrade.Config{
|
|
GraniteEpochDuration: upgrade.Default.GraniteEpochDuration,
|
|
}
|
|
// Initialize all forks to be unscheduled
|
|
SetTimesTo(&c, Latest, upgrade.UnscheduledActivationTime)
|
|
// Schedule the requested forks at the provided upgrade time
|
|
SetTimesTo(&c, fork, upgradeTime)
|
|
return c
|
|
}
|
|
|
|
// SetTimesTo sets the upgrade time of the provided fork, and all prior forks,
|
|
// to the provided upgradeTime.
|
|
func SetTimesTo(c *upgrade.Config, fork Fork, upgradeTime time.Time) {
|
|
switch fork {
|
|
case Granite:
|
|
c.GraniteTime = upgradeTime
|
|
fallthrough
|
|
case Fortuna:
|
|
c.FortunaTime = upgradeTime
|
|
fallthrough
|
|
case Quasar:
|
|
c.QuasarTime = upgradeTime
|
|
fallthrough
|
|
case Durango:
|
|
c.DurangoTime = upgradeTime
|
|
fallthrough
|
|
case Cortina:
|
|
c.CortinaTime = upgradeTime
|
|
fallthrough
|
|
case Banff:
|
|
c.BanffTime = upgradeTime
|
|
fallthrough
|
|
case ApricotPhasePost6:
|
|
c.ApricotPhasePost6Time = upgradeTime
|
|
fallthrough
|
|
case ApricotPhase6:
|
|
c.ApricotPhase6Time = upgradeTime
|
|
fallthrough
|
|
case ApricotPhasePre6:
|
|
c.ApricotPhasePre6Time = upgradeTime
|
|
fallthrough
|
|
case ApricotPhase5:
|
|
c.ApricotPhase5Time = upgradeTime
|
|
fallthrough
|
|
case ApricotPhase4:
|
|
c.ApricotPhase4Time = upgradeTime
|
|
fallthrough
|
|
case ApricotPhase3:
|
|
c.ApricotPhase3Time = upgradeTime
|
|
fallthrough
|
|
case ApricotPhase2:
|
|
c.ApricotPhase2Time = upgradeTime
|
|
fallthrough
|
|
case ApricotPhase1:
|
|
c.ApricotPhase1Time = upgradeTime
|
|
}
|
|
}
|