executor

package
v0.0.198 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package executor contains the configuration file specifications for the Executor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainConfig

type ChainConfig struct {
	// ChainID is the ID of the chain.
	ChainID uint32 `yaml:"chain_id"`
	// OriginAddress is the address of the origin contract.
	OriginAddress string `yaml:"origin_address"`
	// DestinationAddress is the address of the destination contract.
	DestinationAddress string `yaml:"destination_address"`
	// LightInboxAddress is the address of the light inbox contract.
	LightInboxAddress string `yaml:"light_inbox_address"`
}

ChainConfig defines the config for a specific chain.

func (ChainConfig) IsValid

func (c ChainConfig) IsValid(ctx context.Context) (ok bool, err error)

IsValid validates the chain config.

type ChainConfigs

type ChainConfigs []ChainConfig

ChainConfigs contains an array of ChainConfigs.

func (ChainConfigs) IsValid

func (c ChainConfigs) IsValid(ctx context.Context) (ok bool, err error)

IsValid validates the chain config by asserting no two chains appear twice.

type Config

type Config struct {
	// DBConfig is the database configuration.
	DBConfig DBConfig `yaml:"db_config"`
	// ScribeConfig is the scribe configuration.
	ScribeConfig ScribeConfig `yaml:"scribe_config"`
	// Chains stores all chain information
	Chains ChainConfigs `yaml:"chains"`
	// SummitChainID is the chain ID of the chain that the summit contract is deployed on.
	SummitChainID uint32 `yaml:"summit_chain_id"`
	// SummitAddress is the address of the summit contract.
	SummitAddress string `yaml:"summit_address"`
	// InboxAddress is the address of the inbox contract.
	InboxAddress string `yaml:"inbox_address"`
	// BaseOmnirpcURL is the base url for omnirpc.
	// The format is "https://omnirpc.url". Notice the lack of "confirmations" on the URL
	// in comparison to what `Scribe` uses.
	BaseOmnirpcURL string `yaml:"base_omnirpc_url"`
	// UnbondedSigner contains the unbonded signer config for agents
	// (this is signer used to submit transactions)
	UnbondedSigner signerConfig.SignerConfig `yaml:"unbonded_signer"`
	// ExecuteInterval is the interval at which the executor agent will
	// check if messages in the database are ready to be executed.
	ExecuteInterval uint32 `yaml:"execute_interval"`
	// SetMinimumTimeInterval is the interval at which the executor agent will
	// check messages to set their minimum times from attestations.
	SetMinimumTimeInterval uint32 `yaml:"set_minimum_time_interval"`
	// DBPrefix is the prefix for the tables in the database. This is only to be used with mysql.
	DBPrefix string `yaml:"db_prefix"`
}

Config is used to configure an Executor agent.

func DecodeConfig

func DecodeConfig(filePath string) (cfg Config, err error)

DecodeConfig parses in a config from a file.

func (Config) Encode

func (c Config) Encode() ([]byte, error)

Encode gets the encoded config.yaml file.

func (*Config) IsValid

func (c *Config) IsValid(ctx context.Context) (ok bool, err error)

IsValid makes sure the config is valid. This is done by calling IsValid() on each submodule. If any method returns an error that is returned here and the entirety of IsValid returns false. Any warnings are logged by the submodules respective loggers.

type DBConfig

type DBConfig struct {
	// Type is the type of database. This can be either "sqlite" or "mysql".
	Type string `yaml:"type"`
	// Source is the source of the database. This can be either a path to a sqlite database or a mysql database url.
	Source string `yaml:"source"`
}

DBConfig is used to configure a database.

func (*DBConfig) IsValid

func (d *DBConfig) IsValid(_ context.Context) (ok bool, err error)

IsValid asserts the database connection is valid.

type ScribeConfig

type ScribeConfig struct {
	// Type is the type of scribe. This can be either "embedded" or "remote".
	Type string `yaml:"type"`

	// EmbeddedDBConfig is the database configuration for an embedded scribe.
	EmbeddedDBConfig DBConfig `yaml:"embedded_db_config,omitempty"`
	// EmbeddedScribeConfig is the config for the embedded scribe.
	EmbeddedScribeConfig scribeConfig.Config `yaml:"embedded_scribe_config,omitempty"`

	// Port is the port to listen on for the remote scribe.
	Port uint `yaml:"port,omitempty"`
	// URL is the URL to connect to for the remote scribe.
	URL string `yaml:"url,omitempty"`
}

ScribeConfig is used to configure a scribe for the Executor.

func (*ScribeConfig) IsValid

func (c *ScribeConfig) IsValid(ctx context.Context) (ok bool, err error)

IsValid makes sure the config is valid. This is done by calling IsValid() on each submodule. If any method returns an error that is returned here and the entirety of IsValid returns false. Any warnings are logged by the submodules respective loggers.

Jump to

Keyboard shortcuts

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