p2p

package
v0.0.0-...-b9de96a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Code generated by fastssz. DO NOT EDIT. Hash: 2b73fa402e83815608ba5a85896c86d5892a3cc07ef04a7ef05cc1aed2e01983

Code generated by fastssz. DO NOT EDIT. Hash: 06a18560b3a2436dbd9a7c6811342611eaad8ca06357bce307133818589a9ef7

Code generated by fastssz. DO NOT EDIT. Hash: c584b6188398ebb3a8ed514befff07d05cc02fb6735226350f940b0f17a04860

Code generated by fastssz. DO NOT EDIT. Hash: f6659b16b623fb4069e61bfc00661871a4f7d74cf8dbba47b5d5cade0755e09f

Code generated by fastssz. DO NOT EDIT. Hash: 22c562effcbe0d6d288b2af5b025975114d999592f0e6e10b71bb463b47cb093

Code generated by fastssz. DO NOT EDIT. Hash: 5cd34b045feacd7dacf0dc09fba0bb0f9eb91f646be77ad5c600c6e74746af33

Code generated by fastssz. DO NOT EDIT. Hash: b680be60428b7707a66ee1292be79481b7dc168316a1bd8d04385640060b54b3

Code generated by fastssz. DO NOT EDIT. Hash: ee3326d2fa0aed0b4f43a2fc24d337687cfb93e7fc940cd5eca4e5ec47082d8f

Code generated by fastssz. DO NOT EDIT. Hash: 16499077556a40c755f4052cb92884830a72c9cde268528bff7b836b9efa833e

Code generated by fastssz. DO NOT EDIT. Hash: 63ba8db4f7e943eefd40ae9969264778f8e7c9a848ba95b9bb9d615f5c061269

Index

Constants

View Source
const (
	// MsgBlockCmd is a single block element
	MsgBlockCmd = "block"
	// MsgTxCmd is a single tx element
	MsgTxCmd = "tx"
	// MsgDepositsCmd is a deposit slice element
	MsgDepositsCmd = "deposits"
	// MsgVoteCmd is a single vote element
	MsgVoteCmd = "vote"
	// MsgExitsCmd is a exit slice element
	MsgExitsCmd = "exits"
	// MsgVersionCmd is for version handshake
	MsgVersionCmd = "version"
	// MsgGetBlocksCmd ask a node for blocks
	MsgGetBlocksCmd = "getblocks"
	// MsgFinalizationCmd announce a peer to reached state finalization
	MsgFinalizationCmd = "finalized"
	// MsgPartialExitsCmd subtract coins from a contract
	MsgPartialExitsCmd = "partialexit"
)

Variables

View Source
var (
	// ErrorChecksum returned when the message header checksum doesn't match.
	ErrorChecksum = errors.New("message checksum don't match")
	// ErrorAnnLength returned when the header length doesn't match the message length.
	ErrorAnnLength = errors.New("wrong announced length")
	// ErrorSizeExceed returned when the message exceed the maximum payload message.
	ErrorSizeExceed = errors.New("message exceed max payload length")
	// ErrorNetMismatch returned when the message doesn't match the specified network.
	ErrorNetMismatch = errors.New("wrong message network")
)
View Source
var MaxDeposits uint64 = 1024

MaxDeposits define the maximum amount a deposit slice message can contain

View Source
var MaxExits uint64 = 1024

MaxExits define the maximum amount a exits slice message can contain

Functions

func WriteMessage

func WriteMessage(w io.Writer, msg Message, net uint32) error

WriteMessage writes the message to writer

Types

type Message

type Message interface {
	Marshal() ([]byte, error)
	Unmarshal(b []byte) error
	Command() string
	MaxPayloadLength() uint64
	PayloadLength() uint64
}

Message interface for all the messages

func ReadMessage

func ReadMessage(r io.Reader, net uint32) (Message, error)

ReadMessage decodes the message from reader

