clean up types

This commit is contained in:
realbigsean
2022-10-28 10:18:04 -04:00
parent f1a3b3b01c
commit 82eef493f3
6 changed files with 30 additions and 143 deletions

View File

@@ -81,7 +81,26 @@ macro_rules! impl_for_lt_32byte_u8_array {
impl_for_lt_32byte_u8_array!(4);
impl_for_lt_32byte_u8_array!(32);
impl_for_lt_32byte_u8_array!(48);
impl TreeHash for [u8; 48] {
fn tree_hash_type() -> TreeHashType {
TreeHashType::Vector
}
fn tree_hash_packed_encoding(&self) -> PackedEncoding {
unreachable!("Vector should never be packed.")
}
fn tree_hash_packing_factor() -> usize {
unreachable!("Vector should never be packed.")
}
fn tree_hash_root(&self) -> Hash256 {
let values_per_chunk = BYTES_PER_CHUNK;
let minimum_chunk_count = (48 + values_per_chunk - 1) / values_per_chunk;
merkle_root(self, minimum_chunk_count)
}
}
impl TreeHash for U128 {
fn tree_hash_type() -> TreeHashType {