Documentation
¶
Index ¶
- Constants
- Variables
- func BuildMultiAddress(ipAddr, protocol string, port uint, id peer.ID) (ma.Multiaddr, error)
- func CommitteeSubnet(cid spectypes.CommitteeID) uint64
- func CommitteeTopicID(cid spectypes.CommitteeID) []string
- func ECDSAPrivFromInterface(privkey crypto.PrivKey) (*ecdsa.PrivateKey, error)
- func ECDSAPrivToInterface(privkey *ecdsa.PrivateKey) (crypto.PrivKey, error)
- func ECDSAPubFromInterface(pubKey crypto.PubKey) *ecdsa.PublicKey
- func ECDSAPubToInterface(pubkey *ecdsa.PublicKey) (crypto.PubKey, error)
- func GetTopicBaseName(topicName string) string
- func GetTopicFullName(baseName string) string
- func IPAddr() (net.IP, error)
- func SetCommitteeSubnet(bigInt *big.Int, cid spectypes.CommitteeID)
- func SubnetTopicID(subnet uint64) string
- func Topics() []string
- type Subnets
- func (s *Subnets) ActiveCount() int
- func (s *Subnets) Clear(i uint64)
- func (s *Subnets) DiffSubnets(other Subnets) (added Subnets, removed Subnets)
- func (s *Subnets) HasActive() bool
- func (s *Subnets) IsSet(i uint64) bool
- func (s *Subnets) Set(i uint64)
- func (s *Subnets) SharedSubnets(other Subnets) []uint64
- func (s *Subnets) SharedSubnetsN(other Subnets, n int) []uint64
- func (s *Subnets) String() string
- func (s *Subnets) StringHex() string
- func (s *Subnets) StringHumanReadable() string
- func (s *Subnets) SubnetList() []uint64
- func (s *Subnets) ToMap() map[uint64]bool
Constants ¶
const ( // DefaultIP is hte default ip address to use DefaultIP = "127.0.0.1" // DefaultTCP is the default tcp port used in SSV DefaultTCP = 12001 // DefaultUDP is the default udp port used in SSV DefaultUDP = 13001 )
const ( // SubnetsCount returns the subnet count for this fork. It must be power of 2. SubnetsCount = 128 UnknownSubnetId = math.MaxUint64 // UnknownSubnet is used when a validator public key is invalid UnknownSubnet = "unknown" )
Variables ¶
var ( // ZeroSubnets is the representation of no subnets ZeroSubnets = Subnets{/* contains filtered or unexported fields */} // AllSubnets is the representation of all subnets AllSubnets = Subnets{/* contains filtered or unexported fields */} )
Functions ¶
func BuildMultiAddress ¶
BuildMultiAddress creates a multiaddr from the given params
func CommitteeSubnet ¶
func CommitteeSubnet(cid spectypes.CommitteeID) uint64
CommitteeSubnet returns the subnet for the given committee
func CommitteeTopicID ¶
func CommitteeTopicID(cid spectypes.CommitteeID) []string
func ECDSAPrivFromInterface ¶
func ECDSAPrivFromInterface(privkey crypto.PrivKey) (*ecdsa.PrivateKey, error)
ECDSAPrivFromInterface converts crypto.PrivKey back to ecdsa.PrivateKey
func ECDSAPrivToInterface ¶
func ECDSAPrivToInterface(privkey *ecdsa.PrivateKey) (crypto.PrivKey, error)
ECDSAPrivToInterface converts ecdsa.PrivateKey to crypto.PrivKey
func ECDSAPubFromInterface ¶
ECDSAPubFromInterface converts crypto.PubKey to ecdsa.PublicKey
func ECDSAPubToInterface ¶
ECDSAPubToInterface converts ecdsa.PublicKey to crypto.PubKey
func GetTopicBaseName ¶
GetTopicBaseName return the base topic name of the topic, w/o ssv prefix
func GetTopicFullName ¶
GetTopicFullName returns the topic full name, including prefix
func SetCommitteeSubnet ¶
func SetCommitteeSubnet(bigInt *big.Int, cid spectypes.CommitteeID)
SetCommitteeSubnet returns the subnet for the given committee, it doesn't allocate memory but uses the passed in big.Int
func SubnetTopicID ¶
SubnetTopicID returns the topic to use for the given subnet
Types ¶
type Subnets ¶
type Subnets struct {
// contains filtered or unexported fields
}
Subnets holds all the subscribed subnets of a specific node. The array index represents a subnet number, the value holds either 0 or 1 representing if the node is subscribed to the subnet number.
func SubnetsFromString ¶
SubnetsFromString parses a given subnet string
func (*Subnets) ActiveCount ¶
func (*Subnets) DiffSubnets ¶
func (*Subnets) SharedSubnets ¶
SharedSubnets returns the shared subnets
func (*Subnets) String ¶
String returns subnets as a hex-encoded string. DEPRECATED, use StringHex or StringHumanReadable instead, this method is preserved for backward-compatibility since it's used for some p2p-message encoding/decoding.
func (*Subnets) StringHumanReadable ¶
StringHumanReadable returns human-readable subnets representation.
func (*Subnets) SubnetList ¶
SubnetList returns a list of subnets; Each subnet in that list is a number in the range [0, SubnetsCount).