2020-04-29 17:40:33 +00:00
// Package flags defines beacon-node specific runtime flags for
// setting important values such as ports, eth1 endpoints, and more.
2019-07-23 13:58:20 +00:00
package flags
2018-07-19 16:31:50 +00:00
import (
2020-05-31 06:44:34 +00:00
"github.com/urfave/cli/v2"
2018-07-19 16:31:50 +00:00
)
var (
2019-04-18 23:53:37 +00:00
// HTTPWeb3ProviderFlag provides an HTTP access endpoint to an ETH 1.0 RPC.
2020-03-19 21:46:44 +00:00
HTTPWeb3ProviderFlag = & cli . StringFlag {
2019-04-18 23:53:37 +00:00
Name : "http-web3provider" ,
Usage : "A mainchain web3 provider string http endpoint" ,
2020-08-27 15:17:21 +00:00
Value : "" ,
2019-04-18 23:53:37 +00:00
}
2019-02-13 19:08:28 +00:00
// DepositContractFlag defines a flag for the deposit contract address.
2020-03-19 21:46:44 +00:00
DepositContractFlag = & cli . StringFlag {
2019-02-13 19:08:28 +00:00
Name : "deposit-contract" ,
Usage : "Deposit contract address. Beacon chain node will listen logs coming from the deposit contract to determine when validator is eligible to participate." ,
2020-08-03 17:40:05 +00:00
Value : "0x07b39F4fDE4A38bACe212b546dAc87C58DfE3fDC" , // Medalla deposit contract address.
2018-07-19 16:31:50 +00:00
}
2020-01-17 02:18:26 +00:00
// RPCHost defines the host on which the RPC server should listen.
2020-03-19 21:46:44 +00:00
RPCHost = & cli . StringFlag {
2020-01-17 02:18:26 +00:00
Name : "rpc-host" ,
Usage : "Host on which the RPC server should listen" ,
2020-06-09 22:40:48 +00:00
Value : "127.0.0.1" ,
2020-01-17 02:18:26 +00:00
}
2018-08-01 22:08:44 +00:00
// RPCPort defines a beacon node RPC port to open.
2020-03-19 21:46:44 +00:00
RPCPort = & cli . IntFlag {
2018-08-01 22:08:44 +00:00
Name : "rpc-port" ,
Usage : "RPC port exposed by a beacon node" ,
2019-06-02 15:33:44 +00:00
Value : 4000 ,
2018-08-01 22:08:44 +00:00
}
2020-04-19 08:36:19 +00:00
// MonitoringPortFlag defines the http port used to serve prometheus metrics.
2020-07-08 08:21:06 +00:00
MonitoringPortFlag = & cli . IntFlag {
2020-04-19 08:36:19 +00:00
Name : "monitoring-port" ,
Usage : "Port used to listening and respond metrics for prometheus." ,
Value : 8080 ,
}
2018-08-08 22:43:25 +00:00
// CertFlag defines a flag for the node's TLS certificate.
2020-03-19 21:46:44 +00:00
CertFlag = & cli . StringFlag {
2018-08-08 22:43:25 +00:00
Name : "tls-cert" ,
Usage : "Certificate for secure gRPC. Pass this and the tls-key flag in order to use gRPC securely." ,
}
// KeyFlag defines a flag for the node's TLS key.
2020-03-19 21:46:44 +00:00
KeyFlag = & cli . StringFlag {
2018-08-08 22:43:25 +00:00
Name : "tls-key" ,
Usage : "Key for secure gRPC. Pass this and the tls-cert flag in order to use gRPC securely." ,
}
2020-06-03 18:11:43 +00:00
// DisableGRPCGateway for JSON-HTTP requests to the beacon node.
DisableGRPCGateway = & cli . BoolFlag {
Name : "disable-grpc-gateway" ,
Usage : "Disable the gRPC gateway for JSON-HTTP requests" ,
}
2020-06-10 16:04:32 +00:00
// GRPCGatewayHost specifies a gRPC gateway host for Prysm.
GRPCGatewayHost = & cli . StringFlag {
Name : "grpc-gateway-host" ,
Usage : "The host on which the gateway server runs on" ,
Value : "127.0.0.1" ,
}
2019-06-02 15:33:44 +00:00
// GRPCGatewayPort enables a gRPC gateway to be exposed for Prysm.
2020-03-19 21:46:44 +00:00
GRPCGatewayPort = & cli . IntFlag {
2019-06-02 15:33:44 +00:00
Name : "grpc-gateway-port" ,
Usage : "Enable gRPC gateway for JSON requests" ,
2020-06-10 13:56:39 +00:00
Value : 3500 ,
2019-06-02 15:33:44 +00:00
}
2020-03-23 18:17:17 +00:00
// GPRCGatewayCorsDomain serves preflight requests when serving gRPC JSON gateway.
GPRCGatewayCorsDomain = & cli . StringFlag {
Name : "grpc-gateway-corsdomain" ,
Usage : "Comma separated list of domains from which to accept cross origin requests " +
"(browser enforced). This flag has no effect if not used with --grpc-gateway-port." ,
2020-09-04 19:03:18 +00:00
Value : "http://localhost:4200" ,
2020-03-23 18:17:17 +00:00
}
2019-12-13 15:12:49 +00:00
// MinSyncPeers specifies the required number of successful peer handshakes in order
// to start syncing with external peers.
2020-03-19 21:46:44 +00:00
MinSyncPeers = & cli . IntFlag {
2019-12-13 15:12:49 +00:00
Name : "min-sync-peers" ,
Usage : "The required number of valid peers to connect with before syncing." ,
Value : 3 ,
}
2020-01-16 01:46:15 +00:00
// ContractDeploymentBlock is the block in which the eth1 deposit contract was deployed.
2020-03-19 21:46:44 +00:00
ContractDeploymentBlock = & cli . IntFlag {
2020-01-16 01:46:15 +00:00
Name : "contract-deployment-block" ,
Usage : "The eth1 block in which the deposit contract was deployed." ,
2020-06-09 22:40:48 +00:00
Value : 2844925 ,
2020-01-16 01:46:15 +00:00
}
2020-02-18 00:37:37 +00:00
// SetGCPercent is the percentage of current live allocations at which the garbage collector is to run.
2020-03-19 21:46:44 +00:00
SetGCPercent = & cli . IntFlag {
2020-02-18 00:37:37 +00:00
Name : "gc-percent" ,
Usage : "The percentage of freshly allocated data to live data on which the gc will be run again." ,
Value : 100 ,
}
2020-02-19 08:25:07 +00:00
// UnsafeSync starts the beacon node from the previously saved head state and syncs from there.
2020-03-19 21:46:44 +00:00
UnsafeSync = & cli . BoolFlag {
2020-02-19 08:25:07 +00:00
Name : "unsafe-sync" ,
Usage : "Starts the beacon node with the previously saved head state instead of finalized state." ,
}
2020-03-06 23:06:01 +00:00
// SlotsPerArchivedPoint specifies the number of slots between the archived points, to save beacon state in the cold
// section of DB.
2020-03-19 21:46:44 +00:00
SlotsPerArchivedPoint = & cli . IntFlag {
2020-03-06 23:06:01 +00:00
Name : "slots-per-archive-point" ,
Usage : "The slot durations of when an archived state gets saved in the DB." ,
2020-05-17 20:40:41 +00:00
Value : 2048 ,
2020-03-06 23:06:01 +00:00
}
2020-04-14 20:27:03 +00:00
// DisableDiscv5 disables running discv5.
DisableDiscv5 = & cli . BoolFlag {
Name : "disable-discv5" ,
Usage : "Does not run the discoveryV5 dht." ,
2020-03-23 14:41:47 +00:00
}
2020-04-27 14:35:40 +00:00
// BlockBatchLimit specifies the requested block batch size.
BlockBatchLimit = & cli . IntFlag {
Name : "block-batch-limit" ,
Usage : "The amount of blocks the local peer is bounded to request and respond to in a batch." ,
Value : 64 ,
}
2020-05-12 11:31:10 +00:00
// BlockBatchLimitBurstFactor specifies the factor by which block batch size may increase.
BlockBatchLimitBurstFactor = & cli . IntFlag {
Name : "block-batch-limit-burst-factor" ,
Usage : "The factor by which block batch limit may increase on burst." ,
Value : 10 ,
}
2020-09-17 06:11:21 +00:00
// DisableSync disables a node from syncing at start-up. Instead the node enters regular sync
// immediately.
DisableSync = & cli . BoolFlag {
Name : "disable-sync" ,
Usage : "Starts the beacon node without entering initial sync and instead exits to regular sync immediately." ,
}
2020-05-01 01:47:10 +00:00
// EnableDebugRPCEndpoints as /v1/beacon/state.
EnableDebugRPCEndpoints = & cli . BoolFlag {
Name : "enable-debug-rpc-endpoints" ,
2020-08-27 02:39:47 +00:00
Usage : "Enables the debug rpc service, containing utility endpoints such as /eth/v1alpha1/beacon/state." ,
2020-05-01 01:47:10 +00:00
}
2020-07-20 20:23:48 +00:00
// HistoricalSlasherNode is a set of beacon node flags required for performing historical detection with a slasher.
HistoricalSlasherNode = & cli . BoolFlag {
Name : "historical-slasher-node" ,
2020-08-02 22:09:10 +00:00
Usage : "Enables required flags for serving historical data to a slasher client. Results in additional storage usage" ,
2020-07-20 20:23:48 +00:00
}
2020-08-05 22:03:25 +00:00
// ChainID defines a flag to set the chain id. If none is set, it derives this value from NetworkConfig
ChainID = & cli . Uint64Flag {
Name : "chain-id" ,
Usage : "Sets the chain id of the beacon chain" ,
}
// NetworkID defines a flag to set the network id. If none is set, it derives this value from NetworkConfig
NetworkID = & cli . Uint64Flag {
Name : "network-id" ,
Usage : "Sets the network id of the beacon chain." ,
}
2020-09-17 19:32:40 +00:00
// WeakSubjectivityCheckpt defines the weak subjectivity checkpoint the node must sync through to defend against long range attacks.
WeakSubjectivityCheckpt = & cli . StringFlag {
Name : "weak-subjectivity-checkpoint" ,
Usage : "Input in `block_root:epoch_number` format. This guarantee that syncing leads to the given Weak Subjectivity Checkpoint being in the canonical chain. " +
"If such a sync is not possible, the node will treat it a critical and irrecoverable failure" ,
Value : "" ,
}
2018-07-19 16:31:50 +00:00
)