cell

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 23 Imported by: 163

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAddressTypeNotSupported = errors.New("address type is not supported")
View Source
var ErrAugmentationSemanticsUnavailable = errors.New("augmented dict was loaded without augmentation semantics; provide an augmentation in LoadAugDict to enable mutation and extra validation")
View Source
var ErrCellDepthLimit = errors.New("cell depth exceeds max depth")
View Source
var ErrDictHasSpecialCells = errors.New("has special cells in tree structure")
View Source
var ErrInvalidSize = errors.New("size should be positive")
View Source
var ErrLabelExceedsKeyBits = errors.New("label exceeds remaining key bits")
View Source
var ErrLazyLoaderNotSet = errors.New("lazy pruned ref loader is not set")
View Source
var ErrLazyRefNotFound = errors.New("lazy pruned ref not found")
View Source
var ErrNegative = errors.New("value should be non negative")
View Source
var ErrNilBigInt = errors.New("value cannot be nil")
View Source
var ErrNoMoreRefs = errors.New("no more refs exists")
View Source
var ErrNoSuchKeyInDict = errors.New("no such key in dict")
View Source
var ErrNotEnoughData = func(has, need int) error {
	return NotEnoughDataError{Has: has, Need: need}
}
View Source
var ErrNotFit1023 = errors.New("cell data size should fit into 1023 bits")
View Source
var ErrRefCannotBeNil = errors.New("ref cannot be nil")
View Source
var ErrSmallSlice = errors.New("too small slice for this size")
View Source
var ErrTooBigSize = errors.New("too big size")
View Source
var ErrTooBigValue = errors.New("too big value")
View Source
var ErrTooMuchRefs = errors.New("too much refs")
View Source
var MaxBOCCells = 1 << 20

MaxBOCCells limits how many cells may be decoded from a single BOC payload, including the improved compression/decompression path. Set it to 0 or a negative value to disable the limit.

View Source
var MaxBOCRoots = 16384

MaxBOCRoots limits how many roots may be decoded from a single BOC payload, including the improved compression/decompression path. Set it to 0 or a negative value to disable the limit.

View Source
var ParallelBOCMinCells = 16384

ParallelBOCMinCells sets the minimum number of cells in a parsed BoC before hash finalization is spread across CPU cores. Set it to 0 or a negative value to always finalize sequentially.

Functions

func AppendBOCWithOptions added in v1.18.0

func AppendBOCWithOptions(dst []byte, roots []*Cell, opts BOCSerializeOptions) ([]byte, error)

AppendBOCWithOptions serializes roots into BoC and appends the result to dst.

func ApplyMerkleUpdate added in v1.17.0

func ApplyMerkleUpdate(from, update *Cell) (*Cell, MerkleUpdateReuse, error)

ApplyMerkleUpdate applies update to from and returns the new root with hashes of old-state subtrees reused through pruned boundaries.

func CheckProof added in v1.6.0

func CheckProof(proof *Cell, hash []byte) error

func CheckProofVirtualized added in v1.17.0

func CheckProofVirtualized(proof *Cell, hash []byte) error

func CompressBOC added in v1.17.0

func CompressBOC(roots []*Cell, algo CompressionAlgorithm, state *Cell) ([]byte, error)

func ComputeFileHash added in v1.17.0

func ComputeFileHash(root *Cell) []byte

func FromBOCMultiRootReader added in v1.17.0

func FromBOCMultiRootReader(reader io.Reader, options BOCParseOptions) ([]*Cell, []Cell, error)

func IsNotEnoughDataError added in v1.18.0

func IsNotEnoughDataError(err error) bool

IsNotEnoughDataError reports whether err wraps a NotEnoughDataError. It walks the unwrap chain manually to avoid errors.As target boxing.

func MayApplyMerkleUpdate added in v1.17.0

func MayApplyMerkleUpdate(from, update *Cell) error

func NeedStateForDecompression added in v1.17.0

func NeedStateForDecompression(data []byte) (bool, error)

func ToBOCWithFlags deprecated added in v1.8.0

func ToBOCWithFlags(roots []*Cell, flags ...bool) []byte

ToBOCWithFlags serializes roots into BOC using the legacy boolean-flag API. Flags are: first - withCRC, second - withIndex, third - withCache, fourth - withTopHash, fifth - withIntHashes.

Deprecated: use ToBOCWithOptions instead.

func ToBOCWithOptions added in v1.17.0

func ToBOCWithOptions(roots []*Cell, opts BOCSerializeOptions) []byte

func ToBOCWithOptionsErr added in v1.17.0

func ToBOCWithOptionsErr(roots []*Cell, opts BOCSerializeOptions) ([]byte, error)

func ToLargeBOC added in v1.17.0

func ToLargeBOC(w io.Writer, rootHashes []Hash, opts BOCSerializeOptions, loader LargeBOCLoader, cellsCountHint uint64, loadBatchSize int) error

ToLargeBOC serializes roots into BoC and writes the result to w. It follows the same large-BOC shape as the C++ serializer: cells are imported by hash in batches, only compact metadata is retained, and payload records are loaded again in final serialization order. loadBatchSize controls the maximum number of cell records loaded by one loader call.

func ToLargeBOCOnePass added in v1.17.0

func ToLargeBOCOnePass(w io.Writer, rootHashes []Hash, opts BOCSerializeOptions, loader LargeBOCOnePassLoader, cellsCountHint uint64, loadBatchSize int) error

ToLargeBOCOnePass serializes roots into BoC and writes the result to w. It imports cell metadata and payload data together, so backing storage is read once. Payloads are retained until final serialization, which uses more memory than ToLargeBOC but avoids the second storage pass.

func ValidateMerkleUpdate added in v1.17.0

func ValidateMerkleUpdate(update *Cell) error

func WriteBOCWithOptions added in v1.17.0

func WriteBOCWithOptions(w io.Writer, roots []*Cell, opts BOCSerializeOptions) error

WriteBOCWithOptions serializes roots into BoC and writes the result to w. It avoids allocating the final BoC byte slice, but still performs the normal prepass needed to order cells, resolve lazy refs, deduplicate cells, and build optional indexes.

Types

type AugDictFilterFunc added in v1.17.0

type AugDictFilterFunc func(value, extra *Slice, key *Cell) (DictFilterAction, error)

type AugDictForeachFunc added in v1.17.0

type AugDictForeachFunc func(value, extra *Slice, key *Cell) (bool, error)

type AugDictItem added in v1.17.0

type AugDictItem struct {
	Key   *Cell
	Value *Slice
	Extra *Slice
}

type AugDictIterator added in v1.17.0

type AugDictIterator struct {
	// contains filtered or unexported fields
}

func (*AugDictIterator) Err added in v1.18.0

func (it *AugDictIterator) Err() error

func (*AugDictIterator) Extra added in v1.17.0

func (it *AugDictIterator) Extra() *Slice

func (*AugDictIterator) Item added in v1.17.0

func (it *AugDictIterator) Item() AugDictItem

func (*AugDictIterator) Key added in v1.17.0

func (it *AugDictIterator) Key() *Cell

func (*AugDictIterator) Next added in v1.17.0

func (it *AugDictIterator) Next() bool

func (*AugDictIterator) Reset added in v1.17.0

func (it *AugDictIterator) Reset()

func (*AugDictIterator) Value added in v1.17.0

func (it *AugDictIterator) Value() *Slice

type AugDictTraverseFunc added in v1.17.0

type AugDictTraverseFunc func(keyPrefix *Cell, extra *Slice, value *Slice) (int, error)

type Augmentation added in v1.17.0

type Augmentation interface {
	SkipExtra(*Slice) error
	EmptyExtra() (*Cell, error)
	LeafExtra(value *Slice) (*Cell, error)
	CombineExtra(leftExtra, rightExtra *Slice) (*Cell, error)
}

type AugmentedDictionary added in v1.17.0

type AugmentedDictionary struct {
	// contains filtered or unexported fields
}

func NewAugDict added in v1.17.0

func NewAugDict(keySz uint, aug Augmentation) (*AugmentedDictionary, error)

func (*AugmentedDictionary) AsCell added in v1.17.0

func (d *AugmentedDictionary) AsCell() *Cell

func (*AugmentedDictionary) CheckForEach added in v1.17.0

func (d *AugmentedDictionary) CheckForEach(fn DictForeachFunc, invertFirst bool, shuffle bool) (bool, error)

func (*AugmentedDictionary) CheckForEachExtra added in v1.17.0

func (d *AugmentedDictionary) CheckForEachExtra(fn AugDictForeachFunc, invertFirst bool) (bool, error)

func (*AugmentedDictionary) CombineWith added in v1.17.0

func (d *AugmentedDictionary) CombineWith(other *AugmentedDictionary) (bool, error)

CombineWith structurally merges other into d.

It returns false, nil when both dictionaries contain the same key. The receiver is mutated only after the whole merge succeeds.

func (*AugmentedDictionary) Copy added in v1.17.0

func (*AugmentedDictionary) Count added in v1.18.0

func (d *AugmentedDictionary) Count() (int, error)

Count returns the number of dictionary leaves without materializing keys or values.

func (*AugmentedDictionary) CutPrefixSubdict added in v1.17.0

func (d *AugmentedDictionary) CutPrefixSubdict(prefix *Cell, removePrefix bool) (bool, error)

func (*AugmentedDictionary) Delete added in v1.17.0

func (d *AugmentedDictionary) Delete(key *Cell) error

func (*AugmentedDictionary) DeleteIntKey added in v1.17.0

func (d *AugmentedDictionary) DeleteIntKey(key *big.Int) error

func (*AugmentedDictionary) ExtractPrefixSubdictRoot added in v1.17.0

func (d *AugmentedDictionary) ExtractPrefixSubdictRoot(prefix *Cell, removePrefix bool) (*Cell, error)

func (*AugmentedDictionary) Filter added in v1.17.0

func (*AugmentedDictionary) ForEachValueExtra added in v1.18.0

func (d *AugmentedDictionary) ForEachValueExtra(fn func(value, extra *Slice) (bool, error)) error

ForEachValueExtra visits every leaf's decomposed value and extra in key order without materializing key cells — cheaper than IteratorExtra when keys are not needed. fn returns false to stop the walk early.

func (*AugmentedDictionary) Get added in v1.17.0

func (d *AugmentedDictionary) Get(key *Cell) *Cell

func (*AugmentedDictionary) GetCommonPrefix added in v1.17.0

func (d *AugmentedDictionary) GetCommonPrefix(limit ...uint) (*Cell, error)

func (*AugmentedDictionary) GetKeySize added in v1.17.0

func (d *AugmentedDictionary) GetKeySize() uint

func (*AugmentedDictionary) GetRootExtra added in v1.17.0

func (d *AugmentedDictionary) GetRootExtra() *Cell

func (*AugmentedDictionary) GetWithExtra added in v1.17.0

func (d *AugmentedDictionary) GetWithExtra(key *Cell) *Cell

func (*AugmentedDictionary) HasCommonPrefix added in v1.17.0

func (d *AugmentedDictionary) HasCommonPrefix(prefix *Cell) (bool, error)

func (*AugmentedDictionary) IsEmpty added in v1.17.0

func (d *AugmentedDictionary) IsEmpty() bool

func (*AugmentedDictionary) Iterator added in v1.17.0

func (d *AugmentedDictionary) Iterator(rev bool, sgnd bool) (*DictIterator, error)

Iterator creates a lazy depth-first raw value+extra iterator. Inspect Err after Next returns false to catch failures discovered in deeper children.

func (*AugmentedDictionary) IteratorAt added in v1.18.0

func (d *AugmentedDictionary) IteratorAt(key *Cell, rev bool, sgnd bool, allowEq bool) (*DictIterator, error)

IteratorAt creates a lazy raw iterator positioned at the nearest key to `key` in iteration order: for rev=false the first item is the smallest key >= key (> key when allowEq is false), for rev=true the largest key <= key (< key). Reset rewinds to the full range, not to the seek position.

func (*AugmentedDictionary) IteratorExtra added in v1.17.0

func (d *AugmentedDictionary) IteratorExtra(rev bool, sgnd bool) (*AugDictIterator, error)

IteratorExtra creates a lazy depth-first decomposed iterator. Inspect Err after Next returns false to catch traversal or extra-decoding failures.

func (*AugmentedDictionary) IteratorExtraAt added in v1.18.0

func (d *AugmentedDictionary) IteratorExtraAt(key *Cell, rev bool, sgnd bool, allowEq bool) (*AugDictIterator, error)

IteratorExtraAt is IteratorAt with values decomposed into value and extra.

func (*AugmentedDictionary) LoadRootExtra added in v1.17.0

func (d *AugmentedDictionary) LoadRootExtra() (*Slice, error)

func (*AugmentedDictionary) LoadValue added in v1.17.0

func (d *AugmentedDictionary) LoadValue(key *Cell) (*Slice, error)

func (*AugmentedDictionary) LoadValueAndDelete added in v1.17.0

func (d *AugmentedDictionary) LoadValueAndDelete(key *Cell) (*Slice, error)

func (*AugmentedDictionary) LoadValueByIntKey added in v1.17.0

func (d *AugmentedDictionary) LoadValueByIntKey(key *big.Int) (*Slice, error)

func (*AugmentedDictionary) LoadValueExtra added in v1.17.0

func (d *AugmentedDictionary) LoadValueExtra(key *Cell) (*Slice, *Slice, error)

func (*AugmentedDictionary) LoadValueExtraAndDelete added in v1.17.0

func (d *AugmentedDictionary) LoadValueExtraAndDelete(key *Cell) (*Slice, *Slice, error)

func (*AugmentedDictionary) LoadValueExtraByIntKey added in v1.17.0

func (d *AugmentedDictionary) LoadValueExtraByIntKey(key *big.Int) (*Slice, *Slice, error)

func (*AugmentedDictionary) LoadValueWithExtra added in v1.17.0

func (d *AugmentedDictionary) LoadValueWithExtra(key *Cell) (*Slice, error)

func (*AugmentedDictionary) LoadValueWithExtraAndDelete added in v1.17.0

func (d *AugmentedDictionary) LoadValueWithExtraAndDelete(key *Cell) (*Slice, error)

func (*AugmentedDictionary) LoadValueWithExtraByIntKey added in v1.17.0

func (d *AugmentedDictionary) LoadValueWithExtraByIntKey(key *big.Int) (*Slice, error)

func (*AugmentedDictionary) LookupNearestKey added in v1.17.0

func (d *AugmentedDictionary) LookupNearestKey(key *Cell, fetchNext bool, allowEq bool, invertFirst bool) (*Cell, *Slice, error)

func (*AugmentedDictionary) MustToCell added in v1.17.0

func (d *AugmentedDictionary) MustToCell() *Cell

func (*AugmentedDictionary) Range added in v1.17.0

func (d *AugmentedDictionary) Range(rev bool, sgnd bool) ([]DictItem, error)

func (*AugmentedDictionary) RangeExtra added in v1.17.0

func (d *AugmentedDictionary) RangeExtra(rev bool, sgnd bool) ([]AugDictItem, error)

func (*AugmentedDictionary) Set added in v1.17.0

func (d *AugmentedDictionary) Set(key, value *Cell) error

func (*AugmentedDictionary) SetBuilder added in v1.17.0

func (d *AugmentedDictionary) SetBuilder(key *Cell, value *Builder) error

func (*AugmentedDictionary) SetBuilderWithMode added in v1.17.0

func (d *AugmentedDictionary) SetBuilderWithMode(key *Cell, value *Builder, mode DictSetMode) (bool, error)

func (*AugmentedDictionary) SetIntKey added in v1.17.0

func (d *AugmentedDictionary) SetIntKey(key *big.Int, value *Cell) error

func (*AugmentedDictionary) SetTrace added in v1.17.0

func (d *AugmentedDictionary) SetTrace(trace *Trace) *AugmentedDictionary

func (*AugmentedDictionary) SetWithMode added in v1.17.0

func (d *AugmentedDictionary) SetWithMode(key, value *Cell, mode DictSetMode) (bool, error)

func (*AugmentedDictionary) ToCell added in v1.17.0

func (d *AugmentedDictionary) ToCell() (*Cell, error)

func (*AugmentedDictionary) TraverseExtra added in v1.17.0

func (d *AugmentedDictionary) TraverseExtra(fn AugDictTraverseFunc) (*Slice, *Slice, error)

func (*AugmentedDictionary) ValidateAll added in v1.17.0

func (d *AugmentedDictionary) ValidateAll() bool

func (*AugmentedDictionary) ValidateCheck added in v1.17.0

func (d *AugmentedDictionary) ValidateCheck(fn DictForeachFunc, invertFirst bool) (bool, error)

func (*AugmentedDictionary) ValidateCheckExtra added in v1.17.0

func (d *AugmentedDictionary) ValidateCheckExtra(fn AugDictForeachFunc, invertFirst bool) (bool, error)

type AugmentedExtraSkipper added in v1.17.0

type AugmentedExtraSkipper func(*Slice) error

type BOCCellMeta added in v1.17.1

type BOCCellMeta struct {
	Hash      Hash
	LevelMask LevelMask
	Hashes    [4]Hash
	Depths    [4]uint16
	Count     uint8
	Stored    bool
}

BOCCellMeta is the storage-visible metadata of a BoC cell.

func (BOCCellMeta) DepthAtLevel added in v1.17.1

func (m BOCCellMeta) DepthAtLevel(level int) uint16

DepthAtLevel returns the cell depth visible at the requested level.

func (BOCCellMeta) HashAtLevel added in v1.17.1

func (m BOCCellMeta) HashAtLevel(level int) Hash

HashAtLevel returns the cell hash visible at the requested level.

type BOCCellRefs added in v1.17.1

type BOCCellRefs struct {
	Items [4]uint32
	Count uint8
}

BOCCellRefs is the compact list of referenced BoC cell indexes.

type BOCCellView added in v1.17.1

type BOCCellView struct {
	Index uint32
	D1    byte
	D2    byte
	Bits  uint16
	Body  []byte
	Refs  BOCCellRefs
	Meta  BOCCellMeta
}

BOCCellView is a decoded BoC cell record.

Body points into the scratch buffer returned by BOCView.ReadCell. Callers should consume it before reusing that buffer.

type BOCNoCopyReader added in v1.17.0

type BOCNoCopyReader struct {
	// contains filtered or unexported fields
}

BOCNoCopyReader wraps in-memory BoC bytes for the parser's direct read path.

func NewBOCNoCopyReader added in v1.17.0

func NewBOCNoCopyReader(data []byte) *BOCNoCopyReader

NewBOCNoCopyReader creates a BoC reader over in-memory bytes.

func (*BOCNoCopyReader) Len added in v1.17.0

func (r *BOCNoCopyReader) Len() int

func (*BOCNoCopyReader) Read added in v1.17.0

func (r *BOCNoCopyReader) Read(p []byte) (int, error)

Read is a fallback for external io.Reader use. BoC parsing uses the direct path for BOCNoCopyReader and does not call Read.

type BOCParseOptions added in v1.17.0

type BOCParseOptions struct {
	// TrustedHashes trusts serialized hashes/depths when a cell stores them in
	// the BoC payload. Cells without serialized hashes are still hashed normally.
	TrustedHashes bool
	// NoCopyPayload lets parsed cells reference the BoC payload directly.
	// The caller must keep the source immutable while returned cells are alive.
	NoCopyPayload bool
	// Lazy keeps BoC subtrees behind lazy pruned boundaries. When TrustedHashes
	// is false, lazy parsing computes hashes/depths from the BoC payload and
	// validates serialized hashes instead of trusting them.
	Lazy bool
	// DisableLazyCache disables lazy BoC materialized-cell caching, even when
	// the BoC carries cache bits for shared cells.
	DisableLazyCache bool
	// MaxCells limits how many cells may be decoded from this BoC payload.
	// Zero or a negative value uses the package-level MaxBOCCells limit.
	MaxCells int
	// contains filtered or unexported fields
}

BOCParseOptions configures BoC parsing.

type BOCSerializeOptions added in v1.17.0

type BOCSerializeOptions struct {
	WithCRC32C    bool
	WithIndex     bool
	WithCacheBits bool
	WithTopHash   bool
	WithIntHashes bool
	// CellsCountHint pre-sizes serializer dedup structures for the expected
	// number of unique cells, avoiding rehash and regrow work on large BoCs.
	// Zero or a negative value uses default sizing.
	CellsCountHint int
}

BOCSerializeOptions configures BoC serialization.

type BOCView added in v1.17.1

type BOCView struct {
	// contains filtered or unexported fields
}

BOCView exposes random-access cells from a BoC without loading the full BoC payload or materializing a Cell tree.

func OpenBOCView added in v1.17.1

func OpenBOCView(r io.ReaderAt, size int64, opts BOCViewOptions) (*BOCView, error)

OpenBOCView opens a random-access BoC view over r.

func (*BOCView) Cell added in v1.17.1

func (v *BOCView) Cell(idx uint32) (BOCCellView, error)

