Remove IPFS integration (#11532)

This commit is contained in:
Artem Vorotnikov
2020-08-17 13:47:53 +03:00
parent defd24c40e
commit 32ea4d69a3
28 changed files with 15 additions and 999 deletions

View File

@@ -41,9 +41,7 @@
extern crate futures;
extern crate ansi_term;
extern crate cid;
extern crate itertools;
extern crate multihash;
extern crate order_stat;
extern crate parking_lot;
extern crate rand;

View File

@@ -330,14 +330,6 @@ pub fn encryption<T: fmt::Debug>(error: T) -> Error {
}
}
pub fn encoding<T: fmt::Debug>(error: T) -> Error {
Error {
code: ErrorCode::ServerError(codes::ENCODING_ERROR),
message: "Encoding error.".into(),
data: Some(Value::String(format!("{:?}", error))),
}
}
pub fn database<T: fmt::Debug>(error: T) -> Error {
Error {
code: ErrorCode::ServerError(codes::DATABASE_ERROR),

View File

@@ -1,32 +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/>.
//! IPFS utility functions
use super::errors;
use cid::{Cid, Codec, Version};
use crypto::digest;
use jsonrpc_core::Error;
use multihash;
use v1::types::Bytes;
/// 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 nonce;
#[cfg(any(test, feature = "accounts"))]
pub mod secretstore;

View File

@@ -39,7 +39,7 @@ use v1::{
block_import::is_major_importing,
errors,
external_signer::{SignerService, SigningQueue},
fake_sign, ipfs, verify_signature, NetworkSettings,
fake_sign, verify_signature, NetworkSettings,
},
metadata::Metadata,
traits::Parity,
@@ -407,10 +407,6 @@ 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

@@ -422,18 +422,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

@@ -195,10 +195,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>>;