bridgectrl

package
v0.5.0-RC2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 11 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// KeyLen is the length of key and value in the Merkle Tree
	KeyLen = 32
)

Variables

View Source
var HashZero = [KeyLen]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

HashZero is an empty hash

Functions

func ComputeSiblings added in v0.4.0

func ComputeSiblings(rollupIndex uint, leaves [][KeyLen]byte, height uint8) ([][KeyLen]byte, common.Hash, error)

func Hash added in v0.1.0

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

Hash calculates the keccak hash of elements.

Types

type BridgeController

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

BridgeController struct

func NewBridgeController

func NewBridgeController(ctx context.Context, cfg Config, networks []uint, mtStore interface{}) (*BridgeController, error)

NewBridgeController creates new BridgeController.

func (*BridgeController) AddDeposit

func (bt *BridgeController) AddDeposit(ctx context.Context, deposit *etherman.Deposit, depositID uint64, dbTx pgx.Tx) error

AddDeposit adds deposit information to the bridge tree.

func (*BridgeController) AddRollupExitLeaf added in v0.4.0

func (bt *BridgeController) AddRollupExitLeaf(ctx context.Context, rollupLeaf etherman.RollupExitLeaf, dbTx pgx.Tx) error

func (*BridgeController) GetExitRoot added in v0.1.0

func (bt *BridgeController) GetExitRoot(ctx context.Context, networkID int, dbTx pgx.Tx) ([]byte, error)

GetExitRoot returns the dedicated merkle tree's root. only use for the test purpose

func (*BridgeController) GetNetworkID added in v0.4.0

func (bt *BridgeController) GetNetworkID(networkID uint) (uint8, error)

func (*BridgeController) ReorgMT

func (bt *BridgeController) ReorgMT(ctx context.Context, depositCount uint, networkID uint, dbTx pgx.Tx) error

ReorgMT reorg the specific merkle tree.

type Config

type Config struct {
	// Store is the kind of storage in the bridge tree
	Store string
	// Height is the depth of the merkle tree
	Height uint8
}

Config is state config

type MerkleTree

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

MerkleTree struct

func NewMerkleTree

func NewMerkleTree(ctx context.Context, store merkleTreeStore, height uint8, network uint) (*MerkleTree, error)

NewMerkleTree creates new MerkleTree.

Directories

Path Synopsis
Package pb is a reverse proxy.
Package pb is a reverse proxy.

Jump to

Keyboard shortcuts

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