ssz

package
v0.0.0-...-ff78b6e Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLowBufferSize    = errors.New("ssz(DecodeSSZ): bad encoding size")
	ErrBadDynamicLength = errors.New("ssz(DecodeSSZ): bad dynamic length")
	ErrBadOffset        = errors.New("ssz(DecodeSSZ): invalid offset")
	ErrBufferNotRounded = errors.New("ssz(DecodeSSZ): badly rounded operator")
	ErrTooBigList       = errors.New("ssz(DecodeSSZ): list too big")
)
View Source
var (
	BaseExtraDataSSZOffsetHeader = 536
	BaseExtraDataSSZOffsetBlock  = 508
)

Functions

func BoolSSZ

func BoolSSZ(b bool) byte

func CalculateIndiciesLimit

func CalculateIndiciesLimit(maxCapacity, numItems, size uint64) uint64

func DecodeDynamicList

func DecodeDynamicList[T Unmarshaler](bytes []byte, start, end uint32, max uint64, version int) ([]T, error)

func DecodeHashList

func DecodeHashList(bytes []byte, start, end, max uint32) ([]common.Hash, error)

func DecodeNumbersList

func DecodeNumbersList(bytes []byte, start, end uint32, max uint64) ([]uint64, error)

func DecodeOffset

func DecodeOffset(x []byte) uint32

ReadOffset unmarshals a little endian uint32 to dst

func DecodeStaticList

func DecodeStaticList[T Unmarshaler](bytes []byte, start, end, bytesPerElement uint32, max uint64, version int) ([]T, error)

func DecodeString

func DecodeString(bytes []byte, start, end, max uint64) ([]byte, error)

func EncodeDynamicList

func EncodeDynamicList[T Marshaler](buf []byte, objs []T) (dst []byte, err error)

func EncodeOffset

func EncodeOffset(buf []byte, offset uint32)

EncodeOffset marshals a little endian uint32 to buf

func MarshalUint64SSZ

func MarshalUint64SSZ(buf []byte, x uint64)

func OffsetSSZ

func OffsetSSZ(x uint32) []byte

func Uint64SSZ

func Uint64SSZ(x uint64) []byte

func UnmarshalUint64SSZ

func UnmarshalUint64SSZ(x []byte) uint64

Types

type EncodableSSZ

type EncodableSSZ interface {
	Marshaler
	Unmarshaler
}

type HashableSSZ

type HashableSSZ interface {
	HashSSZ() ([32]byte, error)
}

type Marshaler

type Marshaler interface {
	EncodeSSZ([]byte) ([]byte, error)
	EncodingSizeSSZ() int
}

type Unmarshaler

type Unmarshaler interface {
	DecodeSSZ(buf []byte, version int) error
	clonable.Clonable
}

Jump to

Keyboard shortcuts

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