more spec v1.0.1 spec ref URL and copyright year updates (#2367)

This commit is contained in:
tersec 2021-03-02 06:04:14 +00:00 committed by GitHub
parent e661f7d0c7
commit 5653b2e13c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 34 deletions

View File

@ -387,20 +387,20 @@ func verifyFinalization(node: BeaconNode, slot: Slot) =
doAssert finalizedEpoch + 4 >= epoch
proc installAttestationSubnetHandlers(node: BeaconNode, subnets: set[uint8]) =
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/p2p-interface.md#attestations-and-aggregation
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#attestations-and-aggregation
# nimbus won't score attestation subnets for now, we just rely on block and aggregate which are more stabe and reliable
for subnet in subnets:
node.network.subscribe(getAttestationTopic(node.forkDigest, subnet), TopicParams.init()) # don't score attestation subnets for now
proc updateStabilitySubnetMetadata(
node: BeaconNode, stabilitySubnets: set[uint8]) =
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/p2p-interface.md#metadata
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#metadata
node.network.metadata.seq_number += 1
for subnet in 0'u8 ..< ATTESTATION_SUBNET_COUNT:
node.network.metadata.attnets[subnet] = (subnet in stabilitySubnets)
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/validator.md#phase-0-attestation-subnet-stability
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/p2p-interface.md#attestation-subnet-bitfield
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/validator.md#phase-0-attestation-subnet-stability
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#attestation-subnet-bitfield
let res = node.network.discovery.updateRecord(
{"attnets": SSZ.encode(node.network.metadata.attnets)})
if res.isErr():
@ -431,13 +431,13 @@ proc updateSubscriptionSchedule(node: BeaconNode, epoch: Epoch) {.async.} =
var cache = StateCache()
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/validator.md#lookahead
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/validator.md#lookahead
# Only subscribe when this node should aggregate; libp2p broadcasting works
# on subnet topics regardless.
#
# Committee sizes in any given epoch vary by 1, i.e. committee sizes $n$
# $n+1$ can exist. Furthermore, according to
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/validator.md#aggregation-selection
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/validator.md#aggregation-selection
# is_aggregator uses `len(committee) div TARGET_AGGREGATORS_PER_COMMITTEE`
# to determine whether committee length/slot signature pairs aggregate the
# attestations in a slot/committee, where TARGET_AGGREGATORS_PER_COMMITTEE
@ -521,7 +521,7 @@ proc updateSubscriptionSchedule(node: BeaconNode, epoch: Epoch) {.async.} =
slot - min(slot.uint64, SUBNET_SUBSCRIPTION_LEAD_TIME_SLOTS),
node.attestationSubnets.subscribeSlot[subnetIndex])
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/validator.md#phase-0-attestation-subnet-stability
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/validator.md#phase-0-attestation-subnet-stability
proc getStabilitySubnetLength(node: BeaconNode): uint64 =
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION +
node.network.rng[].rand(EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION.int).uint64
@ -532,7 +532,7 @@ proc updateStabilitySubnets(node: BeaconNode, slot: Slot): set[uint8] =
static: doAssert ATTESTATION_SUBNET_COUNT <= high(uint8)
let epoch = slot.epoch
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/validator.md#phase-0-attestation-subnet-stability
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/validator.md#phase-0-attestation-subnet-stability
for i in 0 ..< node.attestationSubnets.stabilitySubnets.len:
if epoch >= node.attestationSubnets.stabilitySubnets[i].expiration:
node.attestationSubnets.stabilitySubnets[i].subnet =
@ -660,7 +660,7 @@ proc getInitialAttestationSubnets(node: BeaconNode): Table[uint8, Slot] =
mergeAttestationSubnets(wallEpoch + 1)
proc getAttestationSubnetHandlers(node: BeaconNode) =
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/validator.md#phase-0-attestation-subnet-stability
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/validator.md#phase-0-attestation-subnet-stability
# TODO:
# We might want to reuse the previous stability subnet if not expired when:
# - Restarting the node with a presistent netkey
@ -1125,7 +1125,7 @@ proc installRpcHandlers(rpcServer: RpcServer, node: BeaconNode) =
rpcServer.installValidatorApiHandlers(node)
proc installMessageValidators(node: BeaconNode) =
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/p2p-interface.md#attestations-and-aggregation
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#attestations-and-aggregation
# These validators stay around the whole time, regardless of which specific
# subnets are subscribed to during any given epoch.
for it in 0'u64 ..< ATTESTATION_SUBNET_COUNT.uint64:

View File

