Documentation ¶
Index ¶
- Variables
- func ProofFromMerkleLayers(layers [][][]byte, startingLeafIndex int) [][]byte
- type FieldTrie
- func (f *FieldTrie) CopyTrie() *FieldTrie
- func (f *FieldTrie) Empty() bool
- func (f *FieldTrie) FieldReference() *stateutil.Reference
- func (f *FieldTrie) InsertFieldLayer(layer [][]*[32]byte)
- func (f *FieldTrie) Length() uint64
- func (f *FieldTrie) RecomputeTrie(indices []uint64, elements interface{}) ([32]byte, error)
- func (f *FieldTrie) TransferTrie() *FieldTrie
- func (f *FieldTrie) TrieRoot() ([32]byte, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidFieldTrie = errors.New("invalid field trie") ErrEmptyFieldTrie = errors.New("empty field trie") )
Functions ¶
func ProofFromMerkleLayers ¶
ProofFromMerkleLayers creates a proof starting at the leaf index of the state Merkle layers.
Types ¶
type FieldTrie ¶
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) FieldReference ¶
FieldReference returns the underlying field reference object for the trie.
func (*FieldTrie) InsertFieldLayer ¶
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 ¶
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) TransferTrie ¶
TransferTrie starts the process of transferring all the trie related data to a new trie. This is done if we know that other states which hold references to this trie will unlikely need it for recomputation. This helps us save on a copy. Any caller of this method will need to take care that this isn't called on an empty trie.