relay

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package relay drives the cross-chain message lifecycle. The engine polls configured source chains for events, packages them as R-Chain (relayvm) SendMessage RPCs, watches R-Chain for verified messages, and dispatches the verified payload to destination chains.

The chain VM (`luxfi/node` chains/relayvm) remains the source of truth for verification. This engine is just the courier — the security boundary is `Service.GetVerifiedMessage` on R-Chain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID          string `json:"id"`
	SourceChain string `json:"sourceChain"`
	DestChain   string `json:"destChain"`
	State       string `json:"state"`
}

type Config

type Config struct {
	RelayVMRPC string
	StatePath  string
	OperatorID string
	Logger     *slog.Logger
}

type Engine

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

func New

func New(cfg Config) (*Engine, error)

func (*Engine) ListChannels

func (e *Engine) ListChannels() ([]Channel, error)

ListChannels returns the channels currently tracked by this operator.

func (*Engine) ListMessages

func (e *Engine) ListMessages(state string) ([]Message, error)

ListMessages returns pending messages, optionally filtered by state (one of: "pending", "verified", "delivered", "failed", or empty for all).

func (*Engine) Run

func (e *Engine) Run(ctx context.Context) error

Run starts the polling loops. Stops when ctx is cancelled.

func (*Engine) Shutdown

func (e *Engine) Shutdown(_ context.Context) error

func (*Engine) Stats

func (e *Engine) Stats() Stats

func (*Engine) Trigger

func (e *Engine) Trigger(messageID string) error

Trigger forces a re-attempt at delivering `messageID`.

type Message

type Message struct {
	ID          string `json:"id"`
	ChannelID   string `json:"channelId"`
	State       string `json:"state"`
	SourceChain string `json:"sourceChain"`
	DestChain   string `json:"destChain"`
	Payload     []byte `json:"payload"`
}

type Stats

type Stats struct {
	ChannelsTracked int    `json:"channelsTracked"`
	MessagesPending int    `json:"messagesPending"`
	MessagesRelayed uint64 `json:"messagesRelayed"`
	LastError       string `json:"lastError,omitempty"`
}

Jump to

Keyboard shortcuts

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