l1infotree

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(data ...[32]byte) [32]byte

Hash calculates the keccak hash of elements.

func HashLeafData

func HashLeafData(ger, prevBlockHash common.Hash, minTimestamp uint64) [32]byte

HashLeafData calculates the keccak hash of the leaf values.

Types

type L1InfoTree

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

L1InfoTree provides methods to compute L1InfoTree

func NewL1InfoTree

func NewL1InfoTree(logger *log.Logger, height uint8, initialLeaves [][32]byte) (*L1InfoTree, error)

NewL1InfoTree creates new L1InfoTree.

func (*L1InfoTree) AddLeaf

func (mt *L1InfoTree) AddLeaf(index uint32, leaf [32]byte) (common.Hash, error)

AddLeaf adds new leaves to the tree and computes the new root

func (*L1InfoTree) BuildL1InfoRoot

func (mt *L1InfoTree) BuildL1InfoRoot(leaves [][32]byte) (common.Hash, error)

BuildL1InfoRoot computes the root given the leaves of the tree

func (*L1InfoTree) ComputeMerkleProof

func (mt *L1InfoTree) ComputeMerkleProof(gerIndex uint32, leaves [][32]byte) ([][32]byte, common.Hash, error)

ComputeMerkleProof computes the merkleProof and root given the leaves of the tree

func (*L1InfoTree) GetCurrentRootCountAndSiblings

func (mt *L1InfoTree) GetCurrentRootCountAndSiblings() (common.Hash, uint32, [][32]byte)

GetCurrentRootCountAndSiblings returns the latest root, count and sibblings

func (*L1InfoTree) ResetL1InfoTree

func (mt *L1InfoTree) ResetL1InfoTree(initialLeaves [][32]byte) (*L1InfoTree, error)

ResetL1InfoTree resets the L1InfoTree.

Jump to

Keyboard shortcuts

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