p2p-interface spec ref bump (except non-updated places) (#1862)
This commit is contained in:
parent
15c989f70d
commit
3ee2dd8da4
|
@ -261,7 +261,7 @@ proc validateAttestation*(
|
||||||
|
|
||||||
ok(attesting_indices)
|
ok(attesting_indices)
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
||||||
proc validateAggregate*(
|
proc validateAggregate*(
|
||||||
pool: var AttestationPool,
|
pool: var AttestationPool,
|
||||||
signedAggregateAndProof: SignedAggregateAndProof, wallTime: BeaconTime):
|
signedAggregateAndProof: SignedAggregateAndProof, wallTime: BeaconTime):
|
||||||
|
|
|
@ -324,14 +324,14 @@ func verifyFinalization(node: BeaconNode, slot: Slot) =
|
||||||
proc installAttestationSubnetHandlers(node: BeaconNode, subnets: set[uint8]) =
|
proc installAttestationSubnetHandlers(node: BeaconNode, subnets: set[uint8]) =
|
||||||
var attestationSubscriptions: seq[Future[void]] = @[]
|
var attestationSubscriptions: seq[Future[void]] = @[]
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
||||||
for subnet in subnets:
|
for subnet in subnets:
|
||||||
attestationSubscriptions.add(node.network.subscribe(
|
attestationSubscriptions.add(node.network.subscribe(
|
||||||
getAttestationTopic(node.forkDigest, subnet)))
|
getAttestationTopic(node.forkDigest, subnet)))
|
||||||
|
|
||||||
waitFor allFutures(attestationSubscriptions)
|
waitFor allFutures(attestationSubscriptions)
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#metadata
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#metadata
|
||||||
node.network.metadata.seq_number += 1
|
node.network.metadata.seq_number += 1
|
||||||
for subnet in subnets:
|
for subnet in subnets:
|
||||||
node.network.metadata.attnets[subnet] = true
|
node.network.metadata.attnets[subnet] = true
|
||||||
|
@ -373,7 +373,7 @@ proc cycleAttestationSubnets(node: BeaconNode, slot: Slot) =
|
||||||
|
|
||||||
waitFor allFutures(unsubscriptions)
|
waitFor allFutures(unsubscriptions)
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#metadata
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#metadata
|
||||||
# The race condition window is smaller by placing the fast, local, and
|
# The race condition window is smaller by placing the fast, local, and
|
||||||
# synchronous operation after a variable-latency, asynchronous action.
|
# synchronous operation after a variable-latency, asynchronous action.
|
||||||
node.network.metadata.seq_number += 1
|
node.network.metadata.seq_number += 1
|
||||||
|
@ -810,7 +810,7 @@ proc installRpcHandlers(rpcServer: RpcServer, node: BeaconNode) =
|
||||||
rpcServer.installDebugApiHandlers(node)
|
rpcServer.installDebugApiHandlers(node)
|
||||||
|
|
||||||
proc installMessageValidators(node: BeaconNode) =
|
proc installMessageValidators(node: BeaconNode) =
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#attestations-and-aggregation
|
||||||
# These validators stay around the whole time, regardless of which specific
|
# These validators stay around the whole time, regardless of which specific
|
||||||
# subnets are subscribed to during any given epoch.
|
# subnets are subscribed to during any given epoch.
|
||||||
for it in 0'u64 ..< ATTESTATION_SUBNET_COUNT.uint64:
|
for it in 0'u64 ..< ATTESTATION_SUBNET_COUNT.uint64:
|
||||||
|
|
|
@ -262,7 +262,7 @@ proc addRawBlock*(
|
||||||
|
|
||||||
return err((EVRESULT_IGNORE, MissingParent))
|
return err((EVRESULT_IGNORE, MissingParent))
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#beacon_block
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#beacon_block
|
||||||
proc isValidBeaconBlock*(
|
proc isValidBeaconBlock*(
|
||||||
dag: ChainDAGRef, quarantine: var QuarantineRef,
|
dag: ChainDAGRef, quarantine: var QuarantineRef,
|
||||||
signed_beacon_block: SignedBeaconBlock, current_slot: Slot,
|
signed_beacon_block: SignedBeaconBlock, current_slot: Slot,
|
||||||
|
|
|
@ -164,7 +164,7 @@ type
|
||||||
MounterProc* = proc(network: Eth2Node) {.gcsafe.}
|
MounterProc* = proc(network: Eth2Node) {.gcsafe.}
|
||||||
MessageContentPrinter* = proc(msg: pointer): string {.gcsafe.}
|
MessageContentPrinter* = proc(msg: pointer): string {.gcsafe.}
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#goodbye
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#goodbye
|
||||||
DisconnectionReason* = enum
|
DisconnectionReason* = enum
|
||||||
# might see other values on the wire!
|
# might see other values on the wire!
|
||||||
ClientShutDown = 1
|
ClientShutDown = 1
|
||||||
|
|
|
@ -139,7 +139,7 @@ func getVoluntaryExitsForBlock*(pool: var ExitPool):
|
||||||
getExitMessagesForBlock[SignedVoluntaryExit](
|
getExitMessagesForBlock[SignedVoluntaryExit](
|
||||||
pool.voluntary_exits, pool, MAX_VOLUNTARY_EXITS)
|
pool.voluntary_exits, pool, MAX_VOLUNTARY_EXITS)
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#attester_slashing
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#attester_slashing
|
||||||
proc validateAttesterSlashing*(
|
proc validateAttesterSlashing*(
|
||||||
pool: var ExitPool, attester_slashing: AttesterSlashing):
|
pool: var ExitPool, attester_slashing: AttesterSlashing):
|
||||||
Result[bool, (ValidationResult, cstring)] =
|
Result[bool, (ValidationResult, cstring)] =
|
||||||
|
@ -180,7 +180,7 @@ proc validateAttesterSlashing*(
|
||||||
|
|
||||||
ok(true)
|
ok(true)
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#proposer_slashing
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#proposer_slashing
|
||||||
proc validateProposerSlashing*(
|
proc validateProposerSlashing*(
|
||||||
pool: var ExitPool, proposer_slashing: ProposerSlashing):
|
pool: var ExitPool, proposer_slashing: ProposerSlashing):
|
||||||
Result[bool, (ValidationResult, cstring)] =
|
Result[bool, (ValidationResult, cstring)] =
|
||||||
|
@ -210,7 +210,7 @@ proc validateProposerSlashing*(
|
||||||
|
|
||||||
ok(true)
|
ok(true)
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#voluntary_exit
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#voluntary_exit
|
||||||
proc validateVoluntaryExit*(
|
proc validateVoluntaryExit*(
|
||||||
pool: var ExitPool, signed_voluntary_exit: SignedVoluntaryExit):
|
pool: var ExitPool, signed_voluntary_exit: SignedVoluntaryExit):
|
||||||
Result[bool, (ValidationResult, cstring)] =
|
Result[bool, (ValidationResult, cstring)] =
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# * 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).
|
||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/tests/core/pyspec/eth2spec/utils/merkle_minimal.py
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/tests/core/pyspec/eth2spec/utils/merkle_minimal.py
|
||||||
|
|
||||||
# Merkle tree helpers
|
# Merkle tree helpers
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
|
@ -525,7 +525,7 @@ func get_indexed_attestation*(state: BeaconState, attestation: TrustedAttestatio
|
||||||
# Attestation validation
|
# Attestation validation
|
||||||
# ------------------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------------------
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/beacon-chain.md#attestations
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/beacon-chain.md#attestations
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id
|
||||||
|
|
||||||
func check_attestation_slot_target*(data: AttestationData): Result[void, cstring] =
|
func check_attestation_slot_target*(data: AttestationData): Result[void, cstring] =
|
||||||
if not (data.target.epoch == compute_epoch_at_slot(data.slot)):
|
if not (data.target.epoch == compute_epoch_at_slot(data.slot)):
|
||||||
|
|
|
@ -12,7 +12,7 @@ import
|
||||||
./datatypes, ./helpers, ./validator
|
./datatypes, ./helpers, ./validator
|
||||||
|
|
||||||
const
|
const
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#topics-and-messages
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#topics-and-messages
|
||||||
topicBeaconBlocksSuffix* = "beacon_block/ssz"
|
topicBeaconBlocksSuffix* = "beacon_block/ssz"
|
||||||
topicVoluntaryExitsSuffix* = "voluntary_exit/ssz"
|
topicVoluntaryExitsSuffix* = "voluntary_exit/ssz"
|
||||||
topicProposerSlashingsSuffix* = "proposer_slashing/ssz"
|
topicProposerSlashingsSuffix* = "proposer_slashing/ssz"
|
||||||
|
@ -22,7 +22,7 @@ const
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/validator.md#misc
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/validator.md#misc
|
||||||
ATTESTATION_SUBNET_COUNT* = 64
|
ATTESTATION_SUBNET_COUNT* = 64
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#eth2-network-interaction-domains
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#eth2-network-interaction-domains
|
||||||
MAX_CHUNK_SIZE* = 1 * 1024 * 1024 # bytes
|
MAX_CHUNK_SIZE* = 1 * 1024 * 1024 # bytes
|
||||||
GOSSIP_MAX_SIZE* = 1 * 1024 * 1024 # bytes
|
GOSSIP_MAX_SIZE* = 1 * 1024 * 1024 # bytes
|
||||||
TTFB_TIMEOUT* = 5.seconds
|
TTFB_TIMEOUT* = 5.seconds
|
||||||
|
|
|
@ -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/v0.12.3/ssz/simple-serialize.md#merkleization
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/ssz/simple-serialize.md#merkleization
|
||||||
|
|
||||||
{.push raises: [Defect].}
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{.pragma: raisesssz, raises: [Defect, MalformedSszError, SszSizeMismatchError].}
|
{.pragma: raisesssz, raises: [Defect, MalformedSszError, SszSizeMismatchError].}
|
||||||
|
|
||||||
## 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/v0.12.3/ssz/simple-serialize.md#serialization
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/ssz/simple-serialize.md#serialization
|
||||||
|
|
||||||
import
|
import
|
||||||
typetraits, options,
|
typetraits, options,
|
||||||
|
|
|
@ -16,7 +16,7 @@ type
|
||||||
## which blocks are valid - in particular, blocks are not valid if they
|
## which blocks are valid - in particular, blocks are not valid if they
|
||||||
## come from the future as seen from the local clock.
|
## come from the future as seen from the local clock.
|
||||||
##
|
##
|
||||||
## https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/fork-choice.md#fork-choice
|
## https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/fork-choice.md#fork-choice
|
||||||
##
|
##
|
||||||
# TODO replace time in chronos with a proper unit type, then this code can
|
# TODO replace time in chronos with a proper unit type, then this code can
|
||||||
# follow:
|
# follow:
|
||||||
|
|
|
@ -593,7 +593,7 @@ proc handleValidatorDuties*(
|
||||||
"Waiting to aggregate attestations")
|
"Waiting to aggregate attestations")
|
||||||
|
|
||||||
const TRAILING_DISTANCE = 1
|
const TRAILING_DISTANCE = 1
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.3/specs/phase0/p2p-interface.md#configuration
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#configuration
|
||||||
static:
|
static:
|
||||||
doAssert TRAILING_DISTANCE <= ATTESTATION_PROPAGATION_SLOT_RANGE
|
doAssert TRAILING_DISTANCE <= ATTESTATION_PROPAGATION_SLOT_RANGE
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ const
|
||||||
RewardsDirLeak = RewardsDirBase/"leak"/"pyspec_tests"
|
RewardsDirLeak = RewardsDirBase/"leak"/"pyspec_tests"
|
||||||
RewardsDirRandom = RewardsDirBase/"random"/"pyspec_tests"
|
RewardsDirRandom = RewardsDirBase/"random"/"pyspec_tests"
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/tree/v0.12.3/tests/formats/rewards#rewards-tests
|
# https://github.com/ethereum/eth2.0-specs/tree/v1.0.0-rc.0/tests/formats/rewards#rewards-tests
|
||||||
type Deltas = object
|
type Deltas = object
|
||||||
rewards: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
rewards: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||||
penalties: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
penalties: List[uint64, Limit VALIDATOR_REGISTRY_LIMIT]
|
||||||
|
|
Loading…
Reference in New Issue