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
- Variables
- type BeaconBlockByRootsReq
- type ErrorMessage
- type RPCGoodbyeCode
- type SSZBytes
- type SSZUint64
- func (s *SSZUint64) HashTreeRoot() ([32]byte, error)
- func (s *SSZUint64) HashTreeRootWith(hh *ssz.Hasher) error
- func (s *SSZUint64) MarshalSSZ() ([]byte, error)
- func (s *SSZUint64) MarshalSSZTo(dst []byte) ([]byte, error)
- func (s *SSZUint64) SizeSSZ() int
- func (s *SSZUint64) UnmarshalSSZ(buf []byte) error
Constants ¶
const ( // Spec defined codes. GoodbyeCodeClientShutdown RPCGoodbyeCode = iota GoodbyeCodeWrongNetwork GoodbyeCodeGenericError // Teku specific codes GoodbyeCodeUnableToVerifyNetwork = RPCGoodbyeCode(128) // Lighthouse specific codes GoodbyeCodeTooManyPeers = RPCGoodbyeCode(129) GoodbyeCodeBadScore = RPCGoodbyeCode(250) GoodbyeCodeBanned = RPCGoodbyeCode(251) )
Variables ¶
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") )
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 ¶
This section is empty.
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 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 = 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 ¶ added in v1.2.0
type SSZBytes []byte
SSZUint64 is a bytes slice that satisfies the fast-ssz interface.
func (*SSZBytes) HashTreeRoot ¶ added in v1.2.0
HashTreeRoot hashes the uint64 object following the SSZ standard.
type SSZUint64 ¶
type SSZUint64 uint64
SSZUint64 is a uint64 type that satisfies the fast-ssz interface.
func (*SSZUint64) HashTreeRoot ¶ added in v1.2.0
HashTreeRoot hashes the uint64 object following the SSZ standard.
func (*SSZUint64) HashTreeRootWith ¶ added in v1.2.0
HashTreeRootWith hashes the uint64 object with the given hasher.
func (*SSZUint64) MarshalSSZ ¶
MarshalSSZ Marshals the uint64 type into the serialized object.
func (*SSZUint64) MarshalSSZTo ¶
MarshalSSZTo marshals the uint64 with the provided byte slice.
func (*SSZUint64) UnmarshalSSZ ¶
UnmarshalSSZ unmarshals the provided bytes buffer into the uint64 object.