Remove public node settings from cli (#8758)
* Remove public node related settings * Fix tests * Unwrap accounts provider in all rpc apis * Unwrap AccountProvider in all cli places * Fix rpc tests
This commit is contained in:
@@ -240,10 +240,6 @@ usage! {
|
||||
{
|
||||
// Global flags and arguments
|
||||
["Operating Options"]
|
||||
FLAG flag_public_node: (bool) = false, or |c: &Config| c.parity.as_ref()?.public_node.clone(),
|
||||
"--public-node",
|
||||
"Start Parity as a public web server. Account storage and transaction signing will be delegated to the UI.",
|
||||
|
||||
FLAG flag_no_download: (bool) = false, or |c: &Config| c.parity.as_ref()?.no_download.clone(),
|
||||
"--no-download",
|
||||
"Normally new releases will be downloaded ready for updating. This disables it. Not recommended.",
|
||||
@@ -948,6 +944,10 @@ usage! {
|
||||
"--rpc",
|
||||
"Does nothing; JSON-RPC is on by default now.",
|
||||
|
||||
FLAG flag_public_node: (bool) = false, or |_| None,
|
||||
"--public-node",
|
||||
"Does nothing; Public node is removed from Parity.",
|
||||
|
||||
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.",
|
||||
@@ -1070,7 +1070,6 @@ struct Operating {
|
||||
auto_update_delay: Option<u16>,
|
||||
auto_update_check_frequency: Option<u16>,
|
||||
release_track: Option<String>,
|
||||
public_node: Option<bool>,
|
||||
no_download: Option<bool>,
|
||||
no_consensus: Option<bool>,
|
||||
chain: Option<String>,
|
||||
@@ -1081,6 +1080,9 @@ struct Operating {
|
||||
light: Option<bool>,
|
||||
no_persistent_txqueue: Option<bool>,
|
||||
no_hardcoded_sync: Option<bool>,
|
||||
|
||||
#[serde(rename="public_node")]
|
||||
_legacy_public_node: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, PartialEq, Deserialize)]
|
||||
@@ -1797,7 +1799,6 @@ mod tests {
|
||||
auto_update_delay: None,
|
||||
auto_update_check_frequency: None,
|
||||
release_track: None,
|
||||
public_node: None,
|
||||
no_download: None,
|
||||
no_consensus: None,
|
||||
chain: Some("./chain.json".into()),
|
||||
@@ -1808,6 +1809,7 @@ mod tests {
|
||||
light: None,
|
||||
no_hardcoded_sync: None,
|
||||
no_persistent_txqueue: None,
|
||||
_legacy_public_node: None,
|
||||
}),
|
||||
account: Some(Account {
|
||||
unlock: Some(vec!["0x1".into(), "0x2".into(), "0x3".into()]),
|
||||
|
||||
@@ -35,7 +35,6 @@ use ethcore::verification::queue::VerifierSettings;
|
||||
use miner::pool;
|
||||
|
||||
use rpc::{IpcConfiguration, HttpConfiguration, WsConfiguration, UiConfiguration};
|
||||
use rpc_apis::ApiSet;
|
||||
use parity_rpc::NetworkSettings;
|
||||
use cache::CacheConfig;
|
||||
use helpers::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_price, geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_queue_strategy, to_queue_penalization, passwords_from_files};
|
||||
@@ -138,7 +137,6 @@ impl Configuration {
|
||||
let fat_db = self.args.arg_fat_db.parse()?;
|
||||
let compaction = self.args.arg_db_compaction.parse()?;
|
||||
let wal = !self.args.flag_fast_and_loose;
|
||||
let public_node = self.args.flag_public_node;
|
||||
let warp_sync = !self.args.flag_no_warp;
|
||||
let geth_compatibility = self.args.flag_geth;
|
||||
let dapps_conf = self.dapps_config();
|
||||
@@ -379,7 +377,6 @@ impl Configuration {
|
||||
vm_type: vm_type,
|
||||
warp_sync: warp_sync,
|
||||
warp_barrier: self.args.arg_warp_barrier,
|
||||
public_node: public_node,
|
||||
geth_compatibility: geth_compatibility,
|
||||
net_settings: self.network_settings()?,
|
||||
dapps_conf: dapps_conf,
|
||||
@@ -914,10 +911,7 @@ impl Configuration {
|
||||
enabled: self.rpc_enabled(),
|
||||
interface: self.rpc_interface(),
|
||||
port: self.args.arg_ports_shift + self.args.arg_rpcport.unwrap_or(self.args.arg_jsonrpc_port),
|
||||
apis: match self.args.flag_public_node {
|
||||
false => self.rpc_apis().parse()?,
|
||||
true => self.rpc_apis().parse::<ApiSet>()?.retain(ApiSet::PublicContext),
|
||||
},
|
||||
apis: self.rpc_apis().parse()?,
|
||||
hosts: self.rpc_hosts(),
|
||||
cors: self.rpc_cors(),
|
||||
server_threads: match self.args.arg_jsonrpc_server_threads {
|
||||
@@ -935,10 +929,8 @@ impl Configuration {
|
||||
let http = self.http_config()?;
|
||||
|
||||
let support_token_api =
|
||||
// never enabled for public node
|
||||
!self.args.flag_public_node
|
||||
// enabled when not unlocking unless the ui is forced
|
||||
&& (self.args.arg_unlock.is_none() || ui.enabled);
|
||||
// enabled when not unlocking
|
||||
self.args.arg_unlock.is_none();
|
||||
|
||||
let conf = WsConfiguration {
|
||||
enabled: self.ws_enabled(),
|
||||
@@ -1263,6 +1255,7 @@ mod tests {
|
||||
use params::SpecType;
|
||||
use presale::ImportWallet;
|
||||
use rpc::{WsConfiguration, UiConfiguration};
|
||||
use rpc_apis::ApiSet;
|
||||
use run::RunCmd;
|
||||
|
||||
use network::{AllowIP, IpFilter};
|
||||
@@ -1499,7 +1492,6 @@ mod tests {
|
||||
ipc_conf: Default::default(),
|
||||
net_conf: default_network_config(),
|
||||
network_id: None,
|
||||
public_node: false,
|
||||
warp_sync: true,
|
||||
warp_barrier: None,
|
||||
acc_conf: Default::default(),
|
||||
|
||||
@@ -116,8 +116,6 @@ pub enum ApiSet {
|
||||
SafeContext,
|
||||
// Unsafe context (like jsonrpc over http)
|
||||
UnsafeContext,
|
||||
// Public context (like public jsonrpc over http)
|
||||
PublicContext,
|
||||
// All possible APIs
|
||||
All,
|
||||
// Local "unsafe" context and accounts access
|
||||
@@ -219,7 +217,7 @@ pub struct FullDependencies {
|
||||
pub snapshot: Arc<SnapshotService>,
|
||||
pub sync: Arc<SyncProvider>,
|
||||
pub net: Arc<ManageNetwork>,
|
||||
pub secret_store: Option<Arc<AccountProvider>>,
|
||||
pub secret_store: Arc<AccountProvider>,
|
||||
pub private_tx_service: Option<Arc<PrivateTxService>>,
|
||||
pub miner: Arc<Miner>,
|
||||
pub external_miner: Arc<ExternalMiner>,
|
||||
@@ -316,7 +314,7 @@ impl FullDependencies {
|
||||
}
|
||||
},
|
||||
Api::Personal => {
|
||||
handler.extend_with(PersonalClient::new(self.secret_store.clone(), dispatcher.clone(), self.geth_compatibility).to_delegate());
|
||||
handler.extend_with(PersonalClient::new(&self.secret_store, dispatcher.clone(), self.geth_compatibility).to_delegate());
|
||||
},
|
||||
Api::Signer => {
|
||||
handler.extend_with(SignerClient::new(&self.secret_store, dispatcher.clone(), &self.signer_service, self.remote.clone()).to_delegate());
|
||||
@@ -475,7 +473,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
||||
{
|
||||
let deps = &$deps;
|
||||
let dispatcher = dispatcher.clone();
|
||||
let secret_store = Some(deps.secret_store.clone());
|
||||
let secret_store = deps.secret_store.clone();
|
||||
if deps.signer_service.is_enabled() {
|
||||
$handler.extend_with($namespace::to_delegate(
|
||||
SigningQueueClient::new(&deps.signer_service, dispatcher, deps.remote.clone(), &secret_store)
|
||||
@@ -533,12 +531,10 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
||||
handler.extend_with(EthPubSub::to_delegate(client));
|
||||
},
|
||||
Api::Personal => {
|
||||
let secret_store = Some(self.secret_store.clone());
|
||||
handler.extend_with(PersonalClient::new(secret_store, dispatcher.clone(), self.geth_compatibility).to_delegate());
|
||||
handler.extend_with(PersonalClient::new(&self.secret_store, dispatcher.clone(), self.geth_compatibility).to_delegate());
|
||||
},
|
||||
Api::Signer => {
|
||||
let secret_store = Some(self.secret_store.clone());
|
||||
handler.extend_with(SignerClient::new(&secret_store, dispatcher.clone(), &self.signer_service, self.remote.clone()).to_delegate());
|
||||
handler.extend_with(SignerClient::new(&self.secret_store, dispatcher.clone(), &self.signer_service, self.remote.clone()).to_delegate());
|
||||
},
|
||||
Api::Parity => {
|
||||
let signer = match self.signer_service.is_enabled() {
|
||||
@@ -571,8 +567,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
||||
}
|
||||
},
|
||||
Api::ParityAccounts => {
|
||||
let secret_store = Some(self.secret_store.clone());
|
||||
handler.extend_with(ParityAccountsClient::new(&secret_store).to_delegate());
|
||||
handler.extend_with(ParityAccountsClient::new(&self.secret_store).to_delegate());
|
||||
},
|
||||
Api::ParitySet => {
|
||||
handler.extend_with(light::ParitySetClient::new(
|
||||
@@ -590,8 +585,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
||||
handler.extend_with(RpcClient::new(modules).to_delegate());
|
||||
},
|
||||
Api::SecretStore => {
|
||||
let secret_store = Some(self.secret_store.clone());
|
||||
handler.extend_with(SecretStoreClient::new(&secret_store).to_delegate());
|
||||
handler.extend_with(SecretStoreClient::new(&self.secret_store).to_delegate());
|
||||
},
|
||||
Api::Whisper => {
|
||||
if let Some(ref whisper_rpc) = self.whisper_rpc {
|
||||
@@ -637,7 +631,7 @@ impl ApiSet {
|
||||
}
|
||||
|
||||
pub fn list_apis(&self) -> HashSet<Api> {
|
||||
let mut public_list = [
|
||||
let mut public_list: HashSet<Api> = [
|
||||
Api::Web3,
|
||||
Api::Net,
|
||||
Api::Eth,
|
||||
@@ -651,7 +645,6 @@ impl ApiSet {
|
||||
|
||||
match *self {
|
||||
ApiSet::List(ref apis) => apis.clone(),
|
||||
ApiSet::PublicContext => public_list,
|
||||
ApiSet::UnsafeContext => {
|
||||
public_list.insert(Api::Traces);
|
||||
public_list.insert(Api::ParityPubSub);
|
||||
|
||||
@@ -98,7 +98,6 @@ pub struct RunCmd {
|
||||
pub network_id: Option<u64>,
|
||||
pub warp_sync: bool,
|
||||
pub warp_barrier: Option<u64>,
|
||||
pub public_node: bool,
|
||||
pub acc_conf: AccountsConfig,
|
||||
pub gas_pricer_conf: GasPricerConfig,
|
||||
pub miner_extras: MinerExtras,
|
||||
@@ -721,11 +720,7 @@ fn execute_impl<Cr, Rr>(cmd: RunCmd, logger: Arc<RotatingLogger>, on_client_rq:
|
||||
|
||||
// set up dependencies for rpc servers
|
||||
let rpc_stats = Arc::new(informant::RpcStats::default());
|
||||
let secret_store = match cmd.public_node {
|
||||
true => None,
|
||||
false => Some(account_provider.clone())
|
||||
};
|
||||
|
||||
let secret_store = account_provider.clone();
|
||||
let signer_service = Arc::new(signer::new_service(&cmd.ws_conf, &cmd.logger_config));
|
||||
|
||||
// the dapps server
|
||||
|
||||
Reference in New Issue
Block a user