From 449e8a44a4e9c3040334cac58b204d9ebede0951 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Sat, 13 Apr 2019 18:17:09 +1000 Subject: [PATCH] Remove unused `log2` --- specs/light_client/merkle_proofs.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/specs/light_client/merkle_proofs.md b/specs/light_client/merkle_proofs.md index 47195b2ca..371f0ffde 100644 --- a/specs/light_client/merkle_proofs.md +++ b/specs/light_client/merkle_proofs.md @@ -99,14 +99,7 @@ x x . . . . x * . are unused nodes, * are used nodes, x are the values we are trying to prove. Notice how despite being a multiproof for 3 values, it requires only 3 auxiliary nodes, only one node more than would be required to prove a single value. Normally the efficiency gains are not quite that extreme, but the savings relative to individual Merkle proofs are still significant. As a rule of thumb, a multiproof for k nodes at the same level of an n-node tree has size `k * (n/k + log(n/k))`. -Here is code for creating and verifying a multiproof. First a helper: - -```python -def log2(x: int) -> int: - return 0 if x == 1 else 1 + log2(x // 2) -``` - -First, a method for computing the generalized indices of the auxiliary tree nodes that a proof of a given set of generalized indices will require: +Here is code for creating and verifying a multiproof. First, a method for computing the generalized indices of the auxiliary tree nodes that a proof of a given set of generalized indices will require: ```python def get_proof_indices(tree_indices: List[int]) -> List[int]: