Documentation ¶
Index ¶
- type LogVerifier
- func (v LogVerifier) RootFromInclusionProof(leafIndex, treeSize int64, proof [][]byte, leafHash []byte) ([]byte, error)
- func (v LogVerifier) VerifiedPrefixHashFromInclusionProof(subSize, size int64, proof [][]byte, root []byte, leafHash []byte) ([]byte, error)
- func (v LogVerifier) VerifyConsistencyProof(snapshot1, snapshot2 int64, root1, root2 []byte, proof [][]byte) error
- func (v LogVerifier) VerifyInclusionProof(leafIndex, treeSize int64, proof [][]byte, root []byte, leafHash []byte) error
- type RootMismatchError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogVerifier ¶
type LogVerifier struct {
// contains filtered or unexported fields
}
LogVerifier verifies inclusion and consistency proofs for append only logs.
func (LogVerifier) RootFromInclusionProof ¶
func (v LogVerifier) RootFromInclusionProof(leafIndex, treeSize int64, proof [][]byte, leafHash []byte) ([]byte, error)
RootFromInclusionProof calculates the expected tree root given the proof and leaf. leafIndex starts at 0. treeSize is the number of nodes in the tree. proof is an array of neighbor nodes from the bottom to the root.
func (LogVerifier) VerifiedPrefixHashFromInclusionProof ¶
func (v LogVerifier) VerifiedPrefixHashFromInclusionProof( subSize, size int64, proof [][]byte, root []byte, leafHash []byte, ) ([]byte, error)
VerifiedPrefixHashFromInclusionProof calculates a root hash over leaves [0..subSize), based on the inclusion |proof| and |leafHash| for a leaf at index |subSize-1| in a tree of the specified |size| with the passed in |root| hash. Returns an error if the |proof| verification fails. The resulting smaller tree's root hash is trusted iff the bigger tree's |root| hash is trusted.
func (LogVerifier) VerifyConsistencyProof ¶
func (v LogVerifier) VerifyConsistencyProof(snapshot1, snapshot2 int64, root1, root2 []byte, proof [][]byte) error
VerifyConsistencyProof checks that the passed in consistency proof is valid between the passed in tree snapshots. Snapshots are the respective tree sizes. Accepts shapshot2 >= snapshot1 >= 0.
func (LogVerifier) VerifyInclusionProof ¶
func (v LogVerifier) VerifyInclusionProof(leafIndex, treeSize int64, proof [][]byte, root []byte, leafHash []byte) error
VerifyInclusionProof verifies the correctness of the proof given the passed in information about the tree and leaf.
type RootMismatchError ¶
RootMismatchError occurs when an inclusion proof fails.
func (RootMismatchError) Error ¶
func (e RootMismatchError) Error() string