proof

package module
v0.0.0-...-9989dbf Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyProof

func VerifyProof(proof *Proof, rootHash common.Hash) error

Types

type Link interface {
	// contains filtered or unexported methods
}

Link in intermediate instances is a hashNode (reference to next step) At the end, it is often shortNode(valueNode) to capture all remaining key (or key = 16 for direct value) Sometimes this is an embedded fullnode if there is little data

type PathStep

type PathStep interface {
	// contains filtered or unexported methods
}

type Proof

type Proof struct {
	Steps        []Step
	Key          []byte
	Value        []byte
	HexRemainder []byte
}

func ComputeProof

func ComputeProof(tr *trie.Trie, key []byte) (*Proof, error)

ComputeProof returns the proof value for a key in given trie. Returned path is the way from the value to the root of the tree.

func (*Proof) RecoverKey

func (p *Proof) RecoverKey() []byte

type ProofRecorder

type ProofRecorder struct {
	// contains filtered or unexported fields
}

ProofRecorder is used to help us grab proofs

func (*ProofRecorder) Path

func (p *ProofRecorder) Path() []Step

func (*ProofRecorder) Put

func (p *ProofRecorder) Put(hash, value []byte) error

type Step

type Step struct {
	// This is the next step, FullNode or ShortNode
	Step PathStep
	// Index is set if Step is FullNode and refers to which subnode we followed
	Index int
	// Hash is set to the expected hash of this level
	Hash []byte
}

Jump to

Keyboard shortcuts

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