Cell loads one BoC cell using an internal scratch allocation.

func (*BOCView) CellMeta added in v1.17.1

func (v *BOCView) CellMeta(idx uint32) (BOCCellMeta, error)

CellMeta returns precomputed metadata for a BoC cell without reading its serialized body again.

func (*BOCView) Cells added in v1.17.1

func (v *BOCView) Cells() uint32

func (*BOCView) NewReader added in v1.18.0

func (v *BOCView) NewReader() *BOCViewReader

NewReader creates a cell reader with an independent read window and scratch buffer. Use one reader per goroutine when reading a view concurrently.

func (*BOCView) ReadCell added in v1.17.1

func (v *BOCView) ReadCell(idx uint32, scratch []byte) (BOCCellView, []byte, error)

ReadCell loads one BoC cell. The returned scratch slice owns cell.Body and can be reused by the caller on the next ReadCell call.

func (*BOCView) Roots added in v1.17.1

func (v *BOCView) Roots() []uint32

type BOCViewOptions added in v1.17.1

type BOCViewOptions struct {
	// TrustedHashes trusts serialized hashes/depths when a cell stores them in
	// the BoC payload. Cells without serialized hashes are still hashed normally.
	TrustedHashes bool
	// RequireIndex rejects BoCs without an index table.
	RequireIndex bool
	// ValidateCRC validates the CRC32C trailer when the BoC carries one.
	ValidateCRC bool
	// BuildIndex scans non-indexed BoCs and builds an in-memory index.
	BuildIndex bool
}

BOCViewOptions configures a random-access BoC view.

type BOCViewReader added in v1.18.0

type BOCViewReader struct {
	// contains filtered or unexported fields
}

BOCViewReader reads cells from a BOCView with a private read window and scratch buffer. Separate readers can be used concurrently after the view is opened. Body returned by ReadCell remains valid until the reader's next call.

func (*BOCViewReader) ReadCell added in v1.18.0

func (r *BOCViewReader) ReadCell(idx uint32) (BOCCellView, error)

ReadCell loads one cell. Body in the returned view remains valid until the next ReadCell call on this reader.

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func BeginCell

func BeginCell() *Builder

func (*Builder) BitsLeft added in v0.6.0

func (b *Builder) BitsLeft() uint

func (*Builder) BitsUsed added in v0.5.0

func (b *Builder) BitsUsed() uint

func (*Builder) CanExtendBy added in v1.17.0

func (b *Builder) CanExtendBy(bits uint, refs uint) bool

func (*Builder) Copy added in v0.5.0

func (b *Builder) Copy() *Builder

func (*Builder) Depth added in v1.17.0

func (b *Builder) Depth() uint16

func (*Builder) EndCell

func (b *Builder) EndCell() *Cell

func (*Builder) EndCellSpecial added in v1.17.0

func (b *Builder) EndCellSpecial(special bool) (*Cell, error)

func (*Builder) MustStoreAddr added in v0.4.0

func (b *Builder) MustStoreAddr(addr *address.Address) *Builder

func (*Builder) MustStoreBigCoins

func (b *Builder) MustStoreBigCoins(value *big.Int) *Builder

func (*Builder) MustStoreBigInt

func (b *Builder) MustStoreBigInt(value *big.Int, sz uint) *Builder

func (*Builder) MustStoreBigUInt added in v1.0.0

func (b *Builder) MustStoreBigUInt(value *big.Int, sz uint) *Builder

func (*Builder) MustStoreBigVarInt added in v1.17.0

func (b *Builder) MustStoreBigVarInt(val *big.Int, sz uint) *Builder

func (*Builder) MustStoreBigVarUInt added in v1.7.0

func (b *Builder) MustStoreBigVarUInt(val *big.Int, sz uint) *Builder

func (*Builder) MustStoreBinarySnake added in v1.1.0

func (b *Builder) MustStoreBinarySnake(data []byte) *Builder

func (*Builder) MustStoreBoolBit added in v0.6.0

func (b *Builder) MustStoreBoolBit(value bool) *Builder

func (*Builder) MustStoreBuilder added in v0.6.0

func (b *Builder) MustStoreBuilder(builder *Builder) *Builder

func (*Builder) MustStoreCoins

func (b *Builder) MustStoreCoins(value uint64) *Builder

func (*Builder) MustStoreDict added in v1.0.0

func (b *Builder) MustStoreDict(dict SerializableToCell) *Builder

func (*Builder) MustStoreInt added in v1.0.0

func (b *Builder) MustStoreInt(value int64, sz uint) *Builder

func (*Builder) MustStoreMaybeRef added in v0.7.0

func (b *Builder) MustStoreMaybeRef(ref *Cell) *Builder

func (*Builder) MustStoreRef

func (b *Builder) MustStoreRef(ref *Cell) *Builder

func (*Builder) MustStoreSlice

func (b *Builder) MustStoreSlice(bytes []byte, sz uint) *Builder

func (*Builder) MustStoreStringSnake added in v1.1.0

func (b *Builder) MustStoreStringSnake(str string) *Builder

func (*Builder) MustStoreUInt

func (b *Builder) MustStoreUInt(value uint64, sz uint) *Builder

func (*Builder) MustStoreVarInt added in v1.17.0

func (b *Builder) MustStoreVarInt(val int64, sz uint) *Builder

func (*Builder) MustStoreVarUInt added in v1.7.0

func (b *Builder) MustStoreVarUInt(val uint64, sz uint) *Builder

func (*Builder) RefsLeft added in v0.6.0

func (b *Builder) RefsLeft() uint

func (*Builder) RefsUsed added in v0.6.0

func (b *Builder) RefsUsed() int

func (*Builder) SetTrace added in v1.17.0

func (b *Builder) SetTrace(trace *Trace) *Builder

func (*Builder) StoreAddr added in v0.4.0

func (b *Builder) StoreAddr(addr *address.Address) error

func (*Builder) StoreBigCoins

func (b *Builder) StoreBigCoins(value *big.Int) error

func (*Builder) StoreBigInt

func (b *Builder) StoreBigInt(value *big.Int, sz uint) error

func (*Builder) StoreBigUInt added in v1.0.0

func (b *Builder) StoreBigUInt(value *big.Int, sz uint) error

func (*Builder) StoreBigVarInt added in v1.17.0

func (b *Builder) StoreBigVarInt(val *big.Int, sz uint) error

func (*Builder) StoreBigVarUInt added in v1.7.0

func (b *Builder) StoreBigVarUInt(val *big.Int, sz uint) error

func (*Builder) StoreBinarySnake added in v1.1.0

func (b *Builder) StoreBinarySnake(data []byte) error

func (*Builder) StoreBoolBit added in v0.6.0

func (b *Builder) StoreBoolBit(value bool) error

func (*Builder) StoreBuilder added in v0.6.0

func (b *Builder) StoreBuilder(builder *Builder) error

func (*Builder) StoreBuilderUncheckedDepth added in v1.17.0

func (b *Builder) StoreBuilderUncheckedDepth(builder *Builder) error

func (*Builder) StoreCoins

func (b *Builder) StoreCoins(value uint64) error

func (*Builder) StoreDict added in v1.0.0

func (b *Builder) StoreDict(dict SerializableToCell) error

func (*Builder) StoreInt added in v1.0.0

func (b *Builder) StoreInt(value int64, sz uint) error

func (*Builder) StoreMaybeRef added in v0.7.0

func (b *Builder) StoreMaybeRef(ref *Cell) error

func (*Builder) StoreMaybeRefUncheckedDepth added in v1.17.0

func (b *Builder) StoreMaybeRefUncheckedDepth(ref *Cell) error

func (*Builder) StoreRef

func (b *Builder) StoreRef(ref *Cell) error

func (*Builder) StoreRefUncheckedDepth added in v1.17.0

func (b *Builder) StoreRefUncheckedDepth(ref *Cell) error

func (*Builder) StoreSameBit added in v1.17.0

func (b *Builder) StoreSameBit(bit bool, bits uint) error

func (*Builder) StoreSlice

func (b *Builder) StoreSlice(bytes []byte, sz uint) error

func (*Builder) StoreStringSnake added in v1.1.0

func (b *Builder) StoreStringSnake(str string) error

func (*Builder) StoreUInt

func (b *Builder) StoreUInt(value uint64, sz uint) error

func (*Builder) StoreVarInt added in v1.17.0

func (b *Builder) StoreVarInt(val int64, sz uint) error

func (*Builder) StoreVarUInt added in v1.7.0

func (b *Builder) StoreVarUInt(val uint64, sz uint) error

func (*Builder) String added in v1.11.0

func (b *Builder) String() string

func (*Builder) ToSlice added in v1.9.0

func (b *Builder) ToSlice() *Slice

func (*Builder) Trace added in v1.17.0

func (b *Builder) Trace() *Trace

func (*Builder) WithoutTrace added in v1.17.0

func (b *Builder) WithoutTrace() *Builder

type Cell

type Cell struct {
	// contains filtered or unexported fields
}

func CombineMerkleUpdate added in v1.17.0

func CombineMerkleUpdate(ab, bc *Cell) (*Cell, error)

func CreateMerkleProof added in v1.17.2

func CreateMerkleProof(body *Cell) (*Cell, error)

CreateMerkleProof wraps an already-built proof body into a MerkleProof special cell.

func CreateMerkleUpdate added in v1.17.2

func CreateMerkleUpdate(left, right *Cell) (*Cell, error)

CreateMerkleUpdate wraps already-built old and new update bodies into a MerkleUpdate special cell.

func CreatePrunedBranch added in v1.17.2

func CreatePrunedBranch(source *Cell, newLevel, virtualLevel int) (*Cell, error)

CreatePrunedBranch returns a pruned-branch boundary for source as seen at virtualLevel and bounded by newLevel. Loaded leaf cells are returned as-is.

func CreateWithLazyRefsUnsafe added in v1.17.0

func CreateWithLazyRefsUnsafe(descriptors uint16, data, hashes []byte, depths []uint16, refs []LazyRef, loader LazyCellLoader) (*Cell, error)

CreateWithLazyRefsUnsafe creates a regular cell with trusted precomputed hashes and lazy pruned refs. The parent cell is not marked lazy; only its pruned references are lazy boundaries. descriptors must be encoded as d1<<8 | d2, and data must contain the serialized cell body, including the top-up bit for non-byte-aligned cells. loader is captured by the lazy references; pass nil to create unresolved placeholders which return ErrLazyLoaderNotSet when loaded.

func DecompressBOC added in v1.17.0

func DecompressBOC(data []byte, maxSize int, state *Cell) ([]*Cell, error)

