mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-18 09:27:05 +00:00
update copyright years and spec URLs (#3239)
This commit is contained in:
parent
da017d2ca5
commit
d20387e910
@ -1,5 +1,5 @@
|
|||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
{.push raises: [Defect].}
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/tests/core/pyspec/eth2spec/utils/merkle_minimal.py
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/tests/core/pyspec/eth2spec/utils/merkle_minimal.py
|
||||||
|
|
||||||
# Merkle tree helpers
|
# Merkle tree helpers
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
@ -1822,12 +1822,12 @@ proc newBeaconSwitch*(config: BeaconNodeConf, seckey: PrivateKey,
|
|||||||
.withTcpTransport({ServerFlags.ReuseAddr})
|
.withTcpTransport({ServerFlags.ReuseAddr})
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/phase0/p2p-interface.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/p2p-interface.md#configuration
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/p2p-interface.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/p2p-interface.md#configuration
|
||||||
func maxGossipMaxSize(): auto {.compileTime.} =
|
func maxGossipMaxSize(): auto {.compileTime.} =
|
||||||
max(GOSSIP_MAX_SIZE, GOSSIP_MAX_SIZE_MERGE)
|
max(GOSSIP_MAX_SIZE, GOSSIP_MAX_SIZE_MERGE)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/phase0/p2p-interface.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/p2p-interface.md#configuration
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/p2p-interface.md#configuration
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/p2p-interface.md#configuration
|
||||||
template gossipMaxSize(T: untyped): uint32 =
|
template gossipMaxSize(T: untyped): uint32 =
|
||||||
const maxSize = static:
|
const maxSize = static:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
@ -48,7 +48,7 @@ template epoch*(slot: Slot): Epoch =
|
|||||||
template isEpoch*(slot: Slot): bool =
|
template isEpoch*(slot: Slot): bool =
|
||||||
(slot mod SLOTS_PER_EPOCH) == 0
|
(slot mod SLOTS_PER_EPOCH) == 0
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#generalized_index_sibling
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/ssz/merkle-proofs.md#generalized_index_sibling
|
||||||
template generalized_index_sibling*(
|
template generalized_index_sibling*(
|
||||||
index: GeneralizedIndex): GeneralizedIndex =
|
index: GeneralizedIndex): GeneralizedIndex =
|
||||||
index xor 1.GeneralizedIndex
|
index xor 1.GeneralizedIndex
|
||||||
@ -61,12 +61,12 @@ template generalized_index_sibling_right(
|
|||||||
index: GeneralizedIndex): GeneralizedIndex =
|
index: GeneralizedIndex): GeneralizedIndex =
|
||||||
index or 1.GeneralizedIndex
|
index or 1.GeneralizedIndex
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#generalized_index_parent
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/ssz/merkle-proofs.md#generalized_index_parent
|
||||||
template generalized_index_parent*(
|
template generalized_index_parent*(
|
||||||
index: GeneralizedIndex): GeneralizedIndex =
|
index: GeneralizedIndex): GeneralizedIndex =
|
||||||
index shr 1
|
index shr 1
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#merkle-multiproofs
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/ssz/merkle-proofs.md#merkle-multiproofs
|
||||||
iterator get_branch_indices*(
|
iterator get_branch_indices*(
|
||||||
tree_index: GeneralizedIndex): GeneralizedIndex =
|
tree_index: GeneralizedIndex): GeneralizedIndex =
|
||||||
## Get the generalized indices of the sister chunks along the path
|
## Get the generalized indices of the sister chunks along the path
|
||||||
@ -76,7 +76,7 @@ iterator get_branch_indices*(
|
|||||||
yield generalized_index_sibling(index)
|
yield generalized_index_sibling(index)
|
||||||
index = generalized_index_parent(index)
|
index = generalized_index_parent(index)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#merkle-multiproofs
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/ssz/merkle-proofs.md#merkle-multiproofs
|
||||||
iterator get_path_indices*(
|
iterator get_path_indices*(
|
||||||
tree_index: GeneralizedIndex): GeneralizedIndex =
|
tree_index: GeneralizedIndex): GeneralizedIndex =
|
||||||
## Get the generalized indices of the chunks along the path
|
## Get the generalized indices of the chunks along the path
|
||||||
@ -86,7 +86,7 @@ iterator get_path_indices*(
|
|||||||
yield index
|
yield index
|
||||||
index = generalized_index_parent(index)
|
index = generalized_index_parent(index)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#merkle-multiproofs
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/ssz/merkle-proofs.md#merkle-multiproofs
|
||||||
func get_helper_indices*(
|
func get_helper_indices*(
|
||||||
indices: openArray[GeneralizedIndex]): seq[GeneralizedIndex] =
|
indices: openArray[GeneralizedIndex]): seq[GeneralizedIndex] =
|
||||||
## Get the generalized indices of all "extra" chunks in the tree needed
|
## Get the generalized indices of all "extra" chunks in the tree needed
|
||||||
@ -107,7 +107,7 @@ func get_helper_indices*(
|
|||||||
res.sort(SortOrder.Descending)
|
res.sort(SortOrder.Descending)
|
||||||
res
|
res
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#merkle-multiproofs
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/ssz/merkle-proofs.md#merkle-multiproofs
|
||||||
func check_multiproof_acceptable*(
|
func check_multiproof_acceptable*(
|
||||||
indices: openArray[GeneralizedIndex]): Result[void, string] =
|
indices: openArray[GeneralizedIndex]): Result[void, string] =
|
||||||
# Check that proof verification won't allocate excessive amounts of memory.
|
# Check that proof verification won't allocate excessive amounts of memory.
|
||||||
@ -259,7 +259,7 @@ func calculate_multi_merkle_root*(
|
|||||||
calculate_multi_merkle_root_impl(
|
calculate_multi_merkle_root_impl(
|
||||||
leaves, proof, indices, get_helper_indices(indices))
|
leaves, proof, indices, get_helper_indices(indices))
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#merkle-multiproofs
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/ssz/merkle-proofs.md#merkle-multiproofs
|
||||||
func verify_merkle_multiproof*(
|
func verify_merkle_multiproof*(
|
||||||
leaves: openArray[Eth2Digest],
|
leaves: openArray[Eth2Digest],
|
||||||
proof: openArray[Eth2Digest],
|
proof: openArray[Eth2Digest],
|
||||||
|
@ -4,7 +4,7 @@ import
|
|||||||
datatypes/altair,
|
datatypes/altair,
|
||||||
helpers
|
helpers
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/altair/sync-protocol.md#get_active_header
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#get_active_header
|
||||||
func get_active_header(update: LightClientUpdate): BeaconBlockHeader =
|
func get_active_header(update: LightClientUpdate): BeaconBlockHeader =
|
||||||
# The "active header" is the header that the update is trying to convince
|
# The "active header" is the header that the update is trying to convince
|
||||||
# us to accept. If a finalized header is present, it's the finalized
|
# us to accept. If a finalized header is present, it's the finalized
|
||||||
|
@ -103,7 +103,7 @@ proc aggregateAttesters(
|
|||||||
# Aggregation spec requires non-empty collection
|
# Aggregation spec requires non-empty collection
|
||||||
# - https://tools.ietf.org/html/draft-irtf-cfrg-bls-signature-04
|
# - https://tools.ietf.org/html/draft-irtf-cfrg-bls-signature-04
|
||||||
# Eth2 spec requires at least one attesting index in attestation
|
# Eth2 spec requires at least one attesting index in attestation
|
||||||
# - https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/phase0/beacon-chain.md#is_valid_indexed_attestation
|
# - https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/beacon-chain.md#is_valid_indexed_attestation
|
||||||
return err("aggregateAttesters: no attesting indices")
|
return err("aggregateAttesters: no attesting indices")
|
||||||
|
|
||||||
var attestersAgg{.noInit.}: AggregatePublicKey
|
var attestersAgg{.noInit.}: AggregatePublicKey
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2021 Status Research & Development GmbH
|
# Copyright (c) 2021-2022 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
@ -149,7 +149,7 @@ suite "Ethereum Foundation - Altair - Unittests - Sync protocol" & preset():
|
|||||||
store.finalized_header == pre_store_finalized_header
|
store.finalized_header == pre_store_finalized_header
|
||||||
store.best_valid_update.get == update
|
store.best_valid_update.get == update
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L93-L154
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L93-L154
|
||||||
test "process_light_client_update_timeout":
|
test "process_light_client_update_timeout":
|
||||||
var forked = assignClone(genesisState[])
|
var forked = assignClone(genesisState[])
|
||||||
template state: untyped {.inject.} = forked[].altairData.data
|
template state: untyped {.inject.} = forked[].altairData.data
|
||||||
@ -217,7 +217,7 @@ suite "Ethereum Foundation - Altair - Unittests - Sync protocol" & preset():
|
|||||||
store.best_valid_update.get == update
|
store.best_valid_update.get == update
|
||||||
store.finalized_header == pre_store_finalized_header
|
store.finalized_header == pre_store_finalized_header
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.7/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L157-L224
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L157-L224
|
||||||
test "process_light_client_update_finality_updated":
|
test "process_light_client_update_finality_updated":
|
||||||
var forked = assignClone(genesisState[])
|
var forked = assignClone(genesisState[])
|
||||||
template state: untyped {.inject.} = forked[].altairData.data
|
template state: untyped {.inject.} = forked[].altairData.data
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
@ -16,7 +16,7 @@ import
|
|||||||
# Routines for mocking blocks
|
# Routines for mocking blocks
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.1.5/tests/core/pyspec/eth2spec/test/helpers/block.py#L26-L35
|
# https://github.com/ethereum/consensus-specs/blob/v1.1.8/tests/core/pyspec/eth2spec/test/helpers/block.py#L26-L35
|
||||||
func apply_randao_reveal(state: ForkyBeaconState, blck: var ForkySignedBeaconBlock) =
|
func apply_randao_reveal(state: ForkyBeaconState, blck: var ForkySignedBeaconBlock) =
|
||||||
doAssert state.slot <= blck.message.slot
|
doAssert state.slot <= blck.message.slot
|
||||||
let
|
let
|
||||||
|
Loading…
x
Reference in New Issue
Block a user