helpers

package
v0.0.0-...-6a37184 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package helpers contains functions to build sample data for tests/testgen

In it's own package to avoid polluting the godoc for ics23-smt

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PreimageMap

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

PreimageMap maps each tree path back to its preimage needed because SparseMerkleTree methods take preimage as arg and hash internally

func BuildTree

func BuildTree(size int) (*smt.SparseMerkleTree, *PreimageMap, error)

BuildTree creates random key/values and stores in tree returns a list of all keys in sorted order

func (PreimageMap) FindPath

func (pim PreimageMap) FindPath(path [32]byte) (int, bool)

FindPath returns the closest index to path in paths, and whether it's a match. If not found, the returned index is where the path would be.

func (PreimageMap) GetKey

func (pim PreimageMap) GetKey(loc tmproofs.Where) []byte

GetKey this returns a key, on Left/Right/Middle

func (PreimageMap) GetNonKey

func (pim PreimageMap) GetNonKey(loc tmproofs.Where) []byte

GetNonKey returns a missing key - Left of all, Right of all, or in the Middle

func (PreimageMap) KeyFor

func (pim PreimageMap) KeyFor(pathIx int) []byte

KeyFor returns the preimage (key) for given path index.

func (PreimageMap) Len

func (pim PreimageMap) Len() int

Len returns the number of mapped paths.

Jump to

Keyboard shortcuts

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