Minor fixes

This commit is contained in:
Hsiao-Wei Wang 2019-08-15 18:26:22 +08:00
parent 0f52d460a5
commit 2741a5f33d
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
2 changed files with 4 additions and 4 deletions

View File

@ -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"

View File

@ -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):