From c1a46de55e10906d1b95997612d1316f1fee3600 Mon Sep 17 00:00:00 2001 From: niklasad1 Date: Sat, 19 Jan 2019 23:10:14 +0100 Subject: [PATCH] fix(cleanup) --- rpc/src/v1/helpers/dispatch.rs | 1 - rpc/src/v1/helpers/subscribers.rs | 2 +- rpc/src/v1/helpers/work.rs | 3 --- rpc/src/v1/impls/eth.rs | 16 ++++------------ 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/rpc/src/v1/helpers/dispatch.rs b/rpc/src/v1/helpers/dispatch.rs index d2ab235ad57..631ac3a0210 100644 --- a/rpc/src/v1/helpers/dispatch.rs +++ b/rpc/src/v1/helpers/dispatch.rs @@ -699,7 +699,6 @@ pub fn execute( let res = signature(&accounts, address, data, pass) .map(|result| result .map(|rsv| H520(rsv.into_electrum())) - // .map(RpcH520::from) .map(ConfirmationResponse::Signature) ); Box::new(future::done(res)) diff --git a/rpc/src/v1/helpers/subscribers.rs b/rpc/src/v1/helpers/subscribers.rs index a6cf2cd9336..76dd998ae42 100644 --- a/rpc/src/v1/helpers/subscribers.rs +++ b/rpc/src/v1/helpers/subscribers.rs @@ -23,7 +23,6 @@ use ethereum_types::H64; use jsonrpc_macros::pubsub::{Subscriber, Sink, SubscriptionId}; use rand::{Rng, StdRng}; -// FIXME: This type is needless use `serde_json::to_string` instead #[derive(Debug, Clone, Hash, Eq, PartialEq)] pub struct Id(H64); impl str::FromStr for Id { @@ -38,6 +37,7 @@ impl str::FromStr for Id { } } impl Id { + // FIXME: [niklasad1] replace `format` with `serde_json::to_string_pretty` pub fn as_string(&self) -> String { format!("{:?}", self.0) } diff --git a/rpc/src/v1/helpers/work.rs b/rpc/src/v1/helpers/work.rs index c4278db172b..661b4cab8b8 100644 --- a/rpc/src/v1/helpers/work.rs +++ b/rpc/src/v1/helpers/work.rs @@ -27,9 +27,6 @@ use v1::helpers::errors; // Submit a POW work and return the block's hash pub fn submit_work_detail(client: &Arc, miner: &Arc, nonce: H64, pow_hash: H256, mix_hash: H256) -> Result { // TODO [ToDr] Should disallow submissions in case of PoA? - let nonce: H64 = nonce.into(); - let pow_hash: H256 = pow_hash.into(); - let mix_hash: H256 = mix_hash.into(); trace!(target: "miner", "submit_work_detail: Decoded: nonce={}, pow_hash={}, mix_hash={}", nonce, pow_hash, mix_hash); let seal = vec![rlp::encode(&mix_hash), rlp::encode(&nonce)]; let import = miner.submit_seal(pow_hash, seal) diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index ce77078f944..54777d51aab 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -568,8 +568,6 @@ impl Eth for EthClient< } fn balance(&self, address: H160, num: Trailing) -> BoxFuture { - let address = address.into(); - let num = num.unwrap_or_default(); try_bf!(check_known(&*self.client, num.clone())); @@ -584,8 +582,7 @@ impl Eth for EthClient< fn proof(&self, address: H160, values: Vec, num: Trailing) -> BoxFuture { try_bf!(errors::require_experimental(self.options.allow_experimental_rpcs, "1186")); - let a: H160 = address.clone().into(); - let key1 = keccak(a); + let key1 = keccak(address); let num = num.unwrap_or_default(); let id = match num { @@ -624,10 +621,8 @@ impl Eth for EthClient< Box::new(future::done(res)) } - fn storage_at(&self, address: H160, pos: U256, num: Trailing) -> BoxFuture { - let address: Address = H160::into(address); - let position: U256 = U256::into(pos); - + fn storage_at(&self, address: H160, position: U256, num: Trailing) -> BoxFuture { + let address: Address = address.into(); let num = num.unwrap_or_default(); try_bf!(check_known(&*self.client, num.clone())); @@ -640,7 +635,7 @@ impl Eth for EthClient< } fn transaction_count(&self, address: H160, num: Trailing) -> BoxFuture { - let address: Address = H160::into(address); + let address: Address = address.into(); let res = match num.unwrap_or_default() { BlockNumber::Pending if self.options.pending_nonce_from_queue => { @@ -749,7 +744,6 @@ impl Eth for EthClient< } fn transaction_by_hash(&self, hash: H256) -> BoxFuture> { - let hash: H256 = hash.into(); let tx = try_bf!(self.transaction(PendingTransactionId::Hash(hash))).or_else(|| { self.miner.transaction(&hash) .map(|t| Transaction::from_pending(t.pending().clone())) @@ -781,8 +775,6 @@ impl Eth for EthClient< } fn transaction_receipt(&self, hash: H256) -> BoxFuture> { - let hash: H256 = hash.into(); - if self.options.allow_pending_receipt_query { let best_block = self.client.chain_info().best_block_number; if let Some(receipt) = self.miner.pending_receipt(best_block, &hash) {