Documentation ¶
Index ¶
Constants ¶
View Source
const EnvVarPrefix = "PT_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", EnvVar: prefixEnvVar("L1_ETH_RPC"), } L2EngineAddr = cli.StringFlag{ Name: "l2", Usage: "Address of L2 Engine JSON-RPC endpoints to use (engine and eth namespace required)", EnvVar: prefixEnvVar("L2_ENGINE_RPC"), } RollupConfig = cli.StringFlag{ Name: "rollup.config", Usage: "Rollup chain parameters", EnvVar: prefixEnvVar("ROLLUP_CONFIG"), } Network = cli.StringFlag{ Name: "network", Usage: fmt.Sprintf("Predefined network selection. Available networks: %s", strings.Join(chaincfg.AvailableNetworks(), ", ")), EnvVar: prefixEnvVar("NETWORK"), } RPCListenAddr = cli.StringFlag{ Name: "rpc.addr", Usage: "RPC listening address", EnvVar: prefixEnvVar("RPC_ADDR"), } RPCListenPort = cli.IntFlag{ Name: "rpc.port", Usage: "RPC listening port", EnvVar: prefixEnvVar("RPC_PORT"), } RPCEnableAdmin = cli.BoolFlag{ Name: "rpc.enable-admin", Usage: "Enable the admin API (experimental)", EnvVar: prefixEnvVar("RPC_ENABLE_ADMIN"), } /* Optional Flags */ 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", EnvVar: prefixEnvVar("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), EnvVar: prefixEnvVar("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.", EnvVar: prefixEnvVar("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.", EnvVar: prefixEnvVar("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.", EnvVar: prefixEnvVar("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.", EnvVar: prefixEnvVar("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.", EnvVar: prefixEnvVar("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.", EnvVar: prefixEnvVar("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", EnvVar: prefixEnvVar("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.", EnvVar: prefixEnvVar("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.", EnvVar: prefixEnvVar("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.", EnvVar: prefixEnvVar("L1_EPOCH_POLL_INTERVAL"), Required: false, Value: time.Second * 12 * 32, } MetricsEnabledFlag = cli.BoolFlag{ Name: "metrics.enabled", Usage: "Enable the metrics server", EnvVar: prefixEnvVar("METRICS_ENABLED"), } MetricsAddrFlag = cli.StringFlag{ Name: "metrics.addr", Usage: "Metrics listening address", Value: "0.0.0.0", EnvVar: prefixEnvVar("METRICS_ADDR"), } MetricsPortFlag = cli.IntFlag{ Name: "metrics.port", Usage: "Metrics listening port", Value: 7300, EnvVar: prefixEnvVar("METRICS_PORT"), } PprofEnabledFlag = cli.BoolFlag{ Name: "pprof.enabled", Usage: "Enable the pprof server", EnvVar: prefixEnvVar("PPROF_ENABLED"), } PprofAddrFlag = cli.StringFlag{ Name: "pprof.addr", Usage: "pprof listening address", Value: "0.0.0.0", EnvVar: prefixEnvVar("PPROF_ADDR"), } PprofPortFlag = cli.IntFlag{ Name: "pprof.port", Usage: "pprof listening port", Value: 6060, EnvVar: prefixEnvVar("PPROF_PORT"), } SnapshotLog = cli.StringFlag{ Name: "snapshotlog.file", Usage: "Path to the snapshot log file", EnvVar: prefixEnvVar("SNAPSHOT_LOG"), } HeartbeatEnabledFlag = cli.BoolFlag{ Name: "heartbeat.enabled", Usage: "Enables or disables heartbeating", EnvVar: prefixEnvVar("HEARTBEAT_ENABLED"), } HeartbeatMonikerFlag = cli.StringFlag{ Name: "heartbeat.moniker", Usage: "Sets a moniker for this node", EnvVar: prefixEnvVar("HEARTBEAT_MONIKER"), } HeartbeatURLFlag = cli.StringFlag{ Name: "heartbeat.url", Usage: "Sets the URL to heartbeat to", EnvVar: prefixEnvVar("HEARTBEAT_URL"), Value: "https://heartbeat.patex.io", } BackupL2UnsafeSyncRPC = cli.StringFlag{ Name: "l2.backup-unsafe-sync-rpc", Usage: "Set the backup L2 unsafe sync RPC endpoint.", EnvVar: prefixEnvVar("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.", EnvVar: prefixEnvVar("L2_BACKUP_UNSAFE_SYNC_RPC_TRUST_RPC"), Required: false, } L1BlockTime = cli.Uint64Flag{ Name: "l1.blocktime", Usage: "L1 block production time. Default value is 12, like Ethereum block time", EnvVar: prefixEnvVar("L1_BLOCKTIME"), Required: false, Value: 12, } )
View Source
var ( DisableP2P = cli.BoolFlag{ Name: "p2p.disable", Usage: "Completely disable the P2P stack", Required: false, EnvVar: p2pEnv("DISABLE"), } NoDiscovery = cli.BoolFlag{ Name: "p2p.no-discovery", Usage: "Disable Discv5 (node discovery)", Required: false, EnvVar: p2pEnv("NO_DISCOVERY"), } PeerScoring = cli.StringFlag{ Name: "p2p.scoring.peers", Usage: "Sets the peer scoring strategy for the P2P stack. " + "Can be one of: none or light." + "Custom scoring strategies can be defined in the config file.", Required: false, Value: "none", EnvVar: p2pEnv("PEER_SCORING"), } PeerScoreBands = cli.StringFlag{ Name: "p2p.score.bands", Usage: "Sets the peer score bands used primarily for peer score metrics. " + "Should be provided in following format: <threshold>:<label>;<threshold>:<label>;..." + "For example: -40:graylist;-20:restricted;0:nopx;20:friend;", Required: false, Value: "-40:<=-40;-10:<=-10;-5:<=-05;-0.05:<=-00.05;0:<=0;0.05:<=00.05;5:<=05;10:<=10;20:<=20;100:>20;", EnvVar: p2pEnv("SCORE_BANDS"), } // Banning Flag - whether or not we want to act on the scoring Banning = cli.BoolFlag{ Name: "p2p.ban.peers", Usage: "Enables peer banning. This should ONLY be enabled once certain peer scoring is working correctly.", Required: false, EnvVar: 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, EnvVar: 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, EnvVar: p2pEnv("PEER_BANNING_DURATION"), } TopicScoring = cli.StringFlag{ Name: "p2p.scoring.topics", Usage: "Sets the topic scoring strategy. " + "Can be one of: none or light." + "Custom scoring strategies can be defined in the config file.", Required: false, Value: "none", EnvVar: p2pEnv("TOPIC_SCORING"), } 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: "ptnode_p2p_priv.txt", EnvVar: 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: "", EnvVar: 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", EnvVar: 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, EnvVar: 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, EnvVar: 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: "", EnvVar: 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, EnvVar: 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, EnvVar: 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: "", EnvVar: 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: "", EnvVar: p2pEnv("STATIC"), } 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", EnvVar: 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", EnvVar: 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, EnvVar: 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, EnvVar: 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, EnvVar: p2pEnv("PEERS_GRACE"), } NAT = cli.BoolFlag{ Name: "p2p.nat", Usage: "Enable NAT traversal with PMP/UPNP devices to learn external IP.", Required: false, EnvVar: p2pEnv("NAT"), } UserAgent = cli.StringFlag{ Name: "p2p.useragent", Usage: "User-agent string to share via LibP2P identify. If empty it defaults to 'patex'.", Hidden: true, Required: false, Value: "patex", EnvVar: 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, EnvVar: 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, EnvVar: 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, EnvVar: 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: "ptnode_peerstore_db", EnvVar: 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: "ptnode_discovery_db", EnvVar: 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: "", EnvVar: 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, EnvVar: 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, EnvVar: 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, EnvVar: 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, EnvVar: 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, EnvVar: p2pEnv("GOSSIP_FLOOD_PUBLISH"), } SyncReqRespFlag = cli.BoolFlag{ Name: "p2p.sync.req-resp", Usage: "Enables experimental P2P req-resp alternative sync method, on both server and client side.", Required: false, EnvVar: p2pEnv("SYNC_REQ_RESP"), } )
View Source
var Flags []cli.Flag
Flags contains the list of configuration options available to the binary.
Functions ¶
func CheckRequired ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.