From 8fc124f2e3c8640b404ed4e0ffd91b14f8b87ac0 Mon Sep 17 00:00:00 2001 From: Delweng Date: Wed, 17 Apr 2024 03:37:55 +0800 Subject: [PATCH] chore(node): unify the format of command args (#7656) Signed-off-by: jsvisa Co-authored-by: Matthias Seitz Co-authored-by: Oliver Nordbjerg --- book/cli/reth/node.md | 238 ++++++++++--------- crates/node-core/src/args/rpc_server_args.rs | 36 +-- crates/node-core/src/args/txpool_args.rs | 18 +- 3 files changed, 158 insertions(+), 134 deletions(-) diff --git a/book/cli/reth/node.md b/book/cli/reth/node.md index ccbc9cd3f..dbfe7b1d4 100644 --- a/book/cli/reth/node.md +++ b/book/cli/reth/node.md @@ -4,18 +4,21 @@ Start the node ```bash $ reth node --help + +Start the node + Usage: reth node [OPTIONS] Options: --datadir The path to the data dir for all reth files and subdirectories. - + Defaults to the OS-specific data directory: - + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - Windows: `{FOLDERID_RoamingAppData}/reth/` - macOS: `$HOME/Library/Application Support/reth/` - + [default: default] --config @@ -24,26 +27,26 @@ Options: --chain The chain this node is running. Possible values are either a built-in chain or the path to a chain specification file. - + Built-in chains: mainnet, sepolia, goerli, holesky, dev - + [default: mainnet] --instance Add a new instance of a node. - + Configures the ports of the node to avoid conflicts with the defaults. This is useful for running multiple nodes on the same machine. - + Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other. - + Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2 - + [default: 1] --with-unused-ports Sets all ports to unused, allowing the OS to choose random unused ports when sockets are bound. - + Mutually exclusive with `--instance`. -h, --help @@ -52,7 +55,7 @@ Options: Metrics: --metrics Enable Prometheus metrics. - + The metrics will be served at the given interface and port. Networking: @@ -65,19 +68,32 @@ Networking: --disable-discv4-discovery Disable Discv4 discovery + --enable-discv5-discovery + Enable Discv5 discovery + --discovery.addr - The UDP address to use for P2P discovery/networking - + The UDP address to use for devp2p peer discovery version 4 + [default: 0.0.0.0] --discovery.port - The UDP port to use for P2P discovery/networking - + The UDP port to use for devp2p peer discovery version 4 + [default: 30303] + --discovery.v5.addr + The UDP address to use for devp2p peer discovery version 5 + + [default: 0.0.0.0] + + --discovery.v5.port + The UDP port to use for devp2p peer discovery version 5 + + [default: 9000] + --trusted-peers Comma separated enode URLs of trusted peers for P2P connections. - + --trusted-peers enode://abcd@192.168.0.1:30303 --trusted-only @@ -85,7 +101,7 @@ Networking: --bootnodes Comma separated enode URLs for P2P discovery bootstrap. - + Will fall back to a network-specific default if not specified. --peers-file @@ -94,12 +110,12 @@ Networking: --identity Custom node identity - + [default: reth/-/-gnu] --p2p-secret-key Secret key to use for this node. - + This will also deterministically set the peer ID. If not specified, it will be set in the data dir for the chain being used. --no-persist-peers @@ -107,17 +123,17 @@ Networking: --nat NAT resolution method (any|none|upnp|publicip|extip:\) - + [default: any] --addr Network listening address - + [default: 0.0.0.0] --port Network listening port - + [default: 30303] --max-outbound-peers @@ -128,14 +144,14 @@ Networking: --pooled-tx-response-soft-limit Soft limit for the byte size of a `PooledTransactions` response on assembling a `GetPooledTransactions` request. Spec'd at 2 MiB. - + . - + [default: 2097152] --pooled-tx-pack-soft-limit Default soft limit for the byte size of a `PooledTransactions` response on assembling a `GetPooledTransactions` request. This defaults to less than the [`SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE`], at 2 MiB, used when assembling a `PooledTransactions` response. Default is 128 KiB - + [default: 131072] RPC: @@ -144,17 +160,17 @@ RPC: --http.addr Http server address to listen on - + [default: 127.0.0.1] --http.port Http server port to listen on - + [default: 8545] --http.api Rpc Modules to be configured for the HTTP server - + [possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots, eth-call-bundle] --http.corsdomain @@ -165,12 +181,12 @@ RPC: --ws.addr Ws server address to listen on - + [default: 127.0.0.1] --ws.port Ws server port to listen on - + [default: 8546] --ws.origins @@ -178,176 +194,184 @@ RPC: --ws.api Rpc Modules to be configured for the WS server - + [possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots, eth-call-bundle] --ipcdisable - Disable the IPC-RPC server + Disable the IPC-RPC server --ipcpath Filename for IPC socket/pipe within the datadir - - [default: .ipc] + + [default: /tmp/reth.ipc] --authrpc.addr Auth server address to listen on - + [default: 127.0.0.1] --authrpc.port Auth server port to listen on - + [default: 8551] --authrpc.jwtsecret Path to a JWT secret to use for the authenticated engine-API RPC server. - + This will enforce JWT authentication for all requests coming from the consensus layer. - + If no path is provided, a secret will be generated and stored in the datadir under `//jwt.hex`. For mainnet this would be `~/.reth/mainnet/jwt.hex` by default. + --auth-ipc + Enable auth engine api over IPC + + --auth-ipc.path + Filename for auth IPC socket/pipe within the datadir + + [default: /tmp/reth_engine_api.ipc] + --rpc.jwtsecret Hex encoded JWT secret to authenticate the regular RPC server(s), see `--http.api` and `--ws.api`. - + This is __not__ used for the authenticated engine-API RPC server, see `--authrpc.jwtsecret`. - --rpc-max-request-size + --rpc.max-request-size Set the maximum RPC request payload size for both HTTP and WS in megabytes - + [default: 15] - --rpc-max-response-size + --rpc.max-response-size Set the maximum RPC response payload size for both HTTP and WS in megabytes - - [default: 160] - [aliases: --rpc.returndata.limit] - --rpc-max-subscriptions-per-connection + [default: 160] + [aliases: rpc.returndata.limit] + + --rpc.max-subscriptions-per-connection Set the maximum concurrent subscriptions per connection - + [default: 1024] - --rpc-max-connections + --rpc.max-connections Maximum number of RPC server connections - + [default: 500] - --rpc-max-tracing-requests + --rpc.max-tracing-requests Maximum number of concurrent tracing requests - + [default: 14] - --rpc-max-blocks-per-filter + --rpc.max-blocks-per-filter Maximum number of blocks that could be scanned per filter request. (0 = entire chain) - + [default: 100000] - --rpc-max-logs-per-response + --rpc.max-logs-per-response Maximum number of logs that can be returned in a single response. (0 = no limit) - + [default: 20000] - --rpc-gas-cap + --rpc.gascap Maximum gas limit for `eth_call` and call tracing RPC methods - + [default: 50000000] RPC State Cache: --rpc-cache.max-blocks Max number of blocks in cache - + [default: 5000] --rpc-cache.max-receipts Max number receipts in cache - + [default: 2000] --rpc-cache.max-envs Max number of bytes for cached env data - + [default: 1000] --rpc-cache.max-concurrent-db-requests Max number of concurrent database requests - + [default: 512] Gas Price Oracle: --gpo.blocks Number of recent blocks to check for gas price - + [default: 20] --gpo.ignoreprice Gas Price below which gpo will ignore transactions - + [default: 2] --gpo.maxprice Maximum transaction priority fee(or gasprice before London Fork) to be recommended by gpo - + [default: 500000000000] --gpo.percentile The percentile of gas prices to use for the estimate - + [default: 60] TxPool: - --txpool.pending_max_count + --txpool.pending-max-count Max number of transaction in the pending sub-pool - + [default: 10000] - --txpool.pending_max_size + --txpool.pending-max-size Max size of the pending sub-pool in megabytes - + [default: 20] - --txpool.basefee_max_count + --txpool.basefee-max-count Max number of transaction in the basefee sub-pool - + [default: 10000] - --txpool.basefee_max_size + --txpool.basefee-max-size Max size of the basefee sub-pool in megabytes - + [default: 20] - --txpool.queued_max_count + --txpool.queued-max-count Max number of transaction in the queued sub-pool - + [default: 10000] - --txpool.queued_max_size + --txpool.queued-max-size Max size of the queued sub-pool in megabytes - + [default: 20] --txpool.max_account_slots Max number of executable transaction slots guaranteed per account - + [default: 16] --txpool.pricebump Price bump (in %) for the transaction pool underpriced check - + [default: 10] --blobpool.pricebump Price bump percentage to replace an already existing blob transaction - + [default: 100] - --txpool.max_tx_input_bytes + --txpool.max-tx-input-bytes Max size in bytes of a single transaction allowed to enter the pool - + [default: 131072] - --txpool.max_cached_entries + --txpool.max-cached-entries The maximum number of blobs to keep in the in memory blob cache - + [default: 100] --txpool.nolocals @@ -362,33 +386,33 @@ TxPool: Builder: --builder.extradata Block extra data set by the payload builder - - [default: reth//] + + [default: reth/v0.2.0-beta.5/linux] --builder.gaslimit Target gas ceiling for built blocks - + [default: 30000000] --builder.interval The interval at which the job should build a new payload after the last (in seconds) - + [default: 1] --builder.deadline The deadline for when the payload builder job should resolve - + [default: 12] --builder.max-tasks Maximum number of tasks to spawn for building a payload - + [default: 3] Debug: --debug.continuous Prompt the downloader to download blocks one at a time. - + NOTE: This is for testing purposes only. --debug.terminate @@ -396,7 +420,7 @@ Debug: --debug.tip Set the chain tip manually for testing purposes. - + NOTE: This is a temporary flag --debug.max-block @@ -433,13 +457,13 @@ Database: --db.exclusive Open environment in exclusive/monopolistic mode. Makes it possible to open a database on an NFS volume - + [possible values: true, false] Dev testnet: --dev Start the node in dev mode - + This mode uses a local proof-of-authority consensus engine with either fixed block times or automatically mined blocks. Disables network discovery and enables local http server. @@ -451,7 +475,7 @@ Dev testnet: --dev.block-time Interval between blocks. - + Parses strings using [humantime::parse_duration] --dev.block-time 12s @@ -462,7 +486,7 @@ Pruning: Logging: --log.stdout.format The format to use for logs written to stdout - + [default: terminal] Possible values: @@ -472,12 +496,12 @@ Logging: --log.stdout.filter The filter to use for logs written to stdout - + [default: ] --log.file.format The format to use for logs written to the log file - + [default: terminal] Possible values: @@ -487,22 +511,22 @@ Logging: --log.file.filter The filter to use for logs written to the log file - + [default: debug] --log.file.directory The path to put log files in - - [default: /logs] + + [default: /root/.cache/reth/logs] --log.file.max-size The maximum size (in MB) of one log file - + [default: 200] --log.file.max-files The maximum amount of log files that will be stored. If set to 0, background file logging is disabled - + [default: 5] --log.journald @@ -510,12 +534,12 @@ Logging: --log.journald.filter The filter to use for logs written to journald - + [default: error] --color Sets whether or not the formatter emits ANSI terminal escape codes for colors and other text formatting - + [default: always] Possible values: @@ -526,7 +550,7 @@ Logging: Display: -v, --verbosity... Set the minimum log level. - + -v Errors -vv Warnings -vvv Info @@ -535,4 +559,4 @@ Display: -q, --quiet Silence all log output -``` \ No newline at end of file +``` diff --git a/crates/node-core/src/args/rpc_server_args.rs b/crates/node-core/src/args/rpc_server_args.rs index e9a21616a..b12f2740a 100644 --- a/crates/node-core/src/args/rpc_server_args.rs +++ b/crates/node-core/src/args/rpc_server_args.rs @@ -99,7 +99,7 @@ pub struct RpcServerArgs { #[arg(long = "ws.api", value_parser = RpcModuleSelectionValueParser::default())] pub ws_api: Option, - /// Disable the IPC-RPC server + /// Disable the IPC-RPC server #[arg(long)] pub ipcdisable: bool, @@ -124,6 +124,14 @@ pub struct RpcServerArgs { #[arg(long = "authrpc.jwtsecret", value_name = "PATH", global = true, required = false)] pub auth_jwtsecret: Option, + /// Enable auth engine API over IPC + #[arg(long)] + pub auth_ipc: bool, + + /// Filename for auth IPC socket/pipe within the datadir + #[arg(long = "auth-ipc.path", default_value_t = constants::DEFAULT_ENGINE_API_IPC_ENDPOINT.to_string())] + pub auth_ipc_path: String, + /// Hex encoded JWT secret to authenticate the regular RPC server(s), see `--http.api` and /// `--ws.api`. /// @@ -133,37 +141,37 @@ pub struct RpcServerArgs { pub rpc_jwtsecret: Option, /// Set the maximum RPC request payload size for both HTTP and WS in megabytes. - #[arg(long, default_value_t = RPC_DEFAULT_MAX_REQUEST_SIZE_MB.into())] + #[arg(long = "rpc.max-request-size", alias = "rpc-max-request-size", default_value_t = RPC_DEFAULT_MAX_REQUEST_SIZE_MB.into())] pub rpc_max_request_size: MaxU32, /// Set the maximum RPC response payload size for both HTTP and WS in megabytes. - #[arg(long, visible_alias = "--rpc.returndata.limit", default_value_t = RPC_DEFAULT_MAX_RESPONSE_SIZE_MB.into())] + #[arg(long = "rpc.max-response-size", alias = "rpc-max-response-size", visible_alias = "rpc.returndata.limit", default_value_t = RPC_DEFAULT_MAX_RESPONSE_SIZE_MB.into())] pub rpc_max_response_size: MaxU32, /// Set the maximum concurrent subscriptions per connection. - #[arg(long, default_value_t = RPC_DEFAULT_MAX_SUBS_PER_CONN.into())] + #[arg(long = "rpc.max-subscriptions-per-connection", alias = "rpc-max-subscriptions-per-connection", default_value_t = RPC_DEFAULT_MAX_SUBS_PER_CONN.into())] pub rpc_max_subscriptions_per_connection: MaxU32, /// Maximum number of RPC server connections. - #[arg(long, value_name = "COUNT", default_value_t = RPC_DEFAULT_MAX_CONNECTIONS.into())] + #[arg(long = "rpc.max-connections", alias = "rpc-max-connections", value_name = "COUNT", default_value_t = RPC_DEFAULT_MAX_CONNECTIONS.into())] pub rpc_max_connections: MaxU32, /// Maximum number of concurrent tracing requests. - #[arg(long, value_name = "COUNT", default_value_t = constants::default_max_tracing_requests())] + #[arg(long = "rpc.max-tracing-requests", alias = "rpc-max-tracing-requests", value_name = "COUNT", default_value_t = constants::default_max_tracing_requests())] pub rpc_max_tracing_requests: usize, /// Maximum number of blocks that could be scanned per filter request. (0 = entire chain) - #[arg(long, value_name = "COUNT", default_value_t = ZeroAsNoneU64::new(constants::DEFAULT_MAX_BLOCKS_PER_FILTER))] + #[arg(long = "rpc.max-blocks-per-filter", alias = "rpc-max-blocks-per-filter", value_name = "COUNT", default_value_t = ZeroAsNoneU64::new(constants::DEFAULT_MAX_BLOCKS_PER_FILTER))] pub rpc_max_blocks_per_filter: ZeroAsNoneU64, /// Maximum number of logs that can be returned in a single response. (0 = no limit) - #[arg(long, value_name = "COUNT", default_value_t = ZeroAsNoneU64::new(constants::DEFAULT_MAX_LOGS_PER_RESPONSE as u64))] + #[arg(long = "rpc.max-logs-per-response", alias = "rpc-max-logs-per-response", value_name = "COUNT", default_value_t = ZeroAsNoneU64::new(constants::DEFAULT_MAX_LOGS_PER_RESPONSE as u64))] pub rpc_max_logs_per_response: ZeroAsNoneU64, /// Maximum gas limit for `eth_call` and call tracing RPC methods. #[arg( - long, - alias = "rpc.gascap", + long = "rpc.gascap", + alias = "rpc-gascap", value_name = "GAS_CAP", value_parser = RangedU64ValueParser::::new().range(1..), default_value_t = RPC_DEFAULT_GAS_CAP.into() @@ -177,14 +185,6 @@ pub struct RpcServerArgs { /// Gas price oracle configuration. #[command(flatten)] pub gas_price_oracle: GasPriceOracleArgs, - - /// Enable auth engine api over IPC - #[arg(long)] - pub auth_ipc: bool, - - /// Filename for auth IPC socket/pipe within the datadir - #[arg(long = "auth-ipc.path", default_value_t = constants::DEFAULT_ENGINE_API_IPC_ENDPOINT.to_string())] - pub auth_ipc_path: String, } impl RpcServerArgs { diff --git a/crates/node-core/src/args/txpool_args.rs b/crates/node-core/src/args/txpool_args.rs index ea1bf67b8..db9e43d82 100644 --- a/crates/node-core/src/args/txpool_args.rs +++ b/crates/node-core/src/args/txpool_args.rs @@ -14,28 +14,28 @@ use reth_transaction_pool::{ #[command(next_help_heading = "TxPool")] pub struct TxPoolArgs { /// Max number of transaction in the pending sub-pool. - #[arg(long = "txpool.pending_max_count", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)] + #[arg(long = "txpool.pending-max-count", alias = "txpool.pending_max_count", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)] pub pending_max_count: usize, /// Max size of the pending sub-pool in megabytes. - #[arg(long = "txpool.pending_max_size", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)] + #[arg(long = "txpool.pending-max-size", alias = "txpool.pending_max_size", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)] pub pending_max_size: usize, /// Max number of transaction in the basefee sub-pool - #[arg(long = "txpool.basefee_max_count", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)] + #[arg(long = "txpool.basefee-max-count", alias = "txpool.basefee_max_count", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)] pub basefee_max_count: usize, /// Max size of the basefee sub-pool in megabytes. - #[arg(long = "txpool.basefee_max_size", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)] + #[arg(long = "txpool.basefee-max-size", alias = "txpool.basefee_max_size", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)] pub basefee_max_size: usize, /// Max number of transaction in the queued sub-pool - #[arg(long = "txpool.queued_max_count", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)] + #[arg(long = "txpool.queued-max-count", alias = "txpool.queued_max_count", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)] pub queued_max_count: usize, /// Max size of the queued sub-pool in megabytes. - #[arg(long = "txpool.queued_max_size", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)] + #[arg(long = "txpool.queued-max-size", alias = "txpool.queued_max_size", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)] pub queued_max_size: usize, /// Max number of executable transaction slots guaranteed per account - #[arg(long = "txpool.max_account_slots", default_value_t = TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER)] + #[arg(long = "txpool.max-account-slots", long = "txpool.max_account_slots", default_value_t = TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER)] pub max_account_slots: usize, /// Price bump (in %) for the transaction pool underpriced check. @@ -47,11 +47,11 @@ pub struct TxPoolArgs { pub blob_transaction_price_bump: u128, /// Max size in bytes of a single transaction allowed to enter the pool - #[arg(long = "txpool.max_tx_input_bytes", default_value_t = DEFAULT_MAX_TX_INPUT_BYTES)] + #[arg(long = "txpool.max-tx-input-bytes", alias = "txpool.max_tx_input_bytes", default_value_t = DEFAULT_MAX_TX_INPUT_BYTES)] pub max_tx_input_bytes: usize, /// The maximum number of blobs to keep in the in memory blob cache. - #[arg(long = "txpool.max_cached_entries", default_value_t = DEFAULT_MAX_CACHED_BLOBS)] + #[arg(long = "txpool.max-cached-entries", alias = "txpool.max_cached_entries", default_value_t = DEFAULT_MAX_CACHED_BLOBS)] pub max_cached_entries: u32, /// Flag to disable local transaction exemptions.