flags

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const EnvVarPrefix = "NODE"

Variables

View Source
var (
	/* Required Flags */
	L1NodeAddr = &cli.StringFlag{
		Name:    "l1",
		Usage:   "Address of L1 User JSON-RPC endpoint to use (eth namespace required)",
		Value:   "http://127.0.0.1:8545",
		EnvVars: prefixEnvVars("L1_ETH_RPC"),
	}
	L2EngineAddr = &cli.StringFlag{
		Name:    "l2",
		Usage:   "Address of L2 Engine JSON-RPC endpoints to use (engine and eth namespace required)",
		EnvVars: prefixEnvVars("L2_ENGINE_RPC"),
	}
	RollupConfig = &cli.StringFlag{
		Name:    "rollup.config",
		Usage:   "Rollup chain parameters",
		EnvVars: prefixEnvVars("ROLLUP_CONFIG"),
	}
	Network = &cli.StringFlag{
		Name:    "network",
		Usage:   fmt.Sprintf("Predefined network selection. Available networks: %s", strings.Join(chaincfg.AvailableNetworks(), ", ")),
		EnvVars: prefixEnvVars("NETWORK"),
	}
	/* Optional Flags */
	RPCListenAddr = &cli.StringFlag{
		Name:    "rpc.addr",
		Usage:   "RPC listening address",
		EnvVars: prefixEnvVars("RPC_ADDR"),
		Value:   "127.0.0.1",
	}
	RPCListenPort = &cli.IntFlag{
		Name:    "rpc.port",
		Usage:   "RPC listening port",
		EnvVars: prefixEnvVars("RPC_PORT"),
		Value:   9545,
	}
	RPCEnableAdmin = &cli.BoolFlag{
		Name:    "rpc.enable-admin",
		Usage:   "Enable the admin API (experimental)",
		EnvVars: prefixEnvVars("RPC_ENABLE_ADMIN"),
	}
	RPCAdminPersistence = &cli.StringFlag{
		Name:    "rpc.admin-state",
		Usage:   "File path used to persist state changes made via the admin API so they persist across restarts. Disabled if not set.",
		EnvVars: prefixEnvVars("RPC_ADMIN_STATE"),
	}
	L1TrustRPC = &cli.BoolFlag{
		Name:    "l1.trustrpc",
		Usage:   "Trust the L1 RPC, sync faster at risk of malicious/buggy RPC providing bad or inconsistent L1 data",
		EnvVars: prefixEnvVars("L1_TRUST_RPC"),
	}
	L1RPCProviderKind = &cli.GenericFlag{
		Name: "l1.rpckind",
		Usage: "The kind of RPC provider, used to inform optimal transactions receipts fetching, and thus reduce costs. Valid options: " +
			openum.EnumString(sources.RPCProviderKinds),
		EnvVars: prefixEnvVars("L1_RPC_KIND"),
		Value: func() *sources.RPCProviderKind {
			out := sources.RPCKindBasic
			return &out
		}(),
	}
	L1RPCRateLimit = &cli.Float64Flag{
		Name:    "l1.rpc-rate-limit",
		Usage:   "Optional self-imposed global rate-limit on L1 RPC requests, specified in requests / second. Disabled if set to 0.",
		EnvVars: prefixEnvVars("L1_RPC_RATE_LIMIT"),
		Value:   0,
	}
	L1RPCMaxBatchSize = &cli.IntFlag{
		Name:    "l1.rpc-max-batch-size",
		Usage:   "Maximum number of RPC requests to bundle, e.g. during L1 blocks receipt fetching. The L1 RPC rate limit counts this as N items, but allows it to burst at once.",
		EnvVars: prefixEnvVars("L1_RPC_MAX_BATCH_SIZE"),
		Value:   20,
	}
	L1HTTPPollInterval = &cli.DurationFlag{
		Name:    "l1.http-poll-interval",
		Usage:   "Polling interval for latest-block subscription when using an HTTP RPC provider. Ignored for other types of RPC endpoints.",
		EnvVars: prefixEnvVars("L1_HTTP_POLL_INTERVAL"),
		Value:   time.Second * 12,
	}
	L2EngineJWTSecret = &cli.StringFlag{
		Name:        "l2.jwt-secret",
		Usage:       "Path to JWT secret key. Keys are 32 bytes, hex encoded in a file. A new key will be generated if left empty.",
		EnvVars:     prefixEnvVars("L2_ENGINE_AUTH"),
		Required:    false,
		Value:       "",
		Destination: new(string),
	}
	VerifierL1Confs = &cli.Uint64Flag{
		Name:     "verifier.l1-confs",
		Usage:    "Number of L1 blocks to keep distance from the L1 head before deriving L2 data from. Reorgs are supported, but may be slow to perform.",
		EnvVars:  prefixEnvVars("VERIFIER_L1_CONFS"),
		Required: false,
		Value:    0,
	}
	SequencerEnabledFlag = &cli.BoolFlag{
		Name:    "sequencer.enabled",
		Usage:   "Enable sequencing of new L2 blocks. A separate batch submitter has to be deployed to publish the data for verifiers.",
		EnvVars: prefixEnvVars("SEQUENCER_ENABLED"),
	}
	SequencerStoppedFlag = &cli.BoolFlag{
		Name:    "sequencer.stopped",
		Usage:   "Initialize the sequencer in a stopped state. The sequencer can be started using the admin_startSequencer RPC",
		EnvVars: prefixEnvVars("SEQUENCER_STOPPED"),
	}
	SequencerMaxSafeLagFlag = &cli.Uint64Flag{
		Name:     "sequencer.max-safe-lag",
		Usage:    "Maximum number of L2 blocks for restricting the distance between L2 safe and unsafe. Disabled if 0.",
		EnvVars:  prefixEnvVars("SEQUENCER_MAX_SAFE_LAG"),
		Required: false,
		Value:    0,
	}
	SequencerL1Confs = &cli.Uint64Flag{
		Name:     "sequencer.l1-confs",
		Usage:    "Number of L1 blocks to keep distance from the L1 head as a sequencer for picking an L1 origin.",
		EnvVars:  prefixEnvVars("SEQUENCER_L1_CONFS"),
		Required: false,
		Value:    4,
	}
	L1EpochPollIntervalFlag = &cli.DurationFlag{
		Name:     "l1.epoch-poll-interval",
		Usage:    "Poll interval for retrieving new L1 epoch updates such as safe and finalized block changes. Disabled if 0 or negative.",
		EnvVars:  prefixEnvVars("L1_EPOCH_POLL_INTERVAL"),
		Required: false,
		Value:    time.Second * 12 * 32,
	}
	RuntimeConfigReloadIntervalFlag = &cli.DurationFlag{
		Name:     "l1.runtime-config-reload-interval",
		Usage:    "Poll interval for reloading the runtime config, useful when config events are not being picked up. Disabled if 0 or negative.",
		EnvVars:  prefixEnvVars("L1_RUNTIME_CONFIG_RELOAD_INTERVAL"),
		Required: false,
		Value:    time.Minute * 10,
	}
	MetricsEnabledFlag = &cli.BoolFlag{
		Name:    "metrics.enabled",
		Usage:   "Enable the metrics server",
		EnvVars: prefixEnvVars("METRICS_ENABLED"),
	}
	MetricsAddrFlag = &cli.StringFlag{
		Name:    "metrics.addr",
		Usage:   "Metrics listening address",
		Value:   "0.0.0.0",
		EnvVars: prefixEnvVars("METRICS_ADDR"),
	}
	MetricsPortFlag = &cli.IntFlag{
		Name:    "metrics.port",
		Usage:   "Metrics listening port",
		Value:   7300,
		EnvVars: prefixEnvVars("METRICS_PORT"),
	}
	PprofEnabledFlag = &cli.BoolFlag{
		Name:    "pprof.enabled",
		Usage:   "Enable the pprof server",
		EnvVars: prefixEnvVars("PPROF_ENABLED"),
	}
	PprofAddrFlag = &cli.StringFlag{
		Name:    "pprof.addr",
		Usage:   "pprof listening address",
		Value:   "0.0.0.0",
		EnvVars: prefixEnvVars("PPROF_ADDR"),
	}
	PprofPortFlag = &cli.IntFlag{
		Name:    "pprof.port",
		Usage:   "pprof listening port",
		Value:   6060,
		EnvVars: prefixEnvVars("PPROF_PORT"),
	}
	SnapshotLog = &cli.StringFlag{
		Name:    "snapshotlog.file",
		Usage:   "Path to the snapshot log file",
		EnvVars: prefixEnvVars("SNAPSHOT_LOG"),
	}
	HeartbeatEnabledFlag = &cli.BoolFlag{
		Name:    "heartbeat.enabled",
		Usage:   "Enables or disables heartbeating",
		EnvVars: prefixEnvVars("HEARTBEAT_ENABLED"),
	}
	HeartbeatMonikerFlag = &cli.StringFlag{
		Name:    "heartbeat.moniker",
		Usage:   "Sets a moniker for this node",
		EnvVars: prefixEnvVars("HEARTBEAT_MONIKER"),
	}
	HeartbeatURLFlag = &cli.StringFlag{
		Name:    "heartbeat.url",
		Usage:   "Sets the URL to heartbeat to",
		EnvVars: prefixEnvVars("HEARTBEAT_URL"),
		Value:   "https://heartbeat.optimism.io",
	}
	BackupL2UnsafeSyncRPC = &cli.StringFlag{
		Name:     "l2.backup-unsafe-sync-rpc",
		Usage:    "Set the backup L2 unsafe sync RPC endpoint.",
		EnvVars:  prefixEnvVars("L2_BACKUP_UNSAFE_SYNC_RPC"),
		Required: false,
	}
	BackupL2UnsafeSyncRPCTrustRPC = &cli.StringFlag{
		Name: "l2.backup-unsafe-sync-rpc.trustrpc",
		Usage: "Like l1.trustrpc, configure if response data from the RPC needs to be verified, e.g. blockhash computation." +
			"This does not include checks if the blockhash is part of the canonical chain.",
		EnvVars:  prefixEnvVars("L2_BACKUP_UNSAFE_SYNC_RPC_TRUST_RPC"),
		Required: false,
	}
	L2EngineSyncEnabled = &cli.BoolFlag{
		Name:     "l2.engine-sync",
		Usage:    "Enables or disables execution engine P2P sync",
		EnvVars:  prefixEnvVars("L2_ENGINE_SYNC_ENABLED"),
		Required: false,
		Value:    false,
	}
	SkipSyncStartCheck = &cli.BoolFlag{
		Name: "l2.skip-sync-start-check",
		Usage: "Skip sanity check of consistency of L1 origins of the unsafe L2 blocks when determining the sync-starting point. " +
			"This defers the L1-origin verification, and is recommended to use in when utilizing l2.engine-sync",
		EnvVars:  prefixEnvVars("L2_SKIP_SYNC_START_CHECK"),
		Required: false,
		Value:    false,
	}
)
View Source
var (
	DisableP2P = &cli.BoolFlag{
		Name:     "p2p.disable",
		Usage:    "Completely disable the P2P stack",
		Required: false,
		EnvVars:  p2pEnv("DISABLE"),
	}
	NoDiscovery = &cli.BoolFlag{
		Name:     "p2p.no-discovery",
		Usage:    "Disable Discv5 (node discovery)",
		Required: false,
		EnvVars:  p2pEnv("NO_DISCOVERY"),
	}
	Scoring = &cli.StringFlag{
		Name:     "p2p.scoring",
		Usage:    "Sets the peer scoring strategy for the P2P stack. Can be one of: none or light.",
		Required: false,
		Value:    "light",
		EnvVars:  p2pEnv("PEER_SCORING"),
	}
	PeerScoring = &cli.StringFlag{
		Name:     "p2p.scoring.peers",
		Usage:    fmt.Sprintf("Deprecated: Use %v instead", Scoring.Name),
		Required: false,
		Hidden:   true,
	}
	PeerScoreBands = &cli.StringFlag{
		Name:     "p2p.score.bands",
		Usage:    "Deprecated. This option is ignored and is only present for backwards compatibility.",
		Required: false,
		Value:    "",
		Hidden:   true,
	}

	// Banning Flag - whether or not we want to act on the scoring
	Banning = &cli.BoolFlag{
		Name:     "p2p.ban.peers",
		Usage:    "Enables peer banning.",
		Value:    true,
		Required: false,
		EnvVars:  p2pEnv("PEER_BANNING"),
	}
	BanningThreshold = &cli.Float64Flag{
		Name:     "p2p.ban.threshold",
		Usage:    "The minimum score below which peers are disconnected and banned.",
		Required: false,
		Value:    -100,
		EnvVars:  p2pEnv("PEER_BANNING_THRESHOLD"),
	}
	BanningDuration = &cli.DurationFlag{
		Name:     "p2p.ban.duration",
		Usage:    "The duration that peers are banned for.",
		Required: false,
		Value:    1 * time.Hour,
		EnvVars:  p2pEnv("PEER_BANNING_DURATION"),
	}

	TopicScoring = &cli.StringFlag{
		Name:     "p2p.scoring.topics",
		Usage:    fmt.Sprintf("Deprecated: Use %v instead", Scoring.Name),
		Required: false,
		Hidden:   true,
	}
	P2PPrivPath = &cli.StringFlag{
		Name: "p2p.priv.path",
		Usage: "Read the hex-encoded 32-byte private key for the peer ID from this txt file. Created if not already exists." +
			"Important to persist to keep the same network identity after restarting, maintaining the previous advertised identity.",
		Required:  false,
		Value:     "opnode_p2p_priv.txt",
		EnvVars:   p2pEnv("PRIV_PATH"),
		TakesFile: true,
	}
	P2PPrivRaw = &cli.StringFlag{

		Name:     "p2p.priv.raw",
		Usage:    "The hex-encoded 32-byte private key for the peer ID",
		Required: false,
		Hidden:   true,
		Value:    "",
		EnvVars:  p2pEnv("PRIV_RAW"),
	}
	ListenIP = &cli.StringFlag{
		Name:     "p2p.listen.ip",
		Usage:    "IP to bind LibP2P and Discv5 to",
		Required: false,
		Value:    "0.0.0.0",
		EnvVars:  p2pEnv("LISTEN_IP"),
	}
	ListenTCPPort = &cli.UintFlag{
		Name:     "p2p.listen.tcp",
		Usage:    "TCP port to bind LibP2P to. Any available system port if set to 0.",
		Required: false,
		Value:    9222,
		EnvVars:  p2pEnv("LISTEN_TCP_PORT"),
	}
	ListenUDPPort = &cli.UintFlag{
		Name:     "p2p.listen.udp",
		Usage:    "UDP port to bind Discv5 to. Same as TCP port if left 0.",
		Required: false,
		Value:    0,
		EnvVars:  p2pEnv("LISTEN_UDP_PORT"),
	}
	AdvertiseIP = &cli.StringFlag{
		Name:     "p2p.advertise.ip",
		Usage:    "The IP address to advertise in Discv5, put into the ENR of the node. This may also be a hostname / domain name to resolve to an IP.",
		Required: false,

		Value:   "",
		EnvVars: p2pEnv("ADVERTISE_IP"),
	}
	AdvertiseTCPPort = &cli.UintFlag{
		Name:     "p2p.advertise.tcp",
		Usage:    "The TCP port to advertise in Discv5, put into the ENR of the node. Set to p2p.listen.tcp value if 0.",
		Required: false,
		Value:    0,
		EnvVars:  p2pEnv("ADVERTISE_TCP"),
	}
	AdvertiseUDPPort = &cli.UintFlag{
		Name:     "p2p.advertise.udp",
		Usage:    "The UDP port to advertise in Discv5 as fallback if not determined by Discv5, put into the ENR of the node. Set to p2p.listen.udp value if 0.",
		Required: false,
		Value:    0,
		EnvVars:  p2pEnv("ADVERTISE_UDP"),
	}
	Bootnodes = &cli.StringFlag{
		Name:     "p2p.bootnodes",
		Usage:    "Comma-separated base64-format ENR list. Bootnodes to start discovering other node records from.",
		Required: false,
		Value:    "",
		EnvVars:  p2pEnv("BOOTNODES"),
	}
	StaticPeers = &cli.StringFlag{
		Name:     "p2p.static",
		Usage:    "Comma-separated multiaddr-format peer list. Static connections to make and maintain, these peers will be regarded as trusted.",
		Required: false,
		Value:    "",
		EnvVars:  p2pEnv("STATIC"),
	}
	NetRestrict = &cli.StringFlag{
		Name:     "p2p.netrestrict",
		Usage:    "Comma-separated list of CIDR masks. P2P will only try to connect on these networks",
		Required: false,
		EnvVars:  p2pEnv("NETRESTRICT"),
	}
	HostMux = &cli.StringFlag{
		Name:     "p2p.mux",
		Usage:    "Comma-separated list of multiplexing protocols in order of preference. At least 1 required. Options: 'yamux','mplex'.",
		Hidden:   true,
		Required: false,
		Value:    "yamux,mplex",
		EnvVars:  p2pEnv("MUX"),
	}
	HostSecurity = &cli.StringFlag{
		Name:     "p2p.security",
		Usage:    "Comma-separated list of transport security protocols in order of preference. At least 1 required. Options: 'noise','tls'. Set to 'none' to disable.",
		Hidden:   true,
		Required: false,
		Value:    "noise",
		EnvVars:  p2pEnv("SECURITY"),
	}
	PeersLo = &cli.UintFlag{
		Name:     "p2p.peers.lo",
		Usage:    "Low-tide peer count. The node actively searches for new peer connections if below this amount.",
		Required: false,
		Value:    20,
		EnvVars:  p2pEnv("PEERS_LO"),
	}
	PeersHi = &cli.UintFlag{
		Name:     "p2p.peers.hi",
		Usage:    "High-tide peer count. The node starts pruning peer connections slowly after reaching this number.",
		Required: false,
		Value:    30,
		EnvVars:  p2pEnv("PEERS_HI"),
	}
	PeersGrace = &cli.DurationFlag{
		Name:     "p2p.peers.grace",
		Usage:    "Grace period to keep a newly connected peer around, if it is not misbehaving.",
		Required: false,
		Value:    30 * time.Second,
		EnvVars:  p2pEnv("PEERS_GRACE"),
	}
	NAT = &cli.BoolFlag{
		Name:     "p2p.nat",
		Usage:    "Enable NAT traversal with PMP/UPNP devices to learn external IP.",
		Required: false,
		EnvVars:  p2pEnv("NAT"),
	}
	UserAgent = &cli.StringFlag{
		Name:     "p2p.useragent",
		Usage:    "User-agent string to share via LibP2P identify. If empty it defaults to 'optimism'.",
		Hidden:   true,
		Required: false,
		Value:    "optimism",
		EnvVars:  p2pEnv("AGENT"),
	}
	TimeoutNegotiation = &cli.DurationFlag{
		Name:     "p2p.timeout.negotiation",
		Usage:    "Negotiation timeout, time for new peer connections to share their their supported p2p protocols",
		Hidden:   true,
		Required: false,
		Value:    10 * time.Second,
		EnvVars:  p2pEnv("TIMEOUT_NEGOTIATION"),
	}
	TimeoutAccept = &cli.DurationFlag{
		Name:     "p2p.timeout.accept",
		Usage:    "Accept timeout, time for connection to be accepted.",
		Hidden:   true,
		Required: false,
		Value:    10 * time.Second,
		EnvVars:  p2pEnv("TIMEOUT_ACCEPT"),
	}
	TimeoutDial = &cli.DurationFlag{
		Name:     "p2p.timeout.dial",
		Usage:    "Dial timeout for outgoing connection requests",
		Hidden:   true,
		Required: false,
		Value:    10 * time.Second,
		EnvVars:  p2pEnv("TIMEOUT_DIAL"),
	}
	PeerstorePath = &cli.StringFlag{
		Name: "p2p.peerstore.path",
		Usage: "Peerstore database location. Persisted peerstores help recover peers after restarts. " +
			"Set to 'memory' to never persist the peerstore. Peerstore records will be pruned / expire as necessary. " +
			"Warning: a copy of the priv network key of the local peer will be persisted here.",
		Required:  false,
		TakesFile: true,
		Value:     "opnode_peerstore_db",
		EnvVars:   p2pEnv("PEERSTORE_PATH"),
	}
	DiscoveryPath = &cli.StringFlag{
		Name:      "p2p.discovery.path",
		Usage:     "Discovered ENRs are persisted in a database to recover from a restart without having to bootstrap the discovery process again. Set to 'memory' to never persist the peerstore.",
		Required:  false,
		TakesFile: true,
		Value:     "opnode_discovery_db",
		EnvVars:   p2pEnv("DISCOVERY_PATH"),
	}
	SequencerP2PKeyFlag = &cli.StringFlag{
		Name:     "p2p.sequencer.key",
		Usage:    "Hex-encoded private key for signing off on p2p application messages as sequencer.",
		Required: false,
		Value:    "",
		EnvVars:  p2pEnv("SEQUENCER_KEY"),
	}
	GossipMeshDFlag = &cli.UintFlag{
		Name:     "p2p.gossip.mesh.d",
		Usage:    "Configure GossipSub topic stable mesh target count, a.k.a. desired outbound degree, number of peers to gossip to",
		Required: false,
		Hidden:   true,
		Value:    p2p.DefaultMeshD,
		EnvVars:  p2pEnv("GOSSIP_MESH_D"),
	}
	GossipMeshDloFlag = &cli.UintFlag{
		Name:     "p2p.gossip.mesh.lo",
		Usage:    "Configure GossipSub topic stable mesh low watermark, a.k.a. lower bound of outbound degree",
		Required: false,
		Hidden:   true,
		Value:    p2p.DefaultMeshDlo,
		EnvVars:  p2pEnv("GOSSIP_MESH_DLO"),
	}
	GossipMeshDhiFlag = &cli.UintFlag{
		Name:     "p2p.gossip.mesh.dhi",
		Usage:    "Configure GossipSub topic stable mesh high watermark, a.k.a. upper bound of outbound degree, additional peers will not receive gossip",
		Required: false,
		Hidden:   true,
		Value:    p2p.DefaultMeshDhi,
		EnvVars:  p2pEnv("GOSSIP_MESH_DHI"),
	}
	GossipMeshDlazyFlag = &cli.UintFlag{
		Name:     "p2p.gossip.mesh.dlazy",
		Usage:    "Configure GossipSub gossip target, a.k.a. target degree for gossip only (not messaging like p2p.gossip.mesh.d, just announcements of IHAVE",
		Required: false,
		Hidden:   true,
		Value:    p2p.DefaultMeshDlazy,
		EnvVars:  p2pEnv("GOSSIP_MESH_DLAZY"),
	}
	GossipFloodPublishFlag = &cli.BoolFlag{
		Name:     "p2p.gossip.mesh.floodpublish",
		Usage:    "Configure GossipSub to publish messages to all known peers on the topic, outside of the mesh, also see Dlazy as less aggressive alternative.",
		Required: false,
		Hidden:   true,
		EnvVars:  p2pEnv("GOSSIP_FLOOD_PUBLISH"),
	}
	SyncReqRespFlag = &cli.BoolFlag{
		Name:     "p2p.sync.req-resp",
		Usage:    "Enables P2P req-resp alternative sync method, on both server and client side.",
		Value:    true,
		Required: false,
		EnvVars:  p2pEnv("SYNC_REQ_RESP"),
	}
)
View Source
var Flags []cli.Flag

Flags contains the list of configuration options available to the binary.

None of these flags are strictly required. Some are hidden if they are too technical, or not recommended.

Functions

func CheckRequired

func CheckRequired(ctx *cli.Context) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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