utils

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: GPL-3.0 Imports: 47 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ****************************************
	// **                                    **
	// **         GLOBAL FLAGS               **
	// **                                    **
	// ****************************************
	ConfigDirFlag = Flag{
		Name:         c_GlobalFlagPrefix + "config-dir",
		Abbreviation: "c",
		Value:        xdg.ConfigHome + "/" + constants.APP_NAME + "/",
		Usage:        "config directory" + generateEnvDoc(c_GlobalFlagPrefix+"config-dir"),
	}

	DataDirFlag = Flag{
		Name:         c_GlobalFlagPrefix + "data-dir",
		Abbreviation: "d",
		Value:        filepath.Join(xdg.DataHome, constants.APP_NAME),
		Usage:        "data directory" + generateEnvDoc(c_GlobalFlagPrefix+"data-dir"),
	}

	InitConfigFlag = Flag{
		Name:  c_GlobalFlagPrefix + "init-cfg",
		Value: false,
		Usage: "initialize a new config file, if one does not already exist",
	}

	AncientDirFlag = Flag{
		Name:  c_GlobalFlagPrefix + "datadir-ancient",
		Value: "",
		Usage: "Data directory for ancient chain segments (default = inside chaindata)" + generateEnvDoc(c_GlobalFlagPrefix+"datadir-ancient"),
	}

	LogLevelFlag = Flag{
		Name:         c_GlobalFlagPrefix + "log-level",
		Abbreviation: "l",
		Value:        "info",
		Usage:        "log level (trace, debug, info, warn, error, fatal, panic)" + generateEnvDoc(c_GlobalFlagPrefix+"log-level"),
	}

	LogSizeFlag = Flag{
		Name:  c_GlobalFlagPrefix + "log-size",
		Value: 500,
		Usage: "maximum log file size in MB before rolling (default = no limit)" + generateEnvDoc(c_GlobalFlagPrefix+"log-size"),
	}
)
View Source
var (
	// ****************************************
	// **                                    **
	// **         NODE FLAGS                 **
	// **                                    **
	// ****************************************
	IPAddrFlag = Flag{
		Name:         c_NodeFlagPrefix + "ipaddr",
		Abbreviation: "i",
		Value:        "0.0.0.0",
		Usage:        "ip address to listen on" + generateEnvDoc(c_NodeFlagPrefix+"ipaddr"),
	}

	P2PPortFlag = Flag{
		Name:         c_NodeFlagPrefix + "port",
		Abbreviation: "p",
		Value:        "4001",
		Usage:        "p2p port to listen on" + generateEnvDoc(c_NodeFlagPrefix+"port"),
	}

	BootPeersFlag = Flag{
		Name:  c_NodeFlagPrefix + "bootpeers",
		Value: []string{},
		Usage: "list of bootstrap peers. Syntax: <multiaddress1>,<multiaddress2>,..." + generateEnvDoc(c_NodeFlagPrefix+"bootpeers"),
	}

	PortMapFlag = Flag{
		Name:  c_NodeFlagPrefix + "portmap",
		Value: true,
		Usage: "enable NAT portmap" + generateEnvDoc(c_NodeFlagPrefix+"portmap"),
	}

	KeyFileFlag = Flag{
		Name:         c_NodeFlagPrefix + "private-key",
		Abbreviation: "k",
		Value:        "",
		Usage:        "file containing node private key" + generateEnvDoc(c_NodeFlagPrefix+"private-key"),
	}

	MinPeersFlag = Flag{
		Name:  c_NodeFlagPrefix + "min-peers",
		Value: "5",
		Usage: "minimum number of peers to maintain connectivity with" + generateEnvDoc(c_NodeFlagPrefix+"min-peers"),
	}

	MaxPeersFlag = Flag{
		Name:  c_NodeFlagPrefix + "max-peers",
		Value: "50",
		Usage: "maximum number of peers to maintain connectivity with" + generateEnvDoc(c_NodeFlagPrefix+"max-peers"),
	}

	LocationFlag = Flag{
		Name:  c_NodeFlagPrefix + "location",
		Value: "",
		Usage: "region and zone location" + generateEnvDoc(c_NodeFlagPrefix+"location"),
	}

	SoloFlag = Flag{
		Name:         c_NodeFlagPrefix + "solo",
		Abbreviation: "s",
		Value:        false,
		Usage:        "start the node as a solo node (will not reach out to bootstrap peers)" + generateEnvDoc(c_NodeFlagPrefix+"solo"),
	}

	DBEngineFlag = Flag{
		Name:  c_NodeFlagPrefix + "db-engine",
		Value: "leveldb",
		Usage: "Backing database implementation to use ('leveldb' or 'pebble')" + generateEnvDoc(c_NodeFlagPrefix+"db-engine"),
	}

	NetworkIdFlag = Flag{
		Name:  c_NodeFlagPrefix + "networkid",
		Value: 1,
		Usage: "Explicitly set network id (integer)(For testnets: use --garden)" + generateEnvDoc(c_NodeFlagPrefix+"networkid"),
	}

	SlicesRunningFlag = Flag{
		Name:  c_NodeFlagPrefix + "slices",
		Value: "",
		Usage: "All the slices that are running on this node" + generateEnvDoc(c_NodeFlagPrefix+"slices"),
	}

	DevPeriodFlag = Flag{
		Name:  c_NodeFlagPrefix + "dev-period",
		Value: 0,
		Usage: "Block period to use for the dev network (integer) (0 = mine only if transaction pending)" + generateEnvDoc(c_NodeFlagPrefix+"dev-period"),
	}

	IdentityFlag = Flag{
		Name:  c_NodeFlagPrefix + "identity",
		Value: "",
		Usage: "Custom node name" + generateEnvDoc(c_NodeFlagPrefix+"identity"),
	}

	DocRootFlag = Flag{
		Name:  c_NodeFlagPrefix + "docroot",
		Value: xdg.DataHome,
		Usage: "Document Root for HTTPClient file scheme" + generateEnvDoc(c_NodeFlagPrefix+"docroot"),
	}

	SnapshotFlag = Flag{
		Name:  c_NodeFlagPrefix + "snapshot",
		Value: true,
		Usage: `Enables snapshot-database mode (default = true)` + generateEnvDoc(c_NodeFlagPrefix+"snapshot"),
	}

	TxLookupLimitFlag = Flag{
		Name:  c_NodeFlagPrefix + "txlookuplimit",
		Value: quaiconfig.Defaults.TxLookupLimit,
		Usage: "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain)" + generateEnvDoc(c_NodeFlagPrefix+"txlookuplimit"),
	}

	WhitelistFlag = Flag{
		Name:  c_NodeFlagPrefix + "whitelist",
		Value: "",
		Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)" + generateEnvDoc(c_NodeFlagPrefix+"whitelist"),
	}

	BloomFilterSizeFlag = Flag{
		Name:  c_NodeFlagPrefix + "bloomfilter-size",
		Value: 2048,
		Usage: "Megabytes of memory allocated to bloom-filter for pruning" + generateEnvDoc(c_NodeFlagPrefix+"bloomfilter-size"),
	}

	TxPoolLocalsFlag = Flag{
		Name:  c_TXPoolPrefix + "locals",
		Value: "",
		Usage: "Comma separated accounts to treat as locals (no flush, priority inclusion)" + generateEnvDoc(c_TXPoolPrefix+"locals"),
	}

	TxPoolNoLocalsFlag = Flag{
		Name:  c_TXPoolPrefix + "nolocals",
		Value: false,
		Usage: "Disables price exemptions for locally submitted transactions" + generateEnvDoc(c_TXPoolPrefix+"nolocals"),
	}

	TxPoolJournalFlag = Flag{
		Name:  c_TXPoolPrefix + "journal",
		Value: core.DefaultTxPoolConfig.Journal,
		Usage: "Disk journal for local transaction to survive node restarts" + generateEnvDoc(c_TXPoolPrefix+"journal"),
	}

	TxPoolRejournalFlag = Flag{
		Name:  c_TXPoolPrefix + "rejournal",
		Value: core.DefaultTxPoolConfig.Rejournal,
		Usage: "Time interval to regenerate the local transaction journal" + generateEnvDoc(c_TXPoolPrefix+"rejournal"),
	}

	TxPoolPriceLimitFlag = Flag{
		Name:  c_TXPoolPrefix + "pricelimit",
		Value: quaiconfig.Defaults.TxPool.PriceLimit,
		Usage: "Minimum gas price limit to enforce for acceptance into the pool" + generateEnvDoc(c_TXPoolPrefix+"pricelimit"),
	}

	TxPoolPriceBumpFlag = Flag{
		Name:  c_TXPoolPrefix + "pricebump",
		Value: quaiconfig.Defaults.TxPool.PriceBump,
		Usage: "Price bump percentage to replace an already existing transaction" + generateEnvDoc(c_TXPoolPrefix+"pricebump"),
	}

	TxPoolAccountSlotsFlag = Flag{
		Name:  c_TXPoolPrefix + "accountslots",
		Value: quaiconfig.Defaults.TxPool.AccountSlots,
		Usage: "Minimum number of executable transaction slots guaranteed per account" + generateEnvDoc(c_TXPoolPrefix+"accountslots"),
	}

	TxPoolGlobalSlotsFlag = Flag{
		Name:  c_TXPoolPrefix + "globalslots",
		Value: quaiconfig.Defaults.TxPool.GlobalSlots,
		Usage: "Maximum number of executable transaction slots for all accounts" + generateEnvDoc(c_TXPoolPrefix+"globalslots"),
	}

	TxPoolAccountQueueFlag = Flag{
		Name:  c_TXPoolPrefix + "accountqueue",
		Value: quaiconfig.Defaults.TxPool.AccountQueue,
		Usage: "Maximum number of non-executable transaction slots permitted per account" + generateEnvDoc(c_TXPoolPrefix+"accountqueue"),
	}

	TxPoolGlobalQueueFlag = Flag{
		Name:  c_TXPoolPrefix + "globalqueue",
		Value: quaiconfig.Defaults.TxPool.GlobalQueue,
		Usage: "Maximum number of non-executable transaction slots for all accounts" + generateEnvDoc(c_TXPoolPrefix+"globalqueue"),
	}

	TxPoolLifetimeFlag = Flag{
		Name:  c_TXPoolPrefix + "lifetime",
		Value: quaiconfig.Defaults.TxPool.Lifetime,
		Usage: "Maximum amount of time non-executable transaction are queued" + generateEnvDoc(c_TXPoolPrefix+"lifetime"),
	}

	TxPoolSharingClientsFlag = Flag{
		Name:  c_TXPoolPrefix + "sharing-clients",
		Value: "",
		Usage: "Comma separated list of clients end points that the node would directy share the transactions with" + generateEnvDoc(c_TXPoolPrefix+"sharing-clients"),
	}

	CacheFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache",
		Value: 1024,
		Usage: "Megabytes of memory allocated to internal caching (default = 4096 quai full node, 128 light mode)" + generateEnvDoc(c_NodeFlagPrefix+"cache"),
	}

	CacheDatabaseFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-database",
		Value: 50,
		Usage: "Percentage of cache memory allowance to use for database io" + generateEnvDoc(c_NodeFlagPrefix+"cache-database"),
	}

	CacheTrieFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-trie",
		Value: 15,
		Usage: "Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode)" + generateEnvDoc(c_NodeFlagPrefix+"cache-trie"),
	}

	CacheTrieJournalFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-trie-journal",
		Value: quaiconfig.Defaults.TrieCleanCacheJournal,
		Usage: "Disk journal directory for trie cache to survive node restarts" + generateEnvDoc(c_NodeFlagPrefix+"cache-trie-journal"),
	}

	CacheTrieRejournalFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-trie-rejournal",
		Value: quaiconfig.Defaults.TrieCleanCacheRejournal,
		Usage: "Time interval to regenerate the trie cache journal" + generateEnvDoc(c_NodeFlagPrefix+"cache-trie-rejournal"),
	}

	CacheGCFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-gc",
		Value: 25,
		Usage: "Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode)" + generateEnvDoc(c_NodeFlagPrefix+"cache-gc"),
	}

	CacheSnapshotFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-snapshot",
		Value: 10,
		Usage: "Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode)" + generateEnvDoc(c_NodeFlagPrefix+"cache-snapshot"),
	}

	CacheNoPrefetchFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-noprefetch",
		Value: false,
		Usage: "Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)" + generateEnvDoc(c_NodeFlagPrefix+"cache-noprefetch"),
	}

	CachePreimagesFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-preimages",
		Value: false,
		Usage: "Enable recording the SHA3/keccak preimages of trie keys" + generateEnvDoc(c_NodeFlagPrefix+"cache-preimages"),
	}

	ConsensusEngineFlag = Flag{
		Name:  c_NodeFlagPrefix + "consensus-engine",
		Value: "progpow",
		Usage: "Consensus engine that the blockchain will run and verify blocks using" + generateEnvDoc(c_NodeFlagPrefix+"consensus-engine"),
	}

	MinerGasPriceFlag = Flag{
		Name:  c_NodeFlagPrefix + "miner-gasprice",
		Value: newBigIntValue(quaiconfig.Defaults.Miner.GasPrice),
		Usage: "Minimum gas price for mining a transaction" + generateEnvDoc(c_NodeFlagPrefix+"miner-gasprice"),
	}

	UnlockedAccountFlag = Flag{
		Name:  c_NodeFlagPrefix + "unlock",
		Value: "",
		Usage: "Comma separated list of accounts to unlock" + generateEnvDoc(c_NodeFlagPrefix+"unlock"),
	}

	PasswordFileFlag = Flag{
		Name:  c_NodeFlagPrefix + "password",
		Value: "",
		Usage: "Password file to use for non-interactive password input" + generateEnvDoc(c_NodeFlagPrefix+"password"),
	}

	KeyStoreDirFlag = Flag{
		Name:  c_NodeFlagPrefix + "keystore",
		Value: "",
		Usage: "Directory for the keystore (default = inside the datadir)",
	}

	VMEnableDebugFlag = Flag{
		Name:  c_NodeFlagPrefix + "vmdebug",
		Value: false,
		Usage: "Record information useful for VM and contract debugging" + generateEnvDoc(c_NodeFlagPrefix+"vmdebug"),
	}

	PprofFlag = Flag{
		Name:  c_NodeFlagPrefix + "pprof",
		Value: false,
		Usage: "Enable the pprof HTTP server",
	}

	InsecureUnlockAllowedFlag = Flag{
		Name:  c_NodeFlagPrefix + "allow-insecure-unlock",
		Value: false,
		Usage: "Allow insecure account unlocking when account-related RPCs are exposed by http" + generateEnvDoc(c_NodeFlagPrefix+"allow-insecure-unlock"),
	}

	QuaiCoinbaseFlag = Flag{
		Name:  c_NodeFlagPrefix + "quai-coinbases",
		Value: "",
		Usage: "Input TOML string or path to TOML file" + generateEnvDoc(c_NodeFlagPrefix+"quai-coinbase"),
	}

	QiCoinbaseFlag = Flag{
		Name:  c_NodeFlagPrefix + "qi-coinbases",
		Value: "",
		Usage: "Input TOML string or path to TOML file" + generateEnvDoc(c_NodeFlagPrefix+"qi-coinbase"),
	}

	MinerPreferenceFlag = Flag{
		Name:  c_NodeFlagPrefix + "miner-preference",
		Value: 0.5,
		Usage: "Indicates preference towards mining Quai or Qi. Any value between 0 and 1 is valid. Neutral: 0.5, Quai only: 0, Qi only: 1" + generateEnvDoc(c_NodeFlagPrefix+"miner-preference"),
	}

	CoinbaseLockupFlag = Flag{
		Name:  c_NodeFlagPrefix + "coinbase-lockup",
		Value: 0,
		Usage: "Lockup byte used to determine the number of blocks that coinbase rewards are locked for" + generateEnvDoc(c_NodeFlagPrefix+"coinbase-lockup"),
	}

	IndexAddressUtxos = Flag{
		Name:  c_NodeFlagPrefix + "index-address-utxos",
		Value: false,
		Usage: "Index address utxos" + generateEnvDoc(c_NodeFlagPrefix+"index-address-utxos"),
	}

	EnvironmentFlag = Flag{
		Name:  c_NodeFlagPrefix + "environment",
		Value: params.ColosseumName,
		Usage: "environment to run in (local, colosseum, garden, orchard, lighthouse, dev)" + generateEnvDoc(c_NodeFlagPrefix+"environment"),
	}

	QuaiStatsURLFlag = Flag{
		Name:  c_NodeFlagPrefix + "quaistats",
		Value: "",
		Usage: "Reporting URL of a quaistats service (nodename:secret@host:port)" + generateEnvDoc(c_NodeFlagPrefix+"quaistats"),
	}

	SendFullStatsFlag = Flag{
		Name:  c_NodeFlagPrefix + "sendfullstats",
		Value: false,
		Usage: "Send full stats boolean flag for quaistats" + generateEnvDoc(c_NodeFlagPrefix+"sendfullstats"),
	}

	StartingExpansionNumberFlag = Flag{
		Name:  c_NodeFlagPrefix + "starting-expansion-num",
		Value: 0,
		Usage: "Start the node at the expansion number preferred" + generateEnvDoc(c_NodeFlagPrefix+"starting-expansion-num"),
	}

	NodeLogLevelFlag = Flag{
		Name:  c_NodeFlagPrefix + "log-level",
		Value: "info",
		Usage: "log level (trace, debug, info, warn, error, fatal, panic)" + generateEnvDoc(c_GlobalFlagPrefix+"log-level"),
	}

	GenesisNonce = Flag{
		Name:  c_NodeFlagPrefix + "genesis-nonce",
		Value: 0,
		Usage: "Nonce to use for the genesis block" + generateEnvDoc(c_NodeFlagPrefix+"genesis-nonce"),
	}
)
View Source
var (
	// ****************************************
	// **                                    **
	// ** 	      RPC FLAGS                  **
	// **                                    **
	// ****************************************
	HTTPEnabledFlag = Flag{
		Name:  c_RPCFlagPrefix + "http",
		Value: true,
		Usage: "Enable the HTTP-RPC server" + generateEnvDoc(c_RPCFlagPrefix+"http"),
	}

	HTTPListenAddrFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-addr",
		Value: node.DefaultHTTPHost,
		Usage: "HTTP-RPC server listening interface" + generateEnvDoc(c_RPCFlagPrefix+"http-addr"),
	}

	HTTPCORSDomainFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-corsdomain",
		Value: "",
		Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)" + generateEnvDoc(c_RPCFlagPrefix+"http-corsdomain"),
	}

	HTTPVirtualHostsFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-vhosts",
		Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
		Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard." + generateEnvDoc(c_RPCFlagPrefix+"http-vhosts"),
	}

	HTTPApiFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-api",
		Value: "",
		Usage: "API's offered over the HTTP-RPC interface" + generateEnvDoc(c_RPCFlagPrefix+"http-api"),
	}

	HTTPPathPrefixFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-rpcprefix",
		Value: "",
		Usage: "HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths." + generateEnvDoc(c_RPCFlagPrefix+"http-rpcprefix"),
	}

	HTTPPortStartFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-port",
		Value: 9001,
		Usage: "HTTP-RPC server listening port" + generateEnvDoc(c_RPCFlagPrefix+"http-port"),
	}

	WSEnabledFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws",
		Value: true,
		Usage: "Enable the WS-RPC server" + generateEnvDoc(c_RPCFlagPrefix+"ws"),
	}

	WSListenAddrFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-addr",
		Value: node.DefaultWSHost,
		Usage: "WS-RPC server listening interface" + generateEnvDoc(c_RPCFlagPrefix+"ws-addr"),
	}

	WSMaxSubsFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-max-subs",
		Value: 1000,
		Usage: "maximum concurrent subscribers to the WS-RPC server",
	}

	WSApiFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-api",
		Value: "",
		Usage: "API's offered over the WS-RPC interface" + generateEnvDoc(c_RPCFlagPrefix+"ws-api"),
	}

	WSAllowedOriginsFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-origins",
		Value: "",
		Usage: "Origins from which to accept websockets requests" + generateEnvDoc(c_RPCFlagPrefix+"ws-origins"),
	}

	WSPathPrefixFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-rpcprefix",
		Value: "",
		Usage: "HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths." + generateEnvDoc(c_RPCFlagPrefix+"ws-rpcprefix"),
	}

	WSPortStartFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-port",
		Value: 8001,
		Usage: "WS-RPC server listening port" + generateEnvDoc(c_RPCFlagPrefix+"ws-port"),
	}

	PreloadJSFlag = Flag{
		Name:  c_RPCFlagPrefix + "preload",
		Value: "",
		Usage: "Comma separated list of JavaScript files to preload into the console" + generateEnvDoc(c_RPCFlagPrefix+"preload"),
	}

	RPCGlobalTxFeeCapFlag = Flag{
		Name:  c_RPCFlagPrefix + "txfeecap",
		Value: 0,
		Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)",
	}

	RPCGlobalGasCapFlag = Flag{
		Name:  c_RPCFlagPrefix + "gascap",
		Value: quaiconfig.Defaults.RPCGasCap,
		Usage: "Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite)" + generateEnvDoc(c_RPCFlagPrefix+"gascap"),
	}
)
View Source
var (
	// ****************************************
	// **                                    **
	// **         WORKSHARE FLAGS            **
	// **                                    **
	// ****************************************
	WorkShareMiningFlag = Flag{
		Name:  c_WorkShareFlagPrefix + "mining",
		Value: false,
		Usage: "Enable workshare mining" + generateEnvDoc(c_WorkShareFlagPrefix+"mining"),
	}

	WorkShareThresholdFlag = Flag{
		Name:  c_WorkShareFlagPrefix + "threshold",
		Value: 10,
		Usage: "Threshold for workshare" + generateEnvDoc(c_WorkShareFlagPrefix+"threshold"),
	}

	WorkShareMinerEndpoints = Flag{
		Name:  c_WorkShareFlagPrefix + "miners",
		Value: "",
		Usage: "RPC endpoint to send minimally mined transactions for further working" + generateEnvDoc(c_WorkShareFlagPrefix+"miners"),
	}
)
View Source
var (
	// ****************************************
	// **                                    **
	// **         METRICS FLAGS              **
	// **                                    **
	// ****************************************
	MetricsEnabledFlag = Flag{
		Name:  c_MetricsFlagPrefix + "enabled",
		Value: false,
		Usage: "Enable metrics collection and reporting" + generateEnvDoc(c_MetricsFlagPrefix+"enabled"),
	}
	MetricsEnabledExpensiveFlag = Flag{
		Name:  c_MetricsFlagPrefix + "metrics-expensive",
		Value: false,
		Usage: "Enable expensive metrics collection and reporting" + generateEnvDoc(c_MetricsFlagPrefix+"metrics-expensive"),
	}
	MetricsHTTPFlag = Flag{
		Name:  c_MetricsFlagPrefix + "metrics-addr",
		Value: metrics_config.DefaultConfig.HTTP,
		Usage: "Enable stand-alone metrics HTTP server listening interface" + generateEnvDoc(c_MetricsFlagPrefix+"metrics-addr"),
	}
	MetricsPortFlag = Flag{
		Name:  c_MetricsFlagPrefix + "metrics-port",
		Value: metrics_config.DefaultConfig.Port,
		Usage: "Metrics HTTP server listening port" + generateEnvDoc(c_MetricsFlagPrefix+"metrics-port"),
	}
)
View Source
var PeersFlags = []Flag{
	PeersLogLevelFlag,
}
View Source
var (
	// ****************************************
	// **                                    **
	// **           PEERS FLAGS              **
	// **                                    **
	// ****************************************
	PeersLogLevelFlag = Flag{
		Name:  c_PeersFlagPrefix + "log-level",
		Value: "info",
		Usage: "log level (trace, debug, info, warn, error, fatal, panic)" + generateEnvDoc(c_GlobalFlagPrefix+"log-level"),
	}
)

Functions

func CheckExclusive

func CheckExclusive(args ...interface{})

CheckExclusive verifies that only a single instance of the provided flags was set by the user. Each flag might optionally be followed by a string type to specialize it further.

func CopyConstraintMap added in v0.32.0

func CopyConstraintMap(constraintMap map[string]common.Hash) map[string]common.Hash

func CreateAndBindFlag added in v0.29.0

func CreateAndBindFlag(flag Flag, cmd *cobra.Command)

func EnablePprof added in v0.29.0

func EnablePprof()

func Fatalf

func Fatalf(format string, args ...interface{})

Fatalf formats a message to standard error and exits the program. The message is also printed to standard output if standard error is redirected to a different file.

func GetHttpPort added in v0.29.0

func GetHttpPort(nodeLocation common.Location) int

func GetRunningRegions added in v0.29.0

func GetRunningRegions(runningSlices []common.Location) []byte

getRegionsRunning returns the regions running

func GetRunningZones added in v0.29.0

func GetRunningZones() []common.Location

GetRunningZones returns the slices that are processing state (which are only zones)

func GetWSPort added in v0.29.0

func GetWSPort(nodeLocation common.Location) int

func HexAddress

func HexAddress(account string, nodeLocation common.Location) (common.Address, error)

HexAddress converts an account specified directly as a hex encoded string or a key index in the key store to an internal account representation.

func InitConfig added in v0.29.0

func InitConfig()

InitConfig initializes the viper config instance ensuring that environment variables take precedence over config file parameters. Environment variables should be prefixed with the application name (e.g. QUAI_LOG_LEVEL). If the flag SAVE_CONFIG_FILE is set to true, the config file will be saved or updated with the current config parameters. It panics if an error occurs while reading the config file.

func IsValidEnvironment added in v0.29.0

func IsValidEnvironment(env string) bool

func MakeChainDatabase

func MakeChainDatabase(stack *node.Node, readonly bool) ethdb.Database

MakeChainDatabase open an LevelDB using the flags passed to the client and will hard crash if it fails.

func MakeConsolePreloads

func MakeConsolePreloads() []string

MakeConsolePreloads retrieves the absolute paths for the console JavaScript scripts to preload before starting.

func MakeDatabaseHandles

func MakeDatabaseHandles() int

MakeDatabaseHandles raises out the number of allowed file handles per process for Quai and returns half of the allowance to assign to the database.

func MakeGenesis

func MakeGenesis() *core.Genesis

func MakePasswordList

func MakePasswordList() []string

MakePasswordList reads password lines from the file specified by the global --password flag.

func OpenBackendDB added in v0.29.0

func OpenBackendDB() (*leveldb.DB, error)

func ParseCoinbaseAddresses added in v0.29.0

func ParseCoinbaseAddresses() (map[string]common.Address, error)

ParseCoinbaseAddresses reads the coinbase addresses and performs necessary validation.

func PrintConstraintMap added in v0.32.0

func PrintConstraintMap(constraintMap map[string]common.Hash)

func RegisterQuaiService added in v0.29.0

func RegisterQuaiService(stack *node.Node, p2p quai.NetworkingAPI, cfg quaiconfig.Config, nodeCtx int, currentExpansionNumber uint8, startingExpansionNumber uint64, genesisBlock *types.WorkObject, logger *log.Logger) (quaiapi.Backend, error)

RegisterQuaiService adds a Quai client to the stack. The second return value is the full node instance, which may be nil if the node is running as a light client.

func RegisterQuaiStatsService

func RegisterQuaiStatsService(stack *node.Node, backend quaiapi.Backend, url string, sendfullstats bool)

RegisterQuaiStatsService configures the Quai Stats daemon and adds it to the given node.

func SetNodeConfig

func SetNodeConfig(cfg *node.Config, nodeLocation common.Location, logger *log.Logger)

SetNodeConfig applies node-related command line flags to the config.

func SetQuaiConfig added in v0.29.0

func SetQuaiConfig(stack *node.Node, cfg *quaiconfig.Config, slicesRunning []common.Location, nodeLocation common.Location, currentExpansionNumber uint8, logger *log.Logger)

SetQuaiConfig applies quai-related command line flags to the config.

func SplitAndTrim

func SplitAndTrim(input string) (ret []string)

SplitAndTrim splits input separated by a comma and trims excessive white space from the substrings.

func SplitTagsFlag

func SplitTagsFlag(tagsFlag string) map[string]string

func StartNode

func StartNode(stack *node.Node)

func WriteDefaultConfigFile added in v0.29.0

func WriteDefaultConfigFile(configDir string, configFileName string, configType string) error

Write the default values of each flag to a file

Types

type BigIntValue added in v0.29.0

type BigIntValue big.Int

**************************************** ** ** ** BIG INT FLAG ** ** & CUSTOM VALUE ** ** ** ****************************************

func (*BigIntValue) Set added in v0.29.0

func (b *BigIntValue) Set(val string) error

func (*BigIntValue) String added in v0.29.0

func (b *BigIntValue) String() string

func (*BigIntValue) Type added in v0.29.0

func (b *BigIntValue) Type() string

type Flag added in v0.29.0

type Flag struct {
	Name         string
	Abbreviation string
	Value        interface{}
	Usage        string
}

GenericFlag encapsulates common attributes and an interface for value

func (*Flag) GetAbbreviation added in v0.29.0

func (f *Flag) GetAbbreviation() string

