2019-10-01 13:52:28 +00:00
|
|
|
# beacon_chain
|
2020-02-21 12:16:58 +00:00
|
|
|
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
2019-10-01 13:52:28 +00:00
|
|
|
# Licensed and distributed under either of
|
2019-11-25 15:30:02 +00:00
|
|
|
# * 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).
|
2019-10-01 13:52:28 +00:00
|
|
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
|
|
|
|
2020-02-21 12:16:58 +00:00
|
|
|
import strformat
|
|
|
|
|
2019-10-01 13:52:28 +00:00
|
|
|
const
|
|
|
|
topicBeaconBlocks* = "/eth2/beacon_block/ssz"
|
2020-02-21 12:16:58 +00:00
|
|
|
topicAttestationSuffix* = "_beacon_attestation/ssz"
|
2019-10-01 13:52:28 +00:00
|
|
|
topicVoluntaryExits* = "/eth2/voluntary_exit/ssz"
|
|
|
|
topicProposerSlashings* = "/eth2/proposer_slashing/ssz"
|
|
|
|
topicAttesterSlashings* = "/eth2/attester_slashing/ssz"
|
2020-04-01 09:59:55 +00:00
|
|
|
topicAggregateAndProof* = "/eth2/beacon_aggregate_and_proof/ssz"
|
2020-02-21 12:16:58 +00:00
|
|
|
|
2020-03-22 16:03:07 +00:00
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/p2p-interface.md#configuration
|
2020-02-21 12:16:58 +00:00
|
|
|
ATTESTATION_SUBNET_COUNT* = 64
|
|
|
|
|
2020-03-16 22:28:54 +00:00
|
|
|
defaultEth2TcpPort* = 9000
|
|
|
|
|
|
|
|
# This is not part of the spec yet!
|
|
|
|
defaultEth2RpcPort* = 9090
|
|
|
|
|
2020-02-21 12:16:58 +00:00
|
|
|
func getAttestationTopic*(committeeIndex: uint64): string =
|
2020-03-22 16:03:07 +00:00
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/validator.md#broadcast-attestation
|
2020-02-21 18:29:34 +00:00
|
|
|
let topicIndex = committeeIndex mod ATTESTATION_SUBNET_COUNT
|
2020-03-22 16:03:07 +00:00
|
|
|
&"/eth2/committee_index{topicIndex}{topicAttestationSuffix}"
|