mpt

package
v1.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const CHILDREN_COUNT = 16

Variables

Functions

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 ProofLibNibblePath

type ProofLibNibblePath struct {
	Nibbles [32]byte
	Start   *big.Int
	End     *big.Int
}

type ProofLibProofNode

type ProofLibProofNode struct {
	Path     ProofLibNibblePath
	Children [16][32]byte
	Value    []byte
}

func ConvertProofNode

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

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

type TypesReceiptProof

type TypesReceiptProof struct {
	Headers      [][]byte
	BlockIndex   []byte
	BlockProof   []ProofLibProofNode
	ReceiptsRoot [32]byte
	Index        []byte
	Receipt      []byte
	ReceiptProof []ProofLibProofNode
}

Jump to

Keyboard shortcuts

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