change dependencies of `keccak-hash`and `trie-standardmap` (#111)
* cargo fmt Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Revert "cargo fmt" This reverts commit 529720df1557f42edffe5acf1d24e2b7b4d4da32. Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Revert cargo fmt Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
parent
26d81fc5ef
commit
1409ddaf07
|
@ -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 <admin@parity.io>"]
|
||||
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"
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -14,14 +14,15 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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]
|
||||
|
|
|
@ -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 <marek.kotewicz@gmail.com>", "Parity Technologies <admin@parity.io>"]
|
||||
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" }
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue