diff --git a/ethcore/src/client/error.rs b/ethcore/src/client/error.rs
index 9f22673b7..ff8b6d2ce 100644
--- a/ethcore/src/client/error.rs
+++ b/ethcore/src/client/error.rs
@@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see .
-use trace::Error as TraceError;
use util::UtilError;
use std::fmt::{Display, Formatter, Error as FmtError};
@@ -23,8 +22,6 @@ use util::trie::TrieError;
/// Client configuration errors.
#[derive(Debug)]
pub enum Error {
- /// TraceDB configuration error.
- Trace(TraceError),
/// TrieDB-related error.
Trie(TrieError),
/// Database error
@@ -33,12 +30,6 @@ pub enum Error {
Util(UtilError),
}
-impl From for Error {
- fn from(err: TraceError) -> Self {
- Error::Trace(err)
- }
-}
-
impl From for Error {
fn from(err: TrieError) -> Self {
Error::Trie(err)
@@ -60,7 +51,6 @@ impl From> for Error where Error: From {
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
match *self {
- Error::Trace(ref err) => write!(f, "{}", err),
Error::Trie(ref err) => write!(f, "{}", err),
Error::Util(ref err) => write!(f, "{}", err),
Error::Database(ref s) => write!(f, "Database error: {}", s),
diff --git a/ethcore/src/trace/error.rs b/ethcore/src/trace/error.rs
deleted file mode 100644
index 081045d85..000000000
--- a/ethcore/src/trace/error.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2015-2017 Parity Technologies (UK) Ltd.
-// This file is part of Parity.
-
-// Parity 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 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. If not, see .
-
-//! `TraceDB` errors.
-
-use std::fmt::{Display, Formatter, Error as FmtError};
-
-const RESYNC_ERR: &'static str =
-"Your current parity installation has synced without transaction tracing.
-To use Parity with transaction tracing, you'll need to resync with tracing.
-To do this, remove or move away your current database and restart parity. e.g.:
-
-> mv ~/.parity/906a34e69aec8c0d /tmp
-> parity";
-
-/// `TraceDB` errors.
-#[derive(Debug)]
-pub enum Error {
- /// Returned when tracing is enabled,
- /// but database does not contain traces of old transactions.
- ResyncRequired,
-}
-
-impl Display for Error {
- fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
- write!(f, "{}", RESYNC_ERR)
- }
-}
diff --git a/ethcore/src/trace/mod.rs b/ethcore/src/trace/mod.rs
index c63890ae9..2d13e3260 100644
--- a/ethcore/src/trace/mod.rs
+++ b/ethcore/src/trace/mod.rs
@@ -19,7 +19,6 @@
mod bloom;
mod config;
mod db;
-mod error;
mod executive_tracer;
mod import;
mod noop_tracer;
@@ -28,7 +27,6 @@ pub use types::trace_types::{filter, flat, localized, trace};
pub use types::trace_types::error::Error as TraceError;
pub use self::config::Config;
pub use self::db::TraceDB;
-pub use self::error::Error;
pub use types::trace_types::trace::{VMTrace, VMOperation, VMExecutedOperation, MemoryDiff, StorageDiff};
pub use types::trace_types::flat::{FlatTrace, FlatTransactionTraces, FlatBlockTraces};
pub use self::noop_tracer::{NoopTracer, NoopVMTracer};
diff --git a/rpc/src/v1/helpers/errors.rs b/rpc/src/v1/helpers/errors.rs
index 1f98b922d..e8fcee303 100644
--- a/rpc/src/v1/helpers/errors.rs
+++ b/rpc/src/v1/helpers/errors.rs
@@ -32,7 +32,6 @@ mod codes {
pub const NO_WORK: i64 = -32001;
pub const NO_AUTHOR: i64 = -32002;
pub const NO_NEW_WORK: i64 = -32003;
- pub const NOT_ENOUGH_DATA: i64 = -32006;
pub const UNKNOWN_ERROR: i64 = -32009;
pub const TRANSACTION_ERROR: i64 = -32010;
pub const EXECUTION_ERROR: i64 = -32015;
@@ -41,9 +40,6 @@ mod codes {
pub const ACCOUNT_LOCKED: i64 = -32020;
pub const PASSWORD_INVALID: i64 = -32021;
pub const ACCOUNT_ERROR: i64 = -32023;
- pub const SIGNER_DISABLED: i64 = -32030;
- pub const DAPPS_DISABLED: i64 = -32031;
- pub const NETWORK_DISABLED: i64 = -32035;
pub const REQUEST_REJECTED: i64 = -32040;
pub const REQUEST_REJECTED_LIMIT: i64 = -32041;
pub const REQUEST_NOT_FOUND: i64 = -32042;
@@ -174,9 +170,9 @@ pub fn no_author() -> Error {
pub fn not_enough_data() -> Error {
Error {
- code: ErrorCode::ServerError(codes::NOT_ENOUGH_DATA),
+ code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
message: "The node does not have enough data to compute the given statistic.".into(),
- data: None
+ data: None,
}
}
@@ -190,25 +186,25 @@ pub fn token(e: String) -> Error {
pub fn signer_disabled() -> Error {
Error {
- code: ErrorCode::ServerError(codes::SIGNER_DISABLED),
+ code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
message: "Trusted Signer is disabled. This API is not available.".into(),
- data: None
+ data: None,
}
}
pub fn dapps_disabled() -> Error {
Error {
- code: ErrorCode::ServerError(codes::DAPPS_DISABLED),
+ code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
message: "Dapps Server is disabled. This API is not available.".into(),
- data: None
+ data: None,
}
}
pub fn network_disabled() -> Error {
Error {
- code: ErrorCode::ServerError(codes::NETWORK_DISABLED),
+ code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
message: "Network is disabled or not yet up.".into(),
- data: None
+ data: None,
}
}
@@ -321,7 +317,7 @@ pub fn from_call_error(error: CallError) -> Error {
pub fn unknown_block() -> Error {
Error {
- code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
+ code: ErrorCode::InvalidParams,
message: "Unknown block number".into(),
data: None,
}
diff --git a/rpc/src/v1/helpers/fake_sign.rs b/rpc/src/v1/helpers/fake_sign.rs
new file mode 100644
index 000000000..c8e835bb3
--- /dev/null
+++ b/rpc/src/v1/helpers/fake_sign.rs
@@ -0,0 +1,43 @@
+// Copyright 2015-2017 Parity Technologies (UK) Ltd.
+// This file is part of Parity.
+
+// Parity 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 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. If not, see .
+
+use std::sync::Weak;
+use ethcore::client::MiningBlockChainClient;
+use ethcore::miner::MinerService;
+use ethcore::transaction::{Transaction, SignedTransaction, Action};
+
+use jsonrpc_core::Error;
+use v1::helpers::CallRequest;
+use v1::helpers::dispatch::default_gas_price;
+
+pub fn sign_call(
+ client: &Weak,
+ miner: &Weak,
+ request: CallRequest,
+) -> Result {
+ let client = take_weak!(client);
+ let miner = take_weak!(miner);
+ let from = request.from.unwrap_or(0.into());
+
+ Ok(Transaction {
+ nonce: request.nonce.unwrap_or_else(|| client.latest_nonce(&from)),
+ action: request.to.map_or(Action::Create, Action::Call),
+ gas: request.gas.unwrap_or(50_000_000.into()),
+ gas_price: request.gas_price.unwrap_or_else(|| default_gas_price(&*client, &*miner)),
+ value: request.value.unwrap_or(0.into()),
+ data: request.data.map_or_else(Vec::new, |d| d.to_vec())
+ }.fake_sign(from))
+}
diff --git a/rpc/src/v1/helpers/mod.rs b/rpc/src/v1/helpers/mod.rs
index 1d6bd14f3..ae8990cdc 100644
--- a/rpc/src/v1/helpers/mod.rs
+++ b/rpc/src/v1/helpers/mod.rs
@@ -19,6 +19,7 @@ pub mod errors;
pub mod block_import;
pub mod dispatch;
+pub mod fake_sign;
pub mod informant;
mod network_settings;
diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs
index 341ab13d8..52bc2de71 100644
--- a/rpc/src/v1/impls/eth.rs
+++ b/rpc/src/v1/impls/eth.rs
@@ -23,7 +23,7 @@ use std::sync::{Arc, Weak};
use futures::{self, future, BoxFuture, Future};
use rlp::{self, UntrustedRlp, View};
use time::get_time;
-use util::{H160, H256, Address, U256, H64, Uint};
+use util::{H160, H256, Address, U256, H64};
use util::sha3::Hashable;
use util::Mutex;
@@ -36,14 +36,14 @@ use ethcore::filter::Filter as EthcoreFilter;
use ethcore::header::{Header as BlockHeader, BlockNumber as EthBlockNumber};
use ethcore::log_entry::LogEntry;
use ethcore::miner::{MinerService, ExternalMinerService};
-use ethcore::transaction::{Transaction as EthTransaction, SignedTransaction, Action};
+use ethcore::transaction::SignedTransaction;
use ethcore::snapshot::SnapshotService;
use ethsync::{SyncProvider};
use jsonrpc_core::Error;
use jsonrpc_macros::Trailing;
-use v1::helpers::{CallRequest as CRequest, errors, limit_logs};
+use v1::helpers::{errors, limit_logs, fake_sign};
use v1::helpers::dispatch::{Dispatcher, FullDispatcher, default_gas_price};
use v1::helpers::block_import::is_major_importing;
use v1::traits::Eth;
@@ -222,19 +222,6 @@ impl EthClient where
Ok(Some(block))
}
- fn sign_call(&self, request: CRequest) -> Result {
- let (client, miner) = (take_weak!(self.client), take_weak!(self.miner));
- let from = request.from.unwrap_or(Address::zero());
- Ok(EthTransaction {
- nonce: request.nonce.unwrap_or_else(|| client.latest_nonce(&from)),
- action: request.to.map_or(Action::Create, Action::Call),
- gas: request.gas.unwrap_or(U256::from(50_000_000)),
- gas_price: request.gas_price.unwrap_or_else(|| default_gas_price(&*client, &*miner)),
- value: request.value.unwrap_or_else(U256::zero),
- data: request.data.map_or_else(Vec::new, |d| d.to_vec())
- }.fake_sign(from))
- }
-
fn dapp_accounts(&self, dapp: DappId) -> Result, Error> {
let store = take_weak!(self.accounts);
store
@@ -654,7 +641,7 @@ impl Eth for EthClient where
fn call(&self, request: CallRequest, num: Trailing) -> BoxFuture {
let request = CallRequest::into(request);
- let signed = match self.sign_call(request) {
+ let signed = match fake_sign::sign_call(&self.client, &self.miner, request) {
Ok(signed) => signed,
Err(e) => return future::err(e).boxed(),
};
@@ -672,7 +659,7 @@ impl Eth for EthClient where
fn estimate_gas(&self, request: CallRequest, num: Trailing) -> BoxFuture {
let request = CallRequest::into(request);
- let signed = match self.sign_call(request) {
+ let signed = match fake_sign::sign_call(&self.client, &self.miner, request) {
Ok(signed) => signed,
Err(e) => return future::err(e).boxed(),
};
diff --git a/rpc/src/v1/impls/light/trace.rs b/rpc/src/v1/impls/light/trace.rs
index 5f785ed1b..00d19dc24 100644
--- a/rpc/src/v1/impls/light/trace.rs
+++ b/rpc/src/v1/impls/light/trace.rs
@@ -27,15 +27,15 @@ use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, By
pub struct TracesClient;
impl Traces for TracesClient {
- fn filter(&self, _filter: TraceFilter) -> Result, Error> {
+ fn filter(&self, _filter: TraceFilter) -> Result