Lux Docs
Lux Skills Reference

Lux Upgrade - Network Upgrade Configuration

Documentation for Lux Upgrade - Network Upgrade Configuration

Overview

Lux Upgrade is a standalone Go package that defines all network upgrade schedules (fork activation times) for Lux mainnet, testnet, and default/local networks. It is imported by luxd and other node packages to determine which protocol rules are active at any given timestamp.

Quick Reference

ItemValue
Repogithub.com/luxfi/upgrade
Modulegithub.com/luxfi/upgrade
Default branchmain
LanguageGo 1.26.1
Dependenciesgithub.com/luxfi/ids, github.com/luxfi/crypto
Test frameworktestify

Architecture

upgrade/
├── upgrade.go              # Config struct, Mainnet/Testnet/Default configs, activation checks
├── upgrade_test.go         # Validates all default configs, tests invalid ordering
└── upgradetest/
    ├── fork.go             # Fork enum (NoUpgrades..Granite), String() method
    ├── config.go           # Test helpers: GetConfig, GetConfigWithUpgradeTime, SetTimesTo
    └── upgradetest.go      # TestConfig, GetConfigForVersion helpers

Fork History

All named network upgrades in chronological order:

ForkMainnet ActivationTestnet Activation
ApricotPhase12021-03-312021-03-26
ApricotPhase22021-05-102021-05-05
ApricotPhase32021-08-242021-08-16
ApricotPhase42021-09-222021-09-16
ApricotPhase52021-12-022021-11-24
ApricotPhasePre62022-09-052022-09-06
ApricotPhase62022-09-062022-09-06
ApricotPhasePost62022-09-072022-09-07
Banff2022-10-182022-10-03
Cortina2023-04-252023-04-06
Durango2025-03-062025-02-13
Etna2025-04-082025-03-13
Fortuna2025-12-162025-11-25
GraniteUnscheduledUnscheduled

Network IDs

MainnetID uint32 = 1
TestnetID uint32 = 5

Config Struct

type Config struct {
    ApricotPhase1Time            time.Time
    ApricotPhase2Time            time.Time
    ApricotPhase3Time            time.Time
    ApricotPhase4Time            time.Time
    ApricotPhase4MinPChainHeight uint64
    ApricotPhase5Time            time.Time
    ApricotPhasePre6Time         time.Time
    ApricotPhase6Time            time.Time
    ApricotPhasePost6Time        time.Time
    BanffTime                    time.Time
    CortinaTime                  time.Time
    CortinaXChainStopVertexID    ids.ID
    DurangoTime                  time.Time
    EtnaTime                     time.Time
    FortunaTime                  time.Time
    GraniteTime                  time.Time
    GraniteEpochDuration         time.Duration
}

Usage


// Get config by network ID
cfg := upgrade.GetConfig(upgrade.MainnetID)

// Check if a fork is active at a given time
if cfg.IsFortunaActivated(time.Now()) {
    // Fortuna rules apply
}

// Validate upgrade ordering
if err := cfg.Validate(); err != nil {
    // ErrInvalidUpgradeTimes: upgrades are not in chronological order
}

Test Helpers (upgradetest package)


// Get config with all forks up to Etna activated, rest unscheduled
cfg := upgradetest.GetConfig(upgradetest.Etna)

// Get config with custom activation time
cfg := upgradetest.GetConfigWithUpgradeTime(upgradetest.Durango, time.Now().Add(time.Hour))

// Set fork times on existing config
upgradetest.SetTimesTo(&cfg, upgradetest.Banff, upgrade.InitiallyActiveTime)

// Fork enum
upgradetest.Latest  // == Granite
upgradetest.Fortuna.String()  // "Fortuna"

Commands

go build ./...
go test -v ./...
  • lux/lux-node.md -- Imports this package for fork scheduling
  • lux/lux-consensus.md -- Consensus rules change at fork boundaries
  • lux/lux-evm.md -- EVM rules activated per fork

On this page