diff --git a/keccak-hash/Cargo.toml b/keccak-hash/Cargo.toml index c4f9aac..37ea6ee 100644 --- a/keccak-hash/Cargo.toml +++ b/keccak-hash/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "keccak-hash" -version = "0.1.2" +version = "0.1.3" description = "`keccak-hash` is a set of utility functions to facilitate working with Keccak hashes (256/512 bits long)." authors = ["Parity Technologies "] repository = "https://github.com/paritytech/parity-common" @@ -8,8 +8,8 @@ readme = "README.md" license = "GPL-3.0" [dependencies] -ethereum-types = "0.4" tiny-keccak = "1.4" +primitive-types = { path = "../primitive-types", version = "0.2" } [dev-dependencies] tempdir = "0.3" diff --git a/keccak-hash/benches/keccak_256.rs b/keccak-hash/benches/keccak_256.rs index d59e534..b8f9393 100644 --- a/keccak-hash/benches/keccak_256.rs +++ b/keccak-hash/benches/keccak_256.rs @@ -17,10 +17,9 @@ #![feature(test)] extern crate test; -extern crate ethereum_types; extern crate keccak_hash; -use keccak_hash::{keccak, write_keccak}; +use keccak_hash::keccak; use test::Bencher; #[bench] diff --git a/keccak-hash/src/lib.rs b/keccak-hash/src/lib.rs index c54d723..520fed8 100644 --- a/keccak-hash/src/lib.rs +++ b/keccak-hash/src/lib.rs @@ -14,14 +14,15 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -extern crate ethereum_types; +extern crate primitive_types; extern crate tiny_keccak; use std::io; use std::slice; + use tiny_keccak::Keccak; -pub use ethereum_types::H256; +pub use primitive_types::H256; /// Get the KECCAK (i.e. Keccak) hash of the empty bytes string. pub const KECCAK_EMPTY: H256 = H256( [0xc5, 0xd2, 0x46, 0x01, 0x86, 0xf7, 0x23, 0x3c, 0x92, 0x7e, 0x7d, 0xb2, 0xdc, 0xc7, 0x03, 0xc0, 0xe5, 0x00, 0xb6, 0x53, 0xca, 0x82, 0x27, 0x3b, 0x7b, 0xfa, 0xd8, 0x04, 0x5d, 0x85, 0xa4, 0x70] ); @@ -91,6 +92,8 @@ mod tests { use std::fs; use std::io::{Write, BufReader}; + use std::str::FromStr; + use self::tempdir::TempDir; use super::{keccak, write_keccak, keccak_buffer, KECCAK_EMPTY}; @@ -101,7 +104,7 @@ mod tests { #[test] fn keccak_as() { - assert_eq!(keccak([0x41u8; 32]), From::from("59cad5948673622c1d64e2322488bf01619f7ff45789741b15a9f782ce9290a8")); + assert_eq!(keccak([0x41u8; 32]), FromStr::from_str("59cad5948673622c1d64e2322488bf01619f7ff45789741b15a9f782ce9290a8").unwrap()); } #[test] diff --git a/trie-standardmap/Cargo.toml b/trie-standardmap/Cargo.toml index 6665835..e30e07b 100644 --- a/trie-standardmap/Cargo.toml +++ b/trie-standardmap/Cargo.toml @@ -1,13 +1,12 @@ [package] name = "trie-standardmap" description = "Standard test map for profiling tries" -version = "0.1.1" +version = "0.1.2" authors = ["debris ", "Parity Technologies "] repository = "https://github.com/paritytech/parity-common" license = "GPL-3.0" [dependencies] -ethereum-types = "0.4" keccak-hash = { version = "0.1", path = "../keccak-hash" } parity-bytes = { version = "0.1", path = "../parity-bytes" } -rlp = { version = "0.3.0", path = "../rlp" } +rlp = { version = "0.3", path = "../rlp" } diff --git a/trie-standardmap/src/lib.rs b/trie-standardmap/src/lib.rs index f72b817..cca98e2 100644 --- a/trie-standardmap/src/lib.rs +++ b/trie-standardmap/src/lib.rs @@ -17,13 +17,11 @@ //! Key-value datastore with a modified Merkle tree. extern crate parity_bytes as bytes; -extern crate ethereum_types; extern crate keccak_hash; extern crate rlp; use bytes::Bytes; -use ethereum_types::H256; -use keccak_hash::keccak; +use keccak_hash::{keccak, H256}; use rlp::encode; /// Alphabet to use when creating words for insertion into tries. @@ -77,7 +75,7 @@ impl StandardMap { *seed = keccak(&seed); match seed[0] % 2 { 1 => vec![seed[31];1], - _ => seed.to_vec(), + _ => seed.as_bytes().to_vec(), } } @@ -96,7 +94,7 @@ impl StandardMap { /// Create the standard map (set of keys and values) for the object's fields. pub fn make(&self) -> Vec<(Bytes, Bytes)> { - self.make_with(&mut H256::new()) + self.make_with(&mut H256::zero()) } /// Create the standard map (set of keys and values) for the object's fields, using the given seed.