types

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package types contains all the respective p2p types that are required for sync but cannot be represented as a protobuf schema. This package also contains those types associated fast ssz methods.

Index

Constants

View Source
const (
	// Spec defined codes.
	GoodbyeCodeClientShutdown RPCGoodbyeCode = iota + 1
	GoodbyeCodeWrongNetwork
	GoodbyeCodeGenericError

	// Teku specific codes
	GoodbyeCodeUnableToVerifyNetwork = RPCGoodbyeCode(128)

	// Lighthouse specific codes
	GoodbyeCodeTooManyPeers = RPCGoodbyeCode(129)
	GoodbyeCodeBadScore     = RPCGoodbyeCode(250)
	GoodbyeCodeBanned       = RPCGoodbyeCode(251)
)

Variables

View Source
var (
	// BlockMap maps the fork-version to the underlying data type for that
	// particular fork period.
	BlockMap map[[4]byte]func() (interfaces.ReadOnlySignedBeaconBlock, error)
	// MetaDataMap maps the fork-version to the underlying data type for that
	// particular fork period.
	MetaDataMap map[[4]byte]func() metadata.Metadata
)
View Source
var (
	ErrWrongForkDigestVersion = errors.New("wrong fork digest version")
	ErrInvalidEpoch           = errors.New("invalid epoch")
	ErrInvalidFinalizedRoot   = errors.New("invalid finalized root")
	ErrInvalidSequenceNum     = errors.New("invalid sequence number provided")
	ErrGeneric                = errors.New("internal service error")
	ErrInvalidParent          = errors.New("mismatched parent root")
	ErrRateLimited            = errors.New("rate limited")
	ErrIODeadline             = errors.New("i/o deadline exceeded")
	ErrInvalidRequest         = errors.New("invalid range, step or count")
	ErrBlobLTMinRequest       = errors.New("blob slot < minimum_request_epoch")
	ErrMaxBlobReqExceeded     = errors.New("requested more than MAX_REQUEST_BLOB_SIDECARS")
)
View Source
var GoodbyeCodeMessages = map[RPCGoodbyeCode]string{
	GoodbyeCodeClientShutdown:        "client shutdown",
	GoodbyeCodeWrongNetwork:          "irrelevant network",
	GoodbyeCodeGenericError:          "fault/error",
	GoodbyeCodeUnableToVerifyNetwork: "unable to verify network",
	GoodbyeCodeTooManyPeers:          "client has too many peers",
	GoodbyeCodeBadScore:              "peer score too low",
	GoodbyeCodeBanned:                "client banned this node",
}

GoodbyeCodeMessages defines a mapping between goodbye codes and string messages.

Functions

func InitializeDataMaps

func InitializeDataMaps()

InitializeDataMaps initializes all the relevant object maps. This function is called to reset maps and reinitialize them.

Types

type BeaconBlockByRootsReq

type BeaconBlockByRootsReq [][rootLength]byte

BeaconBlockByRootsReq specifies the block by roots request type.

func (*BeaconBlockByRootsReq) MarshalSSZ

func (r *BeaconBlockByRootsReq) MarshalSSZ() ([]byte, error)

MarshalSSZ Marshals the block by roots request type into the serialized object.

func (*BeaconBlockByRootsReq) MarshalSSZTo

func (r *BeaconBlockByRootsReq) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo marshals the block by roots request with the provided byte slice.

func (*BeaconBlockByRootsReq) SizeSSZ

func (r *BeaconBlockByRootsReq) SizeSSZ() int

SizeSSZ returns the size of the serialized representation.

func (*BeaconBlockByRootsReq) UnmarshalSSZ

func (r *BeaconBlockByRootsReq) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ unmarshals the provided bytes buffer into the block by roots request object.

type BlobSidecarsByRootReq

type BlobSidecarsByRootReq []*eth.BlobIdentifier

BlobSidecarsByRootReq is used to specify a list of blob targets (root+index) in a BlobSidecarsByRoot RPC request.

func (BlobSidecarsByRootReq) Len

func (s BlobSidecarsByRootReq) Len() int

Len is the number of elements in the collection.

func (BlobSidecarsByRootReq) Less

func (s BlobSidecarsByRootReq) Less(i, j int) bool

Less reports whether the element with index i must sort before the element with index j. BlobIdentifier will be sorted in lexicographic order by root, with Blob Index as tiebreaker for a given root.

func (*BlobSidecarsByRootReq) MarshalSSZ

func (b *BlobSidecarsByRootReq) MarshalSSZ() ([]byte, error)

MarshalSSZ serializes the BlobSidecarsByRootReq value to a byte slice.

func (*BlobSidecarsByRootReq) MarshalSSZTo

func (b *BlobSidecarsByRootReq) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo appends the serialized BlobSidecarsByRootReq value to the provided byte slice.

func (*BlobSidecarsByRootReq) SizeSSZ

func (b *BlobSidecarsByRootReq) SizeSSZ() int

SizeSSZ returns the size of the serialized representation.

func (BlobSidecarsByRootReq) Swap

func (s BlobSidecarsByRootReq) Swap(i, j int)

Swap swaps the elements with indexes i and j.

func (*BlobSidecarsByRootReq) UnmarshalSSZ

func (b *BlobSidecarsByRootReq) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ unmarshals the provided bytes buffer into the BlobSidecarsByRootReq value.

type ErrorMessage

type ErrorMessage []byte

ErrorMessage describes the error message type.

func (*ErrorMessage) MarshalSSZ

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

MarshalSSZ Marshals the error message into the serialized object.

func (*ErrorMessage) MarshalSSZTo

func (m *ErrorMessage) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo marshals the error message with the provided byte slice.

func (*ErrorMessage) SizeSSZ

func (m *ErrorMessage) SizeSSZ() int

SizeSSZ returns the size of the serialized representation.

func (*ErrorMessage) UnmarshalSSZ

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

UnmarshalSSZ unmarshals the provided bytes buffer into the error message object.

type RPCGoodbyeCode

type RPCGoodbyeCode = primitives.SSZUint64

RPCGoodbyeCode represents goodbye code, used in sync package.

func ErrToGoodbyeCode

func ErrToGoodbyeCode(err error) RPCGoodbyeCode

ErrToGoodbyeCode converts given error to RPC goodbye code.

type SSZBytes

type SSZBytes []byte

SSZBytes is a bytes slice that satisfies the fast-ssz interface.

func (*SSZBytes) HashTreeRoot

func (b *SSZBytes) HashTreeRoot() ([32]byte, error)

HashTreeRoot hashes the uint64 object following the SSZ standard.

func (*SSZBytes) HashTreeRootWith

func (b *SSZBytes) HashTreeRootWith(hh *ssz.Hasher) error

HashTreeRootWith hashes the uint64 object with the given hasher.

Jump to

Keyboard shortcuts

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