config

package
v0.0.224 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package config contains the config for different kinds of agents

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidChainType error

ErrInvalidChainType indicates chain type was invalid.

View Source
var ErrInvalidDomainID = errors.New("domain ID invalid")

ErrInvalidDomainID indicates domain id is invalid.

View Source
var ErrRequiredField = errors.New("field is required")

ErrRequiredField indicates a required field was left blank.

Functions

This section is empty.

Types

type AgentConfig added in v0.0.130

type AgentConfig struct {
	// DBConfig is the database configuration.
	DBConfig DBConfig `yaml:"db_config"`
	// Domains stores all the domains
	Domains DomainConfigs `yaml:"domains"`
	// DomainID is the domain of the chain that this agent is assigned to.
	// 	For Guards, it is 0 meaning all domains.
	// 	For Notaries, it will be a specific domain greater than 0.
	DomainID uint32 `yaml:"domain_id"`
	// SummitDomainID is the domain of the chain that has the Summit contract (ie SYN chain).
	SummitDomainID uint32 `yaml:"summit_domain_id"`
	// UnbondedSigner contains the unbonded signer config for agents
	// (this is signer used to submit transactions)
	UnbondedSigner config.SignerConfig `yaml:"unbonded_signer"`
	// BondedSigner contains the bonded signer config for agents
	BondedSigner config.SignerConfig `yaml:"bonded_signer"`
	// RefreshIntervalSeconds is the refresh interval in seconds
	RefreshIntervalSeconds uint32 `yaml:"refresh_interval_seconds,omitempty"`
	// 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"`
	// DBPrefix is the prefix for the tables in the database. This is only to be used with mysql.
	DBPrefix string `yaml:"db_prefix"`
	// SubmitterConfig is the config for the submitter.
	SubmitterConfig submitterConfig.Config `yaml:"submitter_config"`
}

AgentConfig is used for configuring the guard.

func DecodeAgentConfig added in v0.0.130

func DecodeAgentConfig(filePath string) (a AgentConfig, err error)

DecodeAgentConfig parses in a config from a file.

func (AgentConfig) Encode added in v0.0.130

func (a AgentConfig) Encode() ([]byte, error)

Encode gets the encoded config.yaml file.

func (*AgentConfig) IsValid added in v0.0.130

func (a *AgentConfig) 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 DomainConfig

type DomainConfig struct {
	// DomainID is the domain of the chain
	DomainID uint32 `yaml:"domain_id"`
	// Type of the chain (e.g. evm)
	Type string `yaml:"type"`
	// RequiredConfirmations is the number of confirmations to way
	RequiredConfirmations uint32 `yaml:"required_confirmations"`
	// OriginAddress gets origin contract address
	OriginAddress string `yaml:"origin_address"`
	// SummitAddress contains the summit address (if present)
	SummitAddress string `yaml:"summit_address"`
	// DestinationAddress gets destination contract address
	DestinationAddress string `yaml:"destination_address"`
	// LightManagerAddress gets then light manager contract address
	LightManagerAddress string `yaml:"light_manager_address"`
	// BondingManagerAddress gets the bonding manager contract address
	BondingManagerAddress string `yaml:"bonding_manager_address"`
	// LightInboxAddress gets the light inbox contract address
	LightInboxAddress string `yaml:"light_inbox_address"`
	// InboxAddress gets the inbox contract address
	InboxAddress string `yaml:"inbox_address"`
}

DomainConfig defines the config for a specific domain.

func (DomainConfig) IsValid

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

IsValid validates the domain config.

type DomainConfigs

type DomainConfigs map[string]DomainConfig

DomainConfigs contains a map of name->domain config.

func (DomainConfigs) IsValid

func (d DomainConfigs) IsValid(ctx context.Context) (ok bool, err error)

IsValid validates the domain configs by asserting no two domains appear twice it also calls IsValid on each individual DomainConfig.

Directories

Path Synopsis
Package executor contains the configuration file specifications for the Executor.
Package executor contains the configuration file specifications for the Executor.

Jump to

Keyboard shortcuts

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