Documentation ¶
Index ¶
- Constants
- Variables
- func ChainByKey() []byte
- func ChainByValue(value []byte) []byte
- func IsChainedByKey(value []byte) bool
- func IsChainedByValue(value []byte) (key []byte, ok bool)
- func VerifyChainedTrieNodesStore(option VerifyTrieNodesStoreOption) error
- func VerifyTrieNodesStore(option VerifyTrieNodesStoreOption) error
- type ChainedBy
- type OnKeyValueFunc
- type OnTrieNodeFunc
- type VerifyTrieNodesStoreOption
Constants ¶
const ( // MarkChainedByKey is used as a value placeholder in a parent TrieNodes (PP), which indicates // that there is a child TrieNodes (CP) chained up in the PP with the key as the CP's root hash // and the value equals to this placeholder. MarkChainedByKey = markChained + byKey // MarkChainedByValue is used to prefix a value in a parent TrieNodes (PP), which indicates that // there is a child TrieNodes (CP) chained up in the PP with the prefix + CP's root hash as the // value in PP. MarkChainedByValue = markChained + byValue )
Variables ¶
var ( // ErrTrieCycleDetected is the error returned when trie cycle is detected ErrTrieCycleDetected = errors.New("trie cycle detected") // ErrTrieTraversalStopped is the error returned when trie traversal is stopped by a callback // function ErrTrieTraversalStopped = errors.New("trie traversal stopped") // ErrTrieRawKeyMissing is the error when a trie raw key is missing ErrTrieRawKeyMissing = errors.New("trie raw key missing") )
Functions ¶
func ChainByKey ¶
func ChainByKey() []byte
ChainByKey returns the value to indicate that the key of the value should be used as the descendent key that is the root of the child trie
func ChainByValue ¶
ChainByValue marks the value as chained by key, where the value will be used as the descendent key that is the root of the child trie
func IsChainedByKey ¶
IsChainedByKey indicates whether the value is a meta value that means chained by key
func IsChainedByValue ¶
IsChainedByValue indicates whether the value is chained by value. If so, the descendent key will be returned, and the ok will be true
func VerifyChainedTrieNodesStore ¶
func VerifyChainedTrieNodesStore(option VerifyTrieNodesStoreOption) error
VerifyChainedTrieNodesStore verifies the chained trie nodes contained in the store. If it succeeds, it will return a set of key-value pairs the chained trie nodes contains, after which it is up to the caller to verify the key-value pairs. The `KeySep` in each `KeyValue` can be used to access the key within each tries
func VerifyTrieNodesStore ¶
func VerifyTrieNodesStore(option VerifyTrieNodesStoreOption) error
VerifyTrieNodesStore verifies the trie nodes contained in the store. If it succeeds, it will return a set of key-value pairs the trie nodes contains, after which it is up to the caller to verify the key-value pairs
Types ¶
type ChainedBy ¶
type ChainedBy int
ChainedBy represents a chained by type
func GetChainedBy ¶
GetChainedBy gets the value's descendent key and chained by type. When the type is ChainedByKey, the returned key is nil, and the user should use the key that is used to retrieve the value as the descendent key
type OnKeyValueFunc ¶
OnKeyValueFunc represents the function type that is called whenever a key-value is retrieved during a traversal. Return an error will stop the traversal. To halt the traversal earlier, return a ErrTrieTraversalStopped
type OnTrieNodeFunc ¶
OnTrieNodeFunc represents the function type that is called whenever a trie node is retrieved during a traversal. Return an error will stop the traversal. To halt the traversal earlier, return a ErrTrieTraversalStopped
type VerifyTrieNodesStoreOption ¶
type VerifyTrieNodesStoreOption struct { Store ethdb.KeyValueReader Node trie.Node OnTrieNode OnTrieNodeFunc OnKeyValue OnKeyValueFunc // contains filtered or unexported fields }
VerifyTrieNodesStoreOption represents the options for VerifyProof