func DecompressBOCSerialized added in v1.18.0

func DecompressBOCSerialized(data []byte, maxSize int, state *Cell, opts BOCSerializeOptions) ([]*Cell, []byte, error)

DecompressBOCSerialized decompresses like DecompressBOC and additionally serializes the result with opts in one go. For structure-aware payloads the serializer is fed the already-deduplicated decompression graph directly, skipping the per-cell hash lookups a fresh ToBOCWithOptions pass would do. The produced bytes are identical to ToBOCWithOptions over the same roots.

func FromBOC

func FromBOC(data []byte) (*Cell, error)

func FromBOCMultiRoot added in v0.5.0

func FromBOCMultiRoot(data []byte) ([]*Cell, error)

func FromBOCMultiRootWithOptions added in v1.18.0

func FromBOCMultiRootWithOptions(data []byte, options BOCParseOptions) ([]*Cell, error)

func FromBOCWithOptions added in v1.18.0

func FromBOCWithOptions(data []byte, options BOCParseOptions) (*Cell, error)

func ReserializeBOC added in v1.18.0

func ReserializeBOC(data []byte, opts BOCSerializeOptions) ([]*Cell, []byte, error)

ReserializeBOC parses a BoC and serializes the same cells with opts in one go, feeding the serializer the parser's reference graph directly so the generic per-cell hash-dedup import pass is skipped. For deduplicated inputs (the only kind standard serializers produce) the output is byte-identical to ToBOCWithOptions over the parsed roots; inputs carrying duplicate cells keep their duplicates, so callers that verify an exact file hash should fall back to ToBOCWithOptions on mismatch.

func UnwrapProof added in v1.8.0

func UnwrapProof(proof *Cell, hash []byte) (*Cell, error)

func UnwrapProofVirtualized added in v1.17.0

func UnwrapProofVirtualized(proof *Cell, hash []byte) (*Cell, error)

func (*Cell) ActualLevel added in v1.17.0

func (c *Cell) ActualLevel() int

func (*Cell) AppendBOCWithOptions added in v1.18.0

func (c *Cell) AppendBOCWithOptions(dst []byte, opts BOCSerializeOptions) ([]byte, error)

AppendBOCWithOptions serializes c into BoC and appends the result to dst.

func (*Cell) AsAugDict added in v1.17.0

func (c *Cell) AsAugDict(keySz uint, aug Augmentation) *AugmentedDictionary

func (*Cell) AsDict added in v1.9.0

func (c *Cell) AsDict(keySz uint) *Dictionary

func (*Cell) AsPrefixDict added in v1.17.0

func (c *Cell) AsPrefixDict(keySz uint) *PrefixDictionary

func (*Cell) BeginParse

func (c *Cell) BeginParse() (*Slice, error)

func (*Cell) BeginParseInto added in v1.18.0

func (c *Cell) BeginParseInto(dst *Slice) error

BeginParseInto is the value-form of BeginParse for tight descent loops: the caller owns dst and reuses it across iterations, so parsing does not allocate a new Slice per visited cell. Traces attached to the cell are honored the same way BeginParse does.

func (*Cell) BeginParseIntoWithoutTrace added in v1.18.0

func (c *Cell) BeginParseIntoWithoutTrace(dst *Slice) error

BeginParseIntoWithoutTrace is the value-form of BeginParseWithoutTrace: like BeginParseInto, but without attaching any trace to the parsed Slice.

func (*Cell) BeginParseWithTrace added in v1.17.0

func (c *Cell) BeginParseWithTrace(trace *Trace) (*Slice, error)

BeginParseWithTrace parses the cell using trace instead of the trace attached to the cell wrapper.

func (*Cell) BeginParseWithoutTrace added in v1.17.0

func (c *Cell) BeginParseWithoutTrace() (*Slice, error)

func (*Cell) BitsSize added in v0.6.0

func (c *Cell) BitsSize() uint

func (*Cell) CreateProof deprecated added in v1.6.0

func (c *Cell) CreateProof(skeleton *ProofSkeleton) (*Cell, error)

CreateProof creates a Merkle proof from the old manual proof skeleton.

Deprecated: use NewMerkleProofBuilder with traced cell loads, or Cell.CreateUsageProof with CellUsageTree.

func (*Cell) CreateUsageProof added in v1.17.0

func (c *Cell) CreateUsageProof(usageTree *CellUsageTree) (*Cell, error)

func (*Cell) Depth added in v1.9.0

func (c *Cell) Depth(level ...int) uint16

func (*Cell) Dump added in v0.1.2

func (c *Cell) Dump(limitLength ...int) string

func (*Cell) DumpBits added in v0.5.0

func (c *Cell) DumpBits(limitLength ...int) string

func (*Cell) EffectiveLevel added in v1.17.0

func (c *Cell) EffectiveLevel() int

func (*Cell) GetMetadata added in v1.17.0

func (c *Cell) GetMetadata() Metadata

func (*Cell) GetType added in v1.8.0

func (c *Cell) GetType() Type

func (*Cell) Hash added in v0.5.0

func (c *Cell) Hash(level ...int) []byte

Hash - calculates a hash of cell recursively Once calculated, it is cached and can be reused cheap.

func (*Cell) HashKey added in v1.17.0

func (c *Cell) HashKey(level ...int) Hash

func (*Cell) IsLazy added in v1.17.0

func (c *Cell) IsLazy() bool

func (*Cell) IsSpecial added in v1.17.0

func (c *Cell) IsSpecial() bool

func (*Cell) IsVirtualized added in v1.17.0

func (c *Cell) IsVirtualized() bool

func (*Cell) Level added in v1.17.0

func (c *Cell) Level() int

func (*Cell) LevelMask added in v1.17.0

func (c *Cell) LevelMask() LevelMask

func (*Cell) MarshalJSON added in v1.7.1

func (c *Cell) MarshalJSON() ([]byte, error)

func (*Cell) MustBeginParse added in v1.17.0

func (c *Cell) MustBeginParse() *Slice

func (*Cell) MustPeekRef added in v1.8.0

func (c *Cell) MustPeekRef(i int) *Cell

func (*Cell) PeekRef added in v1.8.0

func (c *Cell) PeekRef(i int) (*Cell, error)

func (*Cell) Prewarm added in v1.17.1

func (c *Cell) Prewarm() (*Cell, error)

Prewarm prepares the lazy Cell by loading its data and returns the loaded Cell or an error on failure.

func (*Cell) PrewarmRecursive added in v1.17.0

func (c *Cell) PrewarmRecursive(depth int) (*Cell, error)

PrewarmRecursive returns a new cell tree with lazy references loaded up to depth. depth limits how many reference edges are traversed; 0 means no limit. References beyond the depth boundary are kept as boundary refs, so lazy tips stay lazy while all cells above them are materialized.

func (*Cell) RebuildWithRefs added in v1.17.2

func (c *Cell) RebuildWithRefs(refs []*Cell) (*Cell, error)

RebuildWithRefs returns a cell with the same bits and special flag as c, but with all references replaced by refs.

func (*Cell) RefsNum added in v0.6.0

func (c *Cell) RefsNum() uint

func (*Cell) SerializeBOCBodyTo added in v1.17.0

func (c *Cell) SerializeBOCBodyTo(dst []byte) int

func (*Cell) SerializedBOCBodySize added in v1.17.0

func (c *Cell) SerializedBOCBodySize() int

func (*Cell) Sign added in v0.6.0

func (c *Cell) Sign(key ed25519.PrivateKey) []byte

func (*Cell) String added in v1.11.0

func (c *Cell) String() string

func (*Cell) ToBOC

func (c *Cell) ToBOC() []byte

func (*Cell) ToBOCWithFlags deprecated

func (c *Cell) ToBOCWithFlags(flags ...bool) []byte

ToBOCWithFlags serializes the cell into BOC using the legacy boolean-flag API.

Deprecated: use [(*Cell).ToBOCWithOptions] instead.

func (*Cell) ToBOCWithOptions added in v1.17.0

func (c *Cell) ToBOCWithOptions(opts BOCSerializeOptions) []byte

func (*Cell) ToBOCWithOptionsErr added in v1.17.0

func (c *Cell) ToBOCWithOptionsErr(opts BOCSerializeOptions) ([]byte, error)

func (*Cell) ToBuilder added in v0.6.0

func (c *Cell) ToBuilder() *Builder

func (*Cell) Trace added in v1.17.0

func (c *Cell) Trace() *Trace

func (*Cell) UnmarshalJSON added in v1.7.1

func (c *Cell) UnmarshalJSON(bytes []byte) error

func (*Cell) Verify added in v1.8.2

func (c *Cell) Verify(key ed25519.PublicKey, signature []byte) bool

func (*Cell) Virtualize added in v1.17.0

func (c *Cell) Virtualize(effectiveLevel uint8) *Cell

func (*Cell) WithTrace added in v1.17.0

func (c *Cell) WithTrace(trace *Trace) *Cell

func (*Cell) WithoutTrace added in v1.17.0

func (c *Cell) WithoutTrace() *Cell

type CellUsageTree added in v1.17.0

type CellUsageTree struct {
	// contains filtered or unexported fields
}

CellUsageTree records which cells were loaded through traced wrappers so that Merkle proofs and updates can later be built from the visited paths.

Concurrent cell loads through traces of one tree are safe: node creation, load marking and loaded-cell caching are lock-free or briefly locked. The proof/update building phase (CreateUsageProof, CreateMerkleUpdate, SetMark/MarkPath/SetUseMarkForIsLoaded) is not synchronized against concurrent loads and must run after all traced readers are done.

func NewCellUsageTree added in v1.17.0

func NewCellUsageTree() *CellUsageTree

func (*CellUsageTree) CreateChild added in v1.17.0

func (t *CellUsageTree) CreateChild(node TraceNode, refIdx int) TraceNode

func (*CellUsageTree) CreateMerkleUpdate added in v1.17.0

func (t *CellUsageTree) CreateMerkleUpdate(from, to *Cell) (*Cell, error)

CreateMerkleUpdate creates a MerkleUpdate using the same usage-tree flow as the reference VM: the destination proof marks reused source paths, then the source proof is generated from these marks.

func (*CellUsageTree) GetChild added in v1.17.0

func (t *CellUsageTree) GetChild(node TraceNode, refIdx int) TraceNode

func (*CellUsageTree) HasMark added in v1.17.0

func (t *CellUsageTree) HasMark(node TraceNode) bool

func (*CellUsageTree) IsLoaded added in v1.17.0

func (t *CellUsageTree) IsLoaded(node TraceNode) bool

