diff --git a/store/firstlast.go b/store/firstlast.go index 307f932fb0c8..0ab4e319e08a 100644 --- a/store/firstlast.go +++ b/store/firstlast.go @@ -7,7 +7,7 @@ import ( sdkkv "github.com/cosmos/cosmos-sdk/types/kv" ) -// Gets the first item. +// First gets the first item. func First(st KVStore, start, end []byte) (kv sdkkv.Pair, ok bool) { iter := st.Iterator(start, end) if !iter.Valid() { @@ -18,7 +18,7 @@ func First(st KVStore, start, end []byte) (kv sdkkv.Pair, ok bool) { return sdkkv.Pair{Key: iter.Key(), Value: iter.Value()}, true } -// Gets the last item. `end` is exclusive. +// Last gets the last item. `end` is exclusive. func Last(st KVStore, start, end []byte) (kv sdkkv.Pair, ok bool) { iter := st.ReverseIterator(end, start) if !iter.Valid() { diff --git a/store/tools/ics23/iavl/README.md b/store/tools/ics23/iavl/README.md index 45f2e81a5e83..756f04871079 100644 --- a/store/tools/ics23/iavl/README.md +++ b/store/tools/ics23/iavl/README.md @@ -13,7 +13,7 @@ current value). This returns an error if the key does not exist in the tree. `func CreateNonMembershipProof(tree *iavl.MutableTree, key []byte) (*proofs.CommitmentProof, error)` produces a CommitmentProof that the given key doesn't exist in the iavl tree. -This returns an error if the key does not exist in the tree. +This returns an error if the key exists in the tree. Generalized range proofs are lower in priority, as they are just an optimization of the two basic proof types, and don't provide any additional capabilities. diff --git a/store/tools/ics23/iavl/helpers/helpers.go b/store/tools/ics23/iavl/helpers/helpers.go index c39da851c651..26f1f09dcfc9 100644 --- a/store/tools/ics23/iavl/helpers/helpers.go +++ b/store/tools/ics23/iavl/helpers/helpers.go @@ -1,7 +1,7 @@ /* Package helpers contains functions to build sample data for tests/testgen -In it's own package to avoid poluting the godoc for ics23-iavl +In it's own package to avoid polluting the godoc for ics23-iavl */ package helpers @@ -56,7 +56,7 @@ func GenerateIavlResult(size int, loc tmproofs.Where) (*IavlResult, error) { return res, nil } -// GetKey this returns a key, on Left/Right/Middle +// GetKey returns a key, on Left/Right/Middle func GetKey(allkeys [][]byte, loc tmproofs.Where) []byte { if loc == tmproofs.Left { return allkeys[0] diff --git a/store/tools/ics23/smt/README.md b/store/tools/ics23/smt/README.md index 0e65e87e2249..82c06eddcbf1 100644 --- a/store/tools/ics23/smt/README.md +++ b/store/tools/ics23/smt/README.md @@ -10,7 +10,7 @@ It exposes a two main functions : produces a CommitmentProof that the given key exists in the SMT (and contains the current value). This returns an error if the key does not exist in the tree. `func CreateNonMembershipProof(tree *smt.SparseMerkleTree, key []byte, preimages PreimageMap) (*ics23.CommitmentProof, error)` -produces a CommitmentProof that the given key doesn't exist in the SMT. This returns an error if the key does not exist in the tree. +produces a CommitmentProof that the given key doesn't exist in the SMT. This returns an error if the key exists in the tree. This relies on an auxiliary `PreimageMap` object which provides access to the preimages of all keys in the tree based on their (hashed) path ordering. diff --git a/store/tools/ics23/smt/helpers/helpers.go b/store/tools/ics23/smt/helpers/helpers.go index 1c8a1415a7c6..d444c47d61ec 100644 --- a/store/tools/ics23/smt/helpers/helpers.go +++ b/store/tools/ics23/smt/helpers/helpers.go @@ -1,7 +1,7 @@ /* Package helpers contains functions to build sample data for tests/testgen -In it's own package to avoid poluting the godoc for ics23-smt +In it's own package to avoid polluting the godoc for ics23-smt */ package helpers diff --git a/store/tracekv/store.go b/store/tracekv/store.go index a454edc7dd5f..91f3c657682c 100644 --- a/store/tracekv/store.go +++ b/store/tracekv/store.go @@ -79,13 +79,13 @@ func (tkv *Store) Has(key []byte) bool { } // Iterator implements the KVStore interface. It delegates the Iterator call -// the to the parent KVStore. +// to the parent KVStore. func (tkv *Store) Iterator(start, end []byte) types.Iterator { return tkv.iterator(start, end, true) } // ReverseIterator implements the KVStore interface. It delegates the -// ReverseIterator call the to the parent KVStore. +// ReverseIterator call to the parent KVStore. func (tkv *Store) ReverseIterator(start, end []byte) types.Iterator { return tkv.iterator(start, end, false) } diff --git a/store/types/store.go b/store/types/store.go index bb4cf2031af3..988bbf55a4f1 100644 --- a/store/types/store.go +++ b/store/types/store.go @@ -59,7 +59,7 @@ type StoreRename struct { NewKey string `json:"new_key"` } -// IsDeleted returns true if the given key should be added +// IsAdded returns true if the given key should be added func (s *StoreUpgrades) IsAdded(key string) bool { if s == nil { return false @@ -192,7 +192,7 @@ type CommitMultiStore interface { // BasicKVStore is a simple interface to get/set data type BasicKVStore interface { - // Get returns nil iff key doesn't exist. Panics on nil key. + // Get returns nil if key doesn't exist. Panics on nil key. Get(key []byte) []byte // Has checks if a key exists. Panics on nil key. @@ -338,7 +338,7 @@ type StoreKey interface { } // CapabilityKey represent the Cosmos SDK keys for object-capability -// generation in the IBC protocol as defined in https://github.com/cosmos/ics/tree/master/spec/ics-005-port-allocation#data-structures +// generation in the IBC protocol as defined in https://github.com/cosmos/ibc/tree/master/spec/core/ics-005-port-allocation#data-structures type CapabilityKey StoreKey // KVStoreKey is used for accessing substores. diff --git a/store/types/utils.go b/store/types/utils.go index 22c8ca0761f9..f0cf469871d9 100644 --- a/store/types/utils.go +++ b/store/types/utils.go @@ -6,12 +6,12 @@ import ( "github.com/cosmos/cosmos-sdk/types/kv" ) -// Iterator over all the keys with a certain prefix in ascending order +// KVStorePrefixIterator iterates over all the keys with a certain prefix in ascending order func KVStorePrefixIterator(kvs KVStore, prefix []byte) Iterator { return kvs.Iterator(prefix, PrefixEndBytes(prefix)) } -// Iterator over all the keys with a certain prefix in descending order. +// KVStoreReversePrefixIterator iterates over all the keys with a certain prefix in descending order. func KVStoreReversePrefixIterator(kvs KVStore, prefix []byte) Iterator { return kvs.ReverseIterator(prefix, PrefixEndBytes(prefix)) } diff --git a/store/types/validity.go b/store/types/validity.go index ef2387a69269..32619271b488 100644 --- a/store/types/validity.go +++ b/store/types/validity.go @@ -1,13 +1,13 @@ package types -// Check if the key is valid(key is not nil) +// AssertValidKey checks if the key is valid(key is not nil) func AssertValidKey(key []byte) { if len(key) == 0 { panic("key is nil") } } -// Check if the value is valid(value is not nil) +// AssertValidValue checks if the value is valid(value is not nil) func AssertValidValue(value []byte) { if value == nil { panic("value is nil")