Point to current name of Ethereum consensus specs repo (#442)

This commit is contained in:
tersec 2021-12-06 08:08:51 +00:00 committed by GitHub
parent e7bc10ab00
commit 307b4e51b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@
# This module contains the parts necessary to create a merkle hash from the core # This module contains the parts necessary to create a merkle hash from the core
# SSZ types outlined in the spec: # SSZ types outlined in the spec:
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/ssz/simple-serialize.md#merkleization # https://github.com/ethereum/consensus-specs/blob/v1.0.1/ssz/simple-serialize.md#merkleization
{.push raises: [Defect].} {.push raises: [Defect].}
@ -606,16 +606,16 @@ func hash_tree_root*(x: auto): Digest {.raises: [Defect].} =
trs "HASH TREE ROOT FOR ", name(type x), " = ", "0x", $result trs "HASH TREE ROOT FOR ", name(type x), " = ", "0x", $result
# https://github.com/ethereum/eth2.0-specs/blob/dev/ssz/merkle-proofs.md#get_generalized_index_length # https://github.com/ethereum/consensus-specs/blob/dev/ssz/merkle-proofs.md#get_generalized_index_length
func getGeneralizedIndexLength(x: uint64): int = func getGeneralizedIndexLength(x: uint64): int =
log2trunc(x) log2trunc(x)
# https://github.com/ethereum/eth2.0-specs/blob/dev/ssz/merkle-proofs.md#get_generalized_index_bit # https://github.com/ethereum/consensus-specs/blob/dev/ssz/merkle-proofs.md#get_generalized_index_bit
func getGeneralizedIndexBit(index: uint64, position: uint64): bool = func getGeneralizedIndexBit(index: uint64, position: uint64): bool =
(index and (1'u64 shl position)) > 0 (index and (1'u64 shl position)) > 0
# validates merkle proof. Provided index should be a generalized index of leaf node # validates merkle proof. Provided index should be a generalized index of leaf node
# as defined in: https://github.com/ethereum/eth2.0-specs/blob/dev/ssz/merkle-proofs.md#generalized-merkle-tree-index # as defined in: https://github.com/ethereum/consensus-specs/blob/dev/ssz/merkle-proofs.md#generalized-merkle-tree-index
func isValidProof*(leaf: Digest, proof: openArray[Digest], func isValidProof*(leaf: Digest, proof: openArray[Digest],
index: uint64, root: Digest): bool = index: uint64, root: Digest): bool =
if len(proof) == getGeneralizedIndexLength(index): if len(proof) == getGeneralizedIndexLength(index):

View File

@ -8,7 +8,7 @@
{.push raises: [Defect].} {.push raises: [Defect].}
## SSZ serialization for core SSZ types, as specified in: ## SSZ serialization for core SSZ types, as specified in:
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/ssz/simple-serialize.md#serialization # https://github.com/ethereum/consensus-specs/blob/v1.0.1/ssz/simple-serialize.md#serialization
import import
std/[typetraits, options], std/[typetraits, options],