ulxly

package
v0.1.91 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArgGasLimit             = "gas-limit"
	ArgChainID              = "chain-id"
	ArgPrivateKey           = "private-key"
	ArgValue                = "value"
	ArgRPCURL               = "rpc-url"
	ArgBridgeAddress        = "bridge-address"
	ArgRollupManagerAddress = "rollup-manager-address"
	ArgDestNetwork          = "destination-network"
	ArgDestAddress          = "destination-address"
	ArgForceUpdate          = "force-update-root"
	ArgCallData             = "call-data"
	ArgCallDataFile         = "call-data-file"
	ArgTimeout              = "transaction-receipt-timeout"
	ArgDepositCount         = "deposit-count"
	ArgDepositNetwork       = "deposit-network"
	ArgRollupID             = "rollup-id"
	ArgCompleteMT           = "complete-merkle-tree"
	ArgBridgeServiceURL     = "bridge-service-url"
	ArgFileName             = "file-name"
	ArgL2ClaimsFileName     = "l2-claims-file"
	ArgL2DepositsFileName   = "l2-deposits-file"
	ArgL2NetworkID          = "l2-network-id"
	ArgFromBlock            = "from-block"
	ArgToBlock              = "to-block"
	ArgFilterSize           = "filter-size"
	ArgTokenAddress         = "token-address"
	ArgGlobalIndex          = "global-index"
	ArgDryRun               = "dry-run"
	ArgGasPrice             = "gas-price"
	ArgBridgeMappings       = "bridge-service-map"
	ArgBridgeLimit          = "bridge-limit"
	ArgBridgeOffset         = "bridge-offset"
	ArgWait                 = "wait"
	ArgConcurrency          = "concurrency"
	ArgInsecure             = "insecure"
	ArgLegacy               = "legacy"
	ArgProofGER             = "proof-ger"
	ArgProofL1InfoTreeIndex = "proof-l1-info-tree-index"
)
View Source
const (
	// TreeDepth of 32 is pulled directly from the
	// _DEPOSIT_CONTRACT_TREE_DEPTH from the smart contract. We
	// could make this a variable as well
	// https://github.com/0xPolygonHermez/zkevm-contracts/blob/54f58c8b64806429bc4d5c52248f29cf80ba401c/contracts/v2/lib/DepositContractBase.sol#L15
	TreeDepth = 32
)

Variables

View Source
var (
	ErrNotReadyForClaim      = errors.New("the claim transaction is not yet ready to be claimed, try again in a few blocks")
	ErrDepositAlreadyClaimed = errors.New("the claim transaction has already been claimed")
)
View Source
var ULxLyCmd = &cobra.Command{
	Use:   "ulxly",
	Short: "Utilities for interacting with the uLxLy bridge.",
	Long:  "Basic utility commands for interacting with the bridge contracts, bridge services, and generating proofs.",
	Args:  cobra.NoArgs,
}

Functions

func Check added in v0.1.74

func Check(roots []common.Hash, leaf common.Hash, position uint32, siblings [32]common.Hash) (common.Hash, error)

Check is a sanity check of a proof in order to make sure that the proof that was generated creates a root that we recognize. This was useful while testing in order to avoid verifying that the proof works or doesn't work onchain

func DecodeGlobalIndex added in v0.1.79

func DecodeGlobalIndex(globalIndex *big.Int) (bool, uint32, uint32, error)

func FromBool added in v0.1.79

func FromBool(b bool) common.Hash

func FromU256 added in v0.1.79

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

func IsMessageClaim added in v0.1.79

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

func ParseBridgeDepositCount added in v0.1.84

func ParseBridgeDepositCount(logs []types.Log, bridgeContract *ulxly.Ulxly) (uint32, error)

Function to parse deposit count from bridge transaction logs

func String added in v0.1.74

func String[T any](p T) string

String will create the json representation of the proof

func Uint32ToBytesLittleEndian added in v0.1.79

func Uint32ToBytesLittleEndian(num uint32) []byte

func WaitMineTransaction added in v0.1.67

func WaitMineTransaction(ctx context.Context, client *ethclient.Client, tx *types.Transaction, txTimeout uint64) error

Wait for the transaction to be mined

Types

type BalanceTreeOptions added in v0.1.79

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

func (*BalanceTreeOptions) AddFlags added in v0.1.79

func (o *BalanceTreeOptions) AddFlags(cmd *cobra.Command)

type Balancer added in v0.1.79

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

func NewBalanceTree added in v0.1.79

func NewBalanceTree() (*Balancer, error)

func (*Balancer) UpdateBalanceTree added in v0.1.79

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

type DepositID added in v0.1.67

type DepositID struct {
	DepositCnt uint32 `json:"deposit_cnt"`
	NetworkID  uint32 `json:"network_id"`
}

type FileOptions added in v0.1.79

type FileOptions struct {
	FileName string
}

func (*FileOptions) AddFlags added in v0.1.79

func (o *FileOptions) AddFlags(cmd *cobra.Command)

type GetEvent added in v0.1.79

type GetEvent struct {
	URL                            string
	FromBlock, ToBlock, FilterSize uint64
	Insecure                       bool
}

func (*GetEvent) AddFlags added in v0.1.79

func (o *GetEvent) AddFlags(cmd *cobra.Command)

type GetSmcOptions added in v0.1.79

type GetSmcOptions struct {
	BridgeAddress string
}

func (*GetSmcOptions) AddFlags added in v0.1.79

func (o *GetSmcOptions) AddFlags(cmd *cobra.Command)

type GetVerifyBatchesOptions added in v0.1.74

type GetVerifyBatchesOptions struct {
	RollupManagerAddress string
}

func (*GetVerifyBatchesOptions) AddFlags added in v0.1.74

func (o *GetVerifyBatchesOptions) AddFlags(cmd *cobra.Command)

type IMT

type IMT struct {
	Branches   map[uint32][]common.Hash
	Leaves     map[uint32]common.Hash
	Roots      []common.Hash
	ZeroHashes []common.Hash
	Proofs     map[uint32]Proof
}

func (*IMT) AddLeaf

func (s *IMT) AddLeaf(leaf common.Hash, position uint32)

AddLeaf will take a given deposit and add it to the collection of leaves. It will also update the

func (*IMT) GetProof

func (s *IMT) GetProof(depositNum uint32) Proof

GetProof will return an object containing the proof data necessary for verification

func (*IMT) GetRoot

func (s *IMT) GetRoot(depositNum uint32) common.Hash

GetRoot will return the root for a particular deposit

func (*IMT) Init

func (s *IMT) Init()

Init will allocate the objects in the IMT

type JsonError added in v0.1.67

type JsonError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

type Node added in v0.1.79

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

type Nullifier added in v0.1.79

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

func NewNullifierTree added in v0.1.79

func NewNullifierTree() (*Nullifier, error)

func (*Nullifier) UpdateNullifierTree added in v0.1.79

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

type NullifierKey added in v0.1.79

type NullifierKey struct {
	NetworkID uint32
	Index     uint32
}

NullifierKey struct

func (*NullifierKey) ToBits added in v0.1.79

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

type Proof

type Proof struct {
	Siblings     [TreeDepth]common.Hash
	Root         common.Hash
	DepositCount uint32
	LeafHash     common.Hash
}

type ProofOptions added in v0.1.74

type ProofOptions struct {
	DepositCount uint32
}

func (*ProofOptions) AddFlags added in v0.1.74

func (o *ProofOptions) AddFlags(cmd *cobra.Command)

type RollupsProof added in v0.1.74

type RollupsProof struct {
	Siblings [TreeDepth]common.Hash
	Root     common.Hash
	RollupID uint32
	LeafHash common.Hash
}

func ComputeSiblings added in v0.1.74

func ComputeSiblings(rollupID uint32, leaves []common.Hash, height uint8) (*RollupsProof, error)

type RollupsProofOptions added in v0.1.74

type RollupsProofOptions struct {
	RollupID           uint32
	CompleteMerkleTree bool
}

func (*RollupsProofOptions) AddFlags added in v0.1.74

func (o *RollupsProofOptions) AddFlags(cmd *cobra.Command)

type TokenInfo added in v0.1.79

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

TokenInfo struct

func TokenInfoStringToStruct added in v0.1.79

func TokenInfoStringToStruct(key string) (TokenInfo, error)

func (*TokenInfo) String added in v0.1.79

func (t *TokenInfo) String() string

func (*TokenInfo) ToBits added in v0.1.79

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

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

type Tree added in v0.1.79

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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