From 42214ad1c42e7900c809aeaaeb7fab6fcb1687b7 Mon Sep 17 00:00:00 2001 From: David Palm Date: Fri, 6 Jul 2018 19:00:41 +0200 Subject: [PATCH] Upgrade patricia_trie to use triehash v0.2 Bump patricia_trie to v0.2.1 --- patricia_trie/Cargo.toml | 4 ++-- patricia_trie/src/triedbmut.rs | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/patricia_trie/Cargo.toml b/patricia_trie/Cargo.toml index ba18e20..a6f0706 100644 --- a/patricia_trie/Cargo.toml +++ b/patricia_trie/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "patricia-trie" -version = "0.2.0" +version = "0.2.1" authors = ["Parity Technologies "] description = "Merkle-Patricia Trie generic over key hasher and node encoding" license = "GPL-3.0" @@ -20,7 +20,7 @@ keccak-hash = { path = "../keccak-hash" } memorydb = { version = "0.2", path = "../memorydb" } rlp = { version = "0.2.1", path = "../rlp" } trie-standardmap = { path = "../trie-standardmap" } -triehash = { version = "0.1.0", path = "../triehash" } +triehash = { version = "0.2", path = "../triehash" } # REVIEW: what's a better way to deal with this? The tests here in # `patricia_trie` use `keccak-hasher` and `patricia-trie-ethereum` to diff --git a/patricia_trie/src/triedbmut.rs b/patricia_trie/src/triedbmut.rs index 4490285..51005e9 100644 --- a/patricia_trie/src/triedbmut.rs +++ b/patricia_trie/src/triedbmut.rs @@ -1012,7 +1012,7 @@ mod tests { count: 100, }.make_with(&mut seed); - let real = trie_root(x.clone()); + let real = trie_root::(x.clone()); let mut memdb = MemoryDB::::new(); let mut root = H256::new(); let mut memtrie = populate_trie::<_, RlpCodec>(&mut memdb, &mut root, &x); @@ -1055,7 +1055,7 @@ mod tests { let mut root = H256::new(); let mut t = TrieDBMut::new(&mut memdb, &mut root); t.insert(&[0x01u8, 0x23], &[0x01u8, 0x23]).unwrap(); - assert_eq!(*t.root(), trie_root(vec![ (vec![0x01u8, 0x23], vec![0x01u8, 0x23]) ])); + assert_eq!(*t.root(), trie_root::(vec![ (vec![0x01u8, 0x23], vec![0x01u8, 0x23]) ])); } #[test] @@ -1084,7 +1084,7 @@ mod tests { let mut t = TrieDBMut::new(&mut memdb, &mut root); t.insert(&[0x01u8, 0x23], &[0x01u8, 0x23]).unwrap(); t.insert(&[0x01u8, 0x23], &[0x23u8, 0x45]).unwrap(); - assert_eq!(*t.root(), trie_root(vec![ (vec![0x01u8, 0x23], vec![0x23u8, 0x45]) ])); + assert_eq!(*t.root(), trie_root::(vec![ (vec![0x01u8, 0x23], vec![0x23u8, 0x45]) ])); } #[test] @@ -1094,7 +1094,7 @@ mod tests { let mut t = TrieDBMut::new(&mut memdb, &mut root); t.insert(&[0x01u8, 0x23], &[0x01u8, 0x23]).unwrap(); t.insert(&[0x11u8, 0x23], &[0x11u8, 0x23]).unwrap(); - assert_eq!(*t.root(), trie_root(vec![ + assert_eq!(*t.root(), trie_root::(vec![ (vec![0x01u8, 0x23], vec![0x01u8, 0x23]), (vec![0x11u8, 0x23], vec![0x11u8, 0x23]) ])); @@ -1108,7 +1108,7 @@ mod tests { t.insert(&[0x01u8, 0x23], &[0x01u8, 0x23]).unwrap(); t.insert(&[0xf1u8, 0x23], &[0xf1u8, 0x23]).unwrap(); t.insert(&[0x81u8, 0x23], &[0x81u8, 0x23]).unwrap(); - assert_eq!(*t.root(), trie_root(vec![ + assert_eq!(*t.root(), trie_root::(vec![ (vec![0x01u8, 0x23], vec![0x01u8, 0x23]), (vec![0x81u8, 0x23], vec![0x81u8, 0x23]), (vec![0xf1u8, 0x23], vec![0xf1u8, 0x23]), @@ -1122,7 +1122,7 @@ mod tests { let mut t = TrieDBMut::new(&mut memdb, &mut root); t.insert(&[0x01u8, 0x23], &[0x01u8, 0x23]).unwrap(); t.insert(&[], &[0x0]).unwrap(); - assert_eq!(*t.root(), trie_root(vec![ + assert_eq!(*t.root(), trie_root::(vec![ (vec![], vec![0x0]), (vec![0x01u8, 0x23], vec![0x01u8, 0x23]), ])); @@ -1135,7 +1135,7 @@ mod tests { let mut t = TrieDBMut::new(&mut memdb, &mut root); t.insert(&[0x01u8, 0x23], &[0x01u8, 0x23]).unwrap(); t.insert(&[0x01u8, 0x34], &[0x01u8, 0x34]).unwrap(); - assert_eq!(*t.root(), trie_root(vec![ + assert_eq!(*t.root(), trie_root::(vec![ (vec![0x01u8, 0x23], vec![0x01u8, 0x23]), (vec![0x01u8, 0x34], vec![0x01u8, 0x34]), ])); @@ -1149,7 +1149,7 @@ mod tests { t.insert(&[0x01, 0x23, 0x45], &[0x01]).unwrap(); t.insert(&[0x01, 0xf3, 0x45], &[0x02]).unwrap(); t.insert(&[0x01, 0xf3, 0xf5], &[0x03]).unwrap(); - assert_eq!(*t.root(), trie_root(vec![ + assert_eq!(*t.root(), trie_root::(vec![ (vec![0x01, 0x23, 0x45], vec![0x01]), (vec![0x01, 0xf3, 0x45], vec![0x02]), (vec![0x01, 0xf3, 0xf5], vec![0x03]), @@ -1166,7 +1166,7 @@ mod tests { let mut t = TrieDBMut::new(&mut memdb, &mut root); t.insert(&[0x01u8, 0x23], big_value0).unwrap(); t.insert(&[0x11u8, 0x23], big_value1).unwrap(); - assert_eq!(*t.root(), trie_root(vec![ + assert_eq!(*t.root(), trie_root::(vec![ (vec![0x01u8, 0x23], big_value0.to_vec()), (vec![0x11u8, 0x23], big_value1.to_vec()) ])); @@ -1181,7 +1181,7 @@ mod tests { let mut t = TrieDBMut::new(&mut memdb, &mut root); t.insert(&[0x01u8, 0x23], big_value).unwrap(); t.insert(&[0x11u8, 0x23], big_value).unwrap(); - assert_eq!(*t.root(), trie_root(vec![ + assert_eq!(*t.root(), trie_root::(vec![ (vec![0x01u8, 0x23], big_value.to_vec()), (vec![0x11u8, 0x23], big_value.to_vec()) ])); @@ -1237,7 +1237,7 @@ mod tests { count: 4, }.make_with(&mut seed); - let real = trie_root(x.clone()); + let real = trie_root::(x.clone()); let mut memdb = MemoryDB::::new(); let mut root = H256::new(); let mut memtrie = populate_trie::<_, RlpCodec>(&mut memdb, &mut root, &x); @@ -1295,7 +1295,7 @@ mod tests { t.insert(key, value).unwrap(); } - assert_eq!(*t.root(), trie_root(x.clone())); + assert_eq!(*t.root(), trie_root::(x.clone())); for &(ref key, _) in &x { t.insert(key, &[]).unwrap();