Documentation
¶
Index ¶
- Constants
- Variables
- func AnnouncementsLen(types []byte, sizes []uint32, hashes []byte) int
- func BeInt(payload []byte, pos, length int) (int, error)
- func BlobLength(dst *int, src []byte) error
- func Bytes(dst *[]byte, src []byte) error
- func BytesExact(dst *[]byte, src []byte) error
- func EncodeAnnouncements(types []byte, sizes []uint32, hashes []byte, encodeBuf []byte) int
- func EncodeByteArrayAsRlp(raw []byte, w io.Writer, prefixBuf []byte) (int, error)
- func EncodeHash(h, to []byte) int
- func EncodeHashes(hashes []byte, encodeBuf []byte) int
- func EncodeListPrefix(dataLen int, to []byte) int
- func EncodeString(s []byte, to []byte) int
- func EncodeU32(i uint32, to []byte) int
- func EncodeU64(i uint64, to []byte) int
- func GenerateStructLen(buffer []byte, l int) int
- func HashesLen(hashes []byte) int
- func IsEmpty(dst *bool, src []byte) error
- func IsRLPError(err error) bool
- func List(payload []byte, pos int) (dataPos, dataLen int, err error)
- func ListPrefixLen(dataLen int) int
- func ParseAnnouncements(payload []byte, pos int) ([]byte, []uint32, []byte, int, error)
- func ParseHash(payload []byte, pos int, hashbuf []byte) (int, error)
- func Prefix(payload []byte, pos int) (dataPos int, dataLen int, isList bool, err error)
- func ReadElem[T any](d *Decoder, fn func(*T, []byte) error, receiver *T) error
- func Skip(dst *int, src []byte) error
- func String(payload []byte, pos int) (dataPos, dataLen int, err error)
- func StringLen(s []byte) int
- func StringOfLen(payload []byte, pos, expectedLen int) (dataPos int, err error)
- func U256(payload []byte, pos int, x *uint256.Int) (int, error)
- func U256Len(z *uint256.Int) int
- func U32(payload []byte, pos int) (int, uint32, error)
- func U32Len(i uint32) int
- func U64(payload []byte, pos int) (int, uint64, error)
- func U64Len(i uint64) int
- func Uint256(dst *uint256.Int, src []byte) error
- func Uint64(dst *uint64, src []byte) error
- func Unmarshal(data []byte, val any) error
- type Decoder
- func (d *Decoder) Bytes() []byte
- func (d *Decoder) Consumed() []byte
- func (d *Decoder) Elem() ([]byte, Token, error)
- func (d *Decoder) ElemDec() (*Decoder, Token, error)
- func (d *Decoder) Empty() bool
- func (d *Decoder) ForList(fn func(*Decoder) error) error
- func (d *Decoder) Fork() *Decoder
- func (d *Decoder) Offset() int
- func (d *Decoder) PeekByte() (n byte, err error)
- func (d *Decoder) PeekToken() (Token, error)
- func (d *Decoder) RawElem() ([]byte, Token, error)
- func (d *Decoder) RawElemDec() (*Decoder, Token, error)
- func (d *Decoder) ReadByte() (n byte, err error)
- func (d *Decoder) Rebase()
- func (d *Decoder) String() string
- func (d *Decoder) Underlying() []byte
- type Encoder
- func (e *Encoder) Buffer() []byte
- func (e *Encoder) Byte(p byte) *Encoder
- func (e *Encoder) Bytes(p []byte) *Encoder
- func (e *Encoder) List(items ...EncoderFunc) *Encoder
- func (e *Encoder) LongList(items ...EncoderFunc) *Encoder
- func (e *Encoder) LongString(str []byte) *Encoder
- func (e *Encoder) ShortList(items ...EncoderFunc) *Encoder
- func (e *Encoder) ShortString(str []byte) *Encoder
- func (e *Encoder) Str(str []byte) *Encoder
- type EncoderFunc
- type RlpEncodedBytes
- type RlpSerializable
- type RlpSerializableBytes
- type Token
- type Unmarshaler
Constants ¶
const ParseAnnouncementsErrorPrefix = "parse announcement payload"
const ParseHashErrorPrefix = "parse hash payload"
Variables ¶
Functions ¶
func BeInt ¶
BeInt parses Big Endian representation of an integer from given payload at given position
func BlobLength ¶
func BytesExact ¶
func EncodeAnnouncements ¶
EIP-5793: eth/68 - Add tx type to tx announcement
func EncodeByteArrayAsRlp ¶
func EncodeHash ¶
EncodeHash assumes that `to` buffer is already 32bytes long
func EncodeHashes ¶
func EncodeListPrefix ¶
func EncodeString ¶
func GenerateStructLen ¶
func IsRLPError ¶
func ListPrefixLen ¶
func ParseAnnouncements ¶
func Prefix ¶
Prefix parses RLP Prefix from given payload at given position. It returns the offset and length of the RLP element as well as the indication of whether it is a list of string
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
func (*Decoder) Underlying ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
func (*Encoder) List ¶
func (e *Encoder) List(items ...EncoderFunc) *Encoder
List will attempt to write the list of encoder funcs to the buf
func (*Encoder) LongList ¶
func (e *Encoder) LongList(items ...EncoderFunc) *Encoder
LongList will assume that your list payload is more than 55 bytes long, and do no validation as such
func (*Encoder) LongString ¶
String will assume your string is greater than 55 bytes long, and do no validation as such
func (*Encoder) ShortList ¶
func (e *Encoder) ShortList(items ...EncoderFunc) *Encoder
ShortList actually calls List
func (*Encoder) ShortString ¶
String will assume your string is less than 56 bytes long, and do no validation as such
type EncoderFunc ¶
type RlpEncodedBytes ¶
type RlpEncodedBytes []byte
func (RlpEncodedBytes) DoubleRLPLen ¶
func (b RlpEncodedBytes) DoubleRLPLen() int
func (RlpEncodedBytes) RawBytes ¶
func (b RlpEncodedBytes) RawBytes() []byte
func (RlpEncodedBytes) ToDoubleRLP ¶
func (b RlpEncodedBytes) ToDoubleRLP(w io.Writer, prefixBuf []byte) error
type RlpSerializable ¶
type RlpSerializable interface { ToDoubleRLP(io.Writer, []byte) error DoubleRLPLen() int RawBytes() []byte }
RlpSerializable is a value that can be double-RLP coded.
type RlpSerializableBytes ¶
type RlpSerializableBytes []byte
func (RlpSerializableBytes) DoubleRLPLen ¶
func (b RlpSerializableBytes) DoubleRLPLen() int
func (RlpSerializableBytes) RawBytes ¶
func (b RlpSerializableBytes) RawBytes() []byte
func (RlpSerializableBytes) ToDoubleRLP ¶
func (b RlpSerializableBytes) ToDoubleRLP(w io.Writer, prefixBuf []byte) error