constants

package
v1.22.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PlatformName exports the name of the platform
	PlatformName = "lux"

	// AppName exports the name of the lux application
	AppName = "node"
)

Const variables to be exported

View Source
const (
	// Standard network IDs (for compatibility)
	LocalID    uint32 = 1337
	MainnetID  uint32 = 1
	TestnetID  uint32 = 5
	UnitTestID uint32 = 369

	// Lux Network IDs
	// These are the PRIMARY NETWORK identifiers for the entire Lux blockchain
	// All chains (P, X, C, Q, etc.) run on these networks
	LuxMainnetID uint32 = 96369 // Lux mainnet - production network
	LuxTestnetID uint32 = 96368 // Lux testnet - test network (C-Chain EVM chain ID)

	// Q-Chain Network IDs (Quantum-resistant chain)
	QChainMainnetID uint32 = 36963 // Q-Chain mainnet
	QChainTestnetID uint32 = 36962 // Q-Chain testnet

	// Network name strings
	LocalName    = "local"
	MainnetName  = "mainnet"
	TestnetName  = "testnet"
	UnitTestName = "testing"

	// HRP (Human Readable Part) for bech32 addresses
	// Used to format P-chain and X-chain addresses like P-lux1..., X-test1...
	FallbackHRP = "custom" // Used for devnets/custom networks
	LocalHRP    = "local"  // local1... for local development
	MainnetHRP  = "lux"    // lux1... for mainnet
	TestnetHRP  = "test"   // test1... for testnet
	UnitTestHRP = "testing"
)

Const variables to be exported

View Source
const (
	// The network must be "tcp", "tcp4", "tcp6", "unix" or "unixpacket".
	NetworkType = "tcp"

	DefaultMaxMessageSize  = 2 * units.MiB
	DefaultPingPongTimeout = 30 * time.Second
	DefaultPingFrequency   = 3 * DefaultPingPongTimeout / 4
	DefaultByteSliceCap    = 128

	MaxContainersLen = int(4 * DefaultMaxMessageSize / 5)

	DefaultNetworkPeerListNumValidatorIPs        = 15
	DefaultNetworkPeerListValidatorGossipSize    = 20
	DefaultNetworkPeerListNonValidatorGossipSize = 0
	DefaultNetworkPeerListPeersGossipSize        = 10
	DefaultNetworkPeerListGossipFreq             = time.Minute
	DefaultNetworkPeerListPullGossipFreq         = 2 * time.Second
	DefaultNetworkPeerListBloomResetFreq         = time.Minute

	// Inbound Connection Throttling
	DefaultInboundConnUpgradeThrottlerCooldown = 10 * time.Second
	DefaultInboundThrottlerMaxConnsPerSec      = 256

	// Outbound Connection Throttling
	DefaultOutboundConnectionThrottlingRps = 50
	DefaultOutboundConnectionTimeout       = 30 * time.Second

	// Timeouts
	DefaultNetworkInitialTimeout                   = 5 * time.Second
	DefaultNetworkMinimumTimeout                   = 2 * time.Second
	DefaultNetworkMaximumTimeout                   = 10 * time.Second
	DefaultNetworkMaximumInboundTimeout            = 10 * time.Second
	DefaultNetworkTimeoutHalflife                  = 5 * time.Minute
	DefaultNetworkTimeoutCoefficient               = 2
	DefaultNetworkReadHandshakeTimeout             = 15 * time.Second
	DefaultNoIngressValidatorConnectionGracePeriod = 10 * time.Minute

	DefaultNetworkCompressionType           = compression.TypeZstd
	DefaultNetworkMaxClockDifference        = time.Minute
	DefaultNetworkRequireValidatorToConnect = false
	DefaultNetworkPeerReadBufferSize        = 8 * units.KiB
	DefaultNetworkPeerWriteBufferSize       = 8 * units.KiB

	DefaultNetworkTCPProxyEnabled = false

	// The PROXY protocol specification recommends setting this value to be at
	// least 3 seconds to cover a TCP retransmit.
	// Ref: https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt
	// Specifying a timeout of 0 will actually result in a timeout of 200ms, but
	// a timeout of 0 should generally not be provided.
	DefaultNetworkTCPProxyReadTimeout = 3 * time.Second

	// Benchlist
	DefaultBenchlistFailThreshold      = 10
	DefaultBenchlistDuration           = 15 * time.Minute
	DefaultBenchlistMinFailingDuration = 2*time.Minute + 30*time.Second

	// Router
	DefaultConsensusAppConcurrency  = 2
	DefaultConsensusShutdownTimeout = time.Minute
	DefaultFrontierPollFrequency    = 100 * time.Millisecond

	// Inbound Throttling
	DefaultInboundThrottlerAtLargeAllocSize         = 6 * units.MiB
	DefaultInboundThrottlerVdrAllocSize             = 32 * units.MiB
	DefaultInboundThrottlerNodeMaxAtLargeBytes      = DefaultMaxMessageSize
	DefaultInboundThrottlerMaxProcessingMsgsPerNode = 1024
	DefaultInboundThrottlerBandwidthRefillRate      = 512 * units.KiB
	DefaultInboundThrottlerBandwidthMaxBurstSize    = DefaultMaxMessageSize
	DefaultInboundThrottlerCPUMaxRecheckDelay       = 5 * time.Second
	DefaultInboundThrottlerDiskMaxRecheckDelay      = 5 * time.Second
	MinInboundThrottlerMaxRecheckDelay              = time.Millisecond

	// Outbound Throttling
	DefaultOutboundThrottlerAtLargeAllocSize    = 32 * units.MiB
	DefaultOutboundThrottlerVdrAllocSize        = 32 * units.MiB
	DefaultOutboundThrottlerNodeMaxAtLargeBytes = DefaultMaxMessageSize

	// Network Health
	DefaultHealthCheckAveragerHalflife = 10 * time.Second

	DefaultNetworkHealthMaxTimeSinceMsgSent     = time.Minute
	DefaultNetworkHealthMaxTimeSinceMsgReceived = time.Minute
	DefaultNetworkHealthMaxPortionSendQueueFill = 0.9
	DefaultNetworkHealthMinPeers                = 1
	DefaultNetworkHealthMaxSendFailRate         = .9

	// Metrics
	DefaultUptimeMetricFreq = 30 * time.Second

	// Delays
	DefaultNetworkInitialReconnectDelay = time.Second
	DefaultNetworkMaxReconnectDelay     = time.Minute
)
View Source
const (
	PlatformVMName  = "platformvm"  // P-Chain: Platform/Validators
	XVMName         = "xvm"         // X-Chain: UTXO Exchange
	EVMName         = "evm"         // C-Chain: EVM Smart Contracts
	XSVMName        = "xsvm"        // Cross-Subnet VM
	QuantumVMName   = "quantumvm"   // Q-Chain: Quantum-resistant security
	AIVMName        = "aivm"        // A-Chain: AI Virtual Machine
	BridgeVMName    = "bridgevm"    // B-Chain: Bridge/Cross-chain
	ThresholdVMName = "thresholdvm" // T-Chain: Threshold signatures
	ZKVMName        = "zkvm"        // Z-Chain: Zero-Knowledge proofs
	GraphVMName     = "graphvm"     // G-Chain: GraphQL/DGraph unified data layer
)
View Source
const ChainAliasPrefix string = "bc"

ChainAliasPrefix denotes a prefix for an alias that belongs to a blockchain ID.

View Source
const PointerOverhead = 8

PointerOverhead is used to approximate the memory footprint from allocating a pointer.

View Source
const VMAliasPrefix string = "vm"

VMAliasPrefix denotes a prefix for an alias that belongs to a VM ID.

Variables

View Source
var (
	// ActivatedACPs is the set of ACPs that are activated.
	//
	// See: https://github.com/orgs/luxfi/projects/1
	ActivatedACPs = set.Of[uint32](

		23,
		24,
		25,
		30,
		31,
		41,
		62,

		77,
		103,
		118,
		125,
		131,
		151,
	)

	// CurrentACPs is the set of ACPs that are currently, at the time of
	// release, marked as implementable and not activated.
	//
	// See: https://github.com/orgs/luxfi/projects/1
	CurrentACPs = set.Of[uint32](
		176,
	)

	// ScheduledACPs are the ACPs included into the next upgrade.
	ScheduledACPs = set.Of[uint32](
		176,
	)

	// CurrentLPs is the set of supported Lux Protocols
	CurrentLPs = set.Of[uint32](176)

	// ScheduledLPs are the LPs included in the next upgrade
	ScheduledLPs = set.Of[uint32](176)

	// ActivatedLPs is the set of activated LPs
	ActivatedLPs = set.Of[uint32](176)
)
View Source
var (
	PrimaryNetworkID = ids.Empty
	PlatformChainID  = ids.PChainID // P-Chain: 11111111111111111111111111111111P

	// Chain IDs - these identify specific chains WITHIN a network
	// NOT to be confused with Network IDs
	// Native chains have a recognizable pattern: all zeros except last byte which is the chain letter
	// These are provided by the ids package for consistent display across the ecosystem
	CChainID = ids.CChainID // C-Chain: 11111111111111111111111111111111C
	XChainID = ids.XChainID // X-Chain: 11111111111111111111111111111111X
	QChainID = ids.QChainID // Q-Chain: 11111111111111111111111111111111Q
	AChainID = ids.AChainID // A-Chain: 11111111111111111111111111111111A
	BChainID = ids.BChainID // B-Chain: 11111111111111111111111111111111B
	TChainID = ids.TChainID // T-Chain: 11111111111111111111111111111111T
	ZChainID = ids.ZChainID // Z-Chain: 11111111111111111111111111111111Z (Zero-knowledge)
	GChainID = ids.GChainID // G-Chain: 11111111111111111111111111111111G (Graph/dgraph) - COMING SOON
	IChainID = ids.IChainID // I-Chain: 11111111111111111111111111111111I (Identity) - COMING SOON
	KChainID = ids.KChainID // K-Chain: 11111111111111111111111111111111K (KMS) - COMING SOON

	// NetworkIDToNetworkName maps network IDs to human-readable names
	NetworkIDToNetworkName = map[uint32]string{
		LocalID:      LocalName,
		MainnetID:    MainnetName,
		TestnetID:    TestnetName,
		UnitTestID:   UnitTestName,
		LuxMainnetID: MainnetName,
		LuxTestnetID: TestnetName,
	}

	// NetworkNameToNetworkID maps names to network IDs
	NetworkNameToNetworkID = map[string]uint32{
		LocalName:    LocalID,
		MainnetName:  MainnetID,
		TestnetName:  TestnetID,
		UnitTestName: UnitTestID,
	}

	// NetworkIDToHRP maps network IDs to bech32 HRP (Human Readable Part)
	// This determines the address prefix: P-lux1..., P-test1..., P-local1..., P-custom1...
	NetworkIDToHRP = map[uint32]string{
		LocalID:      LocalHRP,
		MainnetID:    MainnetHRP,
		TestnetID:    TestnetHRP,
		UnitTestID:   UnitTestHRP,
		LuxMainnetID: MainnetHRP,
		LuxTestnetID: TestnetHRP,
	}

	// NetworkHRPToNetworkID maps HRP back to network ID
	NetworkHRPToNetworkID = map[string]uint32{
		LocalHRP:    LocalID,
		MainnetHRP:  MainnetID,
		TestnetHRP:  TestnetID,
		UnitTestHRP: UnitTestID,
	}

	// ProductionNetworkIDs are networks that should use production-grade settings
	ProductionNetworkIDs = set.Of(MainnetID, TestnetID, LuxMainnetID, LuxTestnetID)

	ValidNetworkPrefix = "network-"

	ErrParseNetworkName = errors.New("failed to parse network name")
)