func (*Flag) GetName added in v0.29.0

func (f *Flag) GetName() string

Implementing the Flag interface

func (*Flag) GetUsage added in v0.29.0

func (f *Flag) GetUsage() string

func (*Flag) GetValue added in v0.29.0

func (f *Flag) GetValue() interface{}

type HierarchicalCoordinator added in v0.29.0

type HierarchicalCoordinator struct {
	// contains filtered or unexported fields
}

func NewHierarchicalCoordinator added in v0.29.0

func NewHierarchicalCoordinator(p2p quai.NetworkingAPI, logLevel string, nodeWg *sync.WaitGroup, startingExpansionNumber uint64) *HierarchicalCoordinator

NewHierarchicalCoordinator creates a new instance of the HierarchicalCoordinator

func (*HierarchicalCoordinator) Add added in v0.33.0

func (hc *HierarchicalCoordinator) Add(entropy *big.Int, node NodeSet, newPendingHeaders *PendingHeaders)

func (*HierarchicalCoordinator) BuildPendingHeaders added in v0.32.0

func (hc *HierarchicalCoordinator) BuildPendingHeaders(wo *types.WorkObject, order int, newEntropy *big.Int)

func (*HierarchicalCoordinator) CalculateLeaders added in v0.32.0

func (hc *HierarchicalCoordinator) CalculateLeaders(badHashes map[common.Hash]bool) []Node