type MessageHeader

type MessageHeader struct {
	Magic    uint64
	Command  [40]byte `ssz-size:"40"`
	Length   uint64
	Checksum [4]byte `ssz-size:"4"`
}

MessageHeader header of the message

func (*MessageHeader) HashTreeRoot

func (m *MessageHeader) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the MessageHeader object

func (*MessageHeader) HashTreeRootWith

func (m *MessageHeader) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the MessageHeader object with a hasher

func (*MessageHeader) Marshal

func (m *MessageHeader) Marshal() ([]byte, error)

Marshal serializes the data to bytes

func (*MessageHeader) MarshalSSZ

func (m *MessageHeader) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the MessageHeader object

func (*MessageHeader) MarshalSSZTo

func (m *MessageHeader) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the MessageHeader object to a target array

func (*MessageHeader) SizeSSZ

func (m *MessageHeader) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the MessageHeader object

func (*MessageHeader) Unmarshal

func (m *MessageHeader) Unmarshal(b []byte) error

Unmarshal deserializes the data

func (*MessageHeader) UnmarshalSSZ

func (m *MessageHeader) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the MessageHeader object

type MsgBlock

type MsgBlock struct {
	Data *primitives.Block
}

MsgBlock is the struct of the message the is transmitted upon the network.

func (*MsgBlock) Command

func (m *MsgBlock) Command() string

Command returns the message topic

func (*MsgBlock) HashTreeRoot

func (m *MsgBlock) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the MsgBlock object

func (*MsgBlock) HashTreeRootWith

func (m *MsgBlock) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the MsgBlock object with a hasher

func (*MsgBlock) Marshal

func (m *MsgBlock) Marshal() ([]byte, error)

Marshal serializes the data to bytes

func (*MsgBlock) MarshalSSZ

func (m *MsgBlock) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the MsgBlock object

func (*MsgBlock) MarshalSSZTo

func (m *MsgBlock) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the MsgBlock object to a target array

func (*MsgBlock) MaxPayloadLength

func (m *MsgBlock) MaxPayloadLength() uint64

MaxPayloadLength returns the maximum size of the MsgBlock message.

func (*MsgBlock) PayloadLength

func (m *MsgBlock) PayloadLength() uint64

PayloadLength returns the size of the MsgBlock message.

func (*MsgBlock) SizeSSZ

func (m *MsgBlock) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the MsgBlock object

func (*MsgBlock) Unmarshal

func (m *MsgBlock) Unmarshal(b []byte) error

Unmarshal deserializes the data

func (*MsgBlock) UnmarshalSSZ

func (m *MsgBlock) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the MsgBlock object

type MsgDeposits

type MsgDeposits struct {
	Data []*primitives.Deposit `ssz-max:"1024"`
}

MsgDeposits is the struct of the message the is transmitted upon the network.

func (*MsgDeposits) Command

func (m *MsgDeposits) Command() string

Command returns the message topic

func (*MsgDeposits) HashTreeRoot

func (m *MsgDeposits) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the MsgDeposits object

func (*MsgDeposits) HashTreeRootWith

func (m *MsgDeposits) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the MsgDeposits object with a hasher

func (*MsgDeposits) Marshal

func (m *MsgDeposits) Marshal() ([]byte, error)

Marshal serializes the data to bytes

func (*MsgDeposits) MarshalSSZ

func (m *MsgDeposits) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the MsgDeposits object

func (*MsgDeposits) MarshalSSZTo

func (m *MsgDeposits) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the MsgDeposits object to a target array

func (*MsgDeposits) MaxPayloadLength

func (m *MsgDeposits) MaxPayloadLength() uint64

MaxPayloadLength returns the maximum size of the MsgDeposits message.

func (*MsgDeposits) PayloadLength

func (m *MsgDeposits) PayloadLength() uint64

PayloadLength returns the size of the MsgDeposits message.