Variables to be exported

View Source
var (
	PlatformVMID    = ids.ID{'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', 'v', 'm'}
	ExchangeVMID    = ids.ID{'a', 'v', 'm'} // X-Chain: UTXO Exchange
	XVMID           = ExchangeVMID          // Alias for ExchangeVMID
	ContractVMID    = ids.ID{'e', 'v', 'm'} // C-Chain: EVM Smart Contracts
	EVMID           = ContractVMID          // Alias for ContractVMID
	XSVMID          = ids.ID{'x', 's', 'v', 'm'}
	QuantumVMID     = ids.ID{'q', 'u', 'a', 'n', 't', 'u', 'm', 'v', 'm'}
	QVMID           = QuantumVMID                // Alias for QuantumVMID
	AttestationVMID = ids.ID{'a', 'i', 'v', 'm'} // A-Chain: Attestation/AI VM
	AIVMID          = AttestationVMID            // Alias for AttestationVMID
	BridgeVMID      = ids.ID{'b', 'r', 'i', 'd', 'g', 'e', 'v', 'm'}
	ThresholdVMID   = ids.ID{'t', 'h', 'r', 'e', 's', 'h', 'o', 'l', 'd', 'v', 'm'}
	ZKVMID          = ids.ID{'z', 'k', 'v', 'm'}
	GraphVMID       = ids.ID{'g', 'r', 'a', 'p', 'h', 'v', 'm'}
)

Functions

func GetHRP

func GetHRP(networkID uint32) string

GetHRP returns the Human-Readable-Part of bech32 addresses for a networkID

func NetworkID

func NetworkID(networkName string) (uint32, error)

NetworkID returns the ID of the network with name [networkName]

func NetworkName

func NetworkName(networkID uint32) string

NetworkName returns a human readable name for the network with ID [networkID]

func VMName

func VMName(vmID ids.ID) string

VMName returns the name of the VM with the provided ID. If a human readable name isn't known, then the formatted ID is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL