relayer

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: GPL-3.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSubmissions

func CreateSubmissions(up StreamUpdate) ([]xchain.Submission, error)

CreateSubmissions splits the update into multiple submissions that are each small enough (wrt calldata and gas) to be submitted on-chain.

func Run

func Run(ctx context.Context, cfg Config) error

func WriteConfigTOML

func WriteConfigTOML(cfg Config, logCfg log.Config, path string) error

WriteConfigTOML writes the toml halo config to disk.

Types

type Config

type Config struct {
	PrivateKey     string
	HaloURL        string
	NetworkFile    string
	MonitoringAddr string
	StateFile      string
}

func DefaultConfig

func DefaultConfig() Config

type CreateFunc

type CreateFunc func(streamUpdate StreamUpdate) ([]xchain.Submission, error)

CreateFunc is a function that creates one or more submissions from the given stream update.

type SendFunc

type SendFunc func(ctx context.Context, submission xchain.Submission) error

SendFunc sends a submission to the destination chain by invoking "xsubmit" on portal contract.

type Sender

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

Sender uses txmgr to send transactions to the destination chain.

func NewSender

func NewSender(chain netconf.Chain, rpcClient ethclient.Client,
	privateKey ecdsa.PrivateKey, chainNames map[uint64]string) (Sender, error)

NewSender creates a new sender that uses txmgr to send transactions to the destination chain.

func (Sender) SendTransaction

func (o Sender) SendTransaction(ctx context.Context, sub xchain.Submission) error

SendTransaction sends the submission to the destination chain.

type State added in v0.1.0

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

State represents the state of the relayer. It keeps track of the last successfully processed block.

func LoadCursors added in v0.1.0

func LoadCursors(path string) (*State, bool, error)

LoadCursors loads a file state from the given path.

func NewEmptyState added in v0.1.0

func NewEmptyState(filePath string) *State

NewEmptyState creates a new empty state with the given file path.

func (*State) Clear added in v0.1.3

func (s *State) Clear(dstID uint64) error

Clear deletes all destination chain cursors.

func (*State) GetHeight added in v0.1.0

func (s *State) GetHeight(dstID, srcID uint64) uint64

GetHeight returns the last submitted height for the given destChainID and srcChainID.

func (*State) Persist added in v0.1.0

func (s *State) Persist(dstID, srcID, height uint64) error

Persist saves the given height for the given chainID.

type StreamUpdate

type StreamUpdate struct {
	xchain.StreamID
	Tree        xchain.BlockTree
	Attestation xchain.Attestation // Attestation for the xmsgs
	Msgs        []xchain.Msg       // msgs that increment the cursor
}

type Worker

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

func NewWorker

func NewWorker(destChain netconf.Chain, network netconf.Network, cProvider cchain.Provider,
	xProvider xchain.Provider, creator CreateFunc, sendProvider func() (SendFunc, error), state *State,
	awaitValSet awaitValSet,
) *Worker

NewWorker creates a new worker for a single destination chain.

func (*Worker) Run

func (w *Worker) Run(ctx context.Context)

Jump to

Keyboard shortcuts

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