Drop IPFS support (#11532)

This commit is contained in:
Artem Vorotnikov
2020-02-29 13:57:43 +03:00
committed by GitHub
parent 0edd55f42f
commit 597cbc2d6c
28 changed files with 35 additions and 978 deletions

View File

@@ -41,10 +41,8 @@
extern crate futures;
extern crate ansi_term;
extern crate cid;
extern crate itertools;
extern crate machine;
extern crate multihash;
extern crate order_stat;
extern crate parking_lot;
extern crate rand;

View File

@@ -1,32 +0,0 @@
// Copyright 2015-2020 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/>.
//! IPFS utility functions
use multihash;
use cid::{Cid, Codec, Version};
use crypto::digest;
use jsonrpc_core::Error;
use v1::types::Bytes;
use super::errors;
/// Compute CIDv0 from protobuf encoded bytes.
pub fn cid(content: Bytes) -> Result<String, Error> {
let hash = digest::sha256(&content.0);
let mh = multihash::encode(multihash::Hash::SHA2256, &*hash).map_err(errors::encoding)?;
let cid = Cid::new(Codec::DagProtobuf, Version::V0, &mh);
Ok(cid.to_string())
}

View File

@@ -26,7 +26,6 @@ pub mod eip191;
pub mod engine_signer;
pub mod external_signer;
pub mod fake_sign;
pub mod ipfs;
pub mod light_fetch;
pub mod nonce;
#[cfg(any(test, feature = "accounts"))]

View File

@@ -33,7 +33,7 @@ use ethcore_logger::RotatingLogger;
use jsonrpc_core::{Result, BoxFuture};
use jsonrpc_core::futures::{future, Future};
use light::on_demand::OnDemandRequester;
use v1::helpers::{self, errors, ipfs, NetworkSettings, verify_signature};
use v1::helpers::{self, errors, NetworkSettings, verify_signature};
use v1::helpers::external_signer::{SignerService, SigningQueue};
use v1::helpers::dispatch::LightDispatcher;
use v1::helpers::light_fetch::{LightFetch, light_all_transactions};
@@ -372,10 +372,6 @@ where
Box::new(self.fetcher().receipts(id).and_then(|receipts| Ok(receipts.into_iter().map(Into::into).collect())))
}
fn ipfs_cid(&self, content: Bytes) -> Result<String> {
ipfs::cid(content)
}
fn call(&self, _requests: Vec<CallRequest>, _block: Option<BlockNumber>) -> Result<Vec<Bytes>> {
Err(errors::light_unimplemented(None))
}

View File

@@ -40,7 +40,7 @@ use types::{
use updater::{Service as UpdateService};
use version::version_data;
use v1::helpers::{self, errors, fake_sign, ipfs, NetworkSettings, verify_signature};
use v1::helpers::{self, errors, fake_sign, NetworkSettings, verify_signature};
use v1::helpers::external_signer::{SigningQueue, SignerService};
use v1::metadata::Metadata;
use v1::traits::Parity;
@@ -396,10 +396,6 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
Box::new(future::ok(receipts.into_iter().map(Into::into).collect()))
}
fn ipfs_cid(&self, content: Bytes) -> Result<String> {
ipfs::cid(content)
}
fn call(&self, requests: Vec<CallRequest>, num: Option<BlockNumber>) -> Result<Vec<Bytes>> {
let requests = requests
.into_iter()

View File

@@ -469,17 +469,6 @@ fn rpc_parity_node_kind() {
assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
}
#[test]
fn rpc_parity_cid() {
let deps = Dependencies::new();
let io = deps.default_client();
let request = r#"{"jsonrpc": "2.0", "method": "parity_cidV0", "params":["0x414243"], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","result":"QmSF59MAENc8ZhM4aM1thuAE8w5gDmyfzkAvNoyPea7aDz","id":1}"#;
assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
}
#[test]
fn rpc_parity_call() {
let deps = Dependencies::new();

View File

@@ -207,10 +207,6 @@ pub trait Parity {
#[rpc(name = "parity_getBlockReceipts")]
fn block_receipts(&self, _: Option<BlockNumber>) -> BoxFuture<Vec<Receipt>>;
/// Get IPFS CIDv0 given protobuf encoded bytes.
#[rpc(name = "parity_cidV0")]
fn ipfs_cid(&self, _: Bytes) -> Result<String>;
/// Call contract, returning the output data.
#[rpc(name = "parity_call")]
fn call(&self, _: Vec<CallRequest>, _: Option<BlockNumber>) -> Result<Vec<Bytes>>;