trace API stubs
This commit is contained in:
parent
9e761ba2ea
commit
4de208786d
@ -62,11 +62,6 @@ pub struct EthClient {
|
||||
accounts: Arc<AccountProvider>,
|
||||
}
|
||||
|
||||
// helper for internal error: no network context.
|
||||
fn err_no_context() -> Error {
|
||||
errors::internal("network service detached", "")
|
||||
}
|
||||
|
||||
// helper for internal error: on demand sender cancelled.
|
||||
fn err_premature_cancel(_cancel: oneshot::Canceled) -> Error {
|
||||
errors::internal("on-demand sender prematurely cancelled", "")
|
||||
@ -128,10 +123,9 @@ impl EthClient {
|
||||
_ => None, // latest, earliest, and pending will have all already returned.
|
||||
};
|
||||
|
||||
// todo: cache returned values (header, TD)
|
||||
match maybe_future {
|
||||
Some(recv) => recv,
|
||||
None => future::err(err_no_context()).boxed()
|
||||
None => future::err(errors::network_disabled()).boxed()
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,7 +144,7 @@ impl EthClient {
|
||||
address: address,
|
||||
}).map(Some))
|
||||
.map(|x| x.map_err(err_premature_cancel).boxed())
|
||||
.unwrap_or_else(|| future::err(err_no_context()).boxed())
|
||||
.unwrap_or_else(|| future::err(errors::network_disabled()).boxed())
|
||||
}).boxed()
|
||||
}
|
||||
}
|
||||
@ -235,7 +229,7 @@ impl Eth for EthClient {
|
||||
sync.with_context(|ctx| on_demand.block(ctx, request::Body::new(hdr)))
|
||||
.map(|x| x.map(|b| Some(U256::from(b.transactions_count()).into())))
|
||||
.map(|x| x.map_err(err_premature_cancel).boxed())
|
||||
.unwrap_or_else(|| future::err(err_no_context()).boxed())
|
||||
.unwrap_or_else(|| future::err(errors::network_disabled()).boxed())
|
||||
}
|
||||
}).boxed()
|
||||
}
|
||||
@ -255,7 +249,7 @@ impl Eth for EthClient {
|
||||
sync.with_context(|ctx| on_demand.block(ctx, request::Body::new(hdr)))
|
||||
.map(|x| x.map(|b| Some(U256::from(b.transactions_count()).into())))
|
||||
.map(|x| x.map_err(err_premature_cancel).boxed())
|
||||
.unwrap_or_else(|| future::err(err_no_context()).boxed())
|
||||
.unwrap_or_else(|| future::err(errors::network_disabled()).boxed())
|
||||
}
|
||||
}).boxed()
|
||||
}
|
||||
@ -275,7 +269,7 @@ impl Eth for EthClient {
|
||||
sync.with_context(|ctx| on_demand.block(ctx, request::Body::new(hdr)))
|
||||
.map(|x| x.map(|b| Some(U256::from(b.uncles_count()).into())))
|
||||
.map(|x| x.map_err(err_premature_cancel).boxed())
|
||||
.unwrap_or_else(|| future::err(err_no_context()).boxed())
|
||||
.unwrap_or_else(|| future::err(errors::network_disabled()).boxed())
|
||||
}
|
||||
}).boxed()
|
||||
}
|
||||
@ -295,7 +289,7 @@ impl Eth for EthClient {
|
||||
sync.with_context(|ctx| on_demand.block(ctx, request::Body::new(hdr)))
|
||||
.map(|x| x.map(|b| Some(U256::from(b.uncles_count()).into())))
|
||||
.map(|x| x.map_err(err_premature_cancel).boxed())
|
||||
.unwrap_or_else(|| future::err(err_no_context()).boxed())
|
||||
.unwrap_or_else(|| future::err(errors::network_disabled()).boxed())
|
||||
}
|
||||
}).boxed()
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
pub mod eth;
|
||||
pub mod parity;
|
||||
pub mod parity_set;
|
||||
pub mod trace;
|
||||
|
||||
pub use self::eth::EthClient;
|
||||
pub use self::parity::ParityClient;
|
||||
|
@ -18,16 +18,12 @@
|
||||
//! Implementation for light client.
|
||||
|
||||
use std::io;
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::sync::Arc;
|
||||
|
||||
use ethcore::miner::MinerService;
|
||||
use ethcore::client::MiningBlockChainClient;
|
||||
use ethcore::mode::Mode;
|
||||
use ethsync::ManageNetwork;
|
||||
use fetch::{self, Fetch};
|
||||
use fetch::Fetch;
|
||||
use futures::{BoxFuture, Future};
|
||||
use util::sha3;
|
||||
use updater::{Service as UpdateService};
|
||||
|
||||
use jsonrpc_core::Error;
|
||||
use v1::helpers::errors;
|
||||
@ -51,7 +47,6 @@ impl<F: Fetch> ParitySetClient<F> {
|
||||
}
|
||||
|
||||
impl<F: Fetch> ParitySet for ParitySetClient<F> {
|
||||
|
||||
fn set_min_gas_price(&self, _gas_price: U256) -> Result<bool, Error> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
@ -118,7 +113,7 @@ impl<F: Fetch> ParitySet for ParitySetClient<F> {
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
fn set_mode(&self, mode: String) -> Result<bool, Error> {
|
||||
fn set_mode(&self, _mode: String) -> Result<bool, Error> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
|
57
rpc/src/v1/impls/light/trace.rs
Normal file
57
rpc/src/v1/impls/light/trace.rs
Normal file
@ -0,0 +1,57 @@
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Traces api implementation.
|
||||
|
||||
use jsonrpc_core::Error;
|
||||
use jsonrpc_macros::Trailing;
|
||||
use v1::traits::Traces;
|
||||
use v1::helpers::errors;
|
||||
use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, Bytes, TraceResults, H256};
|
||||
|
||||
/// Traces api implementation.
|
||||
// TODO: all calling APIs should be possible w. proved remote TX execution.
|
||||
pub struct TracesClient;
|
||||
|
||||
impl Traces for TracesClient {
|
||||
fn filter(&self, _filter: TraceFilter) -> Result<Vec<LocalizedTrace>, Error> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
fn block_traces(&self, _block_number: BlockNumber) -> Result<Vec<LocalizedTrace>, Error> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
fn transaction_traces(&self, _transaction_hash: H256) -> Result<Vec<LocalizedTrace>, Error> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
fn trace(&self, _transaction_hash: H256, _address: Vec<Index>) -> Result<Option<LocalizedTrace>, Error> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
fn call(&self, _request: CallRequest, _flags: Vec<String>, _block: Trailing<BlockNumber>) -> Result<Option<TraceResults>, Error> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
fn raw_transaction(&self, _raw_transaction: Bytes, _flags: Vec<String>, _block: Trailing<BlockNumber>) -> Result<Option<TraceResults>, Error> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
fn replay_transaction(&self, _transaction_hash: H256, _flags: Vec<String>) -> Result<Option<TraceResults>, Error> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user