Documentation ¶
Overview ¶
Package trie_blake2b_verify contains functions for verification of the proofs of inclusion or absence in the trie with trie_blake2b commitment model. The package only depends on the commitment model implementation and the proof format it defines. The verification package is completely independent on the implementation of the Merkle tree (the trie)
DISCLAIMER: THE FOLLOWING CODE IS SECURITY CRITICAL. ANY POTENTIAL BUG WHICH MAY LEAD TO FALSE POSITIVES OF PROOF VALIDITY CHECKS POTENTIALLY CREATES AN ATTACK VECTOR. THEREFORE, IT IS HIGHLY RECOMMENDED THE VERIFICATION CODE TO BE WRITTEN BY THE VERIFYING PARTY ITSELF, INSTEAD OF CLONING THIS PACKAGE. DO NOT TRUST ANYBODY BUT YOURSELF. IN ANY CASE, PERFORM A DETAILED AUDIT OF THE PROOF-VERIFYING CODE BEFORE USING IT
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsProofOfAbsence ¶
func IsProofOfAbsence(p *trie_blake2b.MerkleProof) bool
IsProofOfAbsence checks if it is proof of absence. MerkleProof that the trie commits to something else in the place where it would commit to the key if it would be present
func MustKeyWithTerminal ¶
func MustKeyWithTerminal(p *trie_blake2b.MerkleProof) ([]byte, []byte)
MustKeyWithTerminal returns key and terminal commitment the proof is about. It returns: - key - terminal commitment. If it is nil, the proof is a proof of absence It does not verify the proof, so this function should be used only after Validate()
func Validate ¶
func Validate(p *trie_blake2b.MerkleProof, rootBytes []byte) error
Validate check the proof against the provided root commitments
func ValidateWithTerminal ¶
func ValidateWithTerminal(p *trie_blake2b.MerkleProof, rootBytes, terminalBytes []byte) error
ValidateWithTerminal checks the proof and checks if the proof commits to the specific value The check is dependent on the commitment model because of valueOptimisationThreshold
Types ¶
This section is empty.