removed redundant FixedHash trait, fixes #4029 (#4866)

This commit is contained in:
Marek Kotewicz
2017-03-11 19:58:15 +01:00
committed by Nikolay Volf
parent 5d5e45ec0d
commit 3fe3353696
45 changed files with 155 additions and 173 deletions

View File

@@ -373,7 +373,7 @@ pub fn write_announcement(announcement: &Announcement) -> Vec<u8> {
mod tests {
use super::*;
use super::super::request_credits::FlowParams;
use util::{U256, H256, FixedHash};
use util::{U256, H256};
use rlp::{RlpStream, Stream ,UntrustedRlp, View};
#[test]

View File

@@ -267,7 +267,7 @@ impl TransactionProof {
#[cfg(test)]
mod tests {
use super::*;
use util::{MemoryDB, Address, H256, FixedHash};
use util::{MemoryDB, Address, H256};
use util::trie::{Trie, TrieMut, SecTrieDB, SecTrieDBMut};
use util::trie::recorder::Recorder;

View File

@@ -23,7 +23,7 @@ use self::stores::{AddressBook, DappsSettingsStore, NewDappsPolicy};
use std::fmt;
use std::collections::{HashMap, HashSet};
use std::time::{Instant, Duration};
use util::{FixedHash, RwLock};
use util::{RwLock};
use ethstore::{SimpleSecretStore, SecretStore, Error as SSError, EthStore, EthMultiStore,
random_string, SecretVaultRef, StoreAccountRef};
use ethstore::dir::MemoryDirectory;

View File

@@ -16,7 +16,7 @@
//! Evm input params.
use util::{Address, Bytes, Uint, U256};
use util::hash::{H256, FixedHash};
use util::hash::{H256};
use util::sha3::{Hashable, SHA3_EMPTY};
use ethjson;
use types::executed::CallType;

View File

@@ -21,7 +21,7 @@ use std::sync::Arc;
use std::collections::HashSet;
use rlp::{UntrustedRlp, RlpStream, Encodable, Decodable, Decoder, DecoderError, View, Stream};
use util::{Bytes, Address, Uint, FixedHash, Hashable, U256, H256, ordered_trie_root, SHA3_NULL_RLP};
use util::{Bytes, Address, Uint, Hashable, U256, H256, ordered_trie_root, SHA3_NULL_RLP};
use util::error::{Mismatch, OutOfBounds};
use basic_types::{LogBloom, Seal};
@@ -618,7 +618,6 @@ mod tests {
use state_db::StateDB;
use views::BlockView;
use util::Address;
use util::hash::FixedHash;
use std::sync::Arc;
use transaction::SignedTransaction;

View File

@@ -18,7 +18,7 @@ use crypto::sha2::Sha256 as Sha256Digest;
use crypto::ripemd160::Ripemd160 as Ripemd160Digest;
use crypto::digest::Digest;
use std::cmp::min;
use util::{U256, H256, Hashable, FixedHash, BytesRef};
use util::{U256, H256, Hashable, BytesRef};
use ethkey::{Signature, recover as ec_recover};
use ethjson;

View File

@@ -25,7 +25,7 @@ use time::precise_time_ns;
// util
use util::{Bytes, PerfTimer, Itertools, Mutex, RwLock, MutexGuard, Hashable};
use util::{journaldb, DBValue, TrieFactory, Trie};
use util::{U256, H256, Address, H2048, Uint, FixedHash};
use util::{U256, H256, Address, H2048, Uint};
use util::trie::TrieSpec;
use util::kvdb::*;

View File

@@ -5,7 +5,7 @@ use std::string::String;
use std::result::Result;
use std::fmt;
use {util, ethabi};
use util::{FixedHash, Uint};
use util::{Uint};
pub struct Registry {
contract: ethabi::Contract,
@@ -22,7 +22,7 @@ impl Registry {
}
}
fn as_string<T: fmt::Debug>(e: T) -> String { format!("{:?}", e) }
/// Auto-generated from: `{"constant":true,"inputs":[{"name":"_data","type":"address"}],"name":"canReverse","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"}`
#[allow(dead_code)]
pub fn can_reverse(&self, _data: &util::Address) -> Result<bool, String>
@@ -45,7 +45,7 @@ impl Registry {
vec![ethabi::Token::Address(_new.clone().0)]
).map_err(Self::as_string)?;
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
Ok(())
}
@@ -318,7 +318,7 @@ impl Registry {
vec![]
).map_err(Self::as_string)?;
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
Ok(())
}

View File

@@ -17,7 +17,7 @@
//! Tendermint specific parameters.
use ethjson;
use util::{U256, Uint, Address, FixedHash};
use util::{U256, Uint, Address};
use time::Duration;
use super::super::transition::Timeouts;
use super::Step;

View File

@@ -92,7 +92,7 @@ mod provider {
use std::result::Result;
use std::fmt;
use {util, ethabi};
use util::{FixedHash, Uint};
use util::{Uint};
pub struct Contract {
contract: ethabi::Contract,
@@ -108,7 +108,7 @@ mod provider {
}
}
fn as_string<T: fmt::Debug>(e: T) -> String { format!("{:?}", e) }
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"validator","type":"address"}],"name":"reportMalicious","outputs":[],"payable":false,"type":"function"}`
#[allow(dead_code)]
pub fn report_malicious(&self, validator: &util::Address) -> Result<(), String> {
@@ -117,7 +117,7 @@ mod provider {
vec![ethabi::Token::Address(validator.clone().0)]
).map_err(Self::as_string)?;
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
Ok(())
}
@@ -129,7 +129,7 @@ mod provider {
vec![ethabi::Token::Address(validator.clone().0)]
).map_err(Self::as_string)?;
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
Ok(())
}
}
@@ -159,7 +159,7 @@ mod tests {
assert!(vc.contains(&last_hash, &Address::from_str("7d577a597b2742b498cb5cf0c26cdcd726d39e6e").unwrap()));
assert!(vc.contains(&last_hash, &Address::from_str("82a978b3f5962a5b0957d9ee9eef472ee55b42f1").unwrap()));
}
#[test]
fn reports_validators() {
let tap = Arc::new(AccountProvider::transient_provider());
@@ -173,12 +173,12 @@ mod tests {
client.miner().set_engine_signer(v1, "".into()).unwrap();
let mut header = Header::default();
let seal = vec![encode(&5u8).to_vec(), encode(&(&H520::default() as &[u8])).to_vec()];
let seal = vec![encode(&5u8).to_vec(), encode(&(&H520::default() as &[u8])).to_vec()];
header.set_seal(seal);
header.set_author(v1);
header.set_number(2);
header.set_parent_hash(client.chain_info().best_block_hash);
// `reportBenign` when the designated proposer releases block from the future (bad clock).
assert!(client.engine().verify_block_family(&header, &header, None).is_err());
// Seal a block.

View File

@@ -509,7 +509,7 @@ mod tests {
use std::sync::Arc;
use ethkey::{Generator, Random};
use super::*;
use util::{H256, U256, U512, Address, Uint, FixedHash, FromHex, FromStr};
use util::{H256, U256, U512, Address, Uint, FromHex, FromStr};
use util::bytes::BytesRef;
use action_params::{ActionParams, ActionValue};
use env_info::EnvInfo;

View File

@@ -20,7 +20,7 @@
use std::collections::HashMap;
use util::Bytes;
use util::{Address, FixedHash, H256};
use util::{Address, H256};
use util::kvdb::Database;
use util::migration::{Batch, Config, Error, Migration, SimpleMigration, Progress};
use util::sha3::Hashable;

View File

@@ -24,7 +24,7 @@ use views::HeaderView;
use bloom_journal::Bloom;
use util::migration::{Error, Migration, Progress, Batch, Config};
use util::journaldb;
use util::{H256, FixedHash, Trie};
use util::{H256, Trie};
use util::{Database, DBTransaction};
/// Account bloom upgrade routine. If bloom already present, does nothing.

View File

@@ -62,12 +62,12 @@ mod provider {
use std::result::Result;
use std::fmt;
use {util, ethabi};
use util::{FixedHash, Uint};
use util::{Uint};
pub struct Contract {
contract: ethabi::Contract,
address: util::Address,
}
impl Contract {
pub fn new(address: util::Address) -> Self
@@ -75,11 +75,11 @@ mod provider {
Contract {
contract: ethabi::Contract::new(ethabi::Interface::load(b"[{\"constant\":false,\"inputs\":[{\"name\":\"_new\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"certify\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"},{\"name\":\"_field\",\"type\":\"string\"}],\"name\":\"getAddress\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"delegate\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"},{\"name\":\"_field\",\"type\":\"string\"}],\"name\":\"getUint\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_new\",\"type\":\"address\"}],\"name\":\"setDelegate\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"certified\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_who\",\"type\":\"address\"},{\"name\":\"_field\",\"type\":\"string\"}],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"}]").expect("JSON is autogenerated; qed")),
address: address,
}
}
fn as_string<T: fmt::Debug>(e: T) -> String { format!("{:?}", e) }
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_new","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"}`
#[allow(dead_code)]
pub fn set_owner<F>(&self, do_call: &F, _new: &util::Address) -> Result<(), String>
@@ -89,7 +89,7 @@ mod provider {
vec![ethabi::Token::Address(_new.clone().0)]
).map_err(Self::as_string)?;
call.decode_output((do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
Ok(())
}
@@ -102,7 +102,7 @@ mod provider {
vec![ethabi::Token::Address(_who.clone().0)]
).map_err(Self::as_string)?;
call.decode_output((do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
Ok(())
}
@@ -128,7 +128,7 @@ mod provider {
vec![ethabi::Token::Address(_who.clone().0)]
).map_err(Self::as_string)?;
call.decode_output((do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
Ok(())
}
@@ -180,7 +180,7 @@ mod provider {
vec![ethabi::Token::Address(_new.clone().0)]
).map_err(Self::as_string)?;
call.decode_output((do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
Ok(())
}

View File

@@ -25,7 +25,7 @@ use std::sync::{Arc, Weak};
use std::net::{SocketAddr, AddrParseError};
use std::fmt;
use util::{H256, U256, FixedHash, H64, clean_0x};
use util::{H256, U256, H64, clean_0x};
use ethereum::ethash::Ethash;
use ethash::SeedHashCompute;
use util::Mutex;

View File

@@ -20,7 +20,7 @@ use account_db::{AccountDB, AccountDBMut};
use basic_account::BasicAccount;
use snapshot::Error;
use util::{U256, FixedHash, H256, Bytes, HashDB, SHA3_EMPTY, SHA3_NULL_RLP};
use util::{U256, H256, Bytes, HashDB, SHA3_EMPTY, SHA3_NULL_RLP};
use util::trie::{TrieDB, Trie};
use rlp::{RlpStream, Stream, UntrustedRlp, View};
@@ -179,7 +179,7 @@ mod tests {
use snapshot::tests::helpers::fill_storage;
use util::sha3::{SHA3_EMPTY, SHA3_NULL_RLP};
use util::{Address, FixedHash, H256, HashDB, DBValue};
use util::{Address, H256, HashDB, DBValue};
use rlp::{UntrustedRlp, View};
use std::collections::HashSet;

View File

@@ -134,7 +134,7 @@ mod tests {
use super::AbridgedBlock;
use types::transaction::{Action, Transaction};
use util::{Address, H256, FixedHash, U256, Bytes};
use util::{Address, H256, U256, Bytes};
fn encode_block(b: &Block) -> Bytes {
b.rlp_bytes(::basic_types::Seal::With)

View File

@@ -32,7 +32,7 @@ use views::BlockView;
use util::{Bytes, Hashable, HashDB, DBValue, snappy, U256, Uint};
use util::Mutex;
use util::hash::{FixedHash, H256};
use util::hash::{H256};
use util::journaldb::{self, Algorithm, JournalDB};
use util::kvdb::Database;
use util::trie::{TrieDB, TrieDBMut, Trie, TrieMut};

View File

@@ -22,7 +22,7 @@ use account_db::AccountDBMut;
use rand::Rng;
use util::DBValue;
use util::hash::{FixedHash, H256};
use util::hash::H256;
use util::hashdb::HashDB;
use util::trie::{Alphabet, StandardMap, SecTrieDBMut, TrieMut, ValueMode};
use util::trie::{TrieDB, TrieDBMut, Trie};

View File

@@ -96,7 +96,7 @@ fn snap_and_restore() {
fn get_code_from_prev_chunk() {
use std::collections::HashSet;
use rlp::{RlpStream, Stream};
use util::{HashDB, H256, FixedHash, U256, Hashable};
use util::{HashDB, H256, U256, Hashable};
use account_db::{AccountDBMut, AccountDB};

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use util::{Address, H256, Uint, U256, FixedHash};
use util::{Address, H256, Uint, U256};
use util::sha3::SHA3_NULL_RLP;
use ethjson;
use super::seal::Seal;

View File

@@ -940,7 +940,7 @@ mod tests {
use rustc_serialize::hex::FromHex;
use super::*;
use ethkey::Secret;
use util::{U256, H256, FixedHash, Address, Hashable};
use util::{U256, H256, Address, Hashable};
use tests::helpers::*;
use devtools::*;
use env_info::EnvInfo;

View File

@@ -454,7 +454,7 @@ impl state::Backend for StateDB {
#[cfg(test)]
mod tests {
use util::{U256, H256, FixedHash, Address, DBTransaction};
use util::{U256, H256, Address, DBTransaction};
use tests::helpers::*;
use state::{Account, Backend};
use util::log::init_log;

View File

@@ -113,7 +113,6 @@ impl Filter {
#[cfg(test)]
mod tests {
use util::FixedHash;
use filter::Filter;
use client::BlockId;
use log_entry::LogEntry;