chore: store audit changes (#11989)
## Description ref: #11362 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This commit is contained in:
parent
b6478026c4
commit
0b810ba08e
@ -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() {
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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))
|
||||
}
|
||||
|
||||
@ -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")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user