Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
removed redundant FixedHash trait, fixes #4029 (#4866)
Browse files Browse the repository at this point in the history
  • Loading branch information
debris authored and NikVolf committed Mar 11, 2017
1 parent 5d5e45e commit 3fe3353
Show file tree
Hide file tree
Showing 45 changed files with 155 additions and 173 deletions.
2 changes: 1 addition & 1 deletion ethcore/light/src/net/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion ethcore/light/src/on_demand/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/account_provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/action_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions ethcore/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
8 changes: 4 additions & 4 deletions ethcore/src/client/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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>
Expand All @@ -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(())
}

Expand Down Expand Up @@ -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(())
}

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/engines/tendermint/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions ethcore/src/engines/validator_set/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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> {
Expand All @@ -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(())
}

Expand All @@ -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(())
}
}
Expand Down Expand Up @@ -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());
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/executive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/migrations/state/v7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/migrations/v10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions ethcore/src/miner/service_transaction_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,24 @@ 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
{
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>
Expand All @@ -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(())
}

Expand All @@ -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(())
}

Expand All @@ -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(())
}

Expand Down Expand Up @@ -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(())
}

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/miner/stratum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/snapshot/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/snapshot/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/snapshot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/snapshot/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/snapshot/tests/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/spec/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/state_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion ethcore/src/types/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ impl Filter {

#[cfg(test)]
mod tests {
use util::FixedHash;
use filter::Filter;
use client::BlockId;
use log_entry::LogEntry;
Expand Down
2 changes: 1 addition & 1 deletion ethcrypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ pub mod ecies {
use rcrypto::sha2::Sha256;
use rcrypto::hmac::Hmac;
use rcrypto::mac::Mac;
use bigint::hash::{FixedHash, H128};
use bigint::hash::H128;
use ethkey::{Random, Generator, Public, Secret};
use {Error, ecdh, aes, Keccak256};

Expand Down
4 changes: 2 additions & 2 deletions ethkey/src/extended.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use secret::Secret;
use Public;
use bigint::hash::{H256, FixedHash};
use bigint::hash::H256;
pub use self::derivation::Error as DerivationError;

/// Represents label that can be stored as a part of key derivation
Expand Down Expand Up @@ -212,7 +212,7 @@ mod derivation {
use rcrypto::hmac::Hmac;
use rcrypto::mac::Mac;
use rcrypto::sha2::Sha512;
use bigint::hash::{H512, H256, FixedHash};
use bigint::hash::{H512, H256};
use bigint::prelude::{U256, U512, Uint};
use secp256k1;
use secp256k1::key::{SecretKey, PublicKey};
Expand Down
Loading

0 comments on commit 3fe3353

Please sign in to comment.