func (*HierarchicalCoordinator) ChainEventLoop added in v0.32.0

func (hc *HierarchicalCoordinator) ChainEventLoop(chainEvent chan core.ChainEvent, sub event.Subscription)

func (*HierarchicalCoordinator) ComputeMapPending added in v0.33.0

func (hc *HierarchicalCoordinator) ComputeMapPending(head core.ChainEvent)

func (*HierarchicalCoordinator) ComputePendingHeader added in v0.32.0

func (hc *HierarchicalCoordinator) ComputePendingHeader(wg *sync.WaitGroup, primeNode, regionNode, zoneNode common.Hash, location common.Location)

func (*HierarchicalCoordinator) ComputePendingHeaders added in v0.33.0

func (hc *HierarchicalCoordinator) ComputePendingHeaders(nodeSet NodeSet)

func (*HierarchicalCoordinator) ConsensusBackend added in v0.29.0

func (hc *HierarchicalCoordinator) ConsensusBackend() quai.ConsensusAPI

func (*HierarchicalCoordinator) Get added in v0.33.0

func (hc *HierarchicalCoordinator) Get(entropy *big.Int) (NodeSet, bool)

func (*HierarchicalCoordinator) GetBackend added in v0.32.0

func (hc *HierarchicalCoordinator) GetBackend(location common.Location) quaiapi.Backend

