Documentation
¶
Index ¶
- Constants
- func MsgIDFunction(pmsg *pubsub_pb.Message) string
- type BLSSignature
- type Config
- type DASMessage
- type Discovery
- type Epoch
- type Eth2Node
- func (n *Eth2Node) Close() error
- func (n *Eth2Node) DiscInfo() (peer.ID, []ma.Multiaddr)
- func (n *Eth2Node) ListValidators() (out []ValidatorIndex)
- func (n *Eth2Node) RegisterValidators(indices ...ValidatorIndex)
- func (n *Eth2Node) Start(ip net.IP, port uint16) error
- func (n *Eth2Node) Stats() (peerCount uint64)
- type ExpandedConfig
- func (conf *ExpandedConfig) DasSlowPeerSeed(id peer.ID) (out [32]byte)
- func (conf *ExpandedConfig) DasSlowPeerSlotOffset(peerSeed [32]byte) Slot
- func (conf *ExpandedConfig) DasSlowSubnetIndex(peerSeed [32]byte, slot Slot, i uint64) VerticalIndex
- func (conf *ExpandedConfig) DasSlowSubnetIndices(id peer.ID, slot Slot, dasP uint64) map[VerticalIndex]struct{}
- func (conf *ExpandedConfig) DasSlowSubnetSlotOffset(i uint64) Slot
- func (conf *ExpandedConfig) HorzTopic(i Shard) string
- func (c *ExpandedConfig) MakeSamples(data ShardBlockData) ([]ShardBlockDataChunk, error)
- func (conf *ExpandedConfig) ShardHeadersTopic() string
- func (conf *ExpandedConfig) VertTopic(i VerticalIndex) string
- type MockDiscovery
- type Point
- type PointIndex
- type Root
- type Shard
- type ShardBlock
- type ShardBlockData
- type ShardBlockDataChunk
- func (d *ShardBlockDataChunk) ByteLength() uint64
- func (d *ShardBlockDataChunk) Deserialize(dr *codec.DecodingReader) error
- func (d *ShardBlockDataChunk) FixedLength() uint64
- func (d *ShardBlockDataChunk) HashTreeRoot(hFn tree.HashFn) Root
- func (d *ShardBlockDataChunk) Serialize(w *codec.EncodingWriter) error
- type ShardBlockHeader
- type SignedShardBlock
- type SignedShardBlockHeader
- func (d *SignedShardBlockHeader) ByteLength() uint64
- func (d *SignedShardBlockHeader) Deserialize(dr *codec.DecodingReader) error
- func (d *SignedShardBlockHeader) FixedLength() uint64
- func (d *SignedShardBlockHeader) HashTreeRoot(hFn tree.HashFn) Root
- func (d *SignedShardBlockHeader) Serialize(w *codec.EncodingWriter) error
- type Slot
- type ValidatorIndex
- type VerticalIndex
Constants ¶
const BYTES_PER_DATA_POINT = 31
const BYTES_PER_FULL_POINT = 32
Variables ¶
This section is empty.
Functions ¶
func MsgIDFunction ¶
Types ¶
type BLSSignature ¶
type BLSSignature = beacon.BLSSignature
type Config ¶
type Config struct { // Subset of indices that nodes sample, privately chosen, and replaced quickly FAST_INDICES uint64 // Subset of indices that nodes sample, publicly determined, and replaced slowly SLOW_INDICES uint64 // Maximum number of samples in which the extended points are split into MAX_SAMPLES_PER_SHARD_BLOCK uint64 // Number of points per sample POINTS_PER_SAMPLE uint64 // Maximum of how frequently a fast vertical subnet subscriptions is randomly swapped. // Rotations of a subnet can happen any time between 1 and SLOTS_PER_FAST_ROTATION_MAX (incl) slots. SLOTS_PER_FAST_ROTATION_MAX uint64 // How frequently a slow vertical subnet subscriptions is randomly swapped. // (deterministic on peer ID, so public and predictable) SLOTS_PER_SLOW_ROTATION uint64 // The time for a slow vertical subscription to wait for the previous index to rotate, for stagger effect.. // If SLOW_INDICES > SLOTS_PER_SLOW_ROTATION / SLOT_OFFSET_PER_SLOW_INDEX then multiple indices // may be rotating closer together / at once. This would be considered super-node territory, // not normal, and not a benefit, nor a big negative. SLOT_OFFSET_PER_SLOW_INDEX uint64 // Number of shards SHARD_COUNT uint64 // Number of seconds in each slot SECONDS_PER_SLOT uint64 // Number of active validators VALIDATOR_COUNT uint64 // Fork digest, put in the topic names ForkDigest [4]byte // How many peers we should try to maintain for each of the SLOW_INDICES and FAST_INDICES subnets, when to hit discovery. // Gossipsub will do some peer management for us too, but may not find peers as quickly. TARGET_PEERS_PER_DAS_SUB uint64 // The Low water should be at least TARGET_PEERS_PER_DAS_SUB * (SLOW_INDICES + FAST_INDICES) // if CHUNK_INDEX_SUBNETS is very large compared to (SLOW_INDICES + FAST_INDICES). // However, peers may cover multiple of our SLOW_INDICES and FAST_INDICES topics, so it is OK to have a little less. // We could try and optimize by selecting good short-term peers from the backbone that cover multiple topic needs, // but that seems fragile. PEER_COUNT_LO uint64 // When HI is hit, peers will be pruned back to LO. This pruning happens on a long interval, and is not a hard limit. PEER_COUNT_HI uint64 // To coordinate work between all nodes GENESIS_TIME uint64 // for shuffling shard committees SHUFFLE_ROUND_COUNT uint8 VERT_SUBNET_TOPIC_SCORE_PARAMS *pubsub.TopicScoreParams HORZ_SUBNET_TOPIC_SCORE_PARAMS *pubsub.TopicScoreParams SHARD_HEADERS_TOPIC_SCORE_PARAMS *pubsub.TopicScoreParams GOSSIP_GLOBAL_SCORE_PARAMS *pubsub.PeerScoreParams GOSSIP_GLOBAL_SCORE_THRESHOLDS *pubsub.PeerScoreThresholds // Network settings ENABLE_NAT bool DISABLE_TRANSPORT_SECURITY bool }
func (*Config) Expand ¶
func (c *Config) Expand() ExpandedConfig
func (*Config) SlotWithOffset ¶
type DASMessage ¶
type DASMessage struct { Slot Slot Chunk ShardBlockDataChunk Index VerticalIndex // TODO: does this need a ref to the shard block root, so it can be matched with the header easily? ShardHeaderRoot Root // Proof to show that the chunk is part of the vector commitment in the header. KateProof beacon.BLSPubkey }
func (*DASMessage) ByteLength ¶
func (d *DASMessage) ByteLength() uint64
func (*DASMessage) Deserialize ¶
func (d *DASMessage) Deserialize(dr *codec.DecodingReader) error
func (*DASMessage) FixedLength ¶
func (d *DASMessage) FixedLength() uint64
func (*DASMessage) HashTreeRoot ¶
func (d *DASMessage) HashTreeRoot(hFn tree.HashFn) Root
func (*DASMessage) Serialize ¶
func (d *DASMessage) Serialize(w *codec.EncodingWriter) error
type Discovery ¶
type Discovery interface { FindPublic(conf *ExpandedConfig, slot Slot, subnets map[VerticalIndex]struct{}) map[VerticalIndex][]peer.ID Addrs(id peer.ID) []ma.Multiaddr }
type Eth2Node ¶
type Eth2Node struct {
// contains filtered or unexported fields
}
func (*Eth2Node) ListValidators ¶
func (n *Eth2Node) ListValidators() (out []ValidatorIndex)
func (*Eth2Node) RegisterValidators ¶
func (n *Eth2Node) RegisterValidators(indices ...ValidatorIndex)
type ExpandedConfig ¶
type ExpandedConfig struct { Config // Total number of vertical subnets SAMPLE_SUBNETS uint64 // Max bytes per (unextended) block data blob MAX_DATA_SIZE uint64 }
func (*ExpandedConfig) DasSlowPeerSeed ¶
func (conf *ExpandedConfig) DasSlowPeerSeed(id peer.ID) (out [32]byte)
DasSlowPeerSeed defines a seed specific to the peer. So that its selection of SLOW_INDICES verticalSubnets is different from other honest peers, and predictable.
func (*ExpandedConfig) DasSlowPeerSlotOffset ¶
func (conf *ExpandedConfig) DasSlowPeerSlotOffset(peerSeed [32]byte) Slot
DasSlowPeerSlotOffset defines an offset specific to the peer. All nodes switching public verticalSubnets at the same time is bad, everyone should pic something predictable and somewhat unique. Otherwise honest nodes could accidentally create spikes of network overhead (subnet switches), Hence the offset based on peer ID (this can be cached for other peers too, but is cheap anyway)
func (*ExpandedConfig) DasSlowSubnetIndex ¶
func (conf *ExpandedConfig) DasSlowSubnetIndex(peerSeed [32]byte, slot Slot, i uint64) VerticalIndex
DasSlowSubnetIndex defines how a peer Seed, some slot (with offsets applied), and a SLOW_INDICES entry index map to a subnet choice.
func (*ExpandedConfig) DasSlowSubnetIndices ¶
func (conf *ExpandedConfig) DasSlowSubnetIndices(id peer.ID, slot Slot, dasP uint64) map[VerticalIndex]struct{}
DasSlowSubnetIndices defines to which verticalSubnets a peer is publicly subscribed to at slot, given its index count (its SLOW_INDICES). This could be called to describe remote nodes, with minimal information (just their peer ID and das_p from ENR/metadata)
func (*ExpandedConfig) DasSlowSubnetSlotOffset ¶
func (conf *ExpandedConfig) DasSlowSubnetSlotOffset(i uint64) Slot
DasSlowSubnetSlotOffset defines an offset specific to each entry i of the SLOW_INDICES verticalSubnets, used to avoid sudden updates all at once.
func (*ExpandedConfig) HorzTopic ¶
func (conf *ExpandedConfig) HorzTopic(i Shard) string
func (*ExpandedConfig) MakeSamples ¶
func (c *ExpandedConfig) MakeSamples(data ShardBlockData) ([]ShardBlockDataChunk, error)
func (*ExpandedConfig) ShardHeadersTopic ¶
func (conf *ExpandedConfig) ShardHeadersTopic() string
func (*ExpandedConfig) VertTopic ¶
func (conf *ExpandedConfig) VertTopic(i VerticalIndex) string
type MockDiscovery ¶
peer ID -> list of multi Addresses (excl. /p2p/ component)
func (*MockDiscovery) Addrs ¶
func (m *MockDiscovery) Addrs(id peer.ID) []ma.Multiaddr
Get addrs of a peer, may be nil if the peer is unknown.
func (*MockDiscovery) FindPublic ¶
func (m *MockDiscovery) FindPublic(conf *ExpandedConfig, slot Slot, subnets map[VerticalIndex]struct{}) map[VerticalIndex][]peer.ID
type PointIndex ¶
type PointIndex uint64
type ShardBlock ¶
type ShardBlock struct { ShardParentRoot Root BeaconParentRoot Root Slot Slot Shard Shard ProposerIndex ValidatorIndex Body ShardBlockData }
func (*ShardBlock) ByteLength ¶
func (d *ShardBlock) ByteLength() uint64
func (*ShardBlock) Deserialize ¶
func (d *ShardBlock) Deserialize(dr *codec.DecodingReader) error
func (*ShardBlock) FixedLength ¶
func (d *ShardBlock) FixedLength() uint64
func (*ShardBlock) HashTreeRoot ¶
func (d *ShardBlock) HashTreeRoot(hFn tree.HashFn) Root
func (*ShardBlock) Serialize ¶
func (d *ShardBlock) Serialize(w *codec.EncodingWriter) error
type ShardBlockData ¶
type ShardBlockData []byte
func (*ShardBlockData) ByteLength ¶
func (d *ShardBlockData) ByteLength() uint64
func (*ShardBlockData) Deserialize ¶
func (d *ShardBlockData) Deserialize(dr *codec.DecodingReader) error
func (*ShardBlockData) FixedLength ¶
func (d *ShardBlockData) FixedLength() uint64
func (*ShardBlockData) HashTreeRoot ¶
func (d *ShardBlockData) HashTreeRoot(hFn tree.HashFn) Root
func (*ShardBlockData) Serialize ¶
func (d *ShardBlockData) Serialize(w *codec.EncodingWriter) error
type ShardBlockDataChunk ¶
type ShardBlockDataChunk []byte
TODO naming
func (*ShardBlockDataChunk) ByteLength ¶
func (d *ShardBlockDataChunk) ByteLength() uint64
func (*ShardBlockDataChunk) Deserialize ¶
func (d *ShardBlockDataChunk) Deserialize(dr *codec.DecodingReader) error
func (*ShardBlockDataChunk) FixedLength ¶
func (d *ShardBlockDataChunk) FixedLength() uint64
func (*ShardBlockDataChunk) HashTreeRoot ¶
func (d *ShardBlockDataChunk) HashTreeRoot(hFn tree.HashFn) Root
func (*ShardBlockDataChunk) Serialize ¶
func (d *ShardBlockDataChunk) Serialize(w *codec.EncodingWriter) error
type ShardBlockHeader ¶
type ShardBlockHeader struct { ShardParentRoot Root BeaconParentRoot Root Slot Slot Shard Shard ProposerIndex ValidatorIndex BodyRoot Root }
func (*ShardBlockHeader) ByteLength ¶
func (d *ShardBlockHeader) ByteLength() uint64
func (*ShardBlockHeader) Deserialize ¶
func (d *ShardBlockHeader) Deserialize(dr *codec.DecodingReader) error
func (*ShardBlockHeader) FixedLength ¶
func (d *ShardBlockHeader) FixedLength() uint64
func (*ShardBlockHeader) HashTreeRoot ¶
func (d *ShardBlockHeader) HashTreeRoot(hFn tree.HashFn) Root
func (*ShardBlockHeader) Serialize ¶
func (d *ShardBlockHeader) Serialize(w *codec.EncodingWriter) error
type SignedShardBlock ¶
type SignedShardBlock struct { Message ShardBlock Signature BLSSignature }
func (*SignedShardBlock) ByteLength ¶
func (d *SignedShardBlock) ByteLength() uint64
func (*SignedShardBlock) Deserialize ¶
func (d *SignedShardBlock) Deserialize(dr *codec.DecodingReader) error
func (*SignedShardBlock) FixedLength ¶
func (d *SignedShardBlock) FixedLength() uint64
func (*SignedShardBlock) HashTreeRoot ¶
func (d *SignedShardBlock) HashTreeRoot(hFn tree.HashFn) Root
func (*SignedShardBlock) Serialize ¶
func (d *SignedShardBlock) Serialize(w *codec.EncodingWriter) error
type SignedShardBlockHeader ¶
type SignedShardBlockHeader struct { Message ShardBlockHeader Signature BLSSignature }
func (*SignedShardBlockHeader) ByteLength ¶
func (d *SignedShardBlockHeader) ByteLength() uint64
func (*SignedShardBlockHeader) Deserialize ¶
func (d *SignedShardBlockHeader) Deserialize(dr *codec.DecodingReader) error
func (*SignedShardBlockHeader) FixedLength ¶
func (d *SignedShardBlockHeader) FixedLength() uint64
func (*SignedShardBlockHeader) HashTreeRoot ¶
func (d *SignedShardBlockHeader) HashTreeRoot(hFn tree.HashFn) Root
func (*SignedShardBlockHeader) Serialize ¶
func (d *SignedShardBlockHeader) Serialize(w *codec.EncodingWriter) error
type VerticalIndex ¶
type VerticalIndex uint64