func (*MsgDeposits) SizeSSZ

func (m *MsgDeposits) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the MsgDeposits object

func (*MsgDeposits) Unmarshal

func (m *MsgDeposits) Unmarshal(b []byte) error

Unmarshal deserializes the data

func (*MsgDeposits) UnmarshalSSZ

func (m *MsgDeposits) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the MsgDeposits object

type MsgExits

type MsgExits struct {
	Data []*primitives.Exit `ssz-max:"1024"`
}

MsgExits is the struct of the message the is transmitted upon the network.

func (*MsgExits) Command

func (m *MsgExits) Command() string

Command returns the message topic

func (*MsgExits) HashTreeRoot

func (m *MsgExits) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the MsgExits object

func (*MsgExits) HashTreeRootWith

func (m *MsgExits) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the MsgExits object with a hasher

func (*MsgExits) Marshal

func (m *MsgExits) Marshal() ([]byte, error)

Marshal serializes the data to bytes

func (*MsgExits) MarshalSSZ

func (m *MsgExits) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the MsgExits object

func (*MsgExits) MarshalSSZTo

func (m *MsgExits) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the MsgExits object to a target array

func (*MsgExits) MaxPayloadLength

func (m *MsgExits) MaxPayloadLength() uint64

MaxPayloadLength returns the maximum size of the MsgExits message.

func (*MsgExits) PayloadLength

func (m *MsgExits) PayloadLength() uint64

PayloadLength returns the size of the MsgExits message.

func (*MsgExits) SizeSSZ

func (m *MsgExits) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the MsgExits object

func (*MsgExits) Unmarshal

func (m *MsgExits) Unmarshal(b []byte) error

Unmarshal deserializes the data

func (*MsgExits) UnmarshalSSZ

func (m *MsgExits) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the MsgExits object

type MsgFinalization

type MsgFinalization struct {
	Tip             uint64
	TipSlot         uint64
	TipHash         [32]byte
	JustifiedSlot   uint64
	JustifiedHeight uint64
	JustifiedHash   [32]byte
	FinalizedSlot   uint64
	FinalizedHeight uint64
	FinalizedHash   [32]byte
}

MsgFinalization is the struct that contains the node information when announcing a finalization.

func (*MsgFinalization) Command

func (m *MsgFinalization) Command() string

Command returns the message topic

func (*MsgFinalization) HashTreeRoot

func (m *MsgFinalization) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the MsgFinalization object

func (*MsgFinalization) HashTreeRootWith

func (m *MsgFinalization) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the MsgFinalization object with a hasher

func (*MsgFinalization) Marshal

func (m *MsgFinalization) Marshal() ([]byte, error)

Marshal serializes the data to bytes

func (*MsgFinalization) MarshalSSZ

func (m *MsgFinalization) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the MsgFinalization object

func (*MsgFinalization) MarshalSSZTo

func (m *MsgFinalization) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the MsgFinalization object to a target array

func (*MsgFinalization) MaxPayloadLength

func (m *MsgFinalization) MaxPayloadLength() uint64

MaxPayloadLength returns the maximum size of the MsgVersion message.

func (*MsgFinalization) PayloadLength

func (m *MsgFinalization) PayloadLength() uint64

PayloadLength returns the size of the MsgFinalization message.

func (*MsgFinalization) SizeSSZ

func (m *MsgFinalization) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the MsgFinalization object

func (*MsgFinalization) Unmarshal

func (m *MsgFinalization) Unmarshal(b []byte) error

Unmarshal deserializes the data

func (*MsgFinalization) UnmarshalSSZ

func (m *MsgFinalization) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the MsgFinalization object

type MsgGetBlocks

type MsgGetBlocks struct {
	LastBlockHash [32]byte
}

MsgGetBlocks is the message that contains the locator to fetch blocks.

func (*MsgGetBlocks) Command

func (m *MsgGetBlocks) Command() string

