parent
5d5e45ec0d
commit
3fe3353696
@ -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]
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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::*;
|
||||
|
||||
|
@ -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(())
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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(())
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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};
|
||||
|
@ -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};
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -113,7 +113,6 @@ impl Filter {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use util::FixedHash;
|
||||
use filter::Filter;
|
||||
use client::BlockId;
|
||||
use log_entry::LogEntry;
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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
|
||||
@ -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};
|
||||
|
@ -22,7 +22,7 @@ use std::hash::{Hash, Hasher};
|
||||
use secp256k1::{Message as SecpMessage, RecoverableSignature, RecoveryId, Error as SecpError};
|
||||
use secp256k1::key::{SecretKey, PublicKey};
|
||||
use rustc_serialize::hex::{ToHex, FromHex};
|
||||
use bigint::hash::{H520, H256, FixedHash};
|
||||
use bigint::hash::{H520, H256};
|
||||
use {Secret, Public, SECP256K1, Error, Message, public_to_address, Address};
|
||||
|
||||
#[repr(C)]
|
||||
|
@ -67,7 +67,7 @@ impl KeyDirectory for MemoryDirectory {
|
||||
fn unique_repr(&self) -> Result<u64, Error> {
|
||||
let mut val = 0u64;
|
||||
let accounts = self.accounts.read();
|
||||
for acc in accounts.keys() { val = val ^ ::util::FixedHash::low_u64(acc) }
|
||||
for acc in accounts.keys() { val = val ^ acc.low_u64() }
|
||||
Ok(val)
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::collections::HashMap;
|
||||
use util::{U256, H256, Address, Bytes, FixedHash, trie};
|
||||
use util::{U256, H256, Address, Bytes, trie};
|
||||
use ethcore::client::EnvInfo;
|
||||
use ethcore::evm::{self, Ext, ContractCreateResult, MessageCallResult, Schedule, CallType};
|
||||
|
||||
|
@ -24,7 +24,7 @@ use std::str::FromStr;
|
||||
use std::time::Duration;
|
||||
use super::WalletInfo;
|
||||
use ethkey::{Address, Signature};
|
||||
use ethcore_bigint::hash::{H256, FixedHash};
|
||||
use ethcore_bigint::hash::H256;
|
||||
|
||||
const LEDGER_VID: u16 = 0x2c97;
|
||||
const LEDGER_PIDS: [u16; 2] = [0x0000, 0x0001]; // Nano S and Blue
|
||||
@ -260,12 +260,12 @@ impl Manager {
|
||||
{
|
||||
let mut chunk = &mut hid_chunk[HID_PREFIX_ZERO..];
|
||||
&mut chunk[0..5].copy_from_slice(&[0x01, 0x01, APDU_TAG, (chunk_index >> 8) as u8, (chunk_index & 0xff) as u8 ]);
|
||||
|
||||
|
||||
if chunk_index == 0 {
|
||||
let data_len = data.len() + 5;
|
||||
&mut chunk[5..12].copy_from_slice(&[ (data_len >> 8) as u8, (data_len & 0xff) as u8, APDU_CLA, command, p1, p2, data.len() as u8 ]);
|
||||
}
|
||||
|
||||
|
||||
&mut chunk[chunk_size..chunk_size + size].copy_from_slice(&data[offset..offset + size]);
|
||||
offset += size;
|
||||
chunk_size += size;
|
||||
|
@ -19,7 +19,7 @@
|
||||
use std::fmt;
|
||||
use std::str::FromStr;
|
||||
use semver::{Version};
|
||||
use util::{H160, FixedHash};
|
||||
use util::H160;
|
||||
use util::misc::raw_package_info;
|
||||
use release_track::ReleaseTrack;
|
||||
|
||||
|
@ -23,7 +23,7 @@ use std::sync::{Arc, Weak};
|
||||
use futures::{self, future, BoxFuture, Future};
|
||||
use rlp::{self, UntrustedRlp, View};
|
||||
use time::get_time;
|
||||
use util::{H160, H256, Address, FixedHash, U256, H64, Uint};
|
||||
use util::{H160, H256, Address, U256, H64, Uint};
|
||||
use util::sha3::Hashable;
|
||||
use util::Mutex;
|
||||
|
||||
|
@ -38,7 +38,7 @@ use ethcore::transaction::{Action, SignedTransaction, Transaction as EthTransact
|
||||
use ethsync::LightSync;
|
||||
use rlp::{UntrustedRlp, View};
|
||||
use util::sha3::{SHA3_NULL_RLP, SHA3_EMPTY_LIST_RLP};
|
||||
use util::{RwLock, Mutex, FixedHash, Uint, U256};
|
||||
use util::{RwLock, Mutex, Uint, U256};
|
||||
|
||||
use futures::{future, Future, BoxFuture, IntoFuture};
|
||||
use futures::sync::oneshot;
|
||||
|
@ -17,7 +17,7 @@
|
||||
//! Test implementation of miner service.
|
||||
|
||||
use std::collections::hash_map::Entry;
|
||||
use util::{Address, H256, Bytes, U256, FixedHash, Uint};
|
||||
use util::{Address, H256, Bytes, U256, Uint};
|
||||
use util::standard::*;
|
||||
use ethcore::error::{Error, CallError};
|
||||
use ethcore::client::{MiningBlockChainClient, Executed, CallAnalytics};
|
||||
|
@ -22,7 +22,7 @@ use rustc_serialize::hex::{FromHex, ToHex};
|
||||
use time::get_time;
|
||||
use rlp;
|
||||
|
||||
use util::{Uint, U256, Address, H256, FixedHash, Mutex};
|
||||
use util::{Uint, U256, Address, H256, Mutex};
|
||||
use ethkey::Secret;
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use ethcore::client::{TestBlockChainClient, EachBlockWith, Executed, TransactionId};
|
||||
|
@ -28,7 +28,7 @@ use v1::types::ConfirmationResponse;
|
||||
use v1::tests::helpers::TestMinerService;
|
||||
use v1::tests::mocked::parity;
|
||||
|
||||
use util::{Address, FixedHash, Uint, U256, ToPretty};
|
||||
use util::{Address, Uint, U256, ToPretty};
|
||||
use ethkey::Secret;
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use ethcore::client::TestBlockChainClient;
|
||||
|
@ -32,7 +32,7 @@ use std::string::String;
|
||||
use std::result::Result;
|
||||
use std::fmt;
|
||||
use {util, ethabi};
|
||||
use util::{FixedHash, Uint};
|
||||
use util::Uint;
|
||||
|
||||
${convertContract(name, json, prefs)}
|
||||
`;
|
||||
|
@ -2175,7 +2175,7 @@ mod tests {
|
||||
use tests::snapshot::TestSnapshotService;
|
||||
use util::{Uint, U256, Address, RwLock};
|
||||
use util::sha3::Hashable;
|
||||
use util::hash::{H256, FixedHash};
|
||||
use util::hash::H256;
|
||||
use util::bytes::Bytes;
|
||||
use rlp::{Rlp, RlpStream, UntrustedRlp, View, Stream};
|
||||
use super::*;
|
||||
|
@ -4,7 +4,7 @@ use std::string::String;
|
||||
use std::result::Result;
|
||||
use std::fmt;
|
||||
use ethabi;
|
||||
use util::{self, FixedHash, Uint};
|
||||
use util::{self, Uint};
|
||||
|
||||
pub struct Operations {
|
||||
contract: ethabi::Contract,
|
||||
@ -20,340 +20,340 @@ impl Operations {
|
||||
}
|
||||
}
|
||||
fn as_string<T: fmt::Debug>(e: T) -> String { format!("{:?}", e) }
|
||||
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_newOwner","type":"address"}],"name":"resetClientOwner","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn reset_client_owner(&self, _client: &str, _new_owner: &util::Address) -> Result<(), String> {
|
||||
pub fn reset_client_owner(&self, _client: &str, _new_owner: &util::Address) -> Result<(), String> {
|
||||
let call = self.contract.function("resetClientOwner".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::Address(_new_owner.clone().0)]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_release","type":"bytes32"}],"name":"isLatest","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn is_latest(&self, _client: &str, _release: &util::H256) -> Result<bool, String> {
|
||||
pub fn is_latest(&self, _client: &str, _release: &util::H256) -> Result<bool, String> {
|
||||
let call = self.contract.function("isLatest".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_txid","type":"bytes32"}],"name":"rejectTransaction","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn reject_transaction(&self, _txid: &util::H256) -> Result<(), String> {
|
||||
pub fn reject_transaction(&self, _txid: &util::H256) -> Result<(), String> {
|
||||
let call = self.contract.function("rejectTransaction".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_txid.as_ref().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn set_owner(&self, _new_owner: &util::Address) -> Result<(), String> {
|
||||
pub fn set_owner(&self, _new_owner: &util::Address) -> Result<(), String> {
|
||||
let call = self.contract.function("setOwner".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::Address(_new_owner.clone().0)]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_number","type":"uint32"},{"name":"_name","type":"bytes32"},{"name":"_hard","type":"bool"},{"name":"_spec","type":"bytes32"}],"name":"proposeFork","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn propose_fork(&self, _number: u32, _name: &util::H256, _hard: bool, _spec: &util::H256) -> Result<(), String> {
|
||||
pub fn propose_fork(&self, _number: u32, _name: &util::H256, _hard: bool, _spec: &util::H256) -> Result<(), String> {
|
||||
let call = self.contract.function("proposeFork".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_number as u64).to_big_endian(&mut r); r }), ethabi::Token::FixedBytes(_name.as_ref().to_owned()), ethabi::Token::Bool(_hard), ethabi::Token::FixedBytes(_spec.as_ref().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_client","type":"bytes32"}],"name":"removeClient","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn remove_client(&self, _client: &str) -> Result<(), String> {
|
||||
pub fn remove_client(&self, _client: &str) -> Result<(), String> {
|
||||
let call = self.contract.function("removeClient".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_release","type":"bytes32"}],"name":"release","outputs":[{"name":"o_forkBlock","type":"uint32"},{"name":"o_track","type":"uint8"},{"name":"o_semver","type":"uint24"},{"name":"o_critical","type":"bool"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn release(&self, _client: &str, _release: &util::H256) -> Result<(u32, u8, u32, bool), String> {
|
||||
pub fn release(&self, _client: &str, _release: &util::H256) -> Result<(u32, u8, u32, bool), String> {
|
||||
let call = self.contract.function("release".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u8 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u8 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_checksum","type":"bytes32"}],"name":"build","outputs":[{"name":"o_release","type":"bytes32"},{"name":"o_platform","type":"bytes32"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn build(&self, _client: &str, _checksum: &util::H256) -> Result<(util::H256, util::H256), String> {
|
||||
pub fn build(&self, _client: &str, _checksum: &util::H256) -> Result<(util::H256, util::H256), String> {
|
||||
let call = self.contract.function("build".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_checksum.as_ref().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[],"name":"rejectFork","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn reject_fork(&self) -> Result<(), String> {
|
||||
pub fn reject_fork(&self) -> Result<(), String> {
|
||||
let call = self.contract.function("rejectFork".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"client","outputs":[{"name":"owner","type":"address"},{"name":"required","type":"bool"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn client(&self, _1: &util::H256) -> Result<(util::Address, bool), String> {
|
||||
pub fn client(&self, _1: &util::H256) -> Result<(util::Address, bool), String> {
|
||||
let call = self.contract.function("client".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_1.as_ref().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_address().ok_or("Invalid type returned")?; util::Address::from(r) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_address().ok_or("Invalid type returned")?; util::Address::from(r) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"setClientOwner","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn set_client_owner(&self, _new_owner: &util::Address) -> Result<(), String> {
|
||||
pub fn set_client_owner(&self, _new_owner: &util::Address) -> Result<(), String> {
|
||||
let call = self.contract.function("setClientOwner".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::Address(_new_owner.clone().0)]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[{"name":"","type":"uint32"}],"name":"fork","outputs":[{"name":"name","type":"bytes32"},{"name":"spec","type":"bytes32"},{"name":"hard","type":"bool"},{"name":"ratified","type":"bool"},{"name":"requiredCount","type":"uint256"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn fork(&self, _1: u32) -> Result<(util::H256, util::H256, bool, bool, util::U256), String> {
|
||||
pub fn fork(&self, _1: u32) -> Result<(util::H256, util::H256, bool, bool, util::U256), String> {
|
||||
let call = self.contract.function("fork".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_1 as u64).to_big_endian(&mut r); r })]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_release","type":"bytes32"},{"name":"_platform","type":"bytes32"},{"name":"_checksum","type":"bytes32"}],"name":"addChecksum","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn add_checksum(&self, _release: &util::H256, _platform: &str, _checksum: &util::H256) -> Result<(), String> {
|
||||
pub fn add_checksum(&self, _release: &util::H256, _platform: &str, _checksum: &util::H256) -> Result<(), String> {
|
||||
let call = self.contract.function("addChecksum".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_release.as_ref().to_owned()), ethabi::Token::FixedBytes(_platform.as_bytes().to_owned()), ethabi::Token::FixedBytes(_checksum.as_ref().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_txid","type":"bytes32"}],"name":"confirmTransaction","outputs":[{"name":"txSuccess","type":"uint256"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn confirm_transaction(&self, _txid: &util::H256) -> Result<util::U256, String> {
|
||||
pub fn confirm_transaction(&self, _txid: &util::H256) -> Result<util::U256, String> {
|
||||
let call = self.contract.function("confirmTransaction".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_txid.as_ref().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"proxy","outputs":[{"name":"requiredCount","type":"uint256"},{"name":"to","type":"address"},{"name":"data","type":"bytes"},{"name":"value","type":"uint256"},{"name":"gas","type":"uint256"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn proxy(&self, _1: &util::H256) -> Result<(util::U256, util::Address, Vec<u8>, util::U256, util::U256), String> {
|
||||
pub fn proxy(&self, _1: &util::H256) -> Result<(util::U256, util::Address, Vec<u8>, util::U256, util::U256), String> {
|
||||
let call = self.contract.function("proxy".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_1.as_ref().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_address().ok_or("Invalid type returned")?; util::Address::from(r) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bytes().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_address().ok_or("Invalid type returned")?; util::Address::from(r) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bytes().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_owner","type":"address"}],"name":"addClient","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn add_client(&self, _client: &str, _owner: &util::Address) -> Result<(), String> {
|
||||
pub fn add_client(&self, _client: &str, _owner: &util::Address) -> Result<(), String> {
|
||||
let call = self.contract.function("addClient".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::Address(_owner.clone().0)]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"clientOwner","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn client_owner(&self, _1: &util::Address) -> Result<util::H256, String> {
|
||||
pub fn client_owner(&self, _1: &util::Address) -> Result<util::H256, String> {
|
||||
let call = self.contract.function("clientOwner".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::Address(_1.clone().0)]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_txid","type":"bytes32"},{"name":"_to","type":"address"},{"name":"_data","type":"bytes"},{"name":"_value","type":"uint256"},{"name":"_gas","type":"uint256"}],"name":"proposeTransaction","outputs":[{"name":"txSuccess","type":"uint256"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn propose_transaction(&self, _txid: &util::H256, _to: &util::Address, _data: &[u8], _value: util::U256, _gas: util::U256) -> Result<util::U256, String> {
|
||||
pub fn propose_transaction(&self, _txid: &util::H256, _to: &util::Address, _data: &[u8], _value: util::U256, _gas: util::U256) -> Result<util::U256, String> {
|
||||
let call = self.contract.function("proposeTransaction".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_txid.as_ref().to_owned()), ethabi::Token::Address(_to.clone().0), ethabi::Token::Bytes(_data.to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; _value.to_big_endian(&mut r); r }), ethabi::Token::Uint({ let mut r = [0u8; 32]; _gas.to_big_endian(&mut r); r })]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()) }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[],"name":"grandOwner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn grand_owner(&self) -> Result<util::Address, String> {
|
||||
pub fn grand_owner(&self) -> Result<util::Address, String> {
|
||||
let call = self.contract.function("grandOwner".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_address().ok_or("Invalid type returned")?; util::Address::from(r) }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_address().ok_or("Invalid type returned")?; util::Address::from(r) }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_release","type":"bytes32"},{"name":"_forkBlock","type":"uint32"},{"name":"_track","type":"uint8"},{"name":"_semver","type":"uint24"},{"name":"_critical","type":"bool"}],"name":"addRelease","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn add_release(&self, _release: &util::H256, _fork_block: u32, _track: u8, _semver: u32, _critical: bool) -> Result<(), String> {
|
||||
pub fn add_release(&self, _release: &util::H256, _fork_block: u32, _track: u8, _semver: u32, _critical: bool) -> Result<(), String> {
|
||||
let call = self.contract.function("addRelease".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_release.as_ref().to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_fork_block as u64).to_big_endian(&mut r); r }), ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_track as u64).to_big_endian(&mut r); r }), ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_semver as u64).to_big_endian(&mut r); r }), ethabi::Token::Bool(_critical)]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[],"name":"acceptFork","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn accept_fork(&self) -> Result<(), String> {
|
||||
pub fn accept_fork(&self) -> Result<(), String> {
|
||||
let call = self.contract.function("acceptFork".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[],"name":"clientsRequired","outputs":[{"name":"","type":"uint32"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn clients_required(&self) -> Result<u32, String> {
|
||||
pub fn clients_required(&self) -> Result<u32, String> {
|
||||
let call = self.contract.function("clientsRequired".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_release","type":"bytes32"}],"name":"track","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn track(&self, _client: &str, _release: &util::H256) -> Result<u8, String> {
|
||||
pub fn track(&self, _client: &str, _release: &util::H256) -> Result<u8, String> {
|
||||
let call = self.contract.function("track".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u8 }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u8 }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":false,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_r","type":"bool"}],"name":"setClientRequired","outputs":[],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn set_client_required(&self, _client: &str, _r: bool) -> Result<(), String> {
|
||||
pub fn set_client_required(&self, _client: &str, _r: bool) -> Result<(), String> {
|
||||
let call = self.contract.function("setClientRequired".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::Bool(_r)]
|
||||
).map_err(Self::as_string)?;
|
||||
call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[],"name":"latestFork","outputs":[{"name":"","type":"uint32"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn latest_fork(&self) -> Result<u32, String> {
|
||||
pub fn latest_fork(&self) -> Result<u32, String> {
|
||||
let call = self.contract.function("latestFork".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_track","type":"uint8"}],"name":"latestInTrack","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn latest_in_track(&self, _client: &str, _track: u8) -> Result<util::H256, String> {
|
||||
pub fn latest_in_track(&self, _client: &str, _track: u8) -> Result<util::H256, String> {
|
||||
let call = self.contract.function("latestInTrack".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; util::U256::from(_track as u64).to_big_endian(&mut r); r })]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[{"name":"_client","type":"bytes32"},{"name":"_release","type":"bytes32"},{"name":"_platform","type":"bytes32"}],"name":"checksum","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn checksum(&self, _client: &str, _release: &util::H256, _platform: &str) -> Result<util::H256, String> {
|
||||
pub fn checksum(&self, _client: &str, _release: &util::H256, _platform: &str) -> Result<util::H256, String> {
|
||||
let call = self.contract.function("checksum".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned()), ethabi::Token::FixedBytes(_platform.as_bytes().to_owned())]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; util::H256::from_slice(r.as_ref()) }))
|
||||
}
|
||||
|
||||
/// Auto-generated from: `{"constant":true,"inputs":[],"name":"proposedFork","outputs":[{"name":"","type":"uint32"}],"payable":false,"type":"function"}`
|
||||
#[allow(dead_code)]
|
||||
pub fn proposed_fork(&self) -> Result<u32, String> {
|
||||
pub fn proposed_fork(&self) -> Result<u32, String> {
|
||||
let call = self.contract.function("proposedFork".into()).map_err(Self::as_string)?;
|
||||
let data = call.encode_call(
|
||||
vec![]
|
||||
).map_err(Self::as_string)?;
|
||||
let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?;
|
||||
let mut result = output.into_iter().rev().collect::<Vec<_>>();
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }))
|
||||
Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; util::U256::from(r.as_ref()).as_u64() as u32 }))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ use target_info::Target;
|
||||
use util::misc;
|
||||
use ipc_common_types::{VersionInfo, ReleaseTrack};
|
||||
use util::path::restrict_permissions_owner;
|
||||
use util::{Address, H160, H256, FixedHash, Mutex, Bytes};
|
||||
use util::{Address, H160, H256, Mutex, Bytes};
|
||||
use ethsync::{SyncProvider};
|
||||
use ethcore::client::{BlockId, BlockChainClient, ChainNotify};
|
||||
use hash_fetch::{self as fetch, HashFetch};
|
||||
|
@ -28,32 +28,6 @@ use rustc_serialize::hex::{FromHex, FromHexError};
|
||||
use bigint::{Uint, U256};
|
||||
use libc::{c_void, memcmp};
|
||||
|
||||
/// Trait for a fixed-size byte array to be used as the output of hash functions.
|
||||
pub trait FixedHash: Sized {
|
||||
/// Create a new, zero-initialised, instance.
|
||||
fn new() -> Self;
|
||||
/// Synonym for `new()`. Prefer to new as it's more readable.
|
||||
fn zero() -> Self;
|
||||
/// Create a new, cryptographically random, instance.
|
||||
fn random() -> Self;
|
||||
/// Assign self have a cryptographically random value.
|
||||
fn randomize(&mut self);
|
||||
/// Get the size of this object in bytes.
|
||||
fn len() -> usize;
|
||||
/// Convert a slice of bytes of length `len()` to an instance of this type.
|
||||
fn from_slice(src: &[u8]) -> Self;
|
||||
/// Assign self to be of the same value as a slice of bytes of length `len()`.
|
||||
fn clone_from_slice(&mut self, src: &[u8]) -> usize;
|
||||
/// Copy the data of this object into some mutable slice of length `len()`.
|
||||
fn copy_to(&self, dest: &mut [u8]);
|
||||
/// Returns `true` if all bits set in `b` are also set in `self`.
|
||||
fn contains<'a>(&'a self, b: &'a Self) -> bool;
|
||||
/// Returns `true` if no bits are set.
|
||||
fn is_zero(&self) -> bool;
|
||||
/// Returns the lowest 8 bytes interpreted as a BigEndian integer.
|
||||
fn low_u64(&self) -> u64;
|
||||
}
|
||||
|
||||
/// Return `s` without the `0x` at the beginning of it, if any.
|
||||
pub fn clean_0x(s: &str) -> &str {
|
||||
if s.starts_with("0x") {
|
||||
@ -105,57 +79,68 @@ macro_rules! impl_hash {
|
||||
}
|
||||
}
|
||||
|
||||
impl FixedHash for $from {
|
||||
fn new() -> $from {
|
||||
impl $from {
|
||||
/// Create a new, zero-initialised, instance.
|
||||
pub fn new() -> $from {
|
||||
$from([0; $size])
|
||||
}
|
||||
|
||||
fn zero() -> $from {
|
||||
/// Synonym for `new()`. Prefer to new as it's more readable.
|
||||
pub fn zero() -> $from {
|
||||
$from([0; $size])
|
||||
}
|
||||
|
||||
fn random() -> $from {
|
||||
/// Create a new, cryptographically random, instance.
|
||||
pub fn random() -> $from {
|
||||
let mut hash = $from::new();
|
||||
hash.randomize();
|
||||
hash
|
||||
}
|
||||
|
||||
fn randomize(&mut self) {
|
||||
/// Assign self have a cryptographically random value.
|
||||
pub fn randomize(&mut self) {
|
||||
let mut rng = OsRng::new().unwrap();
|
||||
rng.fill_bytes(&mut self.0);
|
||||
}
|
||||
|
||||
fn len() -> usize {
|
||||
/// Get the size of this object in bytes.
|
||||
pub fn len() -> usize {
|
||||
$size
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn clone_from_slice(&mut self, src: &[u8]) -> usize {
|
||||
/// Assign self to be of the same value as a slice of bytes of length `len()`.
|
||||
pub fn clone_from_slice(&mut self, src: &[u8]) -> usize {
|
||||
let min = cmp::min($size, src.len());
|
||||
self.0[..min].copy_from_slice(&src[..min]);
|
||||
min
|
||||
}
|
||||
|
||||
fn from_slice(src: &[u8]) -> Self {
|
||||
/// Convert a slice of bytes of length `len()` to an instance of this type.
|
||||
pub fn from_slice(src: &[u8]) -> Self {
|
||||
let mut r = Self::new();
|
||||
r.clone_from_slice(src);
|
||||
r
|
||||
}
|
||||
|
||||
fn copy_to(&self, dest: &mut[u8]) {
|
||||
/// Copy the data of this object into some mutable slice of length `len()`.
|
||||
pub fn copy_to(&self, dest: &mut[u8]) {
|
||||
let min = cmp::min($size, dest.len());
|
||||
dest[..min].copy_from_slice(&self.0[..min]);
|
||||
}
|
||||
|
||||
fn contains<'a>(&'a self, b: &'a Self) -> bool {
|
||||
/// Returns `true` if all bits set in `b` are also set in `self`.
|
||||
pub fn contains<'a>(&'a self, b: &'a Self) -> bool {
|
||||
&(b & self) == b
|
||||
}
|
||||
|
||||
fn is_zero(&self) -> bool {
|
||||
/// Returns `true` if no bits are set.
|
||||
pub fn is_zero(&self) -> bool {
|
||||
self.eq(&Self::new())
|
||||
}
|
||||
|
||||
fn low_u64(&self) -> u64 {
|
||||
/// Returns the lowest 8 bytes interpreted as a BigEndian integer.
|
||||
pub fn low_u64(&self) -> u64 {
|
||||
let mut ret = 0u64;
|
||||
for i in 0..min($size, 8) {
|
||||
ret |= (self.0[$size - 1 - i] as u64) << (i * 8);
|
||||
|
@ -556,7 +556,6 @@ impl Discovery {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::net::{SocketAddr};
|
||||
use util::FixedHash;
|
||||
use node_table::{Node, NodeId, NodeEndpoint};
|
||||
|
||||
use std::str::FromStr;
|
||||
|
@ -333,7 +333,7 @@ mod test {
|
||||
use std::sync::Arc;
|
||||
use rustc_serialize::hex::FromHex;
|
||||
use super::*;
|
||||
use util::hash::{H256, FixedHash};
|
||||
use util::hash::H256;
|
||||
use io::*;
|
||||
use mio::tcp::TcpStream;
|
||||
use stats::NetworkStats;
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
use std::mem;
|
||||
use std::ops::DerefMut;
|
||||
use {H64, H160, H256, H512, H520, H2048, FixedHash};
|
||||
use {H64, H160, H256, H512, H520, H2048};
|
||||
|
||||
/// Returns log2.
|
||||
pub fn log2(x: usize) -> u32 {
|
||||
|
@ -19,7 +19,7 @@ extern crate sha3 as sha3_ext;
|
||||
|
||||
use std::io;
|
||||
use tiny_keccak::Keccak;
|
||||
use hash::{H256, FixedHash};
|
||||
use hash::H256;
|
||||
use self::sha3_ext::*;
|
||||
|
||||
/// Get the SHA3 (i.e. Keccak) hash of the empty bytes string.
|
||||
|
Loading…
Reference in New Issue
Block a user