fix compile warnings (#10993)

* fix warnings

* fix: failing build, use `spec` as dev-dependency
This commit is contained in:
Niklas Adolfsson
2019-08-27 17:29:33 +02:00
committed by Andronik Ordian
parent 505e284932
commit dab2a6bd4b
69 changed files with 203 additions and 199 deletions

View File

@@ -85,7 +85,7 @@ extern crate parity_version as version;
extern crate eip_712;
extern crate rlp;
extern crate account_state;
extern crate spec;
extern crate stats;
extern crate tempdir;
extern crate trace;
@@ -127,6 +127,9 @@ extern crate fake_fetch;
#[cfg(test)]
extern crate ethcore_io as io;
#[cfg(test)]
extern crate spec;
pub extern crate jsonrpc_ws_server as ws;
mod authcodes;

View File

@@ -38,7 +38,7 @@ const PRINT_INTERVAL: Duration = Duration::from_secs(60);
pub struct DeprecationNotice<T = fn() -> Instant> {
now: T,
next_warning_at: RwLock<HashMap<String, Instant>>,
printer: Box<Fn(MethodName, Option<&str>) + Send + Sync>,
printer: Box<dyn Fn(MethodName, Option<&str>) + Send + Sync>,
}
impl Default for DeprecationNotice {

View File

@@ -118,7 +118,7 @@ impl<C: miner::BlockChainClient + BlockChainClient, M: MinerService> Dispatcher
fn sign<P>(
&self,
filled: FilledTransactionRequest,
signer: &Arc<Accounts>,
signer: &Arc<dyn Accounts>,
password: SignWith,
post_sign: P,
) -> BoxFuture<P::Item>

View File

@@ -45,7 +45,7 @@ where
/// Sync service.
pub sync: Arc<S>,
/// Header chain client.
pub client: Arc<LightChainClient>,
pub client: Arc<dyn LightChainClient>,
/// On-demand request service.
pub on_demand: Arc<OD>,
/// Data cache.
@@ -68,7 +68,7 @@ where
/// For correct operation, the OnDemand service is assumed to be registered as a network handler,
pub fn new(
sync: Arc<S>,
client: Arc<LightChainClient>,
client: Arc<dyn LightChainClient>,
on_demand: Arc<OD>,
cache: Arc<Mutex<LightDataCache>>,
transaction_queue: Arc<RwLock<LightTransactionQueue>>,
@@ -215,7 +215,7 @@ where
fn sign<P>(
&self,
filled: FilledTransactionRequest,
signer: &Arc<Accounts>,
signer: &Arc<dyn Accounts>,
password: SignWith,
post_sign: P
) -> BoxFuture<P::Item>
@@ -248,7 +248,7 @@ where
// TODO: this could be `impl Trait`.
pub fn fetch_gas_price_corpus<S, OD>(
sync: Arc<S>,
client: Arc<LightChainClient>,
client: Arc<dyn LightChainClient>,
on_demand: Arc<OD>,
cache: Arc<Mutex<LightDataCache>>,
) -> BoxFuture<Corpus<U256>>

View File

@@ -111,7 +111,7 @@ pub trait Dispatcher: Send + Sync + Clone {
fn sign<P>(
&self,
filled: FilledTransactionRequest,
signer: &Arc<Accounts>,
signer: &Arc<dyn Accounts>,
password: SignWith,
post_sign: P,
) -> BoxFuture<P::Item> where
@@ -277,7 +277,7 @@ impl<T: Debug> From<(T, Option<AccountToken>)> for WithToken<T> {
/// Execute a confirmation payload.
pub fn execute<D: Dispatcher + 'static>(
dispatcher: D,
signer: &Arc<Accounts>,
signer: &Arc<dyn Accounts>,
payload: ConfirmationPayload,
pass: SignWith
) -> BoxFuture<WithToken<ConfirmationResponse>> {

View File

@@ -32,7 +32,7 @@ enum ProspectiveSignerState {
}
pub struct ProspectiveSigner<P: PostSign> {
signer: Arc<Accounts>,
signer: Arc<dyn Accounts>,
filled: FilledTransactionRequest,
chain_id: Option<u64>,
reserved: nonce::Reserved,
@@ -46,7 +46,7 @@ pub struct ProspectiveSigner<P: PostSign> {
impl<P: PostSign> ProspectiveSigner<P> {
pub fn new(
signer: Arc<Accounts>,
signer: Arc<dyn Accounts>,
filled: FilledTransactionRequest,
chain_id: Option<u64>,
reserved: nonce::Reserved,

View File

@@ -30,7 +30,7 @@ pub use self::signing_queue::QueueEvent;
pub struct SignerService {
is_enabled: bool,
queue: Arc<ConfirmationsQueue>,
generate_new_token: Box<Fn() -> Result<String, String> + Send + Sync + 'static>,
generate_new_token: Box<dyn Fn() -> Result<String, String> + Send + Sync + 'static>,
}
impl SignerService {

View File

@@ -96,7 +96,7 @@ pub type ConfirmationReceiver = oneshot::Receiver<ConfirmationResult>;
pub struct ConfirmationsQueue {
id: Mutex<U256>,
queue: RwLock<BTreeMap<U256, ConfirmationSender>>,
on_event: RwLock<Vec<Box<Fn(QueueEvent) -> () + Send + Sync>>>,
on_event: RwLock<Vec<Box<dyn Fn(QueueEvent) -> () + Send + Sync>>>,
}
impl ConfirmationsQueue {

View File

@@ -82,7 +82,7 @@ where
OD: OnDemandRequester + 'static
{
/// The light client.
pub client: Arc<LightChainClient>,
pub client: Arc<dyn LightChainClient>,
/// The on-demand request service.
pub on_demand: Arc<OD>,
/// Handle to the network.
@@ -585,7 +585,7 @@ where
match maybe_future {
Some(recv) => recv,
None => Box::new(future::err(errors::network_disabled())) as Box<Future<Item = _, Error = _> + Send>
None => Box::new(future::err(errors::network_disabled())) as Box<dyn Future<Item = _, Error = _> + Send>
}
}
@@ -741,7 +741,7 @@ where
tx: EthTransaction,
hdr: encoded::Header,
env_info: ::vm::EnvInfo,
engine: Arc<engine::Engine>,
engine: Arc<dyn engine::Engine>,
on_demand: Arc<OD>,
sync: Arc<S>,
}
@@ -806,7 +806,7 @@ where
failed => Ok(future::Loop::Break(failed)),
}
})
})) as Box<Future<Item = _, Error = _> + Send>
})) as Box<dyn Future<Item = _, Error = _> + Send>
} else {
trace!(target: "light_fetch", "Placing execution request for {} gas in on_demand",
params.tx.gas);
@@ -827,8 +827,8 @@ where
});
match proved_future {
Some(fut) => Box::new(fut) as Box<Future<Item = _, Error = _> + Send>,
None => Box::new(future::err(errors::network_disabled())) as Box<Future<Item = _, Error = _> + Send>,
Some(fut) => Box::new(fut) as Box<dyn Future<Item = _, Error = _> + Send>,
None => Box::new(future::err(errors::network_disabled())) as Box<dyn Future<Item = _, Error = _> + Send>,
}
}
}

