Remove IPFS integration (#11532)
This commit is contained in:
@@ -269,7 +269,7 @@ usage! {
|
||||
["Convenience Options"]
|
||||
FLAG flag_unsafe_expose: (bool) = false, or |c: &Config| c.misc.as_ref()?.unsafe_expose,
|
||||
"--unsafe-expose",
|
||||
"All servers will listen on external interfaces and will be remotely accessible. It's equivalent with setting the following: --[ws,jsonrpc,ipfs-api,secretstore,stratum,secretstore-http]-interface=all --*-hosts=all This option is UNSAFE and should be used with great care!",
|
||||
"All servers will listen on external interfaces and will be remotely accessible. It's equivalent with setting the following: --[ws,jsonrpc,secretstore,stratum,secretstore-http]-interface=all --*-hosts=all This option is UNSAFE and should be used with great care!",
|
||||
|
||||
ARG arg_config: (String) = "$BASE/config.toml", or |_| None,
|
||||
"-c, --config=[CONFIG]",
|
||||
@@ -277,7 +277,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 (HTTP JSON-RPC, WebSockets JSON-RPC, IPFS, SecretStore).",
|
||||
"Add SHIFT to all port numbers Parity is listening on. Includes network port and all servers (HTTP JSON-RPC, WebSockets JSON-RPC, SecretStore).",
|
||||
|
||||
["Account Options"]
|
||||
FLAG flag_fast_unlock: (bool) = false, or |c: &Config| c.account.as_ref()?.fast_unlock.clone(),
|
||||
@@ -508,27 +508,6 @@ usage! {
|
||||
"--ipc-apis=[APIS]",
|
||||
"Specify custom API set available via JSON-RPC over IPC 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, secretstore. You can also disable a specific API by putting '-' in the front, example: all,-personal. 'safe' enables the following APIs: web3, net, eth, pubsub, parity, parity_pubsub, traces",
|
||||
|
||||
["API and Console Options – IPFS"]
|
||||
FLAG flag_ipfs_api: (bool) = false, or |c: &Config| c.ipfs.as_ref()?.enable.clone(),
|
||||
"--ipfs-api",
|
||||
"Enable IPFS-compatible HTTP API.",
|
||||
|
||||
ARG arg_ipfs_api_port: (u16) = 5001u16, or |c: &Config| c.ipfs.as_ref()?.port.clone(),
|
||||
"--ipfs-api-port=[PORT]",
|
||||
"Configure on which port the IPFS HTTP API should listen.",
|
||||
|
||||
ARG arg_ipfs_api_interface: (String) = "local", or |c: &Config| c.ipfs.as_ref()?.interface.clone(),
|
||||
"--ipfs-api-interface=[IP]",
|
||||
"Specify the hostname portion of the IPFS API server, IP should be an interface's IP address or local.",
|
||||
|
||||
ARG arg_ipfs_api_hosts: (String) = "none", or |c: &Config| c.ipfs.as_ref()?.hosts.as_ref().map(|vec| vec.join(",")),
|
||||
"--ipfs-api-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_ipfs_api_cors: (String) = "none", or |c: &Config| c.ipfs.as_ref()?.cors.as_ref().map(|vec| vec.join(",")),
|
||||
"--ipfs-api-cors=[URL]",
|
||||
"Specify CORS header for IPFS API responses. Special options: \"all\", \"none\".",
|
||||
|
||||
["Secret Store Options"]
|
||||
FLAG flag_no_secretstore: (bool) = false, or |c: &Config| c.secretstore.as_ref()?.disable.clone(),
|
||||
"--no-secretstore",
|
||||
@@ -854,7 +833,6 @@ struct Config {
|
||||
ipc: Option<Ipc>,
|
||||
secretstore: Option<SecretStore>,
|
||||
private_tx: Option<PrivateTransactions>,
|
||||
ipfs: Option<Ipfs>,
|
||||
mining: Option<Mining>,
|
||||
footprint: Option<Footprint>,
|
||||
snapshots: Option<Snapshots>,
|
||||
@@ -986,16 +964,6 @@ struct SecretStore {
|
||||
path: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, PartialEq, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct Ipfs {
|
||||
enable: Option<bool>,
|
||||
port: Option<u16>,
|
||||
interface: Option<String>,
|
||||
cors: Option<Vec<String>>,
|
||||
hosts: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, PartialEq, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct Mining {
|
||||
@@ -1081,8 +1049,8 @@ struct Misc {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{
|
||||
Account, Args, ArgsError, Config, Footprint, Ipc, Ipfs, Mining, Misc, Network, Operating,
|
||||
Rpc, SecretStore, Snapshots, Ws,
|
||||
Account, Args, ArgsError, Config, Footprint, Ipc, Mining, Misc, Network, Operating, Rpc,
|
||||
SecretStore, Snapshots, Ws,
|
||||
};
|
||||
use clap::ErrorKind as ClapErrorKind;
|
||||
use toml;
|
||||
@@ -1410,13 +1378,6 @@ mod tests {
|
||||
arg_secretstore_http_port: 8082u16,
|
||||
arg_secretstore_path: "$HOME/.parity/secretstore".into(),
|
||||
|
||||
// IPFS
|
||||
flag_ipfs_api: false,
|
||||
arg_ipfs_api_port: 5001u16,
|
||||
arg_ipfs_api_interface: "local".into(),
|
||||
arg_ipfs_api_cors: "null".into(),
|
||||
arg_ipfs_api_hosts: "none".into(),
|
||||
|
||||
// -- Sealing/Mining Options
|
||||
arg_author: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
||||
arg_engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
||||
@@ -1616,13 +1577,6 @@ mod tests {
|
||||
path: None,
|
||||
}),
|
||||
private_tx: None,
|
||||
ipfs: Some(Ipfs {
|
||||
enable: Some(false),
|
||||
port: Some(5001),
|
||||
interface: None,
|
||||
cors: None,
|
||||
hosts: None,
|
||||
}),
|
||||
mining: Some(Mining {
|
||||
author: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
||||
engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
|
||||
|
||||
@@ -9,7 +9,3 @@ min_gas_price = 0
|
||||
interface = "all"
|
||||
apis = ["all"]
|
||||
hosts = ["all"]
|
||||
|
||||
[ipfs]
|
||||
enable = false # this is the default
|
||||
hosts = ["all"]
|
||||
|
||||
@@ -2,7 +2,3 @@
|
||||
interface = "all"
|
||||
apis = ["all"]
|
||||
hosts = ["all"]
|
||||
|
||||
[ipfs]
|
||||
enable = false # this is the default
|
||||
hosts = ["all"]
|
||||
|
||||
@@ -82,13 +82,6 @@ interface = "local"
|
||||
port = 8083
|
||||
path = "$HOME/.parity/secretstore"
|
||||
|
||||
[ipfs]
|
||||
enable = false
|
||||
port = 5001
|
||||
interface = "local"
|
||||
cors = ["null"]
|
||||
hosts = ["none"]
|
||||
|
||||
[mining]
|
||||
author = "0xdeadbeefcafe0000000000000000000000000001"
|
||||
engine_signer = "0xdeadbeefcafe0000000000000000000000000001"
|
||||
|
||||
@@ -36,10 +36,6 @@ apis = ["rpc", "eth"]
|
||||
http_port = 8082
|
||||
port = 8083
|
||||
|
||||
[ipfs]
|
||||
enable = false
|
||||
port = 5001
|
||||
|
||||
[mining]
|
||||
author = "0xdeadbeefcafe0000000000000000000000000001"
|
||||
engine_signer = "0xdeadbeefcafe0000000000000000000000000001"
|
||||
|
||||
@@ -57,7 +57,6 @@ use helpers::{
|
||||
parity_ipc_path, to_address, to_addresses, to_block_id, to_bootnodes, to_duration, to_mode,
|
||||
to_pending_set, to_price, to_queue_penalization, to_queue_strategy, to_u256,
|
||||
};
|
||||
use ipfs::Configuration as IpfsConfiguration;
|
||||
use network::IpFilter;
|
||||
use params::{AccountsConfig, GasPricerConfig, MinerExtras, ResealPolicy, SpecType};
|
||||
use parity_rpc::NetworkSettings;
|
||||
@@ -158,7 +157,6 @@ impl Configuration {
|
||||
let compaction = self.args.arg_db_compaction.parse()?;
|
||||
let warp_sync = !self.args.flag_no_warp;
|
||||
let experimental_rpcs = self.args.flag_jsonrpc_experimental;
|
||||
let ipfs_conf = self.ipfs_config();
|
||||
let secretstore_conf = self.secretstore_config()?;
|
||||
let format = self.format()?;
|
||||
let keys_iterations = NonZeroU32::new(self.args.arg_keys_iterations)
|
||||
@@ -419,7 +417,6 @@ impl Configuration {
|
||||
warp_barrier: self.args.arg_warp_barrier,
|
||||
experimental_rpcs,
|
||||
net_settings: self.network_settings()?,
|
||||
ipfs_conf: ipfs_conf,
|
||||
secretstore_conf: secretstore_conf,
|
||||
private_provider_conf: private_provider_conf,
|
||||
private_encryptor_conf: private_enc_conf,
|
||||
@@ -679,16 +676,6 @@ impl Configuration {
|
||||
})
|
||||
}
|
||||
|
||||
fn ipfs_config(&self) -> IpfsConfiguration {
|
||||
IpfsConfiguration {
|
||||
enabled: self.args.flag_ipfs_api,
|
||||
port: self.args.arg_ports_shift + self.args.arg_ipfs_api_port,
|
||||
interface: self.ipfs_interface(),
|
||||
cors: self.ipfs_cors(),
|
||||
hosts: self.ipfs_hosts(),
|
||||
}
|
||||
}
|
||||
|
||||
fn gas_pricer_config(&self) -> Result<GasPricerConfig, String> {
|
||||
fn wei_per_gas(usd_per_tx: f32, usd_per_eth: f32) -> U256 {
|
||||
let wei_per_usd: f32 = 1.0e18 / usd_per_eth;
|
||||
@@ -881,10 +868,6 @@ impl Configuration {
|
||||
Self::cors(&cors)
|
||||
}
|
||||
|
||||
fn ipfs_cors(&self) -> Option<Vec<String>> {
|
||||
Self::cors(self.args.arg_ipfs_api_cors.as_ref())
|
||||
}
|
||||
|
||||
fn hosts(&self, hosts: &str, interface: &str) -> Option<Vec<String>> {
|
||||
if self.args.flag_unsafe_expose {
|
||||
return None;
|
||||
@@ -923,10 +906,6 @@ impl Configuration {
|
||||
Self::parse_hosts(&self.args.arg_ws_origins)
|
||||
}
|
||||
|
||||
fn ipfs_hosts(&self) -> Option<Vec<String>> {
|
||||
self.hosts(&self.args.arg_ipfs_api_hosts, &self.ipfs_interface())
|
||||
}
|
||||
|
||||
fn ipc_config(&self) -> Result<IpcConfiguration, String> {
|
||||
let conf = IpcConfiguration {
|
||||
enabled: !self.args.flag_no_ipc,
|
||||
@@ -1102,10 +1081,6 @@ impl Configuration {
|
||||
self.interface(&self.args.arg_ws_interface)
|
||||
}
|
||||
|
||||
fn ipfs_interface(&self) -> String {
|
||||
self.interface(&self.args.arg_ipfs_api_interface)
|
||||
}
|
||||
|
||||
fn secretstore_interface(&self) -> String {
|
||||
self.interface(&self.args.arg_secretstore_interface)
|
||||
}
|
||||
@@ -1578,7 +1553,6 @@ mod tests {
|
||||
vm_type: Default::default(),
|
||||
experimental_rpcs: false,
|
||||
net_settings: Default::default(),
|
||||
ipfs_conf: Default::default(),
|
||||
secretstore_conf: Default::default(),
|
||||
private_provider_conf: Default::default(),
|
||||
private_encryptor_conf: Default::default(),
|
||||
@@ -1670,51 +1644,6 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_parse_ipfs_hosts() {
|
||||
// given
|
||||
|
||||
// when
|
||||
let conf0 = parse(&["parity"]);
|
||||
let conf1 = parse(&["parity", "--ipfs-api-hosts", "none"]);
|
||||
let conf2 = parse(&["parity", "--ipfs-api-hosts", "all"]);
|
||||
let conf3 = parse(&["parity", "--ipfs-api-hosts", "parity.io,something.io"]);
|
||||
|
||||
// then
|
||||
assert_eq!(conf0.ipfs_hosts(), Some(Vec::new()));
|
||||
assert_eq!(conf1.ipfs_hosts(), Some(Vec::new()));
|
||||
assert_eq!(conf2.ipfs_hosts(), None);
|
||||
assert_eq!(
|
||||
conf3.ipfs_hosts(),
|
||||
Some(vec!["parity.io".into(), "something.io".into()])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_parse_ipfs_cors() {
|
||||
// given
|
||||
|
||||
// when
|
||||
let conf0 = parse(&["parity"]);
|
||||
let conf1 = parse(&["parity", "--ipfs-api-cors", "*"]);
|
||||
let conf2 = parse(&[
|
||||
"parity",
|
||||
"--ipfs-api-cors",
|
||||
"http://parity.io,http://something.io",
|
||||
]);
|
||||
|
||||
// then
|
||||
assert_eq!(conf0.ipfs_cors(), Some(vec![]));
|
||||
assert_eq!(conf1.ipfs_cors(), None);
|
||||
assert_eq!(
|
||||
conf2.ipfs_cors(),
|
||||
Some(vec![
|
||||
"http://parity.io".into(),
|
||||
"http://something.io".into()
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_parse_ui_configuration() {
|
||||
// given
|
||||
@@ -1815,7 +1744,6 @@ mod tests {
|
||||
}
|
||||
// "web3,eth,net,personal,parity,parity_set,traces,parity_accounts");
|
||||
assert_eq!(c.http_conf.hosts, None);
|
||||
assert_eq!(c.ipfs_conf.hosts, None);
|
||||
}
|
||||
_ => panic!("Should be Cmd::Run"),
|
||||
}
|
||||
@@ -1837,7 +1765,6 @@ mod tests {
|
||||
}
|
||||
// "web3,eth,net,personal,parity,parity_set,traces,parity_accounts");
|
||||
assert_eq!(c.http_conf.hosts, None);
|
||||
assert_eq!(c.ipfs_conf.hosts, None);
|
||||
}
|
||||
_ => panic!("Should be Cmd::Run"),
|
||||
}
|
||||
@@ -1887,7 +1814,6 @@ mod tests {
|
||||
assert_eq!(conf0.ws_config().unwrap().port, 8547);
|
||||
assert_eq!(conf0.secretstore_config().unwrap().port, 8084);
|
||||
assert_eq!(conf0.secretstore_config().unwrap().http_port, 8083);
|
||||
assert_eq!(conf0.ipfs_config().port, 5002);
|
||||
assert_eq!(conf0.stratum_options().unwrap().unwrap().port, 8009);
|
||||
|
||||
assert_eq!(conf1.net_addresses().unwrap().0.port(), 30304);
|
||||
@@ -1897,7 +1823,6 @@ mod tests {
|
||||
assert_eq!(conf1.ws_config().unwrap().port, 8547);
|
||||
assert_eq!(conf1.secretstore_config().unwrap().port, 8084);
|
||||
assert_eq!(conf1.secretstore_config().unwrap().http_port, 8083);
|
||||
assert_eq!(conf1.ipfs_config().port, 5002);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1952,8 +1877,6 @@ mod tests {
|
||||
&conf0.secretstore_config().unwrap().http_interface,
|
||||
"0.0.0.0"
|
||||
);
|
||||
assert_eq!(&conf0.ipfs_config().interface, "0.0.0.0");
|
||||
assert_eq!(conf0.ipfs_config().hosts, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Ethereum.
|
||||
|
||||
// Parity Ethereum is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Ethereum is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use ethcore::client::BlockChainClient;
|
||||
use parity_ipfs_api::{self, error::ServerError, AccessControlAllowOrigin, Host, Listening};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct Configuration {
|
||||
pub enabled: bool,
|
||||
pub port: u16,
|
||||
pub interface: String,
|
||||
pub cors: Option<Vec<String>>,
|
||||
pub hosts: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
impl Default for Configuration {
|
||||
fn default() -> Self {
|
||||
Configuration {
|
||||
enabled: false,
|
||||
port: 5001,
|
||||
interface: "127.0.0.1".into(),
|
||||
cors: Some(vec![]),
|
||||
hosts: Some(vec![]),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn start_server(
|
||||
conf: Configuration,
|
||||
client: Arc<dyn BlockChainClient>,
|
||||
) -> Result<Option<Listening>, ServerError> {
|
||||
if !conf.enabled {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let cors = conf.cors.map(|cors| {
|
||||
cors.into_iter()
|
||||
.map(AccessControlAllowOrigin::from)
|
||||
.collect()
|
||||
});
|
||||
let hosts = conf
|
||||
.hosts
|
||||
.map(|hosts| hosts.into_iter().map(Host::from).collect());
|
||||
|
||||
parity_ipfs_api::start_server(conf.port, conf.interface, cors.into(), hosts.into(), client)
|
||||
.map(Some)
|
||||
}
|
||||
@@ -61,7 +61,6 @@ extern crate keccak_hash as hash;
|
||||
extern crate kvdb;
|
||||
extern crate node_filter;
|
||||
extern crate parity_bytes as bytes;
|
||||
extern crate parity_ipfs_api;
|
||||
extern crate parity_local_store as local_store;
|
||||
extern crate parity_path as path;
|
||||
extern crate parity_rpc;
|
||||
@@ -98,7 +97,6 @@ mod configuration;
|
||||
mod db;
|
||||
mod helpers;
|
||||
mod informant;
|
||||
mod ipfs;
|
||||
mod modules;
|
||||
mod params;
|
||||
mod presale;
|
||||
|
||||
@@ -37,7 +37,6 @@ use ethcore_private_tx::{EncryptorConfig, ProviderConfig, SecretStoreEncryptor};
|
||||
use ethcore_service::ClientService;
|
||||
use helpers::{execute_upgrades, passwords_from_files, to_client_config};
|
||||
use informant::{FullNodeInformantData, Informant};
|
||||
use ipfs;
|
||||
use journaldb::Algorithm;
|
||||
use jsonrpc_core;
|
||||
use miner::{external::ExternalMiner, work_notify::WorkPoster};
|
||||
@@ -100,7 +99,6 @@ pub struct RunCmd {
|
||||
pub vm_type: VMType,
|
||||
pub experimental_rpcs: bool,
|
||||
pub net_settings: NetworkSettings,
|
||||
pub ipfs_conf: ipfs::Configuration,
|
||||
pub secretstore_conf: secretstore::Configuration,
|
||||
pub private_provider_conf: ProviderConfig,
|
||||
pub private_encryptor_conf: EncryptorConfig,
|
||||
@@ -555,9 +553,6 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient
|
||||
runtime.executor(),
|
||||
)?;
|
||||
|
||||
// the ipfs server
|
||||
let ipfs_server = ipfs::start_server(cmd.ipfs_conf.clone(), client.clone())?;
|
||||
|
||||
// the informant
|
||||
let informant = Arc::new(Informant::new(
|
||||
FullNodeInformantData {
|
||||
@@ -621,7 +616,6 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient
|
||||
http_server,
|
||||
ipc_server,
|
||||
secretstore_key_server,
|
||||
ipfs_server,
|
||||
runtime,
|
||||
)),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user