cosmos-sdk: Index | Files

package proofs

import ""


Package Files

convert.go create.go helpers.go


var TendermintSpec = &ics23.ProofSpec{
    LeafSpec: &ics23.LeafOp{
        Prefix:       []byte{0},
        Hash:         ics23.HashOp_SHA256,
        PrehashValue: ics23.HashOp_SHA256,
        Length:       ics23.LengthOp_VAR_PROTO,
    InnerSpec: &ics23.InnerSpec{
        ChildOrder:      []int32{0, 1},
        MinPrefixLength: 1,
        MaxPrefixLength: 1,
        ChildSize:       32,
        Hash:            ics23.HashOp_SHA256,

TendermintSpec constrains the format from ics23-tendermint (crypto/merkle SimpleProof)

func BuildMap Uses

func BuildMap(size int) map[string][]byte

BuildMap creates random key/values and stores in a map, returns a list of all keys in sorted order

func CalcRoot Uses

func CalcRoot(data map[string][]byte) []byte

func ConvertExistenceProof Uses

func ConvertExistenceProof(p *merkle.SimpleProof, key, value []byte) (*ics23.ExistenceProof, error)

ConvertExistenceProof will convert the given proof into a valid existence proof, if that's what it is.

This is the simplest case of the range proof and we will focus on demoing compatibility here

func CreateMembershipProof Uses

func CreateMembershipProof(data map[string][]byte, key []byte) (*ics23.CommitmentProof, error)

CreateMembershipProof will produce a CommitmentProof that the given key (and queries value) exists in the iavl tree. If the key doesn't exist in the tree, this will return an error.

func CreateNonMembershipProof Uses

func CreateNonMembershipProof(data map[string][]byte, key []byte) (*ics23.CommitmentProof, error)

CreateNonMembershipProof will produce a CommitmentProof that the given key doesn't exist in the iavl tree. If the key exists in the tree, this will return an error.

func GetKey Uses

func GetKey(allkeys []string, loc Where) string

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

func GetNonKey Uses

func GetNonKey(allkeys []string, loc Where) string

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

func SortedKeys Uses

func SortedKeys(data map[string][]byte) []string

type SimpleResult Uses

type SimpleResult struct {
    Key      []byte
    Value    []byte
    Proof    *merkle.SimpleProof
    RootHash []byte

SimpleResult contains a merkle.SimpleProof along with all data needed to build the confio/proof

func GenerateRangeProof Uses

func GenerateRangeProof(size int, loc Where) *SimpleResult

GenerateRangeProof makes a tree of size and returns a range proof for one random element

returns a range proof and the root hash of the tree

type Where Uses

type Where int

Where selects a location for a key - Left, Right, or Middle

const (
    Left Where = iota

Package proofs imports 7 packages (graph) and is imported by 1 packages. Updated 2020-07-12. Refresh now. Tools for package owners.