shred

package
v0.0.0-...-3423c7d Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	LegacyCodeID    = uint8(0b0101_1010)
	LegacyDataID    = uint8(0b1010_0101)
	MerkleTypeMask  = uint8(0xF0)
	MerkleDepthMask = uint8(0x0F)
	MerkleCodeID    = uint8(0x40)
	MerkleDataID    = uint8(0x80)
)
View Source
const (
	FlagDataTickMask   = uint8(0b0011_1111)
	FlagDataEndOfBatch = uint8(0b0100_0000)
	FlagDataEndOfBlock = uint8(0b1100_0000)
)
View Source
const (
	RevisionV1 = 1
	RevisionV2 = 2
)
View Source
const (
	LegacyDataV1HeaderSize  = 86
	LegacyDataV2HeaderSize  = 88
	LegacyDataV1PayloadSize = 1057 // TODO where does this number come from?
)

Variables

This section is empty.

Functions

func Concat

func Concat(shreds []Shred) []byte

Types

type CommonHeader

type CommonHeader struct {
	Signature   solana.Signature
	Variant     uint8
	Slot        uint64
	Index       uint32
	Version     uint16
	FECSetIndex uint32
}

func (*CommonHeader) IsCode

func (c *CommonHeader) IsCode() bool

func (*CommonHeader) IsData

func (c *CommonHeader) IsData() bool

func (*CommonHeader) Ok

func (c *CommonHeader) Ok() bool

type DataHeader

type DataHeader struct {
	ParentOffset uint16
	Flags        uint8
	Size         uint16
}

func (*DataHeader) EndOfBatch

func (s *DataHeader) EndOfBatch() bool

func (*DataHeader) EndOfBlock

func (d *DataHeader) EndOfBlock() bool

func (*DataHeader) Tick

func (s *DataHeader) Tick() uint8

type Entry

type Entry struct {
	NumHashes uint64
	Hash      solana.Hash
	Txns      []solana.Transaction
}

func (*Entry) UnmarshalWithDecoder

func (en *Entry) UnmarshalWithDecoder(decoder *bin.Decoder) (err error)

type Shred

type Shred struct {
	CommonHeader
	//CodeHeader
	DataHeader
	Payload    []byte
	MerklePath [][20]byte
}

func NewShredFromSerialized

func NewShredFromSerialized(shred []byte, revision int) (s Shred)

NewShredFromSerialized creates a shred object from the given buffer.

The original slice may be deallocated after this function returns.

func (Shred) MarshalYAML

func (s Shred) MarshalYAML() (any, error)

Jump to

Keyboard shortcuts

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