proof

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFoundInProofTrie = errors.New("key not found in proof trie")
	ErrValueMismatchProofTrie = errors.New("value found in proof trie does not match")
)
View Source
var (
	ErrEmptyProof       = errors.New("proof slice empty")
	ErrRootNodeNotFound = errors.New("root node not found in proof")
)
View Source
var (
	ErrKeyNotFound = errors.New("key not found")
)

Functions

func Generate

func Generate(rootHash []byte, fullKeys [][]byte, database Database) (
	encodedProofNodes [][]byte, err error)

Generate generates and deduplicates the encoded proof nodes for the trie corresponding to the root hash given, and for the slice of (Little Endian) full keys given. The database given is used to load the trie using the root hash given.

func Verify

func Verify(encodedProofNodes [][]byte, rootHash, key, value []byte) (err error)

Verify verifies a given key and value belongs to the trie by creating a proof trie based on the encoded proof nodes given. The order of proofs is ignored. A nil error is returned on success. Note this is exported because it is imported and used by: https://github.com/ComposableFi/ibc-go/blob/6d62edaa1a3cb0768c430dab81bb195e0b0c72db/modules/light-clients/11-beefy/types/client_state.go#L78

Types

type Database

type Database interface {
	Get(key []byte) (value []byte, err error)
}

Database defines a key value Get method used for proof generation.

Jump to

Keyboard shortcuts

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