From 90a034fce80e3b32f474044ff205bd696dfd8c42 Mon Sep 17 00:00:00 2001 From: eauge Date: Wed, 13 Feb 2019 16:58:45 -0800 Subject: [PATCH] warnings as errors --- api/src/lib.rs | 1 + common/src/confidential/confidential_ctx.rs | 1 + common/src/lib.rs | 1 + gateway/bin/main.rs | 1 + gateway/src/client.rs | 9 +++------ gateway/src/impls/confidential.rs | 12 +++--------- gateway/src/impls/oasis.rs | 7 +++---- gateway/src/informant.rs | 13 ------------- gateway/src/lib.rs | 5 ++--- gateway/src/rpc.rs | 6 ------ gateway/src/rpc_apis.rs | 3 --- gateway/src/traits/confidential.rs | 3 +-- gateway/src/traits/oasis.rs | 4 ++-- genesis/src/main.rs | 1 + inspector/parity_patricia_trie/src/lib.rs | 1 + inspector/src/main.rs | 1 + src/lib.rs | 1 + 17 files changed, 22 insertions(+), 48 deletions(-) diff --git a/api/src/lib.rs b/api/src/lib.rs index 8119bdc24..2a5e8a26d 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -1,3 +1,4 @@ +#![deny(warnings)] extern crate protobuf; extern crate serde; diff --git a/common/src/confidential/confidential_ctx.rs b/common/src/confidential/confidential_ctx.rs index 8d3678128..e86d76a3f 100644 --- a/common/src/confidential/confidential_ctx.rs +++ b/common/src/confidential/confidential_ctx.rs @@ -1,3 +1,4 @@ +#![deny(warnings)] use super::key_manager::KeyManagerClient; use ekiden_core::mrae::{ nonce::{Nonce, NONCE_SIZE}, diff --git a/common/src/lib.rs b/common/src/lib.rs index e15273eb1..679aba248 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -1,5 +1,6 @@ //! Common data structures shared by runtime and gateway. +#![deny(warnings)] extern crate ekiden_core; extern crate ekiden_keymanager_client; extern crate ekiden_keymanager_common; diff --git a/gateway/bin/main.rs b/gateway/bin/main.rs index bfb019f7f..51dcdb1b7 100644 --- a/gateway/bin/main.rs +++ b/gateway/bin/main.rs @@ -16,6 +16,7 @@ //! web3 gateway for Oasis Ethereum runtime. +#![deny(warnings)] extern crate ctrlc; extern crate fdlimit; extern crate log; diff --git a/gateway/src/client.rs b/gateway/src/client.rs index f013bbc2a..6b04b1558 100644 --- a/gateway/src/client.rs +++ b/gateway/src/client.rs @@ -28,12 +28,11 @@ use hash::keccak; use parity_rpc::v1::types::Bytes as RpcBytes; use runtime_ethereum; use runtime_ethereum_common::{confidential::has_confidential_prefix, State as EthState}; -use std::time::{SystemTime, UNIX_EPOCH}; use traits::confidential::PublicKeyResult; use transaction::{Action, LocalizedTransaction, SignedTransaction}; use client_utils::{self, db::Snapshot}; -use ekiden_common::{bytes::B512, environment::Environment}; +use ekiden_common::{environment::Environment}; use ekiden_core::{error::Error, futures::prelude::*}; use ekiden_db_trusted::Database; use ekiden_keymanager_client::KeyManager as EkidenKeyManager; @@ -817,9 +816,9 @@ impl Client { .is_confidential(transaction) .map_err(|_| CallError::StateCorrupt)? { - self.confidential_estimate_gas(transaction, id) + self.confidential_estimate_gas(transaction) } else { - self._estimate_gas(transaction, id, db, state) + self._estimate_gas(transaction, db, state) } } @@ -828,7 +827,6 @@ impl Client { fn _estimate_gas( &self, transaction: &SignedTransaction, - id: BlockId, db: StateDb, mut state: EthState, ) -> Result { @@ -849,7 +847,6 @@ impl Client { fn confidential_estimate_gas( &self, transaction: &SignedTransaction, - id: BlockId, ) -> Result { info!("estimating gas for a confidential contract"); diff --git a/gateway/src/impls/confidential.rs b/gateway/src/impls/confidential.rs index c1fac58bb..9bc009333 100644 --- a/gateway/src/impls/confidential.rs +++ b/gateway/src/impls/confidential.rs @@ -1,34 +1,28 @@ use client::Client; -use ekiden_common::bytes::B512; -use ekiden_core::futures::FutureExt; -use ekiden_keymanager_common::confidential; use ethereum_api::TransactionRequest; use ethereum_types::Address; use impls::eth::EthClient; use jsonrpc_core::{ - futures::{future, Future}, + futures::{Future}, BoxFuture, Error, ErrorCode, Result, }; use jsonrpc_macros::Trailing; use parity_rpc::v1::{ helpers::errors, metadata::Metadata, - traits::Eth, - types::{BlockNumber, Bytes, CallRequest, H256}, + types::{BlockNumber, Bytes, CallRequest}, }; use std::sync::Arc; use traits::confidential::{Confidential, PublicKeyResult}; pub struct ConfidentialClient { client: Arc, - eth_client: EthClient, } impl ConfidentialClient { pub fn new(client: Arc) -> Self { ConfidentialClient { client: client.clone(), - eth_client: EthClient::new(&client), } } } @@ -45,7 +39,7 @@ impl Confidential for ConfidentialClient { fn call_enc( &self, - meta: Self::Metadata, + _meta: Self::Metadata, request: CallRequest, tag: Trailing, ) -> BoxFuture { diff --git a/gateway/src/impls/oasis.rs b/gateway/src/impls/oasis.rs index 0a8fc629b..12b475aea 100644 --- a/gateway/src/impls/oasis.rs +++ b/gateway/src/impls/oasis.rs @@ -1,12 +1,11 @@ -use std::{str::FromStr, sync::Arc}; +use std::{sync::Arc}; -use ekiden_common::bytes::H256; use ekiden_core::futures::Future; use ethereum_types::Address; -use jsonrpc_core::{futures::future, BoxFuture, Error, ErrorCode, Result}; +use jsonrpc_core::{BoxFuture, Error, ErrorCode}; use jsonrpc_macros::Trailing; -use parity_rpc::v1::types::{BlockNumber, H160 as RpcH160, H256 as RpcH256}; +use parity_rpc::v1::types::{BlockNumber, H160 as RpcH160}; use client::Client; use impls::eth::EthClient; diff --git a/gateway/src/informant.rs b/gateway/src/informant.rs index a2839fd5d..cfc50ae43 100644 --- a/gateway/src/informant.rs +++ b/gateway/src/informant.rs @@ -110,19 +110,6 @@ impl RpcStats { .unwrap_or(0) } - /// Returns number of open sessions - pub fn sessions(&self) -> usize { - self.sessions.read().len() - } - - /// Returns requests rate - pub fn requests_rate(&self, id: &H256) -> usize { - self.sessions - .read() - .get(id) - .map(|calc| calc.read().rate()) - .unwrap_or(0) - } } #[cfg(test)] diff --git a/gateway/src/lib.rs b/gateway/src/lib.rs index 4933f24b7..49d43cf33 100644 --- a/gateway/src/lib.rs +++ b/gateway/src/lib.rs @@ -15,11 +15,11 @@ // along with Parity. If not, see . //! Ethcore client application. +#![deny(warnings)] #[macro_use] extern crate clap; extern crate env_logger; -#[macro_use] extern crate futures; #[macro_use] extern crate lazy_static; @@ -45,7 +45,6 @@ extern crate jsonrpc_pubsub; extern crate jsonrpc_ws_server; extern crate common_types; -#[macro_use] extern crate ethcore; extern crate ethcore_bytes as bytes; extern crate ethcore_transaction as transaction; @@ -119,7 +118,7 @@ use ethereum_types::U256; use ekiden_core::{environment::Environment, x509}; use ekiden_runtime_client::create_runtime_client; -use ekiden_storage_base::{BackendIdentityMapper, StorageBackend}; +use ekiden_storage_base::{BackendIdentityMapper}; use ethereum_api::with_api; pub use self::run::RunningClient; diff --git a/gateway/src/rpc.rs b/gateway/src/rpc.rs index 6cd5f53c0..0a3bea952 100644 --- a/gateway/src/rpc.rs +++ b/gateway/src/rpc.rs @@ -42,12 +42,6 @@ pub struct HttpConfiguration { pub max_batch_size: usize, } -impl HttpConfiguration { - pub fn address(&self) -> Option { - address(self.enabled, &self.interface, self.port, &self.hosts) - } -} - impl Default for HttpConfiguration { fn default() -> Self { HttpConfiguration { diff --git a/gateway/src/rpc_apis.rs b/gateway/src/rpc_apis.rs index 13ed2704a..68de828c7 100644 --- a/gateway/src/rpc_apis.rs +++ b/gateway/src/rpc_apis.rs @@ -63,8 +63,6 @@ impl FromStr for Api { #[derive(Debug, Clone)] pub enum ApiSet { - // Safe context (like token-protected WS interface) - SafeContext, // Unsafe context (like jsonrpc over http) UnsafeContext, // All possible APIs @@ -239,7 +237,6 @@ impl ApiSet { match *self { ApiSet::List(ref apis) => apis.clone(), ApiSet::UnsafeContext => public_list, - ApiSet::SafeContext => public_list, ApiSet::All => public_list, } } diff --git a/gateway/src/traits/confidential.rs b/gateway/src/traits/confidential.rs index 2592d151c..2621d88d8 100644 --- a/gateway/src/traits/confidential.rs +++ b/gateway/src/traits/confidential.rs @@ -1,8 +1,7 @@ -use ekiden_common::bytes::B512; use ethereum_types::Address; use jsonrpc_core::{BoxFuture, Result}; use jsonrpc_macros::Trailing; -use parity_rpc::v1::types::{BlockNumber, Bytes, CallRequest, H256}; +use parity_rpc::v1::types::{BlockNumber, Bytes, CallRequest}; build_rpc_trait! { pub trait Confidential { diff --git a/gateway/src/traits/oasis.rs b/gateway/src/traits/oasis.rs index 68fe1a472..2e8f90cfa 100644 --- a/gateway/src/traits/oasis.rs +++ b/gateway/src/traits/oasis.rs @@ -1,9 +1,9 @@ //! Oasis rpc interface. -use jsonrpc_core::{BoxFuture, Result}; +use jsonrpc_core::{BoxFuture}; use jsonrpc_macros::Trailing; -use parity_rpc::v1::types::{BlockNumber, H160, H256}; +use parity_rpc::v1::types::{BlockNumber, H160}; build_rpc_trait! { pub trait Oasis { diff --git a/genesis/src/main.rs b/genesis/src/main.rs index 67377d512..4540e59c0 100644 --- a/genesis/src/main.rs +++ b/genesis/src/main.rs @@ -1,3 +1,4 @@ +#![deny(warnings)] extern crate clap; extern crate ethcore; extern crate ethereum_types; diff --git a/inspector/parity_patricia_trie/src/lib.rs b/inspector/parity_patricia_trie/src/lib.rs index 60d55e49d..85670511a 100644 --- a/inspector/parity_patricia_trie/src/lib.rs +++ b/inspector/parity_patricia_trie/src/lib.rs @@ -16,6 +16,7 @@ //! Trie interface and implementation. // extern crate rand; +#![deny(warnings)] extern crate elastic_array; extern crate ethcore_bytes as bytes; extern crate ethereum_types; diff --git a/inspector/src/main.rs b/inspector/src/main.rs index d2a211c37..f2ab78343 100644 --- a/inspector/src/main.rs +++ b/inspector/src/main.rs @@ -1,3 +1,4 @@ +#![deny(warnings)] extern crate clap; extern crate ethcore; extern crate ethereum_types; diff --git a/src/lib.rs b/src/lib.rs index a4de17b93..2df07265e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ +#![deny(warnings)] extern crate common_types as ethcore_types; extern crate ekiden_common; extern crate ekiden_core;