config

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: BSD-3-Clause Imports: 55 Imported by: 6

Documentation

Index

Constants

View Source
const (
	DefaultHTTPPort    = 9630
	DefaultStakingPort = 9631

	LuxNodeDataDirVar = "LUXD_DATA_DIR"

	DefaultProcessContextFilename = "process.json"
)
View Source
const (
	DataDirKey                               = "data-dir"
	ConfigFileKey                            = "config-file"
	ConfigContentKey                         = "config-file-content"
	ConfigContentTypeKey                     = "config-file-content-type"
	VersionKey                               = "version"
	VersionJSONKey                           = "version-json"
	GenesisFileKey                           = "genesis-file"
	GenesisFileContentKey                    = "genesis-file-content"
	GenesisRawBytesKey                       = "genesis-raw-bytes"
	GenesisDBKey                             = "genesis-db"
	GenesisDBTypeKey                         = "genesis-db-type"
	GenesisBlockLimitKey                     = "genesis-block-limit"
	AllowCustomGenesisKey                    = "allow-custom-genesis"
	UpgradeFileKey                           = "upgrade-file"
	UpgradeFileContentKey                    = "upgrade-file-content"
	NetworkNameKey                           = "network-id"
	MainnetKey                               = "mainnet"
	TestnetKey                               = "testnet"
	LocalnetKey                              = "localnet"
	DynamicFeesBandwidthWeightKey            = "dynamic-fees-bandwidth-weight"
	DynamicFeesDBReadWeightKey               = "dynamic-fees-db-read-weight"
	DynamicFeesDBWriteWeightKey              = "dynamic-fees-db-write-weight"
	DynamicFeesComputeWeightKey              = "dynamic-fees-compute-weight"
	DynamicFeesMaxGasCapacityKey             = "dynamic-fees-max-gas-capacity"
	DynamicFeesMaxGasPerSecondKey            = "dynamic-fees-max-gas-per-second"
	DynamicFeesTargetGasPerSecondKey         = "dynamic-fees-target-gas-per-second"
	DynamicFeesMinGasPriceKey                = "dynamic-fees-min-gas-price"
	DynamicFeesExcessConversionConstantKey   = "dynamic-fees-excess-conversion-constant"
	ValidatorFeesCapacityKey                 = "validator-fees-capacity"
	ValidatorFeesTargetKey                   = "validator-fees-target"
	ValidatorFeesMinPriceKey                 = "validator-fees-min-price"
	ValidatorFeesExcessConversionConstantKey = "validator-fees-excess-conversion-constant"
	TxFeeKey                                 = "tx-fee"
	CreateAssetTxFeeKey                      = "create-asset-tx-fee"
	UptimeRequirementKey                     = "uptime-requirement"
	MinValidatorStakeKey                     = "min-validator-stake"
	MaxValidatorStakeKey                     = "max-validator-stake"
	MinDelegatorStakeKey                     = "min-delegator-stake"
	MinDelegatorFeeKey                       = "min-delegation-fee"
	MinStakeDurationKey                      = "min-stake-duration"
	MaxStakeDurationKey                      = "max-stake-duration"
	StakeMaxConsumptionRateKey               = "stake-max-consumption-rate"
	StakeMinConsumptionRateKey               = "stake-min-consumption-rate"
	StakeMintingPeriodKey                    = "stake-minting-period"
	StakeSupplyCapKey                        = "stake-supply-cap"
	DBTypeKey                                = "db-type"
	DBReadOnlyKey                            = "db-read-only"
	DBPathKey                                = "db-dir"
	DBConfigFileKey                          = "db-config-file"
	DBConfigContentKey                       = "db-config-file-content"
	PChainDBTypeKey                          = "p-chain-db-type"
	XChainDBTypeKey                          = "x-chain-db-type"
	CChainDBTypeKey                          = "c-chain-db-type"
	PublicIPKey                              = "public-ip"
	PublicIPResolutionFreqKey                = "public-ip-resolution-frequency"
	PublicIPResolutionServiceKey             = "public-ip-resolution-service"
	HTTPHostKey                              = "http-host"
	HTTPPortKey                              = "http-port"
	HTTPSEnabledKey                          = "http-tls-enabled"
	HTTPSKeyFileKey                          = "http-tls-key-file"
	HTTPSKeyContentKey                       = "http-tls-key-file-content"
	HTTPSCertFileKey                         = "http-tls-cert-file"
	HTTPSCertContentKey                      = "http-tls-cert-file-content"

	HTTPAllowedOrigins       = "http-allowed-origins"
	HTTPAllowedHostsKey      = "http-allowed-hosts"
	HTTPShutdownTimeoutKey   = "http-shutdown-timeout"
	HTTPShutdownWaitKey      = "http-shutdown-wait"
	HTTPReadTimeoutKey       = "http-read-timeout"
	HTTPReadHeaderTimeoutKey = "http-read-header-timeout"

	HTTPIdleTimeoutKey                                 = "http-idle-timeout"
	StateSyncIPsKey                                    = "state-sync-ips"
	StateSyncIDsKey                                    = "state-sync-ids"
	BootstrapIPsKey                                    = "bootstrap-ips"
	BootstrapIDsKey                                    = "bootstrap-ids"
	SkipBootstrapKey                                   = "skip-bootstrap"
	EnableAutominingKey                                = "enable-automining"
	StakingHostKey                                     = "staking-host"
	StakingPortKey                                     = "staking-port"
	StakingEphemeralCertEnabledKey                     = "staking-ephemeral-cert-enabled"
	StakingTLSKeyPathKey                               = "staking-tls-key-file"
	StakingTLSKeyContentKey                            = "staking-tls-key-file-content"
	StakingCertPathKey                                 = "staking-tls-cert-file"
	StakingCertContentKey                              = "staking-tls-cert-file-content"
	StakingEphemeralSignerEnabledKey                   = "staking-ephemeral-signer-enabled"
	StakingSignerKeyPathKey                            = "staking-signer-key-file"
	StakingSignerKeyContentKey                         = "staking-signer-key-file-content"
	SybilProtectionEnabledKey                          = "sybil-protection-enabled"
	SybilProtectionDisabledWeightKey                   = "sybil-protection-disabled-weight"
	NetworkInitialTimeoutKey                           = "network-initial-timeout"
	NetworkMinimumTimeoutKey                           = "network-minimum-timeout"
	NetworkMaximumTimeoutKey                           = "network-maximum-timeout"
	NetworkMaximumInboundTimeoutKey                    = "network-maximum-inbound-timeout"
	NetworkTimeoutHalflifeKey                          = "network-timeout-halflife"
	NetworkTimeoutCoefficientKey                       = "network-timeout-coefficient"
	NetworkHealthMinPeersKey                           = "network-health-min-conn-peers"
	NetworkHealthMaxTimeSinceMsgReceivedKey            = "network-health-max-time-since-msg-received"
	NetworkHealthMaxTimeSinceMsgSentKey                = "network-health-max-time-since-msg-sent"
	NetworkHealthMaxPortionSendQueueFillKey            = "network-health-max-portion-send-queue-full"
	NetworkHealthMaxSendFailRateKey                    = "network-health-max-send-fail-rate"
	NetworkHealthMaxOutstandingDurationKey             = "network-health-max-outstanding-request-duration"
	NetworkPeerListNumValidatorIPsKey                  = "network-peer-list-num-validator-ips"
	NetworkPeerListPullGossipFreqKey                   = "network-peer-list-pull-gossip-frequency"
	NetworkPeerListBloomResetFreqKey                   = "network-peer-list-bloom-reset-frequency"
	NetworkInitialReconnectDelayKey                    = "network-initial-reconnect-delay"
	NetworkReadHandshakeTimeoutKey                     = "network-read-handshake-timeout"
	NetworkPingTimeoutKey                              = "network-ping-timeout"
	NetworkPingFrequencyKey                            = "network-ping-frequency"
	NetworkMaxReconnectDelayKey                        = "network-max-reconnect-delay"
	NetworkCompressionTypeKey                          = "network-compression-type"
	NetworkMaxClockDifferenceKey                       = "network-max-clock-difference"
	NetworkAllowPrivateIPsKey                          = "network-allow-private-ips"
	NetworkRequireValidatorToConnectKey                = "network-require-validator-to-connect"
	NetworkPeerReadBufferSizeKey                       = "network-peer-read-buffer-size"
	NetworkPeerWriteBufferSizeKey                      = "network-peer-write-buffer-size"
	NetworkTCPProxyEnabledKey                          = "network-tcp-proxy-enabled"
	NetworkTCPProxyReadTimeoutKey                      = "network-tcp-proxy-read-timeout"
	NetworkTLSKeyLogFileKey                            = "network-tls-key-log-file-unsafe"
	NetworkInboundConnUpgradeThrottlerCooldownKey      = "network-inbound-connection-throttling-cooldown"
	NetworkInboundThrottlerMaxConnsPerSecKey           = "network-inbound-connection-throttling-max-conns-per-sec"
	NetworkOutboundConnectionThrottlingRpsKey          = "network-outbound-connection-throttling-rps"
	NetworkOutboundConnectionTimeoutKey                = "network-outbound-connection-timeout"
	NetworkNoIngressValidatorConnectionsGracePeriodKey = "network-no-ingress-connections-grace-period"
	BenchlistFailThresholdKey                          = "benchlist-fail-threshold"
	BenchlistDurationKey                               = "benchlist-duration"
	BenchlistMinFailingDurationKey                     = "benchlist-min-failing-duration"
	LogsDirKey                                         = "log-dir"
	LogLevelKey                                        = "log-level"
	LogDisplayLevelKey                                 = "log-display-level"
	LogFormatKey                                       = "log-format"
	LogRotaterMaxSizeKey                               = "log-rotater-max-size"
	LogRotaterMaxFilesKey                              = "log-rotater-max-files"
	LogRotaterMaxAgeKey                                = "log-rotater-max-age"
	LogRotaterCompressEnabledKey                       = "log-rotater-compress-enabled"
	LogDisableDisplayPluginLogsKey                     = "log-disable-display-plugin-logs"
	ConsensusSampleSizeKey                             = "consensus-sample-size"
	ConsensusQuorumSizeKey                             = "consensus-quorum-size"
	ConsensusPreferenceQuorumSizeKey                   = "consensus-preference-quorum-size"
	ConsensusConfidenceQuorumSizeKey                   = "consensus-confidence-quorum-size"
	ConsensusCommitThresholdKey                        = "consensus-commit-threshold"
	ConsensusConcurrentRepollsKey                      = "consensus-concurrent-repolls"
	ConsensusOptimalProcessingKey                      = "consensus-optimal-processing"
	ConsensusMaxProcessingKey                          = "consensus-max-processing"
	ConsensusMaxTimeProcessingKey                      = "consensus-max-time-processing"
	PartialSyncPrimaryNetworkKey                       = "partial-sync-primary-network"
	TrackChainsKey                                     = "track-chains"
	TrackAllChainsKey                                  = "track-all-chains"
	AdminAPIEnabledKey                                 = "api-admin-enabled"
	InfoAPIEnabledKey                                  = "api-info-enabled"
	KeystoreAPIEnabledKey                              = "api-keystore-enabled"
	MetricsAPIEnabledKey                               = "api-metrics-enabled"
	HealthAPIEnabledKey                                = "api-health-enabled"
	MeterVMsEnabledKey                                 = "meter-vms-enabled"
	ConsensusAppConcurrencyKey                         = "consensus-app-concurrency"
	ConsensusShutdownTimeoutKey                        = "consensus-shutdown-timeout"
	ConsensusFrontierPollFrequencyKey                  = "consensus-frontier-poll-frequency"
	ProposerVMUseCurrentHeightKey                      = "proposervm-use-current-height"
	ProposerVMMinBlockDelayKey                         = "proposervm-min-block-delay"
	FdLimitKey                                         = "fd-limit"
	IndexEnabledKey                                    = "index-enabled"
	IndexAllowIncompleteKey                            = "index-allow-incomplete"
	RouterHealthMaxDropRateKey                         = "router-health-max-drop-rate"
	RouterHealthMaxOutstandingRequestsKey              = "router-health-max-outstanding-requests"
	HealthCheckFreqKey                                 = "health-check-frequency"
	HealthCheckAveragerHalflifeKey                     = "health-check-averager-halflife"
	PluginDirKey                                       = "plugin-dir"
	BootstrapBeaconConnectionTimeoutKey                = "bootstrap-beacon-connection-timeout"
	BootstrapMaxTimeGetAncestorsKey                    = "bootstrap-max-time-get-ancestors"
	BootstrapAncestorsMaxContainersSentKey             = "bootstrap-ancestors-max-containers-sent"
	BootstrapAncestorsMaxContainersReceivedKey         = "bootstrap-ancestors-max-containers-received"
	ChainDataDirKey                                    = "chain-data-dir"
	ChainConfigDirKey                                  = "chain-config-dir"
	ChainConfigContentKey                              = "chain-config-content"
	ImportChainDataKey                                 = "import-chain-data"
	NetConfigDirKey                                    = "net-config-dir"
	NetConfigContentKey                                = "net-config-content"
	ProfileDirKey                                      = "profile-dir"
	ProfileContinuousEnabledKey                        = "profile-continuous-enabled"
	ProfileContinuousFreqKey                           = "profile-continuous-freq"
	ProfileContinuousMaxFilesKey                       = "profile-continuous-max-files"
	InboundThrottlerAtLargeAllocSizeKey                = "throttler-inbound-at-large-alloc-size"
	InboundThrottlerVdrAllocSizeKey                    = "throttler-inbound-validator-alloc-size"
	InboundThrottlerNodeMaxAtLargeBytesKey             = "throttler-inbound-node-max-at-large-bytes"
	InboundThrottlerMaxProcessingMsgsPerNodeKey        = "throttler-inbound-node-max-processing-msgs"
	InboundThrottlerBandwidthRefillRateKey             = "throttler-inbound-bandwidth-refill-rate"
	InboundThrottlerBandwidthMaxBurstSizeKey           = "throttler-inbound-bandwidth-max-burst-size"
	InboundThrottlerCPUMaxRecheckDelayKey              = "throttler-inbound-cpu-max-recheck-delay"
	InboundThrottlerDiskMaxRecheckDelayKey             = "throttler-inbound-disk-max-recheck-delay"
	CPUVdrAllocKey                                     = "throttler-inbound-cpu-validator-alloc"
	CPUMaxNonVdrUsageKey                               = "throttler-inbound-cpu-max-non-validator-usage"
	CPUMaxNonVdrNodeUsageKey                           = "throttler-inbound-cpu-max-non-validator-node-usage"
	SystemTrackerFrequencyKey                          = "system-tracker-frequency"
	SystemTrackerProcessingHalflifeKey                 = "system-tracker-processing-halflife"
	SystemTrackerCPUHalflifeKey                        = "system-tracker-cpu-halflife"
	SystemTrackerDiskHalflifeKey                       = "system-tracker-disk-halflife"
	SystemTrackerRequiredAvailableDiskSpaceKey         = "system-tracker-disk-required-available-space"
	SystemTrackerWarningThresholdAvailableDiskSpaceKey = "system-tracker-disk-warning-threshold-available-space"
	DiskVdrAllocKey                                    = "throttler-inbound-disk-validator-alloc"
	DiskMaxNonVdrUsageKey                              = "throttler-inbound-disk-max-non-validator-usage"
	DiskMaxNonVdrNodeUsageKey                          = "throttler-inbound-disk-max-non-validator-node-usage"
	OutboundThrottlerAtLargeAllocSizeKey               = "throttler-outbound-at-large-alloc-size"
	OutboundThrottlerVdrAllocSizeKey                   = "throttler-outbound-validator-alloc-size"
	OutboundThrottlerNodeMaxAtLargeBytesKey            = "throttler-outbound-node-max-at-large-bytes"
	UptimeMetricFreqKey                                = "uptime-metric-freq"
	VMAliasesFileKey                                   = "vm-aliases-file"
	VMAliasesContentKey                                = "vm-aliases-file-content"
	ChainAliasesFileKey                                = "chain-aliases-file"
	ChainAliasesContentKey                             = "chain-aliases-file-content"
	TracingEndpointKey                                 = "tracing-endpoint"
	TracingInsecureKey                                 = "tracing-insecure"
	TracingSampleRateKey                               = "tracing-sample-rate"
	TracingExporterTypeKey                             = "tracing-exporter-type"
	TracingHeadersKey                                  = "tracing-headers"
	ProcessContextFileKey                              = "process-context-file"

	// Development and LP Keys
	DevModeKey   = "dev"
	LPSupportKey = "lp-support"
	LPObjectKey  = "lp-object"

	// GPU Acceleration Keys
	GPUEnabledKey  = "gpu-enabled"
	GPUBackendKey  = "gpu-backend"
	GPUDeviceKey   = "gpu-device"
	GPULogLevelKey = "gpu-log-level"

	// POA Mode Keys
	POAModeEnabledKey     = "poa-mode-enabled"
	POASingleNodeModeKey  = "poa-single-node-mode"
	POAMinBlockTimeKey    = "poa-min-block-time"
	POAAuthorizedNodesKey = "poa-authorized-nodes"

	// Force flags
	ForceIgnoreChecksumKey = "force-ignore-checksum"

	// Low Memory / Dev Light Mode Keys
	LowMemoryKey           = "low-memory"
	MemoryProfileKey       = "memory-profile"
	DevLightKey            = "dev-light"
	ConfigProfileKey       = "config-profile"
	DBCacheSizeKey         = "db-cache-size"
	DBMemtableSizeKey      = "db-memtable-size"
	StateCacheSizeKey      = "state-cache-size"
	BlockCacheSizeKey      = "block-cache-size"
	DisableBloomFiltersKey = "disable-bloom-filters"
	LazyChainLoadingKey    = "lazy-chain-loading"
	SingleValidatorModeKey = "single-validator-mode"
)
View Source
const (
	KB = 1024
	MB = 1024 * KB
	GB = 1024 * MB

	// Standard settings - target <100MB per node (new default)
	DefaultDBCacheSize    = 16 * MB
	DefaultDBMemtableSize = 16 * MB
	DefaultStateCacheSize = 32 * MB
	DefaultBlockCacheSize = 32 * MB

	// Low memory settings - target <50MB per node
	LowMemDBCacheSize    = 4 * MB
	LowMemDBMemtableSize = 4 * MB
	LowMemStateCacheSize = 8 * MB
	LowMemBlockCacheSize = 4 * MB

	// Max memory settings - production/high-performance
	MaxMemDBCacheSize    = 64 * MB
	MaxMemDBMemtableSize = 64 * MB
	MaxMemStateCacheSize = 256 * MB
	MaxMemBlockCacheSize = 128 * MB
)

