Fix MerkleTable comment
@@ -50,11 +50,13 @@ mod hash_rules {
hash(left.as_ref())
}
}
+
/// Merkle tree over list. Data in table is stored in rows.
-/// Height is determined by amount of values: `H = len / 2 +1`
-/// H | Values
-/// 0 | Value hashes
-/// 1..| Hashes tree, where each height calculates Hash(Hash(h - 1, i), Hash(h - 1, i + 1))
+/// Height is determined by amount of values: H = log2(values_length) + 1
+/// 0 | Values, stored in the structure by index. A datum is stored at (0, index).
+/// 1 | Hash of value datum, stored at level 0. (1, index) = Hash((0, index))
+/// 2..| Merkle tree node, where at position (h, i) = Hash((h - 1, 2i) + (h - 1, 2i + 1)).
+/// `+` operation is concatenation of byte arrays.
pub struct MerkleTable<T: Map<[u8], Vec<u8>>, K, V> {
map: T,
count: Cell<Option<K>>,
