merklemulti

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 4 Imported by: 8

Documentation

Index

Constants

View Source
const (
	SourceFromHashes = true
	SourceFromProof  = false
	// Maximum number of leaves in a Merkle tree. This is a limitation of the contract.
	MaxNumberTreeLeaves = 256
)

Variables

This section is empty.

Functions

func VerifyComputeRoot

func VerifyComputeRoot[H hashutil.Hash](hasher hashutil.Hasher[H], leafHashes []H, proof Proof[H]) (H, error)

Types

type Proof

type Proof[H hashutil.Hash] struct {
	Hashes      []H    `json:"hashes"`
	SourceFlags []bool `json:"source_flags"`
}

type Tree

type Tree[H hashutil.Hash] struct {
	// contains filtered or unexported fields
}

func NewTree

func NewTree[H hashutil.Hash](hasher hashutil.Hasher[H], leafHashes []H) (*Tree[H], error)

func (*Tree[H]) Prove

func (t *Tree[H]) Prove(indices []int) (Proof[H], error)

func (*Tree[H]) Root

func (t *Tree[H]) Root() H

func (*Tree[H]) String

func (t *Tree[H]) String() string

Revive appears confused with the generics "receiver name t should be consistent with previous receiver name p for invalid-type"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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