tree

package
v0.1.102 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeBalanceTree

func ComputeBalanceTree(client *ethclient.Client, bridgeAddress common.Address, l2RawClaims []byte, l2NetworkID uint32, l2RawDeposits []byte) (common.Hash, map[string]*big.Int, error)

computeBalanceTree computes the balance tree root from claims and deposits data

func ComputeNullifierTree

func ComputeNullifierTree(rawClaims []byte) (common.Hash, error)

computeNullifierTree computes the nullifier tree root from raw claims data

func FromBool

func FromBool(b bool) common.Hash

func FromU256

func FromU256(u *big.Int) common.Hash

func GetBalanceTreeData

func GetBalanceTreeData(opts *BalanceTreeOptions) ([]byte, []byte, error)

getBalanceTreeData reads the claims and deposits files

func GetInputData

func GetInputData(args []string, fileName string) ([]byte, error)

getInputData reads input data from file, args, or stdin

func IsMessageClaim

func IsMessageClaim(input []byte) (bool, error)

func Uint32ToBytesLittleEndian

func Uint32ToBytesLittleEndian(num uint32) []byte

Types

type BalanceTreeOptions

type BalanceTreeOptions struct {
	L2ClaimsFile, L2DepositsFile, BridgeAddress, RpcURL string
	L2NetworkID                                         uint32
	Insecure                                            bool
}

BalanceTreeOptions holds options for the balance tree command

type Balancer

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

func NewBalanceTree

func NewBalanceTree() (*Balancer, error)

func (*Balancer) UpdateBalanceTree

func (b *Balancer) UpdateBalanceTree(token TokenInfo, leaf *big.Int) (common.Hash, error)

type FileOptions

type FileOptions struct {
	FileName string
}

FileOptions holds options for file input

type Node

type Node struct {
	Left  common.Hash
	Right common.Hash
}

type Nullifier

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

func NewNullifierTree

func NewNullifierTree() (*Nullifier, error)

func (*Nullifier) UpdateNullifierTree

func (n *Nullifier) UpdateNullifierTree(nullifier NullifierKey) (common.Hash, error)

type NullifierKey

type NullifierKey struct {
	NetworkID uint32
	Index     uint32
}

NullifierKey struct

func (*NullifierKey) ToBits

func (n *NullifierKey) ToBits() []bool

type TokenInfo

type TokenInfo struct {
	OriginNetwork      *big.Int
	OriginTokenAddress common.Address // 20 bytes, Ethereum address
}

TokenInfo struct

func TokenInfoStringToStruct

func TokenInfoStringToStruct(key string) (TokenInfo, error)

func (*TokenInfo) String

func (t *TokenInfo) String() string

func (*TokenInfo) ToBits

func (t *TokenInfo) ToBits() []bool

ToBits convert TokenInfo to an array of 192 bits (bool)

type Tree

type Tree struct {
	Tree map[common.Hash]Node
	// contains filtered or unexported fields
}

Directories

Path Synopsis
Package balance provides the compute-balance-tree command.
Package balance provides the compute-balance-tree command.
Package combined provides the compute-balance-nullifier-tree command.
Package combined provides the compute-balance-nullifier-tree command.
Package nullifier provides the compute-nullifier-tree command.
Package nullifier provides the compute-nullifier-tree command.

Jump to

Keyboard shortcuts

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