mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Make it possible to override maximum payload of RPC (#9019)
* Make it possible to override maximum payload of RPC * Finish it. * remove todo. * Update client/cli/src/commands/run_cmd.rs * Apply suggestions from code review Co-authored-by: David <dvdplm@gmail.com> * Apply suggestions from code review Co-authored-by: David <dvdplm@gmail.com> * Incorporate suggestions * Thread rpc_max_payload from configuration to trace_block * Try obey line gitlab/check_line_width.sh * update state rpc tests * Improve readbility * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com> Co-authored-by: David <dvdplm@gmail.com>
This commit is contained in:
@@ -42,12 +42,11 @@ pub struct RunCmd {
|
||||
/// The node will be started with the authority role and actively
|
||||
/// participate in any consensus task that it can (e.g. depending on
|
||||
/// availability of local keys).
|
||||
#[structopt(
|
||||
long = "validator"
|
||||
)]
|
||||
#[structopt(long)]
|
||||
pub validator: bool,
|
||||
|
||||
/// Disable GRANDPA voter when running in validator mode, otherwise disable the GRANDPA observer.
|
||||
/// Disable GRANDPA voter when running in validator mode, otherwise disable the GRANDPA
|
||||
/// observer.
|
||||
#[structopt(long)]
|
||||
pub no_grandpa: bool,
|
||||
|
||||
@@ -57,8 +56,8 @@ pub struct RunCmd {
|
||||
|
||||
/// Listen to all RPC interfaces.
|
||||
///
|
||||
/// Default is local. Note: not all RPC methods are safe to be exposed publicly. Use an RPC proxy
|
||||
/// server to filter out dangerous methods. More details:
|
||||
/// Default is local. Note: not all RPC methods are safe to be exposed publicly. Use an RPC
|
||||
/// proxy server to filter out dangerous methods. More details:
|
||||
/// <https://github.com/paritytech/substrate/wiki/Public-RPC>.
|
||||
/// Use `--unsafe-rpc-external` to suppress the warning if you understand the risks.
|
||||
#[structopt(long = "rpc-external")]
|
||||
@@ -74,8 +73,8 @@ pub struct RunCmd {
|
||||
///
|
||||
/// - `Unsafe`: Exposes every RPC method.
|
||||
/// - `Safe`: Exposes only a safe subset of RPC methods, denying unsafe RPC methods.
|
||||
/// - `Auto`: Acts as `Safe` if RPC is served externally, e.g. when `--{rpc,ws}-external` is passed,
|
||||
/// otherwise acts as `Unsafe`.
|
||||
/// - `Auto`: Acts as `Safe` if RPC is served externally, e.g. when `--{rpc,ws}-external` is
|
||||
/// passed, otherwise acts as `Unsafe`.
|
||||
#[structopt(
|
||||
long,
|
||||
value_name = "METHOD SET",
|
||||
@@ -88,8 +87,9 @@ pub struct RunCmd {
|
||||
|
||||
/// Listen to all Websocket interfaces.
|
||||
///
|
||||
/// Default is local. Note: not all RPC methods are safe to be exposed publicly. Use an RPC proxy
|
||||
/// server to filter out dangerous methods. More details: <https://github.com/paritytech/substrate/wiki/Public-RPC>.
|
||||
/// Default is local. Note: not all RPC methods are safe to be exposed publicly. Use an RPC
|
||||
/// proxy server to filter out dangerous methods. More details:
|
||||
/// <https://github.com/paritytech/substrate/wiki/Public-RPC>.
|
||||
/// Use `--unsafe-ws-external` to suppress the warning if you understand the risks.
|
||||
#[structopt(long = "ws-external")]
|
||||
pub ws_external: bool,
|
||||
@@ -100,6 +100,11 @@ pub struct RunCmd {
|
||||
#[structopt(long = "unsafe-ws-external")]
|
||||
pub unsafe_ws_external: bool,
|
||||
|
||||
/// Set the the maximum RPC payload size for both requests and responses (both http and ws), in
|
||||
/// megabytes. Default is 15MiB.
|
||||
#[structopt(long = "rpc-max-payload")]
|
||||
pub rpc_max_payload: Option<usize>,
|
||||
|
||||
/// Listen to all Prometheus data source interfaces.
|
||||
///
|
||||
/// Default is local.
|
||||
@@ -194,7 +199,8 @@ pub struct RunCmd {
|
||||
#[structopt(long, conflicts_with_all = &["alice", "charlie", "dave", "eve", "ferdie", "one", "two"])]
|
||||
pub bob: bool,
|
||||
|
||||
/// Shortcut for `--name Charlie --validator` with session keys for `Charlie` added to keystore.
|
||||
/// Shortcut for `--name Charlie --validator` with session keys for `Charlie` added to
|
||||
/// keystore.
|
||||
#[structopt(long, conflicts_with_all = &["alice", "bob", "dave", "eve", "ferdie", "one", "two"])]
|
||||
pub charlie: bool,
|
||||
|
||||
@@ -435,6 +441,10 @@ impl CliConfiguration for RunCmd {
|
||||
Ok(self.rpc_methods.into())
|
||||
}
|
||||
|
||||
fn rpc_max_payload(&self) -> Result<Option<usize>> {
|
||||
Ok(self.rpc_max_payload)
|
||||
}
|
||||
|
||||
fn transaction_pool(&self) -> Result<TransactionPoolOptions> {
|
||||
Ok(self.pool_config.transaction_pool())
|
||||
}
|
||||
|
||||
@@ -372,6 +372,11 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
|
||||
Ok(Some(Vec::new()))
|
||||
}
|
||||
|
||||
/// Get maximum RPC payload.
|
||||
fn rpc_max_payload(&self) -> Result<Option<usize>> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
/// Get the prometheus configuration (`None` if disabled)
|
||||
///
|
||||
/// By default this is `None`.
|
||||
@@ -535,6 +540,7 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
|
||||
rpc_ws_max_connections: self.rpc_ws_max_connections()?,
|
||||
rpc_http_threads: self.rpc_http_threads()?,
|
||||
rpc_cors: self.rpc_cors(is_dev)?,
|
||||
rpc_max_payload: self.rpc_max_payload()?,
|
||||
prometheus_config: self.prometheus_config(DCV::prometheus_listen_port())?,
|
||||
telemetry_endpoints,
|
||||
telemetry_external_transport: self.telemetry_external_transport()?,
|
||||
|
||||
Reference in New Issue
Block a user