Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:oasislabs/runtime-ethereum into e…
Browse files Browse the repository at this point in the history
…auge/lint/warnings-as-errors
  • Loading branch information
eauge committed Feb 14, 2019
2 parents edba5ee + 310606f commit 51becc5
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 52 deletions.
6 changes: 3 additions & 3 deletions .buildkite/rust/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export RUST_BACKTRACE="1"
##################################
# Set up RUSTFLAGS for the build #
##################################
if [ -v RUSTLINT ]; then
if [ -z ${RUSTLINT+x} ]; then
RUSTLINT=""
for opt in $(cat .buildkite/rust/lint.txt); do
for opt in $(cat .buildkite/rust/lint.txt | grep -v '#'); do
RUSTLINT=$RUSTLINT" -D "$opt
done

export RUSTLINT
if [ -v RUSTFLAG ]; then
if [ -z ${RUSTFLAGS+x} ]; then
export RUSTFLAGS=$RUSTLINT
else
export RUSTFLAGS=$RUSTFLAGS" "$RUSTLINT
Expand Down
23 changes: 13 additions & 10 deletions .buildkite/rust/lint.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#
# list of lints that will be used to compile the code
# elements after a '#' will be ignored
#
bad-style
const-err
dead-code
extra-requirement-in-impl
improper-ctypes
legacy-directory-ownership
non-shorthand-field-patterns
Expand All @@ -11,19 +14,19 @@ path-statements
patterns-in-fns-without-body
plugin-as-library
private-in-public
private-no-mangle-fns
private-no-mangle-statics
raw-pointer-derive
safe-extern-statics
unconditional-recursion
unions-with-drop-fields
unused
# unused
unused-allocation
unused-comparisons
unused-parens
while-true
trivial-casts
trivial-numeric-casts
unused-extern-crates
unused-import-braces
unused-qualifications
# missing-debug-implementations
# missing-docs
# trivial-casts
# trivial-numeric-casts
# unused-extern-crates
# unused-import-braces
# unused-qualifications
# unused-results
2 changes: 1 addition & 1 deletion common/src/confidential/confidential_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use ethereum_types::Address;
/// nonce to use--to be encrypting under for a *single* transaction. Each
/// transaction for a confidential contract should have it's own ConfidentialCtx
/// that is closed at the end of the transaction's execution.
#[derive(Clone, Debug)]
#[derive(Clone)]
pub struct ConfidentialCtx {
/// The peer public key used for encryption. This should not change for an
/// open confidential context. This is implicitly set by the `open` method.
Expand Down
5 changes: 5 additions & 0 deletions common/src/confidential/key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,22 @@ impl KeyManagerClient {
}
}

// used for the integration tests
#[allow(dead_code)]
#[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;

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)).
Expand All @@ -74,6 +78,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");
Expand Down
3 changes: 0 additions & 3 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ extern crate keccak_hash;
#[macro_use]
extern crate lazy_static;

#[cfg(target_env = "sgx")]
extern crate sgx_rand;

pub mod confidential;

