common

package
v0.14.5-patch.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const HashLen = 32

HashLen is the default output hash length in bytes

Variables

This section is empty.

Functions

func ComputeCompactValue

func ComputeCompactValue(path []byte, payload *ledger.Payload, nodeHeight int) []byte

ComputeCompactValue computes the value for the node considering the sub tree to only include this value and default values.

func GetDefaultHashForHeight

func GetDefaultHashForHeight(height int) []byte

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

func HashInterNode(hash1 []byte, hash2 []byte) []byte

HashInterNode generates hash value for intermediate nodes (SHA3-256).

hash1 and hash2 must each be a 32 byte slice.

func HashLeaf

func HashLeaf(path []byte, value []byte) []byte

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

func VerifyTrieBatchProof

func VerifyTrieBatchProof(bp *ledger.TrieBatchProof, expectedState ledger.State) bool

VerifyTrieBatchProof verifies all the proof inside the batchproof

func VerifyTrieProof

func VerifyTrieProof(p *ledger.TrieProof, expectedState ledger.State) bool

VerifyTrieProof verifies the proof, by constructing all the hash from the leaf to the root and comparing the rootHash

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL