fieldtrie

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleEth1DataSlice

func HandleEth1DataSlice(val []*ethpb.Eth1Data, indices []uint64, convertAll bool) ([][32]byte, error)

HandleEth1DataSlice processes a list of eth1data and indices into the appropriate roots.

Types

type FieldTrie

type FieldTrie struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

FieldTrie is the representation of the representative trie of the particular field.

func NewFieldTrie

func NewFieldTrie(field types.FieldIndex, dataType types.DataType, elements interface{}, length uint64) (*FieldTrie, error)

NewFieldTrie is the constructor for the field trie data structure. It creates the corresponding trie according to the given parameters. Depending on whether the field is a basic/composite array which is either fixed/variable length, it will appropriately determine the trie.

func (*FieldTrie) CopyTrie

func (f *FieldTrie) CopyTrie() *FieldTrie

CopyTrie copies the references to the elements the trie is built on.

func (*FieldTrie) Empty

func (f *FieldTrie) Empty() bool

Empty checks whether the underlying field trie is empty or not.

func (*FieldTrie) FieldReference

func (f *FieldTrie) FieldReference() *stateutil.Reference

FieldReference returns the underlying field reference object for the trie.

func (*FieldTrie) InsertFieldLayer

func (f *FieldTrie) InsertFieldLayer(layer [][]*[32]byte)

InsertFieldLayer manually inserts a field layer. This method bypasses the normal method of field computation, it is only meant to be used in tests.

func (*FieldTrie) RecomputeTrie

func (f *FieldTrie) RecomputeTrie(indices []uint64, elements interface{}) ([32]byte, error)

RecomputeTrie rebuilds the affected branches in the trie according to the provided changed indices and elements. This recomputes the trie according to the particular field the trie is based on.

func (*FieldTrie) TrieRoot

func (f *FieldTrie) TrieRoot() ([32]byte, error)

TrieRoot returns the corresponding root of the trie.

Jump to

Keyboard shortcuts

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