func (*CellUsageTree) MarkPath added in v1.17.0

func (t *CellUsageTree) MarkPath(node TraceNode) bool

func (*CellUsageTree) NodeCount added in v1.18.0

func (t *CellUsageTree) NodeCount() int

NodeCount returns the number of arena nodes allocated so far — an upper bound on the distinct cells a proof built from this tree can include, useful for presizing build state.

func (*CellUsageTree) NodeForCell added in v1.17.0

func (t *CellUsageTree) NodeForCell(c *Cell) (TraceNode, bool)

func (*CellUsageTree) NodeForTrace added in v1.17.0

func (t *CellUsageTree) NodeForTrace(trace *Trace) (TraceNode, bool)

func (*CellUsageTree) OnLoad added in v1.17.0

func (t *CellUsageTree) OnLoad(node TraceNode, c *Cell)

func (*CellUsageTree) Parent added in v1.17.0

func (t *CellUsageTree) Parent(node TraceNode) TraceNode

func (*CellUsageTree) RootNode added in v1.17.0

func (t *CellUsageTree) RootNode() TraceNode

func (*CellUsageTree) RootTrace added in v1.17.0

func (t *CellUsageTree) RootTrace() *Trace

func (*CellUsageTree) SetCellLoadCallback added in v1.17.0

func (t *CellUsageTree) SetCellLoadCallback(fn func(*Cell))

SetCellLoadCallback registers fn to be called on the first load of every node. It must be set before loads start; fn may be called concurrently when traced readers run on multiple goroutines.

func (*CellUsageTree) SetIgnoreLoads added in v1.17.0

func (t *CellUsageTree) SetIgnoreLoads(ignore bool)

func (*CellUsageTree) SetMark added in v1.17.0

func (t *CellUsageTree) SetMark(node TraceNode, mark bool)

func (*CellUsageTree) SetUseMarkForIsLoaded added in v1.17.0

func (t *CellUsageTree) SetUseMarkForIsLoaded(useMark bool)

func (*CellUsageTree) Trace added in v1.17.0

func (t *CellUsageTree) Trace(node TraceNode) *Trace

type CompressionAlgorithm added in v1.17.0

type CompressionAlgorithm byte
const (
	CompressionBaselineLZ4 CompressionAlgorithm = iota
	CompressionImprovedStructureLZ4
	CompressionImprovedStructureLZ4WithState
)

type DictBulkKV added in v1.18.0

type DictBulkKV struct {
	Key   []byte
	Value *Builder
}

DictBulkKV is a key/value pair for NewDictFromItems. Only the first key-size bits of Key are used as the key.

type DictFilterAction added in v1.17.0

type DictFilterAction uint8
const (
	DictFilterKeep DictFilterAction = iota
	DictFilterRemove
	DictFilterKeepRest
	DictFilterRemoveRest
)

type DictFilterFunc added in v1.17.0

type DictFilterFunc func(value *Slice, key *Cell) (DictFilterAction, error)

type DictForeachFunc added in v1.17.0

type DictForeachFunc func(value *Slice, key *Cell) (bool, error)

type DictItem added in v1.17.0

type DictItem struct {
	Key   *Cell
	Value *Slice
}

type DictIterator added in v1.17.0

type DictIterator struct {
	// contains filtered or unexported fields
}

func (*DictIterator) Err added in v1.18.0

func (it *DictIterator) Err() error

Err reports a malformed/lazy-cell error discovered after iterator construction. Next remains source compatible with the historical bool-only API; callers that consume untrusted dictionaries can inspect Err afterwards.

func (*DictIterator) Item added in v1.17.0

func (it *DictIterator) Item() DictItem

func (*DictIterator) Key added in v1.17.0

func (it *DictIterator) Key() *Cell

func (*DictIterator) Next added in v1.17.0

func (it *DictIterator) Next() bool

func (*DictIterator) Reset added in v1.17.0

func (it *DictIterator) Reset()

func (*DictIterator) Value added in v1.17.0

func (it *DictIterator) Value() *Slice

type DictKV added in v1.9.0

type DictKV struct {
	Key   *Slice
	Value *Slice
}

type DictSetMode added in v1.17.0

type DictSetMode uint8
const (
	DictSetModeReplace DictSetMode = 1
	DictSetModeAdd     DictSetMode = 2
	DictSetModeSet     DictSetMode = DictSetModeReplace | DictSetModeAdd
)

type Dictionary added in v0.5.0

type Dictionary struct {
	// contains filtered or unexported fields
}

func NewDict added in v1.0.0

func NewDict(keySz uint) *Dictionary

func NewDictFromItems added in v1.18.0

func NewDictFromItems(keySz uint, items []DictBulkKV) (*Dictionary, error)

NewDictFromItems builds a dictionary from all key/value pairs at once, constructing the tree bottom-up so every node is finalized (hashed) exactly once instead of re-hashing the insert path per key. Dict serialization is canonical, so the result is bit-identical to sequential Set calls over the same items; on duplicate keys the last item wins, matching sequential Set. The items slice is reordered in place.

func (*Dictionary) AsCell added in v1.9.0

func (d *Dictionary) AsCell() *Cell

func (*Dictionary) CheckForEach added in v1.17.0

func (d *Dictionary) CheckForEach(fn DictForeachFunc, invertFirst bool, shuffle bool) (bool, error)

func (*Dictionary) Copy added in v1.9.7

func (d *Dictionary) Copy() *Dictionary

func (*Dictionary) CutPrefixSubdict added in v1.17.0

func (d *Dictionary) CutPrefixSubdict(prefix *Cell, removePrefix bool) (bool, error)

func (*Dictionary) Delete added in v1.8.2

func (d *Dictionary) Delete(key *Cell) error

func (*Dictionary) DeleteByBytesKey added in v1.18.0

func (d *Dictionary) DeleteByBytesKey(key []byte) error

DeleteByBytesKey is the same as Delete, but takes the key as raw big-endian bytes (the first key-size bits), without building and hashing a key cell.

func (*Dictionary) DeleteIntKey added in v1.8.2

func (d *Dictionary) DeleteIntKey(key *big.Int) error

func (*Dictionary) ExtractPrefixSubdictRoot added in v1.17.0

func (d *Dictionary) ExtractPrefixSubdictRoot(prefix *Cell, removePrefix bool) (*Cell, error)

func (*Dictionary) Filter added in v1.17.0

func (d *Dictionary) Filter(fn DictFilterFunc) (int, error)

func (*Dictionary) Get deprecated added in v0.5.0

func (d *Dictionary) Get(key *Cell) *Cell

Deprecated: use LoadValue

func (*Dictionary) GetCommonPrefix added in v1.17.0

func (d *Dictionary) GetCommonPrefix(limit ...uint) (*Cell, error)

func (*Dictionary) GetKeySize added in v1.9.7

func (d *Dictionary) GetKeySize() uint

func (*Dictionary) HasCommonPrefix added in v1.17.0

func (d *Dictionary) HasCommonPrefix(prefix *Cell) (bool, error)

func (*Dictionary) IsEmpty added in v1.9.0

func (d *Dictionary) IsEmpty() bool

func (*Dictionary) Iterator added in v1.17.0

func (d *Dictionary) Iterator(rev bool, sgnd bool) (*DictIterator, error)

Iterator creates a lazy depth-first iterator. If a lazy or malformed child fails after construction, Next returns false and Err reports that failure.

func (*Dictionary) IteratorAt added in v1.18.0

func (d *Dictionary) IteratorAt(key *Cell, rev bool, sgnd bool, allowEq bool) (*DictIterator, error)

IteratorAt creates a lazy iterator positioned at the nearest key to `key` in iteration order: for rev=false the first item is the smallest key >= key (> key when allowEq is false), for rev=true the largest key <= key (< key). Reset rewinds to the full range, not to the seek position.

func (*Dictionary) LoadAll added in v1.9.0

func (d *Dictionary) LoadAll(skipPruned ...bool) ([]DictKV, error)

func (*Dictionary) LoadMax added in v1.17.0

func (d *Dictionary) LoadMax() (*Cell, *Slice, error)

func (*Dictionary) LoadMaxAndDelete added in v1.17.0

func (d *Dictionary) LoadMaxAndDelete() (*Cell, *Slice, error)

func (*Dictionary) LoadMin added in v1.17.0

func (d *Dictionary) LoadMin() (*Cell, *Slice, error)

func (*Dictionary) LoadMinAndDelete added in v1.17.0

func (d *Dictionary) LoadMinAndDelete() (*Cell, *Slice, error)

func (*Dictionary) LoadMinMax added in v1.17.0

func (d *Dictionary) LoadMinMax(fetchMax bool, invertFirst bool) (*Cell, *Slice, error)

func (*Dictionary) LoadMinMaxAndDelete added in v1.17.0

func (d *Dictionary) LoadMinMaxAndDelete(fetchMax bool, invertFirst bool) (*Cell, *Slice, error)

func (*Dictionary) LoadValue added in v1.9.0

func (d *Dictionary) LoadValue(key *Cell) (*Slice, error)

LoadValue - searches key in the underline dict cell and returns its value

If key is not found ErrNoSuchKeyInDict will be returned

func (*Dictionary) LoadValueAndDelete added in v1.17.0

func (d *Dictionary) LoadValueAndDelete(key *Cell) (*Slice, error)

func (*Dictionary) LoadValueAndSet added in v1.17.0

func (d *Dictionary) LoadValueAndSet(key, value *Cell) (*Slice, bool, error)

func (*Dictionary) LoadValueAndSetBuilder added in v1.17.0

func (d *Dictionary) LoadValueAndSetBuilder(key *Cell, value *Builder) (*Slice, bool, error)

func (*Dictionary) LoadValueAndSetBuilderWithMode added in v1.17.0

func (d *Dictionary) LoadValueAndSetBuilderWithMode(key *Cell, value *Builder, mode DictSetMode) (*Slice, bool, error)

func (*Dictionary) LoadValueAndSetWithMode added in v1.17.0

func (d *Dictionary) LoadValueAndSetWithMode(key, value *Cell, mode DictSetMode) (*Slice, bool, error)

func (*Dictionary) LoadValueByBytesKey added in v1.18.0

func (d *Dictionary) LoadValueByBytesKey(key []byte) (*Slice, error)

LoadValueByBytesKey is the same as LoadValue, but takes the key as raw big-endian bytes (the first key-size bits), without building and hashing a key cell.

func (*Dictionary) LoadValueByIntKey added in v1.9.0

func (d *Dictionary) LoadValueByIntKey(key *big.Int) (*Slice, error)

LoadValueByIntKey is the same as LoadValue, but constructs the key cell from int.