use std::{
Expand Down
1 change: 0 additions & 1 deletion gateway/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ extern crate log;
extern crate parking_lot;
#[macro_use]
extern crate clap;
extern crate rand;

#[macro_use]
extern crate client_utils;
Expand Down
15 changes: 0 additions & 15 deletions gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,20 @@
#[macro_use]
extern crate clap;
extern crate env_logger;
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;
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;

Expand All @@ -48,19 +40,13 @@ 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;
Expand All @@ -75,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;
Expand Down
1 change: 1 addition & 0 deletions gateway/src/rpc_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ impl ApiSet {
match *self {
ApiSet::List(ref apis) => apis.clone(),
ApiSet::UnsafeContext => public_list,
ApiSet::SafeContext => public_list,
ApiSet::All => public_list,
}
}
Expand Down
1 change: 0 additions & 1 deletion genesis/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ extern crate filebuffer;
extern crate hex;
extern crate log;
extern crate pretty_env_logger;
extern crate rlp;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
Expand Down
3 changes: 0 additions & 3 deletions inspector/parity_patricia_trie/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@ extern crate ethcore_bytes as bytes;
extern crate ethereum_types;
extern crate hashdb;
extern crate keccak_hash as keccak;
extern crate memorydb;
extern crate rlp;
// extern crate ethcore_logger;

#[cfg(test)]
extern crate trie_standardmap as standardmap;

extern crate log;

use ethereum_types::H256;
use hashdb::DBValue;
use keccak::KECCAK_NULL_RLP;
Expand Down
5 changes: 0 additions & 5 deletions inspector/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
#![deny(warnings)]
extern crate clap;
extern crate ethcore;
extern crate ethereum_types;
extern crate filebuffer;
extern crate hex;
extern crate log;
extern crate patricia_trie as parity_patricia_trie;
extern crate pretty_env_logger;
extern crate rlp;

extern crate ekiden_core;
extern crate ekiden_db_trusted;
extern crate ekiden_roothash_api;
extern crate ekiden_roothash_base;
extern crate ekiden_roothash_client;
extern crate ekiden_storage_base;
Expand Down
3 changes: 2 additions & 1 deletion scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ run_compute_node() {
${EKIDEN_NODE} \
--log.level debug \
--grpc.log.verbose_debug \
--storage.backend client \
--storage.backend cachingclient \
--storage.cachingclient.file ${data_dir}/storage-cache \
--storage.client.address 127.0.0.1:${EKIDEN_STORAGE_PORT} \
--epochtime.backend tendermint_mock \
--beacon.backend tendermint \
Expand Down
12 changes: 4 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
extern crate common_types as ethcore_types;
extern crate ekiden_common;
extern crate ekiden_core;
extern crate ekiden_storage_base;
extern crate ekiden_storage_dummy;
extern crate ekiden_storage_lru;
extern crate ekiden_trusted;
extern crate elastic_array;
extern crate ethcore;
extern crate ethereum_api;
extern crate ethereum_types;
extern crate hashdb;
extern crate hex;
extern crate keccak_hash;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate protobuf;
extern crate runtime_ethereum_common;
extern crate sha3;

extern crate ekiden_keymanager_client;
extern crate ekiden_keymanager_common;
Expand All @@ -40,6 +32,7 @@ use std::sync::Arc;
use ekiden_core::error::{Error, Result};
use ekiden_storage_base::StorageBackend;
#[cfg(not(target_env = "sgx"))]
#[allow(dead_code)]
use ekiden_storage_dummy::DummyStorageBackend;
#[cfg(target_env = "sgx")]
use ekiden_trusted::db::untrusted::UntrustedStorageBackend;
Expand Down Expand Up @@ -162,6 +155,7 @@ pub fn get_block_height(_request: &bool, ctx: &mut RuntimeCallContext) -> Result
Ok(ectx.cache.get_latest_block_number().into())
}

#[allow(dead_code)]
fn get_block_hash(id: &BlockId, ctx: &mut RuntimeCallContext) -> Result<Option<H256>> {
let ectx = ctx.runtime.downcast_mut::<EthereumContext>().unwrap();

Expand All @@ -174,6 +168,7 @@ fn get_block_hash(id: &BlockId, ctx: &mut RuntimeCallContext) -> Result<Option<H
Ok(hash)
}

#[allow(dead_code)]
fn get_block(id: &BlockId, ctx: &mut RuntimeCallContext) -> Result<Option<Vec<u8>>> {
let ectx = ctx.runtime.downcast_mut::<EthereumContext>().unwrap();

Expand All @@ -194,6 +189,7 @@ fn get_block(id: &BlockId, ctx: &mut RuntimeCallContext) -> Result<Option<Vec<u8
}
}

#[allow(dead_code)]
fn get_logs(filter: &Filter, ctx: &mut RuntimeCallContext) -> Result<Vec<Log>> {
let ectx = ctx.runtime.downcast_mut::<EthereumContext>().unwrap();

Expand Down
2 changes: 2 additions & 0 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ mod tests {
extern crate ekiden_storage_dummy;

use self::ekiden_storage_dummy::DummyStorageBackend;

#[allow(dead_code)]
use lazy_static;

use super::*;
Expand Down
1 change: 1 addition & 0 deletions tests/contracts/bulk_storage.rs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tests/contracts/counter.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/estimate_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn estimate_gas_wasm_scaling() {
let data = contracts::bulk_storage::initcode();
// When
let estimate_gas = client.estimate_gas(None, data.clone(), &U256::from(0));
let (tx_hash, addr) = client.create_contract(data, &U256::from(0));
let (tx_hash, _addr) = client.create_contract(data, &U256::from(0));
// Then
let receipt = client.receipt(tx_hash);
assert_eq!(receipt.cumulative_gas_used, estimate_gas);
Expand Down

0 comments on commit 51becc5

Please sign in to comment.