Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Precise HTTP or WebSockets for JSON-RPC options #9027

Merged
merged 2 commits into from
Jul 3, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions parity/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ usage! {

ARG arg_mode: (String) = "last", or |c: &Config| c.parity.as_ref()?.mode.clone(),
"--mode=[MODE]",
"Set the operating mode. MODE can be one of: last - Uses the last-used mode, active if none; active - Parity continuously syncs the chain; passive - Parity syncs initially, then sleeps and wakes regularly to resync; dark - Parity syncs only when the RPC is active; offline - Parity doesn't sync.",
"Set the operating mode. MODE can be one of: last - Uses the last-used mode, active if none; active - Parity continuously syncs the chain; passive - Parity syncs initially, then sleeps and wakes regularly to resync; dark - Parity syncs only when the JSON-RPC is active; offline - Parity doesn't sync.",

ARG arg_mode_timeout: (u64) = 300u64, or |c: &Config| c.parity.as_ref()?.mode_timeout.clone(),
"--mode-timeout=[SECS]",
Expand Down Expand Up @@ -315,7 +315,7 @@ usage! {

ARG arg_ports_shift: (u16) = 0u16, or |c: &Config| c.misc.as_ref()?.ports_shift,
"--ports-shift=[SHIFT]",
"Add SHIFT to all port numbers Parity is listening on. Includes network port and all servers (RPC, WebSockets, UI, IPFS, SecretStore).",
"Add SHIFT to all port numbers Parity is listening on. Includes network port and all servers (HTTP JSON-RPC, WebSockets JSON-RPC, UI, IPFS, SecretStore).",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Off-topic: Can you remove UI here while we are at it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.


["Account Options"]
FLAG flag_no_hardware_wallets: (bool) = false, or |c: &Config| c.account.as_ref()?.disable_hardware.clone(),
Expand Down Expand Up @@ -449,59 +449,59 @@ usage! {
"--reserved-peers=[FILE]",
"Provide a file containing enodes, one per line. These nodes will always have a reserved slot on top of the normal maximum peers.",

["API and Console Options – RPC"]
["API and Console Options – HTTP JSON-RPC"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "…JSON-RPC over HTTP"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to keep it short.

FLAG flag_no_jsonrpc: (bool) = false, or |c: &Config| c.rpc.as_ref()?.disable.clone(),
"--no-jsonrpc",
"Disable the JSON-RPC API server.",
"Disable the HTTP JSON-RPC API server.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe "JSON-RPC HTTP API server"?


ARG arg_jsonrpc_port: (u16) = 8545u16, or |c: &Config| c.rpc.as_ref()?.port.clone(),
"--jsonrpc-port=[PORT]",
"Specify the port portion of the JSONRPC API server.",
"Specify the port portion of the HTTP JSON-RPC API server.",

ARG arg_jsonrpc_interface: (String) = "local", or |c: &Config| c.rpc.as_ref()?.interface.clone(),
"--jsonrpc-interface=[IP]",
"Specify the hostname portion of the JSONRPC API server, IP should be an interface's IP address, or all (all interfaces) or local.",
"Specify the hostname portion of the HTTP JSON-RPC API server, IP should be an interface's IP address, or all (all interfaces) or local.",

ARG arg_jsonrpc_apis: (String) = "web3,eth,pubsub,net,parity,private,parity_pubsub,traces,rpc,shh,shh_pubsub", or |c: &Config| c.rpc.as_ref()?.apis.as_ref().map(|vec| vec.join(",")),
"--jsonrpc-apis=[APIS]",
"Specify the APIs available through the JSONRPC interface using a comma-delimited list of API names. Possible names are: all, safe, web3, net, eth, pubsub, personal, signer, parity, parity_pubsub, parity_accounts, parity_set, traces, rpc, secretstore, shh, shh_pubsub. You can also disable a specific API by putting '-' in the front, example: all,-personal. safe contains following apis: web3, net, eth, pubsub, parity, parity_pubsub, traces, rpc, shh, shh_pubsub",
"Specify the APIs available through the HTTP JSON-RPC interface using a comma-delimited list of API names. Possible names are: all, safe, web3, net, eth, pubsub, personal, signer, parity, parity_pubsub, parity_accounts, parity_set, traces, rpc, secretstore, shh, shh_pubsub. You can also disable a specific API by putting '-' in the front, example: all,-personal. safe contains following apis: web3, net, eth, pubsub, parity, parity_pubsub, traces, rpc, shh, shh_pubsub",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe . "safe" enables the following APIs: web3, net … …?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


ARG arg_jsonrpc_hosts: (String) = "none", or |c: &Config| c.rpc.as_ref()?.hosts.as_ref().map(|vec| vec.join(",")),
"--jsonrpc-hosts=[HOSTS]",
"List of allowed Host header values. This option will validate the Host header sent by the browser, it is additional security against some attack vectors. Special options: \"all\", \"none\",.",

ARG arg_jsonrpc_threads: (usize) = 4usize, or |c: &Config| c.rpc.as_ref()?.processing_threads,
"--jsonrpc-threads=[THREADS]",
"Turn on additional processing threads in all RPC servers. Setting this to non-zero value allows parallel cpu-heavy queries execution.",
"Turn on additional processing threads in all HTTP JSON-RPC servers. Setting this to non-zero value allows parallel cpu-heavy queries execution.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/parallel cpu-heavy queries execution./parallel execution of cpu-heavy queries/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


ARG arg_jsonrpc_cors: (String) = "none", or |c: &Config| c.rpc.as_ref()?.cors.as_ref().map(|vec| vec.join(",")),
"--jsonrpc-cors=[URL]",
"Specify CORS header for JSON-RPC API responses. Special options: \"all\", \"none\".",
"Specify CORS header for HTTP JSON-RPC API responses. Special options: \"all\", \"none\".",

ARG arg_jsonrpc_server_threads: (Option<usize>) = None, or |c: &Config| c.rpc.as_ref()?.server_threads,
"--jsonrpc-server-threads=[NUM]",
"Enables multiple threads handling incoming connections for HTTP JSON-RPC server.",

ARG arg_jsonrpc_max_payload: (Option<usize>) = None, or |c: &Config| c.rpc.as_ref()?.max_payload,
"--jsonrpc-max-payload=[MB]",
"Specify maximum size for RPC requests in megabytes.",
"Specify maximum size for HTTP JSON-RPC requests in megabytes.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a default here? If yes, I think we should state it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is "None", which mean there is no limit per default: ARG arg_jsonrpc_max_payload: (Option<usize>) = None

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of a default value, it is added when the help is computed.
Example:

    --jsonrpc-cors=[URL]
        Specify CORS header for JSON-RPC API responses. Special options: "all", "none". (default: none)


["API and Console Options – WebSockets"]
FLAG flag_no_ws: (bool) = false, or |c: &Config| c.websockets.as_ref()?.disable.clone(),
"--no-ws",
"Disable the WebSockets server.",
"Disable the WebSockets JSON-RPC server.",

ARG arg_ws_port: (u16) = 8546u16, or |c: &Config| c.websockets.as_ref()?.port.clone(),
"--ws-port=[PORT]",
"Specify the port portion of the WebSockets server.",
"Specify the port portion of the WebSockets JSON-RPC server.",

ARG arg_ws_interface: (String) = "local", or |c: &Config| c.websockets.as_ref()?.interface.clone(),
"--ws-interface=[IP]",
"Specify the hostname portion of the WebSockets server, IP should be an interface's IP address, or all (all interfaces) or local.",
"Specify the hostname portion of the WebSockets JSON-RPC server, IP should be an interface's IP address, or all (all interfaces) or local.",

ARG arg_ws_apis: (String) = "web3,eth,pubsub,net,parity,parity_pubsub,private,traces,rpc,shh,shh_pubsub", or |c: &Config| c.websockets.as_ref()?.apis.as_ref().map(|vec| vec.join(",")),
"--ws-apis=[APIS]",
"Specify the APIs available through the WebSockets interface using a comma-delimited list of API names. Possible names are: all, safe, web3, net, eth, pubsub, personal, signer, parity, parity_pubsub, parity_accounts, parity_set, traces, rpc, secretstore, shh, shh_pubsub. You can also disable a specific API by putting '-' in the front, example: all,-personal. safe contains following apis: web3, net, eth, pubsub, parity, parity_pubsub, traces, rpc, shh, shh_pubsub",
"Specify the JSON-RPC APIs available through the WebSockets interface using a comma-delimited list of API names. Possible names are: all, safe, web3, net, eth, pubsub, personal, signer, parity, parity_pubsub, parity_accounts, parity_set, traces, rpc, secretstore, shh, shh_pubsub. You can also disable a specific API by putting '-' in the front, example: all,-personal. safe contains following apis: web3, net, eth, pubsub, parity, parity_pubsub, traces, rpc, shh, shh_pubsub",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe . "safe" enables the following APIs: web3, net … …?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


ARG arg_ws_origins: (String) = "parity://*,chrome-extension://*,moz-extension://*", or |c: &Config| c.websockets.as_ref()?.origins.as_ref().map(|vec| vec.join(",")),
"--ws-origins=[URL]",
Expand All @@ -513,7 +513,7 @@ usage! {

ARG arg_ws_max_connections: (usize) = 100usize, or |c: &Config| c.websockets.as_ref()?.max_connections,
"--ws-max-connections=[CONN]",
"Maximal number of allowed concurrent WS connections.",
"Maximal number of allowed concurrent WebSockets JSON-RPC connections.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Maximal/Maximum/ (or just max)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


["API and Console Options – IPC"]
FLAG flag_no_ipc: (bool) = false, or |c: &Config| c.ipc.as_ref()?.disable.clone(),
Expand Down Expand Up @@ -646,7 +646,7 @@ usage! {

FLAG flag_tx_queue_no_unfamiliar_locals: (bool) = false, or |c: &Config| c.mining.as_ref()?.tx_queue_no_unfamiliar_locals.clone(),
"--tx-queue-no-unfamiliar-locals",
"Transactions received via local means (RPC, WS, etc) will be treated as external if the sending account is unknown.",
"Transactions received via local means (HTTP JSON-RPC, WS JSON-RPC, etc) will be treated as external if the sending account is unknown.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here: WebSockets or WS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I left it as "ws" was not part of the flag, but you're right, I'll change it to WebSockets.


FLAG flag_refuse_service_transactions: (bool) = false, or |c: &Config| c.mining.as_ref()?.refuse_service_transactions.clone(),
"--refuse-service-transactions",
Expand Down Expand Up @@ -885,7 +885,7 @@ usage! {

FLAG flag_dapps_apis_all: (bool) = false, or |_| None,
"--dapps-apis-all",
"Dapps server is merged with RPC server. Use --jsonrpc-apis.",
"Dapps server is merged with HTTP JSON-RPC server. Use --jsonrpc-apis.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we prefix with "DEPRECATED. Dapps server is merged… …"?


FLAG flag_geth: (bool) = false, or |_| None,
"--geth",
Expand Down Expand Up @@ -913,7 +913,7 @@ usage! {

FLAG flag_jsonrpc: (bool) = false, or |_| None,
"-j, --jsonrpc",
"Does nothing; JSON-RPC is on by default now.",
"Does nothing; HTTP JSON-RPC is on by default now.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need DEPRECATED prefix? Also, I for one prefer "JSON-RPC over HTTP".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same below)


FLAG flag_jsonrpc_off: (bool) = false, or |_| None,
"--jsonrpc-off",
Expand All @@ -929,7 +929,7 @@ usage! {

FLAG flag_rpc: (bool) = false, or |_| None,
"--rpc",
"Does nothing; JSON-RPC is on by default now.",
"Does nothing; HTTP JSON-RPC is on by default now.",

FLAG flag_public_node: (bool) = false, or |_| None,
"--public-node",
Expand Down Expand Up @@ -961,19 +961,19 @@ usage! {

ARG arg_dapps_port: (Option<u16>) = None, or |c: &Config| c.dapps.as_ref()?.port.clone(),
"--dapps-port=[PORT]",
"Dapps server is merged with RPC server. Use --jsonrpc-port.",
"Dapps server is merged with HTTP JSON-RPC server. Use --jsonrpc-port.",

ARG arg_dapps_interface: (Option<String>) = None, or |c: &Config| c.dapps.as_ref()?.interface.clone(),
"--dapps-interface=[IP]",
"Dapps server is merged with RPC server. Use --jsonrpc-interface.",
"Dapps server is merged with HTTP JSON-RPC server. Use --jsonrpc-interface.",

ARG arg_dapps_hosts: (Option<String>) = None, or |c: &Config| c.dapps.as_ref()?.hosts.as_ref().map(|vec| vec.join(",")),
"--dapps-hosts=[HOSTS]",
"Dapps server is merged with RPC server. Use --jsonrpc-hosts.",
"Dapps server is merged with HTTP JSON-RPC server. Use --jsonrpc-hosts.",

ARG arg_dapps_cors: (Option<String>) = None, or |c: &Config| c.dapps.as_ref()?.cors.clone(),
"--dapps-cors=[URL]",
"Dapps server is merged with RPC server. Use --jsonrpc-cors.",
"Dapps server is merged with HTTP JSON-RPC server. Use --jsonrpc-cors.",

ARG arg_dapps_user: (Option<String>) = None, or |c: &Config| c.dapps.as_ref()?.user.clone(),
"--dapps-user=[USERNAME]",
Expand Down