From 2741a5f33dfa0a19fb2185705e5bd1cc4435baa0 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Thu, 15 Aug 2019 18:26:22 +0800 Subject: [PATCH] Minor fixes --- scripts/build_spec.py | 2 +- specs/light_client/merkle_proofs.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build_spec.py b/scripts/build_spec.py index 410db2f21..07306af8a 100644 --- a/scripts/build_spec.py +++ b/scripts/build_spec.py @@ -343,7 +343,7 @@ If building phase 1: build_phase1_spec(*args.files) else: print( - " Phase 1 requires input files as well as an output file:\n" + " Phase 1 requires input files as well as an output file:\n" "\t core/phase_0: (0_beacon-chain.md, 0_fork-choice.md)\n" "\t core/phase_1: (1_custody-game.md, 1_shard-data-chains.md)\n" "\t light_client: (merkle_proofs.md)\n" diff --git a/specs/light_client/merkle_proofs.md b/specs/light_client/merkle_proofs.md index faad40c45..d6c6dee62 100644 --- a/specs/light_client/merkle_proofs.md +++ b/specs/light_client/merkle_proofs.md @@ -8,7 +8,7 @@ - [Merkle proof formats](#merkle-proof-formats) - [Table of contents](#table-of-contents) - [Custom types](#custom-types) - - [Helpers](#helpers) + - [Helper functions](#helper-functions) - [Generalized Merkle tree index](#generalized-merkle-tree-index) - [SSZ object to index](#ssz-object-to-index) - [Helpers for generalized indices](#helpers-for-generalized-indices) @@ -30,7 +30,7 @@ We define the following Python custom types for type hinting and readability: | - | - | - | | `GeneralizedIndex` | `uint64` | the index of a node in a binary Merkle tree | -## Helpers +## Helper functions ```python def get_next_power_of_two(x: int) -> int: @@ -67,7 +67,7 @@ In a binary Merkle tree, we define a "generalized index" of a node as `2**depth Note that the generalized index has the convenient property that the two children of node `k` are `2k` and `2k+1`, and also that it equals the position of a node in the linear representation of the Merkle tree that's computed by this function: ```python -def merkle_tree(leaves: List[Bytes32]) -> List[Bytes32]: +def merkle_tree(leaves: Squence[Hash]) -> Squence[Hash]: padded_length = get_next_power_of_two(len(leaves)) o = [Hash()] * padded_length + leaves + [Hash()] * (padded_length - len(leaves)) for i in range(len(leaves) - 1, 0, -1):