mpt

package
v1.5.10 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const CHILDREN_COUNT = 16

Variables

Functions

func ConvertProofNode

func ConvertProofNode(nodes []*ProofNode) []contract.ProofLibProofNode

func IndexToKey

func IndexToKey(index, total int) []byte

func MinReprBytes

func MinReprBytes(numKeys int) (keyLen int)

func Prove

func Prove(root common.Hash, key, value []byte, proofNodes []*ProofNode) bool

func ToIndexBytes

func ToIndexBytes(index, keyLen int) []byte

Types

type NibblePath

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

func NewNibblePath

func NewNibblePath(key []byte) NibblePath

func (*NibblePath) CommonPrefix

func (path *NibblePath) CommonPrefix(other *NibblePath) (prefix, path1, path2 NibblePath)

func (*NibblePath) ComputeMerkle

func (path *NibblePath) ComputeMerkle(nodeMerkle common.Hash) common.Hash

func (*NibblePath) Length

func (path *NibblePath) Length() int

func (*NibblePath) ToChild

func (path *NibblePath) ToChild() (childIndex byte, childPath NibblePath, ok bool)

func (*NibblePath) Trim

func (path *NibblePath) Trim() NibblePath

type Node

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

func (*Node) Hash

func (n *Node) Hash() common.Hash

func (*Node) Insert

func (n *Node) Insert(key, value []byte)

Insert inserts key and value into mpt. Note, key should be in the same length and inserted in order.

func (*Node) Proof

func (n *Node) Proof(key []byte) ([]*ProofNode, bool)

type ProofNode

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

func (*ProofNode) ComputeMerkle

func (n *ProofNode) ComputeMerkle() common.Hash

func (ProofNode) String

func (n ProofNode) String() string

Jump to

Keyboard shortcuts

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