@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2018-2020 Status Research & Development GmbH
# Copyright (c) 2018-2021 Status Research & Development GmbH
# Licensed and distributed under either of
# * 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).
@ -16,7 +16,7 @@ import
const
# Misc
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/mainnet/phase0.yaml#L5
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/mainnet/phase0.yaml#L5
CONFIG_NAME* = "mainnet"
MAX_COMMITTEES_PER_SLOT* {.intdefine.}: uint64 = 64
@ -47,7 +47,7 @@ const
# Gwei values
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/mainnet/phase0.yaml#L60
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/mainnet/phase0.yaml#L60
MIN_DEPOSIT_AMOUNT*: uint64 = 2'u64^0 * 10'u64^9 ##\
## Minimum amounth of ETH that can be deposited in one call - deposits can
@ -64,14 +64,14 @@ const
# Initial values
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/mainnet/phase0.yaml#L72
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/mainnet/phase0.yaml#L72
# GENESIS_FORK_VERSION is a runtime preset
BLS_WITHDRAWAL_PREFIX*: byte = 0
# Time parameters
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/mainnet/phase0.yaml#L79
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/mainnet/phase0.yaml#L79
# GENESIS_DELAY is a runtime preset
@ -118,7 +118,7 @@ const
# State vector lengths
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/mainnet/phase0.yaml#L105
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/mainnet/phase0.yaml#L105
EPOCHS_PER_HISTORICAL_VECTOR*: uint64 = 65536 ##\
## epochs (~0.8 years)
@ -133,7 +133,7 @@ const
# Reward and penalty quotients
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/mainnet/phase0.yaml#L117
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/mainnet/phase0.yaml#L117
BASE_REWARD_FACTOR*: uint64 = 2'u64^6
WHISTLEBLOWER_REWARD_QUOTIENT*: uint64 = 2'u64^9
PROPOSER_REWARD_QUOTIENT*: uint64 = 2'u64^3
@ -143,7 +143,7 @@ const
# Max operations per block
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/mainnet/phase0.yaml#L133
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/mainnet/phase0.yaml#L133
MAX_PROPOSER_SLASHINGS*: uint64 = 2'u64 ^ 4
MAX_ATTESTER_SLASHINGS*: uint64 = 2'u64 ^ 1
MAX_ATTESTATIONS*: uint64 = 2'u64 ^ 7
@ -152,12 +152,12 @@ const
# Fork choice
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/mainnet/phase0.yaml#L31
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/mainnet/phase0.yaml#L31
SAFE_SLOTS_TO_UPDATE_JUSTIFIED*: uint64 = 8 # 96 seconds
# Validators
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/mainnet/phase0.yaml#L37
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/mainnet/phase0.yaml#L37
# ETH1_FOLLOW_DISTANCE is a runtime preset
@ -168,7 +168,7 @@ const
# Deposit contract
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/mainnet/phase0.yaml#L51
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/mainnet/phase0.yaml#L51
# Ethereum PoW Mainnet
# TODO(zah) These violate the spec (this is a temporary change to allow `make medalla` to work)

View File

@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2018-2020 Status Research & Development GmbH
# Copyright (c) 2018-2021 Status Research & Development GmbH
# Licensed and distributed under either of
# * 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).
@ -16,7 +16,7 @@ import
const
# Misc
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/minimal/phase0.yaml#L5
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/minimal/phase0.yaml#L5
CONFIG_NAME* = "minimal"
# Changed
@ -40,7 +40,7 @@ const
# Gwei values
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/minimal/phase0.yaml#L61
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/minimal/phase0.yaml#L61
# Unchanged
MIN_DEPOSIT_AMOUNT*: uint64 = 2'u64^0 * 10'u64^9
@ -50,7 +50,7 @@ const
# Initial values
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/minimal/phase0.yaml#L73
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/minimal/phase0.yaml#L73
# GENESIS_FORK_VERSION is a runtime preset
@ -58,7 +58,7 @@ const
# Time parameters
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/minimal/phase0.yaml#L80
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/minimal/phase0.yaml#L80
# Changed: Faster to spin up testnets, but does not give validator
# reasonable warning time for genesis
@ -91,7 +91,7 @@ const
# State vector lengths
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/minimal/phase0.yaml#L106
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/minimal/phase0.yaml#L106
# Changed
EPOCHS_PER_HISTORICAL_VECTOR*: uint64 = 64
@ -103,7 +103,7 @@ const
# Reward and penalty quotients
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/minimal/phase0.yaml#L118
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/minimal/phase0.yaml#L118
BASE_REWARD_FACTOR*: uint64 = 2'u64^6
WHISTLEBLOWER_REWARD_QUOTIENT*: uint64 = 2'u64^9
@ -114,7 +114,7 @@ const
# Max operations per block
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/minimal/phase0.yaml#L134
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/minimal/phase0.yaml#L134
MAX_PROPOSER_SLASHINGS*: uint64 = 2'u64 ^ 4
MAX_ATTESTER_SLASHINGS*: uint64 = 2'u64 ^ 1
@ -124,7 +124,7 @@ const
# Deposit contract
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/minimal/phase0.yaml#L52
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/minimal/phase0.yaml#L52
# Ethereum Goerli testnet
DEPOSIT_CHAIN_ID* = 5
@ -132,14 +132,14 @@ const
# Fork choice
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/minimal/phase0.yaml#L32
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/minimal/phase0.yaml#L32
# Changed
SAFE_SLOTS_TO_UPDATE_JUSTIFIED*: uint64 = 2
# Validators
# ---------------------------------------------------------------
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/configs/minimal/phase0.yaml#L38
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/configs/minimal/phase0.yaml#L38
# ETH1_FOLLOW_DISTANCE is a runtime preset

View File

@ -399,7 +399,7 @@ proc handleAttestations(node: BeaconNode, head: BlockRef, slot: Slot) =
# We need to run attestations exactly for the slot that we're attesting to.
# In case blocks went missing, this means advancing past the latest block
# using empty slots as fillers.
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/validator.md#validator-assignments
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/validator.md#validator-assignments
let
epochRef = node.chainDag.getEpochRef(
attestationHead.blck, slot.compute_epoch_at_slot())
@ -711,7 +711,7 @@ proc handleValidatorDuties*(node: BeaconNode, lastSlot, slot: Slot) {.async.} =
updateValidatorMetrics(node) # the important stuff is done, update the vanity numbers
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/validator.md#broadcast-aggregate
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/validator.md#broadcast-aggregate
# If the validator is selected to aggregate (is_aggregator), then they
# broadcast their best aggregate as a SignedAggregateAndProof to the global
# aggregate channel (beacon_aggregate_and_proof) two-thirds of the way