bridgectrl

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 8 Imported by: 0

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 Hash

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(cfg Config, networks []uint, mtStore interface{}) (*BridgeController, error)

NewBridgeController creates new BridgeController.

func (*BridgeController) AddDeposit

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

AddDeposit adds deposit information to the bridge tree.

func (*BridgeController) GetExitRoot

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

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

func (*BridgeController) ReorgMT

func (bt *BridgeController) ReorgMT(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