Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Eliminate compilation warnings #646

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/evmbin/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub trait Informant: trace::VMTracer {
/// Clone sink.
fn clone_sink(&self) -> Self::Sink;
/// Display final result.
fn finish(result: RunResult<Self::Output>, &mut Self::Sink);
fn finish(result: RunResult<Self::Output>, sink: &mut Self::Sink);
}

/// Execution finished correctly
Expand Down
3 changes: 2 additions & 1 deletion bin/evmbin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ fn run_call<T: Informant>(args: Args, informant: T) {

#[derive(Debug, Deserialize)]
struct Args {
cmd_stats: bool,
#[serde(rename = "cmd_stats")]
_cmd_stats: bool,
cmd_state_test: bool,
cmd_stats_jsontests_vm: bool,
arg_file: Option<PathBuf>,
Expand Down
2 changes: 1 addition & 1 deletion crates/concensus/miner/src/local_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use ethereum_types::Address;
/// Local accounts checker
pub trait LocalAccounts: Send + Sync {
/// Returns true if given address should be considered local account.
fn is_local(&self, &Address) -> bool;
fn is_local(&self, address: &Address) -> bool;
}

impl LocalAccounts for HashSet<Address> {
Expand Down
1 change: 1 addition & 0 deletions crates/ethcore/src/client/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ impl TestBlockChainClient {
self.disabled.load(AtomicOrder::SeqCst)
}

/// Set receiver for new transaction hashes
pub fn set_new_transaction_hashes_producer(
&self,
new_transaction_hashes: crossbeam_channel::Sender<H256>,
Expand Down
2 changes: 1 addition & 1 deletion crates/ethcore/src/engines/authority_round/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3725,7 +3725,7 @@ mod tests {
}
}"#;
let deserialized: ethjson::spec::AuthorityRound = serde_json::from_str(config).unwrap();
AuthorityRoundParams::from(deserialized.params);
let _ = AuthorityRoundParams::from(deserialized.params);
}

#[test]
Expand Down
10 changes: 5 additions & 5 deletions crates/ethcore/src/executive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ pub fn contract_address(
let code_hash = keccak(code);
let mut buffer = [0u8; 1 + 20 + 32 + 32];
buffer[0] = 0xff;
&mut buffer[1..(1 + 20)].copy_from_slice(&sender[..]);
&mut buffer[(1 + 20)..(1 + 20 + 32)].copy_from_slice(&salt[..]);
&mut buffer[(1 + 20 + 32)..].copy_from_slice(&code_hash[..]);
buffer[1..(1 + 20)].copy_from_slice(&sender[..]);
buffer[(1 + 20)..(1 + 20 + 32)].copy_from_slice(&salt[..]);
buffer[(1 + 20 + 32)..].copy_from_slice(&code_hash[..]);
(From::from(keccak(&buffer[..])), Some(code_hash))
}
CreateContractAddress::FromSenderAndCodeHash => {
let code_hash = keccak(code);
let mut buffer = [0u8; 20 + 32];
&mut buffer[..20].copy_from_slice(&sender[..]);
&mut buffer[20..].copy_from_slice(&code_hash[..]);
buffer[..20].copy_from_slice(&sender[..]);
buffer[20..].copy_from_slice(&code_hash[..]);
(From::from(keccak(&buffer[..])), Some(code_hash))
}
}
Expand Down
6 changes: 2 additions & 4 deletions crates/ethcore/src/externalities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,8 @@ where
let index = self.env_info.number - number.low_u64() - 1;
assert!(
index < self.env_info.last_hashes.len() as u64,
format!(
"Inconsistent env_info, should contain at least {:?} last hashes",
index + 1
)
"Inconsistent env_info, should contain at least {:?} last hashes",
index + 1
);
let r = self.env_info.last_hashes[index as usize].clone();
trace!(
Expand Down
4 changes: 4 additions & 0 deletions crates/ethcore/src/spec/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,10 @@ impl Spec {
load_bundled!("test/authority_round_block_reward_contract")
}

/// Create a new Spec with AuthorityRound consensus which does internal sealing (not
/// requiring work). Contains `rewriteBytecode` field specifying hardforks when
/// block numbers and contracts should be rewritten. See:
/// https://docs.google.com/document/d/10DikWMCVLhemF8FOJRTRI2AXhWa8bE1-kFaOElXN8Wc/edit
pub fn new_test_round_rewrite_bytecode_transitions() -> Self {
load_bundled!("test/authority_round_rewrite_bytecode_transitions")
}
Expand Down
1 change: 1 addition & 0 deletions crates/ethcore/src/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ pub fn push_block_with_transactions(client: &Arc<Client>, transactions: &[Signed
client.import_verified_blocks();
}

/// Adds one block with transactions and specified author
pub fn push_block_with_transactions_and_author(
client: &Arc<Client>,
transactions: &[SignedTransaction],
Expand Down
4 changes: 2 additions & 2 deletions crates/ethcore/sync/src/block_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ const MAX_USELESS_HEADERS_PER_ROUND: usize = 3;
// logging macros prepend BlockSet context for log filtering
macro_rules! trace_sync {
($self:ident, $fmt:expr, $($arg:tt)+) => {
trace!(target: "sync", concat!("{:?}: ", $fmt), $self.block_set, $($arg)+);
trace!(target: "sync", concat!("{:?}: ", $fmt), $self.block_set, $($arg)+)
};
($self:ident, $fmt:expr) => {
trace!(target: "sync", concat!("{:?}: ", $fmt), $self.block_set);
trace!(target: "sync", concat!("{:?}: ", $fmt), $self.block_set)
};
}

Expand Down
2 changes: 1 addition & 1 deletion crates/ethcore/sync/src/chain/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ impl SyncHandler {
snapshot_hash,
snapshot_number,
block_set: None,
client_version: ClientVersion::from(io.peer_version(peer_id)),
_client_version: ClientVersion::from(io.peer_version(peer_id)),
};

trace!(target: "sync", "New peer {} (\
Expand Down
4 changes: 2 additions & 2 deletions crates/ethcore/sync/src/chain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ pub struct PeerInfo {
/// Block set requested
block_set: Option<BlockSet>,
/// Version of the software the peer is running
client_version: ClientVersion,
_client_version: ClientVersion,
}

impl PeerInfo {
Expand Down Expand Up @@ -1818,7 +1818,7 @@ pub mod tests {
snapshot_hash: None,
asking_snapshot_data: None,
block_set: None,
client_version: ClientVersion::from(""),
_client_version: ClientVersion::from(""),
},
);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ethcore/sync/src/chain/propagator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ mod tests {
snapshot_hash: None,
asking_snapshot_data: None,
block_set: None,
client_version: ClientVersion::from(""),
_client_version: ClientVersion::from(""),
},
);
let ss = TestSnapshotService::new();
Expand Down
2 changes: 1 addition & 1 deletion crates/net/fetch/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ mod test {
.map(|resp| resp.concat2())
.flatten()
.map(|body| assert_eq!(&body[..], b"123"))
.map_err(|err| panic!(err));
.map_err(|err| panic!("{}", err));

runtime.block_on(future).unwrap();
}
Expand Down
6 changes: 3 additions & 3 deletions crates/net/network-devp2p/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ impl EncryptedConnection {
let mut packet = vec![0u8; 16 + 16 + len + padding + 16];
let mut header = header.out();
header.resize(HEADER_LEN, 0u8);
&mut packet[..HEADER_LEN].copy_from_slice(&mut header);
packet[..HEADER_LEN].copy_from_slice(&mut header);
self.encoder.encrypt(&mut packet[..HEADER_LEN])?;
EncryptedConnection::update_mac(
&mut self.egress_mac,
Expand All @@ -444,7 +444,7 @@ impl EncryptedConnection {
self.egress_mac
.clone()
.finalize(&mut packet[HEADER_LEN..32]);
&mut packet[32..32 + len].copy_from_slice(payload);
packet[32..32 + len].copy_from_slice(payload);
self.encoder.encrypt(&mut packet[32..32 + len])?;
if padding != 0 {
self.encoder
Expand Down Expand Up @@ -526,7 +526,7 @@ impl EncryptedConnection {
let mut prev = H128::default();
mac.clone().finalize(prev.as_bytes_mut());
let mut enc = H128::default();
&mut enc[..].copy_from_slice(prev.as_bytes());
enc[..].copy_from_slice(prev.as_bytes());
let mac_encoder = AesEcb256::new(mac_encoder_key.as_bytes())?;
mac_encoder.encrypt(enc.as_bytes_mut())?;

Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ extern crate ethcore_io as io;
// #[cfg(test)]
extern crate tempdir;

// #[cfg(test)]
#[cfg(test)]
extern crate rpc_servers;

extern crate rpc_common;
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@

mod helpers;
mod http_client;
// #[cfg(test)]
#[cfg(test)]
mod rpc;
pub mod ws;
4 changes: 2 additions & 2 deletions crates/rpc/src/v1/tests/mocked/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn snapshot_service() -> Arc<TestSnapshotService> {
}

struct EthTester {
pub runtime: Runtime,
pub _runtime: Runtime,
pub client: Arc<TestBlockChainClient>,
pub sync: Arc<TestSyncProvider>,
pub accounts_provider: Arc<AccountProvider>,
Expand Down Expand Up @@ -139,7 +139,7 @@ impl EthTester {
io.extend_with(filter);

EthTester {
runtime,
_runtime: runtime,
client,
sync,
accounts_provider: ap,
Expand Down
8 changes: 4 additions & 4 deletions crates/rpc/src/v1/tests/mocked/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ use serde_json;
use types::transaction::{Action, SignedTransaction, Transaction, TypedTransaction};

struct SigningTester {
pub runtime: Runtime,
pub _runtime: Runtime,
pub signer: Arc<SignerService>,
pub client: Arc<TestBlockChainClient>,
pub _client: Arc<TestBlockChainClient>,
pub miner: Arc<TestMinerService>,
pub accounts: Arc<AccountProvider>,
pub io: IoHandler<Metadata>,
Expand Down Expand Up @@ -75,9 +75,9 @@ impl Default for SigningTester {
io.extend_with(ParitySigning::to_delegate(rpc));

SigningTester {
runtime,
_runtime: runtime,
signer: signer,
client: client,
_client: client,
miner: miner,
accounts: accounts,
io: io,
Expand Down
8 changes: 4 additions & 4 deletions crates/rpc/src/v1/tests/mocked/signing_unsafe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ fn miner_service() -> Arc<TestMinerService> {
}

struct EthTester {
pub runtime: Runtime,
pub client: Arc<TestBlockChainClient>,
pub _runtime: Runtime,
pub _client: Arc<TestBlockChainClient>,
pub accounts_provider: Arc<AccountProvider>,
pub miner: Arc<TestMinerService>,
pub io: IoHandler<Metadata>,
Expand Down Expand Up @@ -82,8 +82,8 @@ impl EthTester {
io.extend_with(sign);

EthTester {
runtime,
client,
_runtime: runtime,
_client: client,
miner,
io,
accounts_provider,
Expand Down
4 changes: 2 additions & 2 deletions crates/runtime/io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ mod tests {

#[derive(Clone)]
struct MyMessage {
data: u32,
_data: u32,
}

impl IoHandler<MyMessage> for MyHandler {
Expand Down Expand Up @@ -286,7 +286,7 @@ mod tests {

#[derive(Clone)]
struct MyMessage {
data: u32,
_data: u32,
}

impl IoHandler<MyMessage> for MyHandler {
Expand Down
1 change: 0 additions & 1 deletion crates/transaction-pool/src/tests/tx_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use ethereum_types::BigEndianHash;
pub struct TransactionBuilder {
nonce: U256,
gas_price: U256,
gas: U256,
sender: Address,
mem_usage: usize,
}
Expand Down
4 changes: 2 additions & 2 deletions crates/util/EIP-712/src/eip712.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ lazy_static! {
static ref IDENT_REGEX: Regex = Regex::new(r"^[a-zA-Z_$][a-zA-Z_$0-9]*$").unwrap();
}

#[derive(Deserialize, Serialize, Validate, Debug, Clone)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
#[derive(Deserialize, Serialize, Validate, Debug, Clone)]
pub(crate) struct EIP712Domain {
pub(crate) name: String,
pub(crate) version: String,
Expand All @@ -42,9 +42,9 @@ pub(crate) struct EIP712Domain {
pub(crate) salt: Option<H256>,
}
/// EIP-712 struct
#[derive(Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
#[derive(Deserialize, Debug, Clone)]
pub struct EIP712 {
pub(crate) types: MessageTypes,
pub(crate) primary_type: String,
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/evm/src/interpreter/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub trait Memory {
/// Read a word from memory
fn read(&self, offset: U256) -> U256;
/// Write slice of bytes to memory. Does not resize memory!
fn write_slice(&mut self, offset: U256, &[u8]);
fn write_slice(&mut self, offset: U256, slice: &[u8]);
/// Retrieve part of the memory between offset and offset + size
fn read_slice(&self, offset: U256, size: U256) -> &[u8];
/// Retrieve writeable part of memory
Expand Down
17 changes: 7 additions & 10 deletions crates/vm/evm/src/interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ enum InstructionResult<Gas> {
#[derive(Debug)]
struct InterpreterParams {
/// Address of currently executed code.
pub code_address: Address,
pub _code_address: Address,
/// Hash of currently executed code.
pub code_hash: Option<H256>,
/// Receive address. Usually equal to code_address,
Expand All @@ -144,15 +144,15 @@ struct InterpreterParams {
/// Input data.
pub data: Option<Bytes>,
/// Type of call
pub call_type: CallType,
pub _call_type: CallType,
/// Param types encoding
pub params_type: ParamsType,
pub _params_type: ParamsType,
}

impl From<ActionParams> for InterpreterParams {
fn from(params: ActionParams) -> Self {
InterpreterParams {
code_address: params.code_address,
_code_address: params.code_address,
code_hash: params.code_hash,
address: params.address,
sender: params.sender,
Expand All @@ -161,8 +161,8 @@ impl From<ActionParams> for InterpreterParams {
gas_price: params.gas_price,
value: params.value,
data: params.data,
call_type: params.call_type,
params_type: params.params_type,
_call_type: params.call_type,
_params_type: params.params_type,
}
}
}
Expand Down Expand Up @@ -832,10 +832,7 @@ impl<Cost: CostType> Interpreter<Cost> {
true,
CallType::StaticCall,
),
_ => panic!(format!(
"Unexpected instruction {:?} in CALL branch.",
instruction
)),
_ => panic!("Unexpected instruction {:?} in CALL branch.", instruction),
};

// clear return data buffer before creating new call frame.
Expand Down