func (*HierarchicalCoordinator) GetBackendForLocationAndOrder added in v0.32.0

func (hc *HierarchicalCoordinator) GetBackendForLocationAndOrder(location common.Location, order int) quaiapi.Backend

func (*HierarchicalCoordinator) GetContextLocation added in v0.32.0

func (hc *HierarchicalCoordinator) GetContextLocation(location common.Location, ctx int) common.Location

func (*HierarchicalCoordinator) GetNodeListForLocation added in v0.32.0

func (hc *HierarchicalCoordinator) GetNodeListForLocation(location common.Location, badHashesList map[common.Hash]bool) []Node

func (*HierarchicalCoordinator) InitPendingHeaders added in v0.33.0

func (hc *HierarchicalCoordinator) InitPendingHeaders()

func (*HierarchicalCoordinator) IsAncestor added in v0.32.0

func (hc *HierarchicalCoordinator) IsAncestor(ancestor common.Hash, header common.Hash, headerLoc common.Location, order int) bool

func (*HierarchicalCoordinator) MapConstructProc added in v0.33.0

func (hc *HierarchicalCoordinator) MapConstructProc()

func (*HierarchicalCoordinator) NodeFromHash added in v0.33.0

func (hc *HierarchicalCoordinator) NodeFromHash(hash common.Hash, location common.Location) (Node, error)

func (*HierarchicalCoordinator) PendingHeadersMap added in v0.33.0

func (hc *HierarchicalCoordinator) PendingHeadersMap()

func (*HierarchicalCoordinator) ReapplicationLoop added in v0.33.0

func (hc *HierarchicalCoordinator) ReapplicationLoop(head core.ChainEvent)

func (*HierarchicalCoordinator) StartHierarchicalCoordinator added in v0.29.0

func (hc *HierarchicalCoordinator) StartHierarchicalCoordinator() error

func (*HierarchicalCoordinator) StartQuaiBackend added in v0.29.0

func (hc *HierarchicalCoordinator) StartQuaiBackend() (*quai.QuaiBackend, error)

Create a new instance of the QuaiBackend consensus service

func (*HierarchicalCoordinator) Stop added in v0.29.0

func (hc *HierarchicalCoordinator) Stop()

func (*HierarchicalCoordinator) TriggerTreeExpansion added in v0.29.0

func (hc *HierarchicalCoordinator) TriggerTreeExpansion(block *types.WorkObject) error

type Node added in v0.32.0

type Node struct {
	// contains filtered or unexported fields
}

func (*Node) Empty added in v0.32.0

func (ch *Node) Empty() bool

type NodeSet added in v0.33.0

type NodeSet struct {
	// contains filtered or unexported fields
}

func (*NodeSet) Copy added in v0.33.0

func (ns *NodeSet) Copy() NodeSet

func (*NodeSet) Entropy added in v0.33.0

func (ns *NodeSet) Entropy(numRegions int, numZones int) *big.Int

func (*NodeSet) Extendable added in v0.33.0

func (ns *NodeSet) Extendable(wo *types.WorkObject, order int) bool

func (*NodeSet) Update added in v0.33.0

func (ns *NodeSet) Update(wo *types.WorkObject, entropy *big.Int, order int)

type PendingHeaders added in v0.33.0

type PendingHeaders struct {
	// contains filtered or unexported fields
}

func NewPendingHeaders added in v0.33.0

func NewPendingHeaders() *PendingHeaders

type TextMarshaler

type TextMarshaler interface {
	encoding.TextMarshaler
	encoding.TextUnmarshaler
}

**************************************** ** ** ** TEXT MARSHALER FLAG ** ** & CUSTOM VALUE ** ** ** ****************************************

type TextMarshalerValue added in v0.29.0

type TextMarshalerValue struct {
	Value encoding.TextMarshaler
}

func NewTextMarshalerValue added in v0.29.0

func NewTextMarshalerValue(val encoding.TextMarshaler) *TextMarshalerValue

func (*TextMarshalerValue) Set added in v0.29.0

func (t *TextMarshalerValue) Set(val string) error

func (*TextMarshalerValue) String added in v0.29.0

func (t *TextMarshalerValue) String() string

func (*TextMarshalerValue) Type added in v0.29.0

func (t *TextMarshalerValue) Type() string

Jump to

Keyboard shortcuts

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