Files

288 lines
7.8 KiB
Go

// Copyright (C) 2022, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package constants
import (
"time"
)
const (
DefaultPerms755 = 0o755
BaseDirName = ".cli"
LogDir = "logs"
ServerRunFile = "gRPCserver.run"
LuxCliBinDir = "bin"
RunDir = "runs"
SuffixSeparator = "_"
SidecarFileName = "sidecar.json"
GenesisFileName = "genesis.json"
ElasticSubnetConfigFileName = "elastic_subnet_config.json"
SidecarSuffix = SuffixSeparator + SidecarFileName
GenesisSuffix = SuffixSeparator + GenesisFileName
NodeFileName = "node.json"
SidecarVersion = "1.4.0"
MaxLogFileSize = 4
MaxNumOfLogFiles = 5
RetainOldFiles = 0 // retain all old log files
RequestTimeout = 3 * time.Minute
E2ERequestTimeout = 30 * time.Second
SimulatePublicNetwork = "SIMULATE_PUBLIC_NETWORK"
TestnetAPIEndpoint = "https://api.lux-test.network"
MainnetAPIEndpoint = "https://api.lux.network"
// Cloud service constants
GCPCloudService = "gcp"
AWSCloudService = "aws"
E2EDocker = "e2e-docker"
GCPNodeAnsiblePrefix = "gcp_node"
AWSNodeAnsiblePrefix = "aws_node"
E2EDockerLoopbackHost = "127.0.0.1"
GCPDefaultImageProvider = "canonical"
GCPImageFilter = "ubuntu-os-cloud"
// SSH constants
SSHSleepBetweenChecks = 1 * time.Second
SSHFileOpsTimeout = 10 * time.Second
// this depends on bootstrap snapshot
LocalAPIEndpoint = "http://127.0.0.1:9630"
LocalNetworkID = 1337
DefaultTokenName = "TEST"
HealthCheckInterval = 100 * time.Millisecond
// it's unlikely anyone would want to name a snapshot `default`
// but let's add some more entropy
SnapshotsDirName = "snapshots"
DefaultSnapshotName = "default-1654102509"
BootstrapSnapshotArchiveName = "bootstrapSnapshot.tar.gz"
BootstrapSnapshotLocalPath = "assets/" + BootstrapSnapshotArchiveName
BootstrapSnapshotURL = "https://github.com/luxfi/cli/raw/main/" + BootstrapSnapshotLocalPath
BootstrapSnapshotSHA256URL = "https://github.com/luxfi/cli/raw/main/assets/sha256sum.txt"
CliInstallationURL = "https://raw.githubusercontent.com/luxfi/cli/main/scripts/install.sh"
ExpectedCliInstallErr = "resource temporarily unavailable"
KeyDir = "key"
KeySuffix = ".pk"
YAMLSuffix = ".yml"
ConfigDir = "config"
Enable = "enable"
Disable = "disable"
TimeParseLayout = "2006-01-02 15:04:05"
MinStakeDuration = 24 * 14 * time.Hour
MaxStakeDuration = 24 * 365 * time.Hour
MaxStakeWeight = 100
MinStakeWeight = 1
DefaultStakeWeight = 20
// The absolute minimum is 25 seconds, but set to 1 minute to allow for
// time to go through the command
StakingStartLeadTime = 1 * time.Minute
StakingMinimumLeadTime = 25 * time.Second
DefaultConfigFileName = ".cli"
DefaultConfigFileType = "json"
CustomVMDir = "vms"
LuxOrg = "luxfi"
LuxRepoName = "node"
EVMRepoName = "evm"
CliRepoName = "cli"
LuxInstallDir = "node"
EVMInstallDir = "evm"
EVMBin = "evm"
DefaultNodeRunURL = "http://127.0.0.1:9630"
// Latest EVM version
LatestEVMVersion = "v0.7.7"
LPMDir = ".lpm"
// Network ports
SSHTCPPort = 22
LuxdAPIPort = 9650
LuxdP2PPort = 9651
LuxdGrafanaPort = 3000
LuxdMonitoringPort = 9090
LuxdLokiPort = 3100
// Node roles
APIRole = "api"
ValidatorRole = "validator"
MonitorRole = "monitor"
WarpRelayerRole = "warp-relayer"
// Cloud constants
CloudOperationTimeout = 10 * time.Minute
GCPStaticIPPrefix = "lux-ip"
CloudServerStorageSize = 200
MonitoringCloudServerStorageSize = 500
)
// HTTPAccess represents HTTP access configuration
type HTTPAccess string
const (
// HTTPAccess values
HTTPAccessPublic HTTPAccess = "public"
HTTPAccessPrivate HTTPAccess = "private"
// SSH timeouts
SSHLongRunningScriptTimeout = 10 * time.Minute
LPMLogName = "lpm.log"
DefaultLuxPackage = "luxfi/plugins-core"
LPMPluginDir = "lpm_plugins"
// #nosec G101
GithubAPITokenEnvVarName = "LUX_CLI_GITHUB_TOKEN"
ReposDir = "repos"
SubnetDir = "subnets"
VMDir = "vms"
ChainConfigDir = "chains"
SubnetType = "subnet type"
SubnetConfigFileName = "subnet.json"
ChainConfigFileName = "chain.json"
PerNodeChainConfigFileName = "per-node-chain.json"
GitRepoCommitName = "Lux CLI"
GitRepoCommitEmail = "[email protected]"
LuxMaintainers = "luxfi"
UpgradeBytesFileName = "upgrade.json"
UpgradeBytesLockExtension = ".lock"
NotAvailableLabel = "Not available"
BackendCmd = "cli-backend"
LuxCompatibilityVersionAdded = "v1.9.2"
LuxCompatibilityURL = "https://raw.githubusercontent.com/luxfi/node/master/version/compatibility.json"
LuxdCompatibilityURL = "https://raw.githubusercontent.com/luxfi/node/master/version/compatibility.json"
EVMRPCCompatibilityURL = "https://raw.githubusercontent.com/luxfi/evm/main/compatibility.json"
CLILatestDependencyURL = "https://raw.githubusercontent.com/luxfi/cli/main/cli.json"
CLIMinVersionURL = "https://raw.githubusercontent.com/luxfi/cli/main/minVersion.json"
YesLabel = "Yes"
NoLabel = "No"
SubnetIDLabel = "SubnetID: "
BlockchainIDLabel = "BlockchainID: "
PluginDir = "plugins"
Network = "network"
SkipUpdateFlag = "skip-update-check"
LastFileName = ".last_actions.json"
DefaultWalletCreationTimeout = 5 * time.Second
DefaultConfirmTxTimeout = 20 * time.Second
// API request timeouts
ANRRequestTimeout = 30 * time.Second
APIRequestTimeout = 2 * time.Minute
APIRequestLargeTimeout = 10 * time.Minute
// Environment variables
CodespaceNameEnvVar = "CODESPACE_NAME"
// More cloud constants
ErrReleasingGCPStaticIP = "error releasing GCP static IP"
IPAddressSuffix = "-ip"
// Bootstrap validator
BootstrapValidatorBalanceNanoLUX = 2000000000000 // 2000 LUX in nanoLUX
// Default versions
DefaultLuxdVersion = "latest"
// PoS constants
PoSL1MinimumStakeDurationSeconds = 86400 // 24 hours
// Repository names
LuxdRepoName = "node"
SubnetEVMRepoName = "evm"
// Binary names
SubnetEVMBin = "evm"
// Default log level
DefaultAggregatorLogLevel = "info"
// File permissions
WriteReadReadPerms = 0o644
// Cloud node configuration
CloudNodeCLIConfigBasePath = "/home/ubuntu/.config/lux"
// SSH constants
AnsibleSSHShellParams = "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
RemoteSSHUser = "ubuntu"
// Ansible constants
AnsibleHostInventoryFileName = "hosts"
AnsibleSSHUseAgentParams = "-o ForwardAgent=yes"
// Staking constants
StakerCertFileName = "staker.crt"
BLSKeyFileName = "signer.key"
ValidatorUptimeDeductible = 20 * time.Minute
// Warp constants
WarpRelayerKeyName = "warp-relayer"
WarpServicesRepoName = "warp-services"
WarpRelayerKind = "warp-relayer"
WarpRelayerBin = "warp-relayer"
// Version tags
LatestPreReleaseVersionTag = "latest-prerelease"
LatestReleaseVersionTag = "latest"
// Monitoring constants
DashboardsDir = "dashboards"
// Cloud constants
DevnetFlagsProposerVMUseCurrentHeight = "--proposervm-use-current-height"
CloudNodeConfigPath = "/home/ubuntu/.lux-cli"
UpgradeFileName = "upgrade.json"
AliasesFileName = "aliases.json"
AWSCloudServerRunningState = "running"
// Git constants
GitExtension = ".git"
// Config constants
ConfigMetricsUserIDKey = "metrics.userID"
// Signature Aggregator
SignatureAggregator = "signature-aggregator"
// SSH constants
SSHScriptTimeout = 10 * time.Minute
// APM constants
ConfigLPMAdminAPIEndpointKey = "lpm.admin.api.endpoint"
// Metrics constants
ConfigMetricsEnabledKey = "metrics.enabled"
// Model types
SubnetEvm = "SubnetEVM"
)