Memory size constants

View Source
const EnvPrefix = "luxd"
View Source
const HTTPWriteTimeoutKey = "http-write-timeout" // #nosec G101

the HTTPWriteTimeoutKey was moved here so that it would not generate the false-positive linter error "G101: Potential hardcoded credentials" when running golangci-lint.

Variables

View Source
var DashesToUnderscores = strings.NewReplacer("-", "_")
View Source
var MainnetParameters = struct {
	K                     int
	AlphaPreference       int
	AlphaConfidence       int
	Beta                  int
	ConcurrentPolls       int
	OptimalProcessing     int
	MaxOutstandingItems   int
	MaxItemProcessingTime time.Duration
}{
	K:                     20,
	AlphaPreference:       15,
	AlphaConfidence:       15,
	Beta:                  20,
	ConcurrentPolls:       4,
	OptimalProcessing:     10,
	MaxOutstandingItems:   1024,
	MaxItemProcessingTime: 2 * time.Minute,
}

MainnetParameters contains mainnet consensus parameters

Functions

func ApplyConfigProfile added in v1.23.0

func ApplyConfigProfile(v *viper.Viper, profile map[string]interface{})

ApplyConfigProfile applies a configuration profile to viper. Profile values are set with lower priority than command-line flags.

func ApplyDevLightMode added in v1.23.0

func ApplyDevLightMode(v *viper.Viper) error

ApplyDevLightMode applies --dev-light settings to viper. This is equivalent to --dev --low-memory.

func BuildFlagSet

func BuildFlagSet() *pflag.FlagSet

BuildFlagSet returns a complete set of flags for node

func BuildViper

func BuildViper(fs *pflag.FlagSet, args []string) (*viper.Viper, error)

BuildViper returns the viper environment from parsing config file from default search paths and any parsed command line flags

func EnvVarName

func EnvVarName(prefix string, key string) string

func GPUBackend added in v1.22.82

func GPUBackend() string

GPUBackend returns the configured GPU backend.

func GetNodeConfig

func GetNodeConfig(v *viper.Viper) (node.Config, error)

func IsGPUEnabled added in v1.22.82

func IsGPUEnabled() bool

IsGPUEnabled returns whether GPU acceleration is enabled globally.

func LoadConfigProfile added in v1.23.0

func LoadConfigProfile(name string) (map[string]interface{}, error)

LoadConfigProfile loads a predefined configuration profile from embedded files. Returns the profile as a map for merging with viper.

func SetGlobalGPUConfig added in v1.22.82

func SetGlobalGPUConfig(cfg GPUConfig) error

SetGlobalGPUConfig sets the global GPU configuration. This should be called once during node initialization before any GPU accelerators are created.