Command returns the message topic

func (*MsgGetBlocks) HashTreeRoot

func (m *MsgGetBlocks) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the MsgGetBlocks object

func (*MsgGetBlocks) HashTreeRootWith

func (m *MsgGetBlocks) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the MsgGetBlocks object with a hasher

func (*MsgGetBlocks) Marshal

func (m *MsgGetBlocks) Marshal() ([]byte, error)

Marshal serializes the data to bytes

func (*MsgGetBlocks) MarshalSSZ

func (m *MsgGetBlocks) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the MsgGetBlocks object

func (*MsgGetBlocks) MarshalSSZTo

func (m *MsgGetBlocks) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the MsgGetBlocks object to a target array

func (*MsgGetBlocks) MaxPayloadLength

func (m *MsgGetBlocks) MaxPayloadLength() uint64

MaxPayloadLength returns the maximum size of the MsgGetBlocks message.

func (*MsgGetBlocks) PayloadLength

func (m *MsgGetBlocks) PayloadLength() uint64

PayloadLength returns the size of the MsgGetBlocks message.

func (*MsgGetBlocks) SizeSSZ

func (m *MsgGetBlocks) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the MsgGetBlocks object

func (*MsgGetBlocks) Unmarshal

func (m *MsgGetBlocks) Unmarshal(b []byte) error

Unmarshal deserializes the data

func (*MsgGetBlocks) UnmarshalSSZ

func (m *MsgGetBlocks) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the MsgGetBlocks object

type MsgPartialExits

type MsgPartialExits struct {
	Data []*primitives.PartialExit `ssz-max:"1024"`
}

MsgPartialExit is the struct of the message the is transmitted upon the network.

func (*MsgPartialExits) Command

func (m *MsgPartialExits) Command() string

Command returns the message topic

func (*MsgPartialExits) HashTreeRoot

func (m *MsgPartialExits) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the MsgPartialExits object

func (*MsgPartialExits) HashTreeRootWith

func (m *MsgPartialExits) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the MsgPartialExits object with a hasher

func (*MsgPartialExits) Marshal

func (m *MsgPartialExits) Marshal() ([]byte, error)

Marshal serializes the data to bytes

func (*MsgPartialExits) MarshalSSZ

func (m *MsgPartialExits) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the MsgPartialExits object

func (*MsgPartialExits) MarshalSSZTo

func (m *MsgPartialExits) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the MsgPartialExits object to a target array

func (*MsgPartialExits) MaxPayloadLength

func (m *MsgPartialExits) MaxPayloadLength() uint64

MaxPayloadLength returns the maximum size of the MsgExits message.

func (*MsgPartialExits) PayloadLength

func (m *MsgPartialExits) PayloadLength() uint64

PayloadLength returns the size of the MsgPartialExits message.

func (*MsgPartialExits) SizeSSZ

func (m *MsgPartialExits) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the MsgPartialExits object

func (*MsgPartialExits) Unmarshal

func (m *MsgPartialExits) Unmarshal(b []byte) error

Unmarshal deserializes the data

func (*MsgPartialExits) UnmarshalSSZ

func (m *MsgPartialExits) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the MsgPartialExits object

type MsgTx

type MsgTx struct {
	Data *primitives.Tx
}

MsgTx is the struct of the message the is transmitted upon the network.

func (*MsgTx) Command

func (m *MsgTx) Command() string

Command returns the message topic

func (*MsgTx) HashTreeRoot

func (m *MsgTx) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the MsgTx object

func (*MsgTx) HashTreeRootWith

func (m *MsgTx) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the MsgTx object with a hasher

func (*MsgTx) Marshal

func (m *MsgTx) Marshal() ([]byte, error)

Marshal serializes the data to bytes

func (*MsgTx) MarshalSSZ

func (m *MsgTx) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the MsgTx object

func (*MsgTx) MarshalSSZTo

func (m *MsgTx) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the MsgTx object to a target array

func (*MsgTx) MaxPayloadLength

func (m *MsgTx) MaxPayloadLength() uint64

MaxPayloadLength returns the maximum size of the MsgTx message.

func (*MsgTx) PayloadLength

func (m *MsgTx) PayloadLength() uint64

PayloadLength returns the size of the MsgTx message.

func (*MsgTx) SizeSSZ

func (m *MsgTx) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the MsgTx object

func (*MsgTx) Unmarshal

func (m *MsgTx) Unmarshal(b []byte) error

Unmarshal deserializes the data

func (*MsgTx) UnmarshalSSZ

func (m *MsgTx) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the MsgTx object

type MsgVersion

type MsgVersion struct {
	Tip             uint64
	TipSlot         uint64
	TipHash         [32]byte
	Nonce           uint64
	Timestamp       uint64
	JustifiedSlot   uint64
	JustifiedHeight uint64
	JustifiedHash   [32]byte
	FinalizedSlot   uint64
	FinalizedHeight uint64
	FinalizedHash   [32]byte
}

MsgVersion is the struct that contains the node information during the version handshake.

func (*MsgVersion) Command

func (m *MsgVersion) Command() string

Command returns the message topic

func (*MsgVersion) HashTreeRoot

func (m *MsgVersion) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the MsgVersion object

func (*MsgVersion) HashTreeRootWith

func (m *MsgVersion) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the MsgVersion object with a hasher

func (*MsgVersion) Marshal

func (m *MsgVersion) Marshal() ([]byte, error)

Marshal serializes the data to bytes

func (*MsgVersion) MarshalSSZ

func (m *MsgVersion) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the MsgVersion object

func (*MsgVersion) MarshalSSZTo

func (m *MsgVersion) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the MsgVersion object to a target array

func (*MsgVersion) MaxPayloadLength

func (m *MsgVersion) MaxPayloadLength() uint64

MaxPayloadLength returns the maximum size of the MsgVersion message.

func (*MsgVersion) PayloadLength

func (m *MsgVersion) PayloadLength() uint64

PayloadLength returns the size of the MsgVersion message.

func (*MsgVersion) SizeSSZ

func (m *MsgVersion) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the MsgVersion object

func (*MsgVersion) Unmarshal

func (m *MsgVersion) Unmarshal(b []byte) error

Unmarshal deserializes the data

func (*MsgVersion) UnmarshalSSZ

func (m *MsgVersion) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the MsgVersion object

type MsgVote

type MsgVote struct {
	Data *primitives.MultiValidatorVote
}

MsgVote is the struct of the message the is transmitted upon the network.

func (*MsgVote) Command

func (m *MsgVote) Command() string

Command returns the message topic

func (*MsgVote) HashTreeRoot

func (m *MsgVote) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the MsgVote object

func (*MsgVote) HashTreeRootWith

func (m *MsgVote) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the MsgVote object with a hasher

func (*MsgVote) Marshal

func (m *MsgVote) Marshal() ([]byte, error)

Marshal serializes the data to bytes

func (*MsgVote) MarshalSSZ

func (m *MsgVote) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the MsgVote object

func (*MsgVote) MarshalSSZTo

func (m *MsgVote) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the MsgVote object to a target array

func (*MsgVote) MaxPayloadLength

func (m *MsgVote) MaxPayloadLength() uint64

MaxPayloadLength returns the maximum size of the MsgVote message.

func (*MsgVote) PayloadLength

func (m *MsgVote) PayloadLength() uint64

PayloadLength returns the size of the MsgVote message.

func (*MsgVote) SizeSSZ

func (m *MsgVote) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the MsgVote object

func (*MsgVote) Unmarshal

func (m *MsgVote) Unmarshal(b []byte) error

Unmarshal deserializes the data

func (*MsgVote) UnmarshalSSZ

func (m *MsgVote) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the MsgVote object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL