Documentation ¶
Index ¶
- Constants
- Variables
- func ComputeCompactValue(result *[]byte, path []byte, payload *ledger.Payload, nodeHeight int)
- func GetDefaultHashForHeight(height int) []byte
- func GetDefaultHashes() [defaultHashLen][]byte
- func HashInterNode(hash1 []byte, hash2 []byte) []byte
- func HashInterNodeIn(result *[]byte, hash1 []byte, hash2 []byte)
- func HashLeaf(path []byte, value []byte) []byte
- func HashLeafIn(result *[]byte, path []byte, value []byte)
- func VerifyTrieBatchProof(bp *ledger.TrieBatchProof, expectedState ledger.State) bool
- func VerifyTrieProof(p *ledger.TrieProof, expectedState ledger.State) bool
Constants ¶
const HashLen = hash.HashLenSha3_256
HashLen is the default output hash length in bytes
Variables ¶
var EmptyHash [HashLen]byte
EmptyHash is a hash with all zeroes, used for padding
Functions ¶
func ComputeCompactValue ¶
ComputeCompactValue computes the value for the node considering the sub tree to only include this value and default values. It writes the hash result to the result input.
func GetDefaultHashForHeight ¶
GetDefaultHashForHeight returns the default hashes of the SMT at a specified height.
For each tree level N, there is a default hash equal to the chained hashing of the default value N times.
func GetDefaultHashes ¶
func GetDefaultHashes() [defaultHashLen][]byte
GetDefaultHashes returns the default hashes of the SMT.
For each tree level N, there is a default hash equal to the chained hashing of the default value N times.
func HashInterNode ¶
HashInterNode generates hash value for intermediate nodes (SHA3-256).
hash1 and hash2 must each be a 32 byte slice. TODO: delete this function after refactoring ptrie
func HashInterNodeIn ¶ added in v0.16.0
HashInterNodeIn generates hash value for intermediate nodes (SHA3-256) and stores the hash value in the provided result slice
result slice can be equal to hash1 or hash2. hash1 and hash2 must each be a 32 byte slice.
func HashLeaf ¶
HashLeaf generates hash value for leaf nodes (SHA3-256).
path must be a 32 byte slice. note that we don't include the keys here as they are already included in the path TODO: delete this function after refactoring ptrie
func HashLeafIn ¶ added in v0.16.0
HashLeafIn generates hash value for leaf nodes (SHA3-256) and stores the hash value in the provided result slice
path must be a 32 byte slice. note that we don't include the keys here as they are already included in the path
func VerifyTrieBatchProof ¶
func VerifyTrieBatchProof(bp *ledger.TrieBatchProof, expectedState ledger.State) bool
VerifyTrieBatchProof verifies all the proof inside the batchproof
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package encoding provides byte serialization and deserialization of trie and ledger structs.
|
Package encoding provides byte serialization and deserialization of trie and ledger structs. |
Package pathfinder computes the trie storage path for any given key/value pair
|
Package pathfinder computes the trie storage path for any given key/value pair |