func (*Dictionary) LoadValueByUintKey added in v1.18.0

func (d *Dictionary) LoadValueByUintKey(key uint64) (*Slice, error)

LoadValueByUintKey is the same as LoadValue, but constructs the key cell from uint, without a big.Int allocation.

func (*Dictionary) LookupNearestKey added in v1.17.0

func (d *Dictionary) LookupNearestKey(key *Cell, fetchNext bool, allowEq bool, invertFirst bool) (*Cell, *Slice, error)

func (*Dictionary) Range added in v1.17.0

func (d *Dictionary) Range(rev bool, sgnd bool) ([]DictItem, error)

func (*Dictionary) Set added in v1.0.0

func (d *Dictionary) Set(key, value *Cell) error

func (*Dictionary) SetBuilder added in v1.17.0

func (d *Dictionary) SetBuilder(key *Cell, value *Builder) error

func (*Dictionary) SetBuilderByBytesKey added in v1.18.0

func (d *Dictionary) SetBuilderByBytesKey(key []byte, value *Builder) error

SetBuilderByBytesKey is the same as SetBuilder, but takes the key as raw big-endian bytes (the first key-size bits), without building and hashing a key cell.

func (*Dictionary) SetBuilderWithMode added in v1.17.0

func (d *Dictionary) SetBuilderWithMode(key *Cell, value *Builder, mode DictSetMode) (bool, error)

func (*Dictionary) SetIntKey added in v1.1.0

func (d *Dictionary) SetIntKey(key *big.Int, value *Cell) error

func (*Dictionary) SetTrace added in v1.17.0

func (d *Dictionary) SetTrace(trace *Trace) *Dictionary

func (*Dictionary) SetWithMode added in v1.17.0

func (d *Dictionary) SetWithMode(key, value *Cell, mode DictSetMode) (bool, error)

func (*Dictionary) String added in v1.11.1

func (d *Dictionary) String() string

func (*Dictionary) ToCell added in v1.0.0

func (d *Dictionary) ToCell() (*Cell, error)

func (*Dictionary) ValidateAll added in v1.17.0

func (d *Dictionary) ValidateAll() bool

func (*Dictionary) ValidateCheck added in v1.17.0

func (d *Dictionary) ValidateCheck(fn DictForeachFunc, invertFirst bool) (bool, error)

type Hash added in v1.17.0

type Hash [hashSize]byte

type HashmapKV added in v0.5.0

type HashmapKV struct {
	Key   *Cell
	Value *Cell
}

type LargeBOCLoader added in v1.17.0

type LargeBOCLoader interface {
	// LoadMeta must append exactly one LargeBOCMetaRecord per input hash to
	// dst, in the same order as hashes. Returned records must stay valid while
	// the following batch may already be loading.
	LoadMeta(hashes []Hash, dst []LargeBOCMetaRecord) ([]LargeBOCMetaRecord, error)

	// LoadPayload must append exactly one LargeBOCPayloadRecord per input hash
	// to dst, in the same order as hashes. The returned records may borrow Data
	// from the loader; Data must stay valid while the following batch may
	// already be loading.
	LoadPayload(hashes []Hash, dst []LargeBOCPayloadRecord) ([]LargeBOCPayloadRecord, error)
}

LargeBOCLoader provides two-phase large BoC loading. LoadMeta is used during graph import and should avoid loading payload bytes when the backing storage can do that cheaply. LoadPayload is used during final serialization order and must provide only raw cell payload bytes.

type LargeBOCMetaRecord added in v1.17.0

type LargeBOCMetaRecord struct {
	D1     byte
	BitsSz uint16
	Refs   [4]Hash
	Hashes [4]Hash
	Depths [4]uint16
}

LargeBOCMetaRecord is a compact storage-shaped cell metadata record for large BoC import. D1 is the ordinary BoC descriptor byte without the "with hashes" bit. BitsSz is the exact payload bit length, without the BoC terminator bit. Refs must contain top hashes in descriptor order.

Depths[0] must always be filled. Hashes/Depths for higher significant levels are required only when D1 carries a non-zero level mask.

type LargeBOCOnePassLoader added in v1.17.0

type LargeBOCOnePassLoader interface {
	LoadCells(hashes []Hash, dst []LargeBOCRecord) ([]LargeBOCRecord, error)
}

LargeBOCOnePassLoader provides one-pass large BoC loading. LoadCells must append exactly one LargeBOCRecord per input hash to dst, in the same order as hashes. ToLargeBOCOnePass may prefetch the next batch in a goroutine while the current batch is being imported, so LoadCells calls can overlap and implementations must synchronize any shared state they touch. Payload data must stay valid until ToLargeBOCOnePass returns.

type LargeBOCPayloadRecord added in v1.17.0

type LargeBOCPayloadRecord struct {
	Data []byte
}

LargeBOCPayloadRecord is a compact storage-shaped cell payload record. Data must contain raw cell data bytes without the BoC terminator bit.

type LargeBOCRecord added in v1.17.0

type LargeBOCRecord struct {
	Meta    LargeBOCMetaRecord
	Payload LargeBOCPayloadRecord
}

LargeBOCRecord is a one-pass large BoC storage record. Meta is used to import the graph, while Payload is retained until final serialization.

type LazyCellLoader added in v1.17.0

type LazyCellLoader func(hash Hash) (*Cell, error)

LazyCellLoader resolves lazy pruned references by the hash of the represented cell.

type LazyRef added in v1.17.0

type LazyRef struct {
	LevelMask LevelMask
	Hashes    []byte
	Depths    []uint16
}

LazyRef describes a lazy reference placeholder. Hashes and depths must be ordered by significant levels, starting from level 0.

type LevelMask added in v1.7.1

type LevelMask struct {
	Mask byte
}

func (LevelMask) Apply added in v1.8.0

func (m LevelMask) Apply(level int) LevelMask

func (LevelMask) GetLevel added in v1.8.0

func (m LevelMask) GetLevel() int

func (LevelMask) IsSignificant added in v1.8.0

func (m LevelMask) IsSignificant(level int) bool

type MerkleProofBuilder added in v1.17.0

type MerkleProofBuilder struct {
	// contains filtered or unexported fields
}

func NewMerkleProofBuilder added in v1.17.0

func NewMerkleProofBuilder(root *Cell) *MerkleProofBuilder

func (*MerkleProofBuilder) Clear added in v1.17.0

func (b *MerkleProofBuilder) Clear()

func (*MerkleProofBuilder) CreateProof added in v1.17.0

func (b *MerkleProofBuilder) CreateProof() (*Cell, error)

func (*MerkleProofBuilder) Init added in v1.17.0

func (b *MerkleProofBuilder) Init(root *Cell) *Cell

func (*MerkleProofBuilder) OriginalRoot added in v1.17.0

func (b *MerkleProofBuilder) OriginalRoot() *Cell

func (*MerkleProofBuilder) Root added in v1.17.0

func (b *MerkleProofBuilder) Root() *Cell

func (*MerkleProofBuilder) UsageTree added in v1.17.0

func (b *MerkleProofBuilder) UsageTree() *CellUsageTree

type MerkleUpdateReuse added in v1.17.0

type MerkleUpdateReuse struct {
	Cells []MerkleUpdateReusedCell
	Refs  []MerkleUpdateReusedRef
}

type MerkleUpdateReusedCell added in v1.17.0

type MerkleUpdateReusedCell struct {
	// Hash is the logical hash of the reused subtree as it appears in the
	// returned root. It can be a virtual hash.
	Hash Hash
	// Cell carries the reference identity for storage and serialization. It may
	// be a full source cell or a pruned placeholder with the same hashes/depths.
	Cell *Cell
}

MerkleUpdateReusedCell describes an old-state subtree reused through a pruned boundary while applying a Merkle update.

type MerkleUpdateReusedRef added in v1.17.0

type MerkleUpdateReusedRef struct {
	ParentHash  Hash
	RefIndex    int
	LogicalHash Hash
	RawCell     *Cell
}

MerkleUpdateReusedRef describes a parent->child edge where the child was reused through a pruned boundary while applying a Merkle update.

type Metadata added in v1.17.0

type Metadata struct {
	Hash      Hash
	LevelMask LevelMask
	Hashes    []Hash
	Depths    []uint16
	Refs      []RefMetadata
}

Metadata is the storage-visible representation of a cell.

It exposes hashes and depths exactly as they are visible from the cell's current effective level. Lazy pruned references are represented as metadata boundaries: their hash/depth data is available, while Lazy is true.

type NotEnoughDataError added in v1.18.0

type NotEnoughDataError struct {
	Has  int
	Need int
}

NotEnoughDataError is returned when a read needs more bits/bytes than left. The message is formatted lazily: cell underflow is a regular control-flow path for TVM programs, so constructing it must stay cheap.

func (NotEnoughDataError) Error added in v1.18.0

func (e NotEnoughDataError) Error() string

type PrefixDictionary added in v1.17.0

type PrefixDictionary struct {
	// contains filtered or unexported fields
}

func NewPrefixDict added in v1.17.0

func NewPrefixDict(keySz uint) *PrefixDictionary

func (*PrefixDictionary) AsCell added in v1.17.0

func (d *PrefixDictionary) AsCell() *Cell

func (*PrefixDictionary) Copy added in v1.17.0

func (*PrefixDictionary) Delete added in v1.17.0

func (d *PrefixDictionary) Delete(key *Cell) error

func (*PrefixDictionary) DeleteIntKey added in v1.18.0

func (d *PrefixDictionary) DeleteIntKey(key *big.Int) error

DeleteIntKey removes a full-width prefix-dictionary key.

func (*PrefixDictionary) Get added in v1.17.0

func (d *PrefixDictionary) Get(key *Cell) *Cell

func (*PrefixDictionary) GetKeySize added in v1.17.0

func (d *PrefixDictionary) GetKeySize() uint

func (*PrefixDictionary) IsEmpty added in v1.17.0

func (d *PrefixDictionary) IsEmpty() bool

func (*PrefixDictionary) LoadValue added in v1.17.0

func (d *PrefixDictionary) LoadValue(key *Cell) (*Slice, error)

func (*PrefixDictionary) LoadValueAndDelete added in v1.17.0

func (d *PrefixDictionary) LoadValueAndDelete(key *Cell) (*Slice, error)

func (*PrefixDictionary) LoadValueByIntKey added in v1.18.0

func (d *PrefixDictionary) LoadValueByIntKey(key *big.Int) (*Slice, error)

LoadValueByIntKey loads a full-width prefix-dictionary key without finalizing and hashing an intermediate key cell.

