Documentation
¶
Index ¶
- Variables
- func AppendZeroPadding(buf []byte, count int) []byte
- func CalculateLimit(maxCapacity, numItems, size uint64) uint64
- func ExpandSlice[T any](src []T, size int) []T
- func MarshalBool(dst []byte, b bool) []byte
- func MarshalOffset(dst []byte, offset int) []byte
- func MarshalUint8(dst []byte, i uint8) []byte
- func MarshalUint16(dst []byte, i uint16) []byte
- func MarshalUint32(dst []byte, i uint32) []byte
- func MarshalUint64(dst []byte, i uint64) []byte
- func NextPowerOfTwo(v uint64) uint
- func ReadOffset(buf []byte) uint64
- func UnmarshalBool(src []byte) bool
- func UnmarshallUint8(src []byte) uint8
- func UnmarshallUint16(src []byte) uint16
- func UnmarshallUint32(src []byte) uint32
- func UnmarshallUint64(src []byte) uint64
- func UpdateOffset(dst []byte, offset int)
- func ZeroBytes() []byte
- type DynamicHashRoot
- type DynamicMarshaler
- type DynamicSizer
- type DynamicSpecs
- type DynamicUnmarshaler
- type FastsszHashRoot
- type FastsszMarshaler
- type FastsszUnmarshaler
- type HashWalker
Constants ¶
This section is empty.
Variables ¶
var ( ErrListTooBig = fmt.Errorf("list length is higher than max value") ErrUnexpectedEOF = fmt.Errorf("unexpected end of SSZ") ErrOffset = fmt.Errorf("incorrect offset") ErrInvalidUnionVariant = fmt.Errorf("invalid union variant") ErrVectorLength = fmt.Errorf("incorrect vector length") ErrNotImplemented = fmt.Errorf("not implemented") )
Functions ¶
func AppendZeroPadding ¶
AppendZeroPadding appends the specified number of zero bytes to buf
func CalculateLimit ¶
func ExpandSlice ¶ added in v1.1.1
ExpandSlice expands a slice to a byte slice
func MarshalBool ¶
MarshalBool marshals a boolean to dst
func MarshalOffset ¶
MarshalOffset marshals an offset to dst
func MarshalUint8 ¶
MarshalUint8 marshals a little endian uint8 to dst
func MarshalUint16 ¶
MarshalUint16 marshals a little endian uint16 to dst
func MarshalUint32 ¶
MarshalUint32 marshals a little endian uint32 to dst
func MarshalUint64 ¶
MarshalUint64 marshals a little endian uint64 to dst
func NextPowerOfTwo ¶ added in v1.1.1
func UnmarshalBool ¶
UnmarshalBool unmarshals a boolean from the src input
func UnmarshallUint8 ¶
UnmarshallUint8 unmarshals a little endian uint8 from the src input
func UnmarshallUint16 ¶
UnmarshallUint16 unmarshals a little endian uint16 from the src input
func UnmarshallUint32 ¶
UnmarshallUint32 unmarshals a little endian uint32 from the src input
func UnmarshallUint64 ¶
UnmarshallUint64 unmarshals a little endian uint64 from the src input
func UpdateOffset ¶
UpdateOffset updates the offset in dst
Types ¶
type DynamicHashRoot ¶
type DynamicHashRoot interface {
HashTreeRootWithDyn(ds DynamicSpecs, hh HashWalker) error
}
type DynamicMarshaler ¶
type DynamicMarshaler interface {
MarshalSSZDyn(ds DynamicSpecs, buf []byte) ([]byte, error)
}
DynamicMarshaler is the interface implemented by types that can marshal themselves using dynamic SSZ
type DynamicSizer ¶
type DynamicSizer interface {
SizeSSZDyn(ds DynamicSpecs) int
}
DynamicSizer is the interface implemented by types that can calculate their own SSZ size dynamically
type DynamicSpecs ¶ added in v1.1.0
DynamicSsz is the interface for a dynamic SSZ encoder/decoder
type DynamicUnmarshaler ¶
type DynamicUnmarshaler interface {
UnmarshalSSZDyn(ds DynamicSpecs, buf []byte) error
}
DynamicUnmarshaler is the interface implemented by types that can unmarshal using dynamic SSZ
type FastsszHashRoot ¶
type FastsszMarshaler ¶
type FastsszMarshaler interface {
MarshalSSZTo(dst []byte) ([]byte, error)
MarshalSSZ() ([]byte, error)
SizeSSZ() int
}
FastsszMarshaler is the interface implemented by types that can marshal themselves into valid SZZ using fastssz.
type FastsszUnmarshaler ¶
FastsszUnmarshaler is the interface implemented by types that can unmarshal a SSZ description of themselves
type HashWalker ¶
type HashWalker interface {
// Hash returns the latest hash generated during merkleize
Hash() []byte
// Methods for appending single values
AppendBool(b bool)
AppendUint8(i uint8)
AppendUint16(i uint16)
AppendUint32(i uint32)
AppendUint64(i uint64)
AppendBytes32(b []byte)
// Methods for putting values into the buffer
PutUint64Array(b []uint64, maxCapacity ...uint64)
PutUint64(i uint64)
PutUint32(i uint32)
PutUint16(i uint16)
PutUint8(i uint8)
PutBitlist(bb []byte, maxSize uint64)
PutProgressiveBitlist(bb []byte)
PutBool(b bool)
PutBytes(b []byte)
// Buffer manipulation methods
FillUpTo32()
Append(i []byte)
Index() int
// temporary buffer methods
WithTemp(func(tmp []byte) []byte)
// Merkleization methods
Merkleize(indx int)
MerkleizeWithMixin(indx int, num, limit uint64)
MerkleizeProgressive(indx int)
MerkleizeProgressiveWithMixin(indx int, num uint64)
MerkleizeProgressiveWithActiveFields(indx int, activeFields []byte)
// HashRoot methods
HashRoot() ([32]byte, error)
}
HashWalker is our own interface that mirrors fastssz.HashWalker This allows us to avoid importing fastssz directly while still being compatible with types that implement HashTreeRootWith