Documentation ¶
Index ¶
- Variables
- func BuildMap(size int) map[string][]byte
- func CalcRoot(data map[string][]byte) []byte
- func ConvertExistenceProof(p *merkle.SimpleProof, key, value []byte) (*ics23.ExistenceProof, error)
- func CreateMembershipProof(data map[string][]byte, key []byte) (*ics23.CommitmentProof, error)
- func CreateNonMembershipProof(data map[string][]byte, key []byte) (*ics23.CommitmentProof, error)
- func GetKey(allkeys []string, loc Where) string
- func GetNonKey(allkeys []string, loc Where) string
- func SortedKeys(data map[string][]byte) []string
- type SimpleResult
- type Where
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyKey = errors.New("key is empty") ErrEmptyKeyInData = errors.New("data contains empty key") )
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)
Functions ¶
func BuildMap ¶
BuildMap creates random key/values and stores in a map, returns a list of all keys in sorted order
func ConvertExistenceProof ¶
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 ¶
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 ¶
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 SortedKeys ¶
Types ¶
type SimpleResult ¶
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 ¶
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