Update some dependencies

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
koushiro
2022-07-22 12:26:56 +08:00
parent bb196e8b96
commit 7796272361
5 changed files with 16 additions and 16 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
use super::new_blake2b;
use crate::{leaf_index_to_pos, util::MemStore, MMRStore, Merge, MerkleProof, Result, MMR};
use bytes::Bytes;
use std::fmt::{self, Debug};
use bytes::{Bytes, BytesMut};
use std::fmt;
#[derive(Clone)]
struct Header {
@@ -42,9 +42,9 @@ struct HashWithTD {
impl HashWithTD {
fn serialize(&self) -> Bytes {
let mut data = self.hash.clone();
let mut data = BytesMut::from(self.hash.as_ref());
data.extend(&self.td.to_le_bytes());
data
data.into()
}
fn deserialize(mut data: Bytes) -> Self {
@@ -57,12 +57,12 @@ impl HashWithTD {
}
}
impl Debug for HashWithTD {
impl fmt::Debug for HashWithTD {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"HashWithTD {{ hash: {}, td: {} }}",
faster_hex::hex_string(&self.hash).unwrap(),
faster_hex::hex_string(&self.hash),
self.td
)
}
+2 -2
View File
@@ -64,7 +64,7 @@ fn test_mmr_root() {
mmr.push(NumberHash::from(i)).unwrap();
});
let root = mmr.get_root().expect("get root");
let hex_root = hex_string(&root.0).unwrap();
let hex_root = hex_string(&root.0);
assert_eq!(
"f6794677f37a57df6a5ec36ce61036e43a36c1a009d05c81c9aa685dde1fd6e3",
hex_root
@@ -154,7 +154,7 @@ proptest! {
let mut leaves: Vec<u32> = (0..count).collect();
let mut rng = thread_rng();
leaves.shuffle(&mut rng);
let leaves_count = rng.gen_range(1, count - 1);
let leaves_count = rng.gen_range(1..count - 1);
leaves.truncate(leaves_count as usize);
test_mmr(count, leaves);
}
+1 -1
View File
@@ -91,7 +91,7 @@ proptest! {
let mut leaves: Vec<u32> = (0..count).collect();
let mut rng = thread_rng();
leaves.shuffle(&mut rng);
let leaves_count = rng.gen_range(1, count - 1);
let leaves_count = rng.gen_range(1..count - 1);
leaves.truncate(leaves_count as usize);
test_sequence_sub_func(count, leaves);
}