mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 01:07:57 +00:00
client: Replace unsafe_rpc_expose with an RpcMethods enum (#5729)
* client: Replace `unsafe_rpc_expose` with an `RpcMethods` enum which can be either Default, Safe or Unsafe. The idea is to have the following: | | --rpc-external=false | --rpc-external=true | |--------------------- |------------------- |----------------- | | --rpc-methods=Default | | unsafe calls denied | | --rpc-methods=Safe | unsafe calls denied | unsafe calls denied | | --rpc-methods=Unsafe | | | Since the previous `unsafe-rpc-expose` option was confusing. * client: Only warn against exposing externally unsafe RPC method set * Apply suggestions from code review Co-Authored-By: Cecile Tonglet <cecile.tonglet@cecton.com> * cli: Rephrase doc comment for rpc_methods config * Improve debuggability of build_spec_works ...by printing to stderr the stderr of the command. This is normally suppressed for succesful tests but not for failing ones - if that's the case then it's useful to see the test failure reason inline rather than having to execute the command separately ourselves. * Rename RpcMethods::{Default => Auto} variant * Update bin/node/cli/tests/build_spec_works.rs Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com> Co-authored-by: Cecile Tonglet <cecile.tonglet@cecton.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -27,8 +27,8 @@ use names::{Generator, Name};
|
||||
use sc_client_api::execution_extensions::ExecutionStrategies;
|
||||
use sc_service::config::{
|
||||
Configuration, DatabaseConfig, ExtTransport, KeystoreConfig, NetworkConfiguration,
|
||||
NodeKeyConfig, OffchainWorkerConfig, PrometheusConfig, PruningMode, Role, TaskType,
|
||||
TelemetryEndpoints, TransactionPoolOptions, WasmExecutionMethod,
|
||||
NodeKeyConfig, OffchainWorkerConfig, PrometheusConfig, PruningMode, Role, RpcMethods,
|
||||
TaskType, TelemetryEndpoints, TransactionPoolOptions, WasmExecutionMethod,
|
||||
};
|
||||
use sc_service::{ChainSpec, TracingReceiver};
|
||||
use std::future::Future;
|
||||
@@ -265,10 +265,11 @@ pub trait CliConfiguration: Sized {
|
||||
Ok(Default::default())
|
||||
}
|
||||
|
||||
/// Returns `Ok(true) if potentially unsafe RPC is to be exposed.
|
||||
/// Returns the RPC method set to expose.
|
||||
///
|
||||
/// By default this is `false`.
|
||||
fn unsafe_rpc_expose(&self) -> Result<bool> {
|
||||
/// By default this is `RpcMethods::Auto` (unsafe RPCs are denied iff
|
||||
/// `{rpc,ws}_external` returns true, respectively).
|
||||
fn rpc_methods(&self) -> Result<RpcMethods> {
|
||||
Ok(Default::default())
|
||||
}
|
||||
|
||||
@@ -449,7 +450,7 @@ pub trait CliConfiguration: Sized {
|
||||
execution_strategies: self.execution_strategies(is_dev)?,
|
||||
rpc_http: self.rpc_http()?,
|
||||
rpc_ws: self.rpc_ws()?,
|
||||
unsafe_rpc_expose: self.unsafe_rpc_expose()?,
|
||||
rpc_methods: self.rpc_methods()?,
|
||||
rpc_ws_max_connections: self.rpc_ws_max_connections()?,
|
||||
rpc_cors: self.rpc_cors(is_dev)?,
|
||||
prometheus_config: self.prometheus_config()?,
|
||||
|
||||
Reference in New Issue
Block a user