Types

type AirdropConfig added in v1.16.56

type AirdropConfig struct {
	Enabled         bool
	SnapshotDate    string
	ConversionRatio float64 // Legacy token to LUX conversion ratio
	VestingPeriod   uint64  // in seconds
	ClaimPeriod     uint64  // in seconds
}

AirdropConfig defines airdrop parameters

type BadgerDBConfig added in v1.1.11

type BadgerDBConfig struct {
	Enable          bool
	DataDir         string
	EnableAncient   bool
	AncientDir      string
	ReadOnly        bool
	SharedAncient   bool
	FreezeThreshold uint64
}

BadgerDB flags for C-Chain

func AddBadgerDBFlags added in v1.1.11

func AddBadgerDBFlags(fs *flag.FlagSet) *BadgerDBConfig

AddBadgerDBFlags adds BadgerDB-related flags to the flag set

func (*BadgerDBConfig) Validate added in v1.1.11

func (c *BadgerDBConfig) Validate(dataDir string) error

Validate validates the BadgerDB configuration

type BenchlistConfig added in v1.16.56

type BenchlistConfig struct {
	Deprecated         bool
	Duration           time.Duration
	MinFailingDuration time.Duration
	Threshold          int
	MaxPortion         float64
	FailThreshold      int
}

BenchlistConfig contains configuration for benchlisting

type ChainDatabaseConfig added in v1.1.11

type ChainDatabaseConfig struct {
	// Default database type for all chains
	DefaultType string

	// Per-chain overrides
	PChainDBType string
	XChainDBType string
	CChainDBType string
}

ChainDatabaseConfig holds per-chain database configuration

func (*ChainDatabaseConfig) GetDatabaseType added in v1.1.11

func (c *ChainDatabaseConfig) GetDatabaseType(chainAlias string) string

GetDatabaseType returns the database type for a specific chain

func (*ChainDatabaseConfig) Validate added in v1.1.11

func (c *ChainDatabaseConfig) Validate() error

Validate ensures all database types are valid

type ChainStakeRequirement added in v1.16.56

type ChainStakeRequirement struct {
	ChainID               string
	MinimumStake          uint64
	RequiresSpecialAccess bool   // e.g., B-chain bridge validators
	AccessRequirements    string // Description of special requirements
}

ChainStakeRequirement defines chain-specific staking requirements

type DevNetworkConfig added in v1.22.79

type DevNetworkConfig struct {
	// Version for forward compatibility
	Version int `json:"version"`

	// Genesis start time - captured on first boot, reused on restart
	StartTime uint64 `json:"startTime"`

	// Node identity
	NodeID string `json:"nodeId"`

	// BLS credentials (hex-encoded)
	BLSPublicKey string `json:"blsPublicKey"`
	BLSPopProof  string `json:"blsPopProof"`

	// Computed genesis bytes and hash (for verification)
	GenesisBytes []byte `json:"genesisBytes"`
	GenesisHash  string `json:"genesisHash"` // Actual hash of GenesisBytes

	// X-Chain asset ID (LUX token ID)
	XAssetID string `json:"xAssetId"`

	// C-Chain genesis (stored separately for EVM immutability)
	CChainGenesis string `json:"cChainGenesis"`
}

DevNetworkConfig captures immutable network state for dev mode persistence. Once written to dev-network.json, this ensures the same genesis is produced on every restart, making C-Chain/EVM state persistence work correctly.

type GPUConfig added in v1.22.82

type GPUConfig struct {
	// Enabled controls whether GPU acceleration is used
	Enabled bool

	// Backend specifies which GPU backend to use: "auto", "metal", "cuda", "cpu"
	Backend string

	// DeviceIndex specifies which GPU device to use when multiple are available
	DeviceIndex int

	// LogLevel sets the GPU subsystem log level: "debug", "info", "warn", "error"
	LogLevel string
}

GPUConfig holds GPU acceleration configuration.

func DefaultGPUConfig added in v1.22.82

func DefaultGPUConfig() GPUConfig

DefaultGPUConfig returns the default GPU configuration.

func GetGlobalGPUConfig added in v1.22.82

func GetGlobalGPUConfig() GPUConfig

GetGlobalGPUConfig returns the global GPU configuration. If not set, returns the default configuration.

func (GPUConfig) ResolveBackend added in v1.22.82

func (c GPUConfig) ResolveBackend() string

ResolveBackend returns the actual backend to use based on configuration. If Backend is "auto", it detects the best available backend.

func (GPUConfig) Validate added in v1.22.82

func (c GPUConfig) Validate() error

Validate checks that the GPU configuration is valid.

type LowMemoryConfig added in v1.23.0

type LowMemoryConfig struct {
	// Enabled indicates low memory mode is active
	Enabled bool `json:"enabled"`

	// DBCacheSize is the database cache size in bytes
	// Default: 64MB, Low memory: 8MB
	DBCacheSize uint64 `json:"dbCacheSize"`

	// DBMemtableSize is the memtable size in bytes
	// Default: 64MB, Low memory: 8MB
	DBMemtableSize uint64 `json:"dbMemtableSize"`

	// StateCacheSize is the state cache size in bytes
	// Default: 256MB, Low memory: 16MB
	StateCacheSize uint64 `json:"stateCacheSize"`

	// BlockCacheSize is the block cache size in bytes
	// Default: 128MB, Low memory: 8MB
	BlockCacheSize uint64 `json:"blockCacheSize"`

	// DisableBloomFilters disables bloom filters to save memory
	DisableBloomFilters bool `json:"disableBloomFilters"`

	// LazyChainLoading defers chain loading until first request
	LazyChainLoading bool `json:"lazyChainLoading"`

	// SingleValidatorMode runs with a single validator
	SingleValidatorMode bool `json:"singleValidatorMode"`
}

LowMemoryConfig holds memory-related configuration for resource-constrained environments. Default mode uses standard production settings. Low memory mode targets <200MB idle, <500MB under load.

func DefaultLowMemoryConfig added in v1.23.0

func DefaultLowMemoryConfig() LowMemoryConfig

DefaultLowMemoryConfig returns the default configuration (standard profile).

func GetLowMemoryConfig added in v1.23.0

func GetLowMemoryConfig(v *viper.Viper) LowMemoryConfig

GetLowMemoryConfig builds a LowMemoryConfig from viper settings.

func GetMemoryConfigForProfile added in v1.23.0

func GetMemoryConfigForProfile(profile MemoryProfile) LowMemoryConfig

GetMemoryConfigForProfile returns config for the given memory profile.

func NewLowMemoryConfig added in v1.23.0

func NewLowMemoryConfig() LowMemoryConfig

NewLowMemoryConfig returns a configuration for low memory profile (<50MB).

func NewMaxMemoryConfig added in v1.23.0

func NewMaxMemoryConfig() LowMemoryConfig

NewMaxMemoryConfig returns a configuration for max memory profile (~512MB).

func (LowMemoryConfig) EstimatedMemoryUsage added in v1.23.0

func (c LowMemoryConfig) EstimatedMemoryUsage() (idle, load uint64)

EstimatedMemoryUsage returns an estimate of memory usage based on config.

type MemoryProfile added in v1.23.0

type MemoryProfile string

MemoryProfile defines memory usage profiles.

const (
	// MemoryProfileLow targets <50MB per node - for very resource-constrained environments
	MemoryProfileLow MemoryProfile = "low"
	// MemoryProfileStandard is the default, targets <100MB per node
	MemoryProfileStandard MemoryProfile = "standard"
	// MemoryProfileMax is for production/high-performance, ~512MB per node
	MemoryProfileMax MemoryProfile = "max"
)

type NFTTier added in v1.16.56

type NFTTier struct {
	Name              string
	RequiredLUX       uint64 // Base LUX requirement with NFT
	StakingMultiplier uint32 // Reward multiplier percentage
	MaxValidators     uint32 // Max validators in this tier
}

NFTTier represents different validator NFT tiers

type PrismParameters added in v1.16.56

type PrismParameters struct {
	NumParents          int
	NumNodes            int
	AlphaPreference     int
	AlphaConfidence     int
	K                   int
	MaxOutstandingItems int
}

PrismParameters contains prism protocol parameters

type RouterHealthConfig added in v1.16.56

type RouterHealthConfig struct {
	MaxTimeSinceMsgReceived time.Duration
	MaxTimeSinceMsgSent     time.Duration
	MaxPortionSendQueueFull float64
	MinConnectedPeers       uint
	ReadTimeout             time.Duration
	WriteTimeout            time.Duration
	MaxSendFailRate         float64
	MaxDropRate             float64
	MaxOutstandingRequests  int
	MaxOutstandingDuration  time.Duration
	MaxRunTimeRequests      time.Duration
	MaxDropRateHalflife     time.Duration
}

RouterHealthConfig contains configuration for router health checks

type StakingConfig added in v1.16.56

type StakingConfig struct {
	// Minimum stake: 1M LUX for validators
	MinimumValidatorStake uint64

	// NFT staking tiers
	NFTStakingEnabled bool
	NFTTiers          []NFTTier

	// Delegation parameters
	MinimumDelegatorStake uint64
	MaxDelegationRatio    uint32

	// Chain-specific validator requirements
	ChainValidatorRequirements map[string]ChainStakeRequirement

	// Combined staking (NFT + delegation + staked) to reach minimum
	AllowCombinedStaking bool
}

StakingConfig defines staking parameters

type TokenomicsConfig added in v1.16.56

type TokenomicsConfig struct {
	// Total supply: 2T tokens
	TotalSupply uint64

	// Airdrop configuration for legacy token holders
	AirdropConfig AirdropConfig

	// Staking requirements
	StakingConfig StakingConfig

	// Chain-specific allocations
	ChainAllocations map[string]uint64
}

TokenomicsConfig defines the token economics for the Lux Network

func DefaultTokenomicsConfig added in v1.16.56

func DefaultTokenomicsConfig() *TokenomicsConfig

DefaultTokenomicsConfig returns the default tokenomics configuration

func (*TokenomicsConfig) GetMinimumStake added in v1.16.56

func (c *TokenomicsConfig) GetMinimumStake(hasNFT bool, nftTier string) uint64

GetMinimumStake returns the minimum stake based on NFT ownership

func (*TokenomicsConfig) GetStakingMultiplier added in v1.16.56

func (c *TokenomicsConfig) GetStakingMultiplier(nftTier string) uint32

GetStakingMultiplier returns the reward multiplier for a given NFT tier

type TrackerTargeterConfig added in v1.16.56

type TrackerTargeterConfig struct {
	VdrAlloc           float64 `json:"vdrAlloc"`
	MaxNonVdrUsage     float64 `json:"maxNonVdrUsage"`
	MaxNonVdrNodeUsage float64 `json:"maxNonVdrNodeUsage"`
}

TrackerTargeterConfig contains resource allocation configurations

Directories

Path Synopsis
Package spec provides a machine-readable specification of all luxd configuration flags.
Package spec provides a machine-readable specification of all luxd configuration flags.

Jump to

Keyboard shortcuts

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