View File

@@ -87,7 +87,7 @@ impl<S: core::Middleware<Metadata>> GenericPollManager<S> {
}).is_some()
}
pub fn tick(&self) -> Box<Future<Item=(), Error=()> + Send> {
pub fn tick(&self) -> Box<dyn Future<Item=(), Error=()> + Send> {
let mut futures = Vec::new();
// poll all subscriptions
for (id, subscription) in self.subscribers.iter() {

View File

@@ -113,7 +113,7 @@ pub struct EthClient<C, SN: ?Sized, S: ?Sized, M, EM> where
client: Arc<C>,
snapshot: Arc<SN>,
sync: Arc<S>,
accounts: Arc<Fn() -> Vec<Address> + Send + Sync>,
accounts: Arc<dyn Fn() -> Vec<Address> + Send + Sync>,
miner: Arc<M>,
external_miner: Arc<EM>,
seed_compute: Mutex<SeedHashCompute>,
@@ -193,7 +193,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> EthClient<C, SN, S
client: &Arc<C>,
snapshot: &Arc<SN>,
sync: &Arc<S>,
accounts: &Arc<Fn() -> Vec<Address> + Send + Sync>,
accounts: &Arc<dyn Fn() -> Vec<Address> + Send + Sync>,
miner: &Arc<M>,
em: &Arc<EM>,
options: EthClientOptions
@@ -449,8 +449,8 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> EthClient<C, SN, S
self.miner
.pending_state(info.best_block_number)
.map(|s| Box::new(s) as Box<StateInfo>)
.unwrap_or(Box::new(self.client.latest_state()) as Box<StateInfo>)
.map(|s| Box::new(s) as Box<dyn StateInfo>)
.unwrap_or(Box::new(self.client.latest_state()) as Box<dyn StateInfo>)
.into()
}
}

View File

@@ -137,7 +137,7 @@ where
{
/// Creates a new `EthPubSubClient` for `LightClient`.
pub fn light(
client: Arc<LightChainClient>,
client: Arc<dyn LightChainClient>,
on_demand: Arc<OD>,
sync: Arc<S>,
cache: Arc<Mutex<Cache>>,

View File

@@ -58,7 +58,7 @@ pub struct EthClient<C, S: LightSyncProvider + LightNetworkDispatcher + 'static,
client: Arc<C>,
on_demand: Arc<OD>,
transaction_queue: Arc<RwLock<TransactionQueue>>,
accounts: Arc<Fn() -> Vec<Address> + Send + Sync>,
accounts: Arc<dyn Fn() -> Vec<Address> + Send + Sync>,
cache: Arc<Mutex<LightDataCache>>,
polls: Mutex<PollManager<SyncPollFilter>>,
poll_lifetime: u32,
@@ -101,7 +101,7 @@ where
client: Arc<C>,
on_demand: Arc<OD>,
transaction_queue: Arc<RwLock<TransactionQueue>>,
accounts: Arc<Fn() -> Vec<Address> + Send + Sync>,
accounts: Arc<dyn Fn() -> Vec<Address> + Send + Sync>,
cache: Arc<Mutex<LightDataCache>>,
gas_price_percentile: usize,
poll_lifetime: u32

View File

@@ -34,14 +34,14 @@ use v1::types::{Bytes, ReleaseInfo, Transaction};
/// Parity-specific rpc interface for operations altering the settings.
pub struct ParitySetClient<F> {
client: Arc<LightChainClient>,
net: Arc<ManageNetwork>,
client: Arc<dyn LightChainClient>,
net: Arc<dyn ManageNetwork>,
fetch: F,
}
impl<F: Fetch> ParitySetClient<F> {
/// Creates new `ParitySetClient` with given `Fetch`.
pub fn new(client: Arc<LightChainClient>, net: Arc<ManageNetwork>, fetch: F) -> Self {
pub fn new(client: Arc<dyn LightChainClient>, net: Arc<dyn ManageNetwork>, fetch: F) -> Self {
ParitySetClient {
client,
net,

View File

@@ -59,13 +59,13 @@ pub struct ParityClient<C, M, U> {
client: Arc<C>,
miner: Arc<M>,
updater: Arc<U>,
sync: Arc<SyncProvider>,
net: Arc<ManageNetwork>,
sync: Arc<dyn SyncProvider>,
net: Arc<dyn ManageNetwork>,
logger: Arc<RotatingLogger>,
settings: Arc<NetworkSettings>,
signer: Option<Arc<SignerService>>,
ws_address: Option<Host>,
snapshot: Option<Arc<SnapshotService>>,
snapshot: Option<Arc<dyn SnapshotService>>,
}
impl<C, M, U> ParityClient<C, M, U> where
@@ -75,14 +75,14 @@ impl<C, M, U> ParityClient<C, M, U> where
pub fn new(
client: Arc<C>,
miner: Arc<M>,
sync: Arc<SyncProvider>,
sync: Arc<dyn SyncProvider>,
updater: Arc<U>,
net: Arc<ManageNetwork>,
net: Arc<dyn ManageNetwork>,
logger: Arc<RotatingLogger>,
settings: Arc<NetworkSettings>,
signer: Option<Arc<SignerService>>,
ws_address: Option<Host>,
snapshot: Option<Arc<SnapshotService>>,
snapshot: Option<Arc<dyn SnapshotService>>,
) -> Self {
ParityClient {
client,

View File

@@ -87,7 +87,7 @@ pub struct ParitySetClient<C, M, U, F = fetch::Client> {
client: Arc<C>,
miner: Arc<M>,
updater: Arc<U>,
net: Arc<ManageNetwork>,
net: Arc<dyn ManageNetwork>,
fetch: F,
}
@@ -99,7 +99,7 @@ impl<C, M, U, F> ParitySetClient<C, M, U, F>
client: &Arc<C>,
miner: &Arc<M>,
updater: &Arc<U>,
net: &Arc<ManageNetwork>,
net: &Arc<dyn ManageNetwork>,
fetch: F,
) -> Self {
ParitySetClient {

View File

@@ -40,7 +40,7 @@ use v1::types::{TransactionModification, ConfirmationRequest, ConfirmationRespon
/// Transactions confirmation (personal) rpc implementation.
pub struct SignerClient<D: Dispatcher> {
signer: Arc<SignerService>,
accounts: Arc<dispatch::Accounts>,
accounts: Arc<dyn dispatch::Accounts>,
dispatcher: D,
subscribers: Arc<Mutex<Subscribers<Sink<Vec<ConfirmationRequest>>>>>,
deprecation_notice: DeprecationNotice,
@@ -49,7 +49,7 @@ pub struct SignerClient<D: Dispatcher> {
impl<D: Dispatcher + 'static> SignerClient<D> {
/// Create new instance of signer client.
pub fn new(
accounts: Arc<dispatch::Accounts>,
accounts: Arc<dyn dispatch::Accounts>,
dispatcher: D,
signer: &Arc<SignerService>,
executor: Executor,
@@ -81,7 +81,7 @@ impl<D: Dispatcher + 'static> SignerClient<D> {
}
fn confirm_internal<F, T>(&self, id: U256, modification: TransactionModification, f: F) -> BoxFuture<WithToken<ConfirmationResponse>> where
F: FnOnce(D, &Arc<dispatch::Accounts>, ConfirmationPayload) -> T,
F: FnOnce(D, &Arc<dyn dispatch::Accounts>, ConfirmationPayload) -> T,
T: IntoFuture<Item=WithToken<ConfirmationResponse>, Error=Error>,
T::Future: Send + 'static
{

View File

@@ -91,7 +91,7 @@ fn schedule(executor: Executor,
/// Implementation of functions that require signing when no trusted signer is used.
pub struct SigningQueueClient<D> {
signer: Arc<SignerService>,
accounts: Arc<dispatch::Accounts>,
accounts: Arc<dyn dispatch::Accounts>,
dispatcher: D,
executor: Executor,
// None here means that the request hasn't yet been confirmed
@@ -101,7 +101,7 @@ pub struct SigningQueueClient<D> {
impl<D: Dispatcher + 'static> SigningQueueClient<D> {
/// Creates a new signing queue client given shared signing queue.
pub fn new(signer: &Arc<SignerService>, dispatcher: D, executor: Executor, accounts: &Arc<dispatch::Accounts>) -> Self {
pub fn new(signer: &Arc<SignerService>, dispatcher: D, executor: Executor, accounts: &Arc<dyn dispatch::Accounts>) -> Self {
SigningQueueClient {
signer: signer.clone(),
accounts: accounts.clone(),

View File

@@ -37,14 +37,14 @@ use v1::types::{
/// Implementation of functions that require signing when no trusted signer is used.
pub struct SigningUnsafeClient<D> {
accounts: Arc<dispatch::Accounts>,
accounts: Arc<dyn dispatch::Accounts>,
dispatcher: D,
deprecation_notice: DeprecationNotice,
}
impl<D: Dispatcher + 'static> SigningUnsafeClient<D> {
/// Creates new SigningUnsafeClient.
pub fn new(accounts: &Arc<dispatch::Accounts>, dispatcher: D) -> Self {
pub fn new(accounts: &Arc<dyn dispatch::Accounts>, dispatcher: D) -> Self {
SigningUnsafeClient {
accounts: accounts.clone(),
dispatcher,

View File

@@ -55,7 +55,7 @@ pub struct TestMinerService {
/// Minimum gas price
pub min_gas_price: RwLock<Option<U256>>,
/// Signer (if any)
pub signer: RwLock<Option<Box<EngineSigner>>>,
pub signer: RwLock<Option<Box<dyn EngineSigner>>>,
authoring_params: RwLock<AuthoringParams>,
}
@@ -102,7 +102,7 @@ impl StateClient for TestMinerService {
}
impl EngineInfo for TestMinerService {
fn engine(&self) -> &Engine {
fn engine(&self) -> &dyn Engine {
unimplemented!()
}
}

View File

@@ -31,5 +31,5 @@ impl ManageNetwork for TestManageNetwork {
fn start_network(&self) {}
fn stop_network(&self) {}
fn num_peers_range(&self) -> RangeInclusive<u32> { 25..=50 }
fn with_proto_context(&self, _: ProtocolId, _: &mut FnMut(&NetworkContext)) { }
fn with_proto_context(&self, _: ProtocolId, _: &mut dyn FnMut(&dyn NetworkContext)) { }
}

View File

@@ -45,7 +45,7 @@ pub struct Dependencies {
pub updater: Arc<TestUpdater>,
pub logger: Arc<RotatingLogger>,
pub settings: Arc<NetworkSettings>,
pub network: Arc<ManageNetwork>,
pub network: Arc<dyn ManageNetwork>,
pub ws_address: Option<Host>,
}

View File

@@ -58,7 +58,7 @@ fn parity_set_client(
client,
miner,
updater,
&(net.clone() as Arc<ManageNetwork>),
&(net.clone() as Arc<dyn ManageNetwork>),
FakeFetch::new(Some(1)),
)
}

View File

@@ -19,7 +19,7 @@ use serde::{Deserialize, Deserializer};
use serde::de::{Error, Visitor};
use ethereum_types::H256;
use ethstore;
/// Type of derivation
pub enum DerivationType {