bridgevm

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name = "bridgevm"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicTransaction

type AtomicTransaction struct {
	ID           ids.ID            `json:"id"`
	Status       AtomicTxStatus    `json:"status"`
	SubTxs       []SubTransaction  `json:"subTxs"`
	Creator      ids.ShortID       `json:"creator"`
	CreatedAt    int64             `json:"createdAt"`
	CompletedAt  int64             `json:"completedAt,omitempty"`
	CommitProofs map[string][]byte `json:"commitProofs"`
}

AtomicTransaction represents a cross-chain atomic transaction

type AtomicTxStatus

type AtomicTxStatus uint8

AtomicTxStatus represents the status of an atomic transaction

const (
	AtomicPending AtomicTxStatus = iota
	AtomicLocked
	AtomicCommitting
	AtomicCommitted
	AtomicAborted
)

type AtomicTxUpdate

type AtomicTxUpdate struct {
	TxID        ids.ID         `json:"txId"`
	NewStatus   AtomicTxStatus `json:"newStatus"`
	SubTxUpdate *SubTxUpdate   `json:"subTxUpdate,omitempty"`
}

AtomicTxUpdate represents an update to an atomic transaction

type Block

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

Block represents a block in the Bridge Chain

func (*Block) Accept

func (b *Block) Accept(context.Context) error

Accept implements the chain.Block interface

func (*Block) Bytes

func (b *Block) Bytes() []byte

Bytes implements the chain.Block interface

func (*Block) Height

func (b *Block) Height() uint64

Height implements the chain.Block interface

func (*Block) ID

func (b *Block) ID() ids.ID

ID implements the chain.Block interface

func (*Block) Parent

func (b *Block) Parent() ids.ID

Parent implements the chain.Block interface

func (*Block) Reject

func (b *Block) Reject(context.Context) error

Reject implements the chain.Block interface

func (*Block) Status

func (b *Block) Status() choices.Status

Status implements the chain.Block interface

func (*Block) Timestamp added in v1.16.56

func (b *Block) Timestamp() time.Time

Timestamp implements the chain.Block interface

func (*Block) Verify

func (b *Block) Verify(ctx context.Context) error

Verify implements the chain.Block interface

type BridgeContract

type BridgeContract struct {
	ChainName   string            `json:"chainName"`
	Address     ethcommon.Address `json:"address"`
	ABI         string            `json:"abi"`
	DeployBlock uint64            `json:"deployBlock"`
}

BridgeContract represents a bridge contract on external chains

type EthCheckpoint

type EthCheckpoint struct {
	BlockNumber uint64         `json:"blockNumber"`
	BlockHash   ethcommon.Hash `json:"blockHash"`
	StateRoot   ethcommon.Hash `json:"stateRoot"`
	Timestamp   uint64         `json:"timestamp"`
	Validators  [][]byte       `json:"validators"`
}

EthCheckpoint represents an Ethereum checkpoint

type Factory

type Factory struct{}

Factory creates new instances of the Bridge VM

func (*Factory) New

func (f *Factory) New(log.Logger) (interface{}, error)

New returns a new instance of the Bridge VM

type StateRootSubmission

type StateRootSubmission struct {
	ChainID     ids.ID         `json:"chainId"`
	BlockHeight uint64         `json:"blockHeight"`
	StateRoot   ethcommon.Hash `json:"stateRoot"`
	BlockHash   ids.ID         `json:"blockHash"`
	EthTxHash   ethcommon.Hash `json:"ethTxHash,omitempty"`
	Submitted   bool           `json:"submitted"`
}

StateRootSubmission represents a state root submission to Ethereum

type SubTransaction

type SubTransaction struct {
	ChainID ids.ID   `json:"chainId"`
	TxData  []byte   `json:"txData"`
	Status  TxStatus `json:"status"`
	Result  []byte   `json:"result,omitempty"`
}

SubTransaction represents a transaction on a specific chain

type SubTxUpdate

type SubTxUpdate struct {
	ChainID ids.ID   `json:"chainId"`
	Index   int      `json:"index"`
	Status  TxStatus `json:"status"`
	Result  []byte   `json:"result,omitempty"`
}

SubTxUpdate represents an update to a sub-transaction

type TxStatus

type TxStatus uint8

TxStatus represents the status of a sub-transaction

const (
	TxPending TxStatus = iota
	TxExecuted
	TxFailed
)

type VM

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

VM implements the chain.ChainVM interface for the Bridge Chain (B-Chain) This chain serves as Lux's interoperability hub and Ethereum anchor

func (*VM) AppGossip

func (vm *VM) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

AppGossip implements the common.AppHandler interface

func (*VM) AppRequest

func (vm *VM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error

AppRequest implements the common.AppHandler interface

func (*VM) AppRequestFailed

func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *common.AppError) error

AppRequestFailed implements the common.AppHandler interface

func (*VM) AppResponse

func (vm *VM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error

AppResponse implements the common.AppHandler interface

func (*VM) BuildBlock

func (vm *VM) BuildBlock(ctx context.Context) (chain.Block, error)

BuildBlock implements the chain.ChainVM interface

func (*VM) Connected

func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error

Connected implements the validators.Connector interface

func (*VM) CreateHandlers

func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error)

CreateHandlers implements the common.VM interface

func (*VM) CrossChainAppRequest

func (vm *VM) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, msg []byte) error

CrossChainAppRequest implements the common.VM interface

func (*VM) CrossChainAppRequestFailed

func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *common.AppError) error

CrossChainAppRequestFailed implements the common.VM interface

func (*VM) CrossChainAppResponse

func (vm *VM) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error

CrossChainAppResponse implements the common.VM interface

func (*VM) Disconnected

func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error

Disconnected implements the validators.Connector interface

func (*VM) GetBlock

func (vm *VM) GetBlock(ctx context.Context, blkID ids.ID) (chain.Block, error)

GetBlock implements the chain.ChainVM interface

func (*VM) GetBlockIDAtHeight

func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)

GetBlockIDAtHeight implements the chain.ChainVM interface

func (*VM) HealthCheck

func (vm *VM) HealthCheck(context.Context) (any, error)

HealthCheck implements the health.Checker interface

func (*VM) ImportEthereumBlock

func (vm *VM) ImportEthereumBlock(header *types.Header, proof []byte) error

ImportEthereumBlock imports an Ethereum block header

func (*VM) Initialize

func (vm *VM) Initialize(
	ctx context.Context,
	chainCtx *snow.Context,
	db database.Database,
	genesisBytes []byte,
	upgradeBytes []byte,
	configBytes []byte,
	toEngine chan<- common.Message,
	fxs []*common.Fx,
	appSender common.AppSender,
) error

Initialize implements the common.VM interface

func (*VM) LastAccepted

func (vm *VM) LastAccepted(context.Context) (ids.ID, error)

LastAccepted implements the chain.ChainVM interface

func (*VM) ParseBlock

func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (chain.Block, error)

ParseBlock implements the chain.ChainVM interface

func (*VM) SetPreference

func (vm *VM) SetPreference(ctx context.Context, blkID ids.ID) error

SetPreference implements the chain.ChainVM interface

func (*VM) SetState

func (vm *VM) SetState(ctx context.Context, state snow.State) error

SetState implements the common.VM interface

func (*VM) Shutdown

func (vm *VM) Shutdown(context.Context) error

Shutdown implements the common.VM interface

func (*VM) SubmitAtomicTx

func (vm *VM) SubmitAtomicTx(atomicTx *AtomicTransaction) error

SubmitAtomicTx submits a new atomic transaction

func (*VM) Version

func (vm *VM) Version(context.Context) (string, error)

Version implements the common.VM interface

Jump to

Keyboard shortcuts

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