func (*PrefixDictionary) LookupPrefix added in v1.17.0

func (d *PrefixDictionary) LookupPrefix(key *Cell) (*Slice, uint, error)

func (*PrefixDictionary) MustToCell added in v1.17.0

func (d *PrefixDictionary) MustToCell() *Cell

func (*PrefixDictionary) Set added in v1.17.0

func (d *PrefixDictionary) Set(key, value *Cell) error

func (*PrefixDictionary) SetBuilder added in v1.17.0

func (d *PrefixDictionary) SetBuilder(key *Cell, value *Builder) error

func (*PrefixDictionary) SetBuilderWithMode added in v1.17.0

func (d *PrefixDictionary) SetBuilderWithMode(key *Cell, value *Builder, mode DictSetMode) (bool, error)

func (*PrefixDictionary) SetIntKey added in v1.18.0

func (d *PrefixDictionary) SetIntKey(key *big.Int, value *Cell) error

SetIntKey stores a full-width prefix-dictionary key.

func (*PrefixDictionary) SetTrace added in v1.17.0

func (d *PrefixDictionary) SetTrace(trace *Trace) *PrefixDictionary

func (*PrefixDictionary) SetWithMode added in v1.17.0

func (d *PrefixDictionary) SetWithMode(key, value *Cell, mode DictSetMode) (bool, error)

func (*PrefixDictionary) ToCell added in v1.17.0

func (d *PrefixDictionary) ToCell() (*Cell, error)

type ProofSkeleton deprecated added in v1.9.0

type ProofSkeleton struct {
	// contains filtered or unexported fields
}

ProofSkeleton describes the old manual Merkle proof selection tree.

Deprecated: use NewMerkleProofBuilder with traced cell loads, or Cell.CreateUsageProof with CellUsageTree.

func CreateProofSkeleton deprecated added in v1.9.0

func CreateProofSkeleton() *ProofSkeleton

CreateProofSkeleton creates the old manual Merkle proof selection tree.

Deprecated: use NewMerkleProofBuilder with traced cell loads, or Cell.CreateUsageProof with CellUsageTree.

func (*ProofSkeleton) AttachAt deprecated added in v1.9.0

func (s *ProofSkeleton) AttachAt(i int, sk *ProofSkeleton)

AttachAt - attach skeleton chain at specific ref slot

Deprecated: use NewMerkleProofBuilder with traced cell loads, or Cell.CreateUsageProof with CellUsageTree.

func (*ProofSkeleton) Copy deprecated added in v1.9.0

func (s *ProofSkeleton) Copy() *ProofSkeleton

Copy returns a shallow copy of the old manual Merkle proof selection tree.

Deprecated: use NewMerkleProofBuilder with traced cell loads, or Cell.CreateUsageProof with CellUsageTree.

func (*ProofSkeleton) Merge deprecated added in v1.9.0

func (s *ProofSkeleton) Merge(sk *ProofSkeleton)

Merge - merge 2 proof chains in a single proof tree

Deprecated: use NewMerkleProofBuilder with traced cell loads, or Cell.CreateUsageProof with CellUsageTree.

func (*ProofSkeleton) ProofRef deprecated added in v1.9.0

func (s *ProofSkeleton) ProofRef(i int) *ProofSkeleton

ProofRef - include ref with index i to proof

Deprecated: use NewMerkleProofBuilder with traced cell loads, or Cell.CreateUsageProof with CellUsageTree.

func (*ProofSkeleton) SetRecursive deprecated added in v1.9.0

func (s *ProofSkeleton) SetRecursive()

SetRecursive - include all underlying refs recursively in ordinary form to proof

Deprecated: use NewMerkleProofBuilder with traced cell loads, or Cell.CreateUsageProof with CellUsageTree.

type ReadOnlyAugmentation added in v1.17.0

type ReadOnlyAugmentation struct {
	SkipExtraFn AugmentedExtraSkipper
}

func (ReadOnlyAugmentation) CombineExtra added in v1.17.0

func (a ReadOnlyAugmentation) CombineExtra(*Slice, *Slice) (*Cell, error)

func (ReadOnlyAugmentation) EmptyExtra added in v1.17.0

func (a ReadOnlyAugmentation) EmptyExtra() (*Cell, error)

func (ReadOnlyAugmentation) LeafExtra added in v1.17.0

func (a ReadOnlyAugmentation) LeafExtra(*Slice) (*Cell, error)

func (ReadOnlyAugmentation) SkipExtra added in v1.17.0

func (a ReadOnlyAugmentation) SkipExtra(loader *Slice) error

type RefMetadata added in v1.17.0

type RefMetadata struct {
	Hash      Hash
	LevelMask LevelMask
	Hashes    []Hash
	Depths    []uint16
	Lazy      bool
}

type SerializableToCell added in v1.17.0

type SerializableToCell interface {
	ToCell() (*Cell, error)
}

type Slice added in v1.0.0

type Slice struct {
	// contains filtered or unexported fields
}

func (*Slice) AugDictInlineIterator added in v1.18.0

func (c *Slice) AugDictInlineIterator(keySz uint, aug Augmentation, skipValue AugmentedExtraSkipper, rev bool, sgnd bool) (*AugDictIterator, error)

AugDictInlineIterator iterates a non-empty HashmapAug whose root node is serialized inline starting at the slice's current position (as in an AccountBlock's transactions field). The slice is advanced past the dictionary. skipValue must consume a leaf value that does not occupy the rest of the node; pass nil when it does. Unlike ToAugDictWithValue no synthetic root cell is built, so no hashing happens. Reset is unsupported on the returned iterator: the inline root has no standalone cell to rewind to.

func (*Slice) AugDictInlineIteratorAt added in v1.18.0

func (c *Slice) AugDictInlineIteratorAt(keySz uint, aug Augmentation, skipValue AugmentedExtraSkipper, key *Cell, rev bool, sgnd bool, allowEq bool) (*AugDictIterator, error)

AugDictInlineIteratorAt is AugDictInlineIterator positioned at the nearest key to `key` in iteration order; see (*AugmentedDictionary).IteratorExtraAt for the positioning semantics.

func (*Slice) BaseCell added in v1.17.0

func (c *Slice) BaseCell() *Cell

func (*Slice) BitAt added in v1.17.0

func (c *Slice) BitAt(offset uint) (uint8, error)

func (*Slice) BitRange added in v1.17.0

func (c *Slice) BitRange() (start, end uint)

func (*Slice) BitsEqual added in v1.17.0

func (c *Slice) BitsEqual(other *Slice) bool

func (*Slice) BitsLeft added in v1.0.0

func (c *Slice) BitsLeft() uint

func (*Slice) Copy added in v1.0.0

func (c *Slice) Copy() *Slice

func (*Slice) CountInlineDictLeaves added in v1.18.0

func (c *Slice) CountInlineDictLeaves(keySz uint) (int, error)

CountInlineDictLeaves counts the leaves of a non-empty Hashmap/HashmapAug whose root node is serialized inline at the slice's current position, like the transactions dict of an AccountBlock. Neither keys nor values are materialized and the slice is not advanced. Fork children occupy the first two refs in both plain and augmented dictionaries, so no augmentation knowledge is needed.

func (*Slice) CountLeading added in v1.17.0

func (c *Slice) CountLeading(bit bool) int

func (*Slice) CountTrailing added in v1.17.0

func (c *Slice) CountTrailing(bit bool) int

func (*Slice) Depth added in v1.17.0

func (c *Slice) Depth() uint16

func (*Slice) FetchSubslice added in v1.17.0

func (c *Slice) FetchSubslice(bits uint, refs int) (*Slice, error)

func (*Slice) HasPrefix added in v1.17.0

func (c *Slice) HasPrefix(prefix *Slice) bool

func (*Slice) IsPrefixOf added in v1.17.0

func (c *Slice) IsPrefixOf(other *Slice) bool

func (*Slice) IsProperPrefixOf added in v1.17.0

func (c *Slice) IsProperPrefixOf(other *Slice) bool

func (*Slice) IsProperSuffixOf added in v1.17.0

func (c *Slice) IsProperSuffixOf(other *Slice) bool

func (*Slice) IsSpecial added in v1.8.9

func (c *Slice) IsSpecial() bool

func (*Slice) IsSuffixOf added in v1.17.0

func (c *Slice) IsSuffixOf(other *Slice) bool

func (*Slice) LexCompare added in v1.17.0

func (c *Slice) LexCompare(other *Slice) int

func (*Slice) LoadAddr added in v1.0.0

func (c *Slice) LoadAddr() (*address.Address, error)

func (*Slice) LoadAugDict added in v1.17.0

func (c *Slice) LoadAugDict(keySz uint, aug Augmentation, asProof bool) (*AugmentedDictionary, error)

func (*Slice) LoadBigCoins added in v1.0.0

func (c *Slice) LoadBigCoins() (*big.Int, error)

func (*Slice) LoadBigInt added in v1.0.0

func (c *Slice) LoadBigInt(sz uint) (*big.Int, error)

func (*Slice) LoadBigUInt added in v1.0.0

func (c *Slice) LoadBigUInt(sz uint) (*big.Int, error)

func (*Slice) LoadBigUIntInto added in v1.18.0

func (c *Slice) LoadBigUIntInto(dst *big.Int, sz uint) error

LoadBigUIntInto decodes sz bits into dst and advances the slice. Reusing dst avoids the allocation performed by LoadBigUInt. On error, neither dst nor the slice cursor is changed.

func (*Slice) LoadBinarySnake added in v1.1.0

func (c *Slice) LoadBinarySnake() ([]byte, error)

func (*Slice) LoadBoolBit added in v1.0.0

func (c *Slice) LoadBoolBit() (bool, error)

func (*Slice) LoadCoins added in v1.0.0

func (c *Slice) LoadCoins() (uint64, error)

func (*Slice) LoadDict added in v1.0.0

func (c *Slice) LoadDict(keySz uint) (*Dictionary, error)

func (*Slice) LoadInt added in v1.0.0

func (c *Slice) LoadInt(sz uint) (int64, error)

func (*Slice) LoadMaybeRef added in v1.0.0

func (c *Slice) LoadMaybeRef() (*Slice, error)

func (*Slice) LoadPrefixDict added in v1.17.0

func (c *Slice) LoadPrefixDict(keySz uint) (*PrefixDictionary, error)

func (*Slice) LoadRef added in v1.0.0

func (c *Slice) LoadRef() (*Slice, error)

func (*Slice) LoadRefCell added in v1.8.0

func (c *Slice) LoadRefCell() (*Cell, error)

func (*Slice) LoadSlice added in v1.0.0

