Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc server: tracking/stabilize --experimental-rpc-endpoint CLI #5508

Open
niklasad1 opened this issue Aug 28, 2024 · 0 comments
Open

rpc server: tracking/stabilize --experimental-rpc-endpoint CLI #5508

niklasad1 opened this issue Aug 28, 2024 · 0 comments

Comments

@niklasad1
Copy link
Member

niklasad1 commented Aug 28, 2024

#4792 introduces a new CLI option --experimental-rpc-endpoint which a new way to configure the rpc settings including listening addr and specify any number of times which different settings.

The format for this option is --experimental-rpc-endpoint" listen-addr=<ip:port>,<key=value>,..." where each option is separated by a comma and listen-addr is the only required param.

Possible settings

The following options are available:

  • listen-addr: The socket address (ip:port) to listen on. Be careful to not expose the server to the public internet unless you know what you're doing. (required)
  • disable-batch-requests: Disable batch requests (optional)
  • max-connections: The maximum number of concurrent connections that the server will accept (optional)
  • max-request-size: The maximum size of a request body in megabytes (optional)
  • max-response-size: The maximum size of a response body in megabytes (optional)
  • max-subscriptions-per-connection: The maximum number of subscriptions per connection (optional)
  • max-buffer-capacity-per-connection: The maximum buffer capacity per connection (optional)
  • max-batch-request-len: The maximum number of requests in a batch (optional)
  • cors: The CORS allowed origins, this can enabled more than once (optional)
  • methods: Which RPC methods to allow, valid values are "safe", "unsafe" and "auto" (optional)
  • optional: If the listen address is optional i.e the interface is not required to be available For example this may be useful if some platforms doesn't support ipv6 (optional)
  • rate-limit: The rate limit in calls per minute for each connection (optional)
  • rate-limit-trust-proxy-headers: Trust proxy headers for disable rate limiting (optional)
  • rate-limit-whitelisted-ips: Disable rate limiting for certain ip addresses (optional)
  • retry-random-port: If the port is already in use, retry with a random port (optional)

How to use it

So for instance in this PR it's now possible to start up three RPC endpoints as follows:

$ polkadot --experimental-rpc-endpoint "listen-addr=127.0.0.1:9944,methods=unsafe" --experimental-rpc-endpoint "listen-addr=0.0.0.0:9945,methods=safe,rate-limit=100" --experimental-rpc-endpoint "listen-addr=[::1]:9944,optional=true"

Cons

The params is not automatically generated by the CLI parsing (clap) instead these options are manually documented and manually parsed which isn't as ergonomic both for usage (not as nice help menu) and maintenance (manual documentation needs to updated with changes). That's why it's currently --experimental and needs to be battle-tested by different use-cases etc...

Stabilize/call for feedback on this feature

We are happy to get feedback on this feature, bug reports or any changes you want to see until stabilization

Roadmap

  1. Stabilize --rpc-endpoint
  2. Deprecate old CLI rpc params --rpc-port, --rpc-methods, and all other --rpc_x except --rpc-endpoint
@niklasad1 niklasad1 changed the title rpc server: tracking/stablize --experimental-rpc-endpoint CLI rpc server: tracking/stabilize --experimental-rpc-endpoint CLI Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant