-
Notifications
You must be signed in to change notification settings - Fork 16
warnings as errors #583
warnings as errors #583
Changes from 10 commits
90a034f
79dea7d
7dad571
526fa24
34fa6c3
fb8e23f
18a22a9
edba5ee
201aff5
d453276
b3d38a3
2071cdc
e876929
69aad5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# list of lints that will be used to compile the code | ||
# elements after a '#' will be ignored | ||
# | ||
bad-style | ||
const-err | ||
dead-code | ||
improper-ctypes | ||
legacy-directory-ownership | ||
non-shorthand-field-patterns | ||
no-mangle-generic-items | ||
overflowing-literals | ||
path-statements | ||
patterns-in-fns-without-body | ||
plugin-as-library | ||
private-in-public | ||
safe-extern-statics | ||
unconditional-recursion | ||
unions-with-drop-fields | ||
# unused | ||
unused-allocation | ||
unused-comparisons | ||
unused-parens | ||
while-true | ||
# missing-debug-implementations | ||
# missing-docs | ||
# trivial-casts | ||
# trivial-numeric-casts | ||
# unused-extern-crates | ||
# unused-import-braces | ||
# unused-qualifications | ||
# unused-results |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//! Build crate for the ekiden api. | ||
|
||
extern crate ekiden_tools; | ||
|
||
fn main() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
extern crate protobuf; | ||
extern crate serde; | ||
|
||
#[macro_use] | ||
extern crate serde_derive; | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,3 +1,5 @@ | ||||||
//! build crate for the ekiden runtime based enclave | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
extern crate ekiden_edl; | ||||||
extern crate ekiden_tools; | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,16 +41,21 @@ impl KeyManagerClient { | |
} | ||
} | ||
|
||
#[cfg(not(test))] | ||
#[derive(Debug)] | ||
/// Wrapper around the Ekiden key manager client to provide a more convenient | ||
/// Ethereum address based interface along with runtime-specific utility methods. | ||
struct KeyManager; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What made you delete this? We still need it. :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was just not being used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is definitely used. See KeyManagerClient. We do some conditional compilation for testing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The e2e tests will fail if this is deleted. |
||
|
||
impl KeyManager { | ||
#[allow(dead_code)] | ||
/// Returns the contract id for the given contract address. The contract_id | ||
/// is used to fetch keys for a contract. | ||
fn contract_id(contract: Address) -> ContractId { | ||
ContractId::from(&keccak(contract.to_vec())[..]) | ||
} | ||
|
||
#[allow(dead_code)] | ||
/// Creates and returns the long term public key for the given contract. | ||
/// If the key already exists, returns the existing key. | ||
/// Returns the tuple (public_key, signature_{KeyManager}(public_key)). | ||
|
@@ -72,6 +77,7 @@ impl KeyManager { | |
}) | ||
} | ||
|
||
#[allow(dead_code)] | ||
fn contract_key(address: Address) -> Result<ContractKey, String> { | ||
let contract_id = Self::contract_id(address); | ||
let mut km = EkidenKeyManager::instance().expect("Should always have a key manager client"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -86,9 +85,11 @@ pub trait ChainNotify: Send + Sync { | |
pub struct Client { | ||
client: runtime_ethereum::Client, | ||
engine: Arc<EthEngine>, | ||
#[allow(dead_code)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is dead can we delete it? |
||
snapshot_manager: Option<client_utils::db::Manager>, | ||
eip86_transition: u64, | ||
environment: Arc<Environment>, | ||
#[allow(dead_code)] | ||
storage_backend: Arc<StorageBackend>, | ||
/// The most recent block for which we have sent notifications. | ||
notified_block_number: Mutex<BlockNumber>, | ||
|
@@ -817,9 +818,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 +829,6 @@ impl Client { | |
fn _estimate_gas<T: 'static + Database + Send + Sync>( | ||
&self, | ||
transaction: &SignedTransaction, | ||
id: BlockId, | ||
db: StateDb<T>, | ||
mut state: EthState, | ||
) -> Result<U256, CallError> { | ||
|
@@ -849,7 +849,6 @@ impl Client { | |
fn confidential_estimate_gas( | ||
&self, | ||
transaction: &SignedTransaction, | ||
id: BlockId, | ||
) -> Result<U256, CallError> { | ||
info!("estimating gas for a confidential contract"); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,51 +18,35 @@ | |
|
||
#[macro_use] | ||
extern crate clap; | ||
extern crate env_logger; | ||
#[macro_use] | ||
extern crate futures; | ||
#[macro_use] | ||
extern crate lazy_static; | ||
#[macro_use] | ||
extern crate log; | ||
extern crate parking_lot; | ||
extern crate path; | ||
extern crate rayon; | ||
extern crate regex; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Look at all of these removed crates. Glorious. Are they removed from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't, but we could do that. I would prefer to do it in a separate PR if that's okay though :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why another PR? Might as well do it here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let me try then |
||
extern crate rustc_hex; | ||
extern crate serde; | ||
extern crate serde_json; | ||
#[macro_use] | ||
extern crate serde_derive; | ||
extern crate toml; | ||
|
||
extern crate jsonrpc_core; | ||
#[macro_use] | ||
extern crate jsonrpc_macros; | ||
extern crate jsonrpc_http_server; | ||
extern crate jsonrpc_ipc_server; | ||
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; | ||
extern crate ethereum_types; | ||
extern crate evm; | ||
#[cfg(test)] | ||
extern crate hex; | ||
extern crate journaldb; | ||
extern crate keccak_hash as hash; | ||
extern crate kvdb; | ||
extern crate parity_machine; | ||
extern crate parity_reactor; | ||
extern crate parity_rpc; | ||
extern crate rlp; | ||
extern crate rlp_compress; | ||
extern crate util_error; | ||
extern crate vm; | ||
|
||
#[macro_use] | ||
extern crate client_utils; | ||
|
@@ -77,7 +61,6 @@ extern crate ekiden_keymanager_common; | |
extern crate ekiden_registry_client; | ||
#[cfg(test)] | ||
extern crate ekiden_roothash_client; | ||
extern crate ekiden_rpc_client; | ||
#[cfg(test)] | ||
extern crate ekiden_scheduler_client; | ||
extern crate ekiden_storage_base; | ||
|
@@ -119,7 +102,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; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity is this an exhaustive list? I assume not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got the list from here https://github.com/rust-unofficial/patterns/blob/master/anti_patterns/deny-warnings.md. It's not exhaustive since rust still adds/deprecates lints with quite some frequency. Based on that post, it looks like this is a reasonable set. Let me know if there's any other lint that you think should be added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is great to start. We can add/subtract as necessary in the future.