func (c *Slice) LoadSlice(sz uint) ([]byte, error)

func (*Slice) LoadSliceInto added in v1.18.0

func (c *Slice) LoadSliceInto(dst []byte, sz uint) error

LoadSliceInto copies sz bits into dst and advances the slice. The copied bits are left-aligned in dst, matching LoadSlice. It returns io.ErrShortBuffer when dst cannot hold the result and leaves the slice cursor unchanged on every error.

func (*Slice) LoadStringSnake added in v1.1.0

func (c *Slice) LoadStringSnake() (string, error)

func (*Slice) LoadUInt added in v1.0.0

func (c *Slice) LoadUInt(sz uint) (uint64, error)

func (*Slice) LoadVarInt added in v1.17.0

func (c *Slice) LoadVarInt(sz uint) (*big.Int, error)

func (*Slice) LoadVarUInt added in v1.0.0

func (c *Slice) LoadVarUInt(sz uint) (*big.Int, error)

func (*Slice) MustLoadAddr added in v1.0.0

func (c *Slice) MustLoadAddr() *address.Address

func (*Slice) MustLoadBigCoins added in v1.0.0

func (c *Slice) MustLoadBigCoins() *big.Int

func (*Slice) MustLoadBigUInt added in v1.0.0

func (c *Slice) MustLoadBigUInt(sz uint) *big.Int

func (*Slice) MustLoadBinarySnake added in v1.1.0

func (c *Slice) MustLoadBinarySnake() []byte

func (*Slice) MustLoadBoolBit added in v1.0.0

func (c *Slice) MustLoadBoolBit() bool

func (*Slice) MustLoadCoins added in v1.0.0

func (c *Slice) MustLoadCoins() uint64

func (*Slice) MustLoadDict added in v1.0.1

func (c *Slice) MustLoadDict(keySz uint) *Dictionary

func (*Slice) MustLoadInt added in v1.0.0

func (c *Slice) MustLoadInt(sz uint) int64

func (*Slice) MustLoadMaybeRef added in v1.0.0

func (c *Slice) MustLoadMaybeRef() *Slice

func (*Slice) MustLoadPrefixDict added in v1.17.0

func (c *Slice) MustLoadPrefixDict(keySz uint) *PrefixDictionary

func (*Slice) MustLoadRef added in v1.0.0

func (c *Slice) MustLoadRef() *Slice

func (*Slice) MustLoadSlice added in v1.0.0

func (c *Slice) MustLoadSlice(sz uint) []byte

func (*Slice) MustLoadStringSnake added in v1.1.0

func (c *Slice) MustLoadStringSnake() string

func (*Slice) MustLoadUInt added in v1.0.0

func (c *Slice) MustLoadUInt(sz uint) uint64

func (*Slice) MustLoadVarInt added in v1.17.0

func (c *Slice) MustLoadVarInt(sz uint) *big.Int

func (*Slice) MustLoadVarUInt added in v1.7.0

func (c *Slice) MustLoadVarUInt(sz uint) *big.Int

func (*Slice) MustPreloadBigUInt added in v1.9.6

func (c *Slice) MustPreloadBigUInt(sz uint) *big.Int

func (*Slice) MustPreloadSlice added in v1.9.6

func (c *Slice) MustPreloadSlice(sz uint) []byte

func (*Slice) MustPreloadUInt added in v1.9.6

func (c *Slice) MustPreloadUInt(sz uint) uint64

func (*Slice) MustToCell added in v1.0.0

func (c *Slice) MustToCell() *Cell

func (*Slice) MustToPrefixDict added in v1.17.0

func (c *Slice) MustToPrefixDict(keySz uint) *PrefixDictionary

func (*Slice) OnlyFirst added in v1.17.0

func (c *Slice) OnlyFirst(bits uint, refs int) bool

func (*Slice) OnlyLast added in v1.17.0

func (c *Slice) OnlyLast(bits uint, refs int) bool

func (*Slice) PeekRefCell added in v1.17.0

func (c *Slice) PeekRefCell() (*Cell, error)

func (*Slice) PeekRefCellAt added in v1.17.0

func (c *Slice) PeekRefCellAt(i int) (*Cell, error)

func (*Slice) PreloadBigInt added in v1.17.0

func (c *Slice) PreloadBigInt(sz uint) (*big.Int, error)

func (*Slice) PreloadBigUInt added in v1.9.6

func (c *Slice) PreloadBigUInt(sz uint) (*big.Int, error)

func (*Slice) PreloadBigUIntInto added in v1.18.0

func (c *Slice) PreloadBigUIntInto(dst *big.Int, sz uint) error

PreloadBigUIntInto decodes sz bits into dst without advancing the slice. Reusing dst avoids the allocation performed by PreloadBigUInt. On error, dst is not changed.

func (*Slice) PreloadRef added in v1.9.6

func (c *Slice) PreloadRef() (*Slice, error)

func (*Slice) PreloadRefCell added in v1.9.6

func (c *Slice) PreloadRefCell() (*Cell, error)

func (*Slice) PreloadSlice added in v1.9.6

func (c *Slice) PreloadSlice(sz uint) ([]byte, error)

func (*Slice) PreloadSliceInto added in v1.18.0

func (c *Slice) PreloadSliceInto(dst []byte, sz uint) error

PreloadSliceInto copies sz bits into dst without advancing the slice. The copied bits are left-aligned in dst, matching PreloadSlice. It returns io.ErrShortBuffer when dst cannot hold the result.

func (*Slice) PreloadSubslice added in v1.17.0

func (c *Slice) PreloadSubslice(bits uint, refs int) (*Slice, error)

func (*Slice) PreloadUInt added in v1.9.6

func (c *Slice) PreloadUInt(sz uint) (uint64, error)

func (*Slice) RefRange added in v1.17.0

func (c *Slice) RefRange() (start, end int)

func (*Slice) RefsNum added in v1.0.0

func (c *Slice) RefsNum() int

func (*Slice) RemoveTrailing added in v1.17.0

func (c *Slice) RemoveTrailing() int

func (*Slice) RestBits added in v1.0.0

func (c *Slice) RestBits() (uint, []byte, error)

func (*Slice) SetTrace added in v1.17.0

func (c *Slice) SetTrace(trace *Trace) *Slice

func (*Slice) SkipBits added in v1.17.0

func (c *Slice) SkipBits(bits uint) error

func (*Slice) SkipBitsAndRefs added in v1.17.0

func (c *Slice) SkipBitsAndRefs(bits uint, refs int) error

func (*Slice) SkipFirst added in v1.17.0

func (c *Slice) SkipFirst(bits uint, refs int) bool

func (*Slice) SkipLast added in v1.17.0

func (c *Slice) SkipLast(bits uint, refs int) bool

func (*Slice) String added in v1.11.0

func (c *Slice) String() string

func (*Slice) Subslice added in v1.17.0

func (c *Slice) Subslice(offsetBits uint, offsetRefs int, bits uint, refs int) (*Slice, error)

func (*Slice) ToAugDict added in v1.17.0

func (c *Slice) ToAugDict(keySz uint, skipExtra AugmentedExtraSkipper) (*AugmentedDictionary, error)

func (*Slice) ToAugDictWithAugmentation added in v1.17.0

func (c *Slice) ToAugDictWithAugmentation(keySz uint, aug Augmentation) (*AugmentedDictionary, error)

func (*Slice) ToAugDictWithValue added in v1.17.0

func (c *Slice) ToAugDictWithValue(keySz uint, skipExtra AugmentedExtraSkipper, skipValue AugmentedExtraSkipper) (*AugmentedDictionary, error)

ToAugDictWithValue is the safe inline HashmapAug loader when the augmented leaf value does not consume the whole remainder of the current slice. Pass nil skipValue only when the augmented dict occupies the rest of the slice.

func (*Slice) ToAugDictWithValueAndAugmentation added in v1.17.0

func (c *Slice) ToAugDictWithValueAndAugmentation(keySz uint, aug Augmentation, skipValue AugmentedExtraSkipper) (*AugmentedDictionary, error)

func (*Slice) ToBuilder added in v1.9.0

func (c *Slice) ToBuilder() *Builder

func (*Slice) ToCell added in v1.0.0

func (c *Slice) ToCell() (*Cell, error)

func (*Slice) ToDict added in v1.0.0

func (c *Slice) ToDict(keySz uint) (*Dictionary, error)

func (*Slice) ToPrefixDict added in v1.17.0

func (c *Slice) ToPrefixDict(keySz uint) (*PrefixDictionary, error)

func (*Slice) Trace added in v1.17.0

func (c *Slice) Trace() *Trace

func (*Slice) WithoutTrace added in v1.17.0

func (c *Slice) WithoutTrace() *Slice

type Trace added in v1.17.0

type Trace struct {
	// contains filtered or unexported fields
}

func CombineTraces added in v1.17.0

func CombineTraces(traces ...*Trace) *Trace

func NewTrace added in v1.17.0

func NewTrace(hooks TraceHooks) *Trace

func NewTraceForListener added in v1.18.0

func NewTraceForListener(l TraceListener) *Trace

NewTraceForListener wires a Trace directly to the listener, allocating only the Trace itself.

func (*Trace) Child added in v1.17.0

func (t *Trace) Child(refIdx int) *Trace

func (*Trace) NotifyCreate added in v1.17.0

func (t *Trace) NotifyCreate() error

func (*Trace) NotifyLoad added in v1.17.0

func (t *Trace) NotifyLoad(c *Cell)

func (*Trace) PendingError added in v1.17.0

func (t *Trace) PendingError() error

func (*Trace) WithoutTrace added in v1.17.0

func (t *Trace) WithoutTrace(trace *Trace) *Trace

type TraceHooks added in v1.17.0

type TraceHooks struct {
	OnLoad       func(*Cell)
	OnCreate     func()
	OnChild      func(refIdx int) *Trace
	PendingError func() error
}

type TraceListener added in v1.18.0

type TraceListener interface {
	OnLoad(*Cell)
	OnCreate()
	ChildTrace(refIdx int) *Trace
	PendingError() error
}

TraceListener receives the same events as TraceHooks through interface dispatch, letting a single object back a Trace without allocating a closure per hook.

type TraceNode added in v1.17.0

type TraceNode uint32

type Type added in v1.8.0

type Type uint8
const (
	OrdinaryCellType     Type = 0x00
	PrunedCellType       Type = 0x01
	LibraryCellType      Type = 0x02
	MerkleProofCellType  Type = 0x03
	MerkleUpdateCellType Type = 0x04
	UnknownCellType      Type = 0xFF
)

Jump to

Keyboard shortcuts

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