Documentation ¶
Index ¶
- Constants
- func CreateLocalNode(privKey *ecdsa.PrivateKey, storagePath string, ipAddr net.IP, ...) (*enode.LocalNode, error)
- func DiffSubnets(a, b []byte) map[int]byte
- func GetForkVersionEntry(record *enr.Record) (forksprotocol.ForkVersion, error)
- func GetSubnetsEntry(record *enr.Record) ([]byte, error)
- func SetForkVersionEntry(node *enode.LocalNode, forkv string) error
- func SetSubnetsEntry(node *enode.LocalNode, subnets []byte) error
- func SharedSubnets(a, b []byte, maxLen int) []int
- func UpdateSubnets(node *enode.LocalNode, count int, added []int, removed []int) ([]byte, error)
- type ForkVersionEntry
- type NodeInfo
- type NodeMetadata
- type Subnets
Constants ¶
const ( // ZeroSubnets is the representation of no subnets ZeroSubnets = "00000000000000000000000000000000" // AllSubnets is the representation of all subnets AllSubnets = "ffffffffffffffffffffffffffffffff" )
Variables ¶
This section is empty.
Functions ¶
func CreateLocalNode ¶
func CreateLocalNode(privKey *ecdsa.PrivateKey, storagePath string, ipAddr net.IP, udpPort, tcpPort int) (*enode.LocalNode, error)
CreateLocalNode create a new enode.LocalNode instance
func DiffSubnets ¶ added in v0.3.0
DiffSubnets returns a diff of the two given subnets. returns a map with all the different entries and their post change value
func GetForkVersionEntry ¶
func GetForkVersionEntry(record *enr.Record) (forksprotocol.ForkVersion, error)
GetForkVersionEntry extracts the value of operator-id entry ('oid')
func GetSubnetsEntry ¶
GetSubnetsEntry extracts the value of subnets entry from some record
func SetForkVersionEntry ¶
SetForkVersionEntry adds operator-id entry ('oid') to the node
func SetSubnetsEntry ¶
SetSubnetsEntry adds subnets entry to our enode.LocalNode
func SharedSubnets ¶ added in v0.3.0
SharedSubnets returns the shared subnets
Types ¶
type ForkVersionEntry ¶
type ForkVersionEntry string
ForkVersionEntry holds the fork version of the node
func (*ForkVersionEntry) DecodeRLP ¶
func (fv *ForkVersionEntry) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder, required because fork version is a string
func (ForkVersionEntry) ENRKey ¶
func (fv ForkVersionEntry) ENRKey() string
ENRKey implements enr.Entry, returns the entry key
type NodeInfo ¶
type NodeInfo struct { // ForkVersion is the fork version used by the node ForkVersion forksprotocol.ForkVersion // NetworkID is the id of the node's network NetworkID string // Metadata holds node's general information Metadata *NodeMetadata }
NodeInfo holds node's information such as network information. it implements record.Record so we can safely sign, exchange and verify the data. for more information see record.Envelope
func NewNodeInfo ¶
func NewNodeInfo(forkVersion forksprotocol.ForkVersion, networkID string) *NodeInfo
NewNodeInfo creates a new node info
func (*NodeInfo) Domain ¶
Domain is the "signature domain" used when signing and verifying an record.Record
func (*NodeInfo) MarshalRecord ¶
MarshalRecord converts a Record instance to a []byte, so that it can be used as an Envelope payload
func (*NodeInfo) UnmarshalRecord ¶
UnmarshalRecord unmarshals a []byte payload into an instance of a particular Record type
type NodeMetadata ¶
type NodeMetadata struct { // NodeVersion is the ssv-node version, it is a required field NodeVersion string // OperatorID holds a hash of the operator public key, based on operator key OperatorID string // ExecutionNode is the "name/version" of the eth1 node ExecutionNode string // ConsensusNode is the "name/version" of the beacon node ConsensusNode string // Subnets represents the subnets that our node is subscribed to Subnets string }
NodeMetadata holds node's general information
func (*NodeMetadata) Decode ¶
func (nm *NodeMetadata) Decode(data []byte) error
Decode decodes a raw payload into metadata TODO: switch to SSZ
func (*NodeMetadata) Encode ¶
func (nm *NodeMetadata) Encode() ([]byte, error)
Encode encodes the metadata into bytes TODO: switch to SSZ