config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	DB      database.Config `toml:"db"`
	Logger  logger.Config   `toml:"logger"`
	Chain   config.Chain    `toml:"chain"`
	Metrics Metrics         `toml:"metrics"`

	Clients Clients `toml:"clients"`

	ContractAddresses config.ContractAddresses `toml:"contract_addresses"`
	Identity          Identity                 `toml:"identity"`
	Credentials       Credentials              `toml:"credentials"`

	Protocol map[string]ProtocolConfig `toml:"protocol"`

	Submit1          Submit           `toml:"submit1"`
	Submit2          Submit           `toml:"submit2"`
	SubmitSignatures SubmitSignatures `toml:"submit_signatures"`

	Finalizer Finalizer `toml:"finalizer"`

	SubmitGas   Gas `toml:"gas_submit"`
	RegisterGas Gas `toml:"gas_register"`
	RelayGas    Gas `toml:"gas_relay"`

	Rewards RewardsConfig `toml:"rewards"`
}

func Build

func Build(cfgFileName string) (*Client, error)

func (Client) ChainConfig

func (c Client) ChainConfig() config.Chain

func (Client) LoggerConfig

func (c Client) LoggerConfig() logger.Config

type Clients

type Clients struct {
	EnabledRegistration   bool `toml:"enabled_registration"`
	EnabledUptimeVoting   bool `toml:"enabled_uptime_voting"`
	EnabledRewardSigning  bool `toml:"enabled_reward_signing"`
	EnabledProtocolVoting bool `toml:"enabled_protocol_voting"`
	EnabledFinalizer      bool `toml:"enabled_finalizer"`
}

func (*Clients) EpochClientEnabled

func (c *Clients) EpochClientEnabled() bool

type Credentials

type Credentials struct {
	// Sign all data.
	SigningPolicyPrivateKeyFile string `toml:"signing_policy_private_key_file"`
	SigningPolicyPrivateKey     string `toml:"-" envconfig:"SIGNING_POLICY_PRIVATE_KEY"`

	// Send RegisterVoter and SignNewSigningPolicy transactions.
	SystemClientSenderPrivateKeyFile string `toml:"system_client_sender_private_key_file"`
	SystemClientSenderPrivateKey     string `toml:"-" envconfig:"SYSTEM_CLIENT_SENDER_PRIVATE_KEY"`

	// Submit protocol data (submit1, submit2, submit3).
	ProtocolManagerSubmitPrivateKeyFile string `toml:"protocol_manager_submit_private_key_file"`
	ProtocolManagerSubmitPrivateKey     string `toml:"-" envconfig:"PROTOCOL_MANAGER_SUBMIT_PRIVATE_KEY"`

	// Submit protocol signatures.
	ProtocolManagerSubmitSignaturesPrivateKeyFile string `toml:"protocol_manager_submit_signatures_private_key_file"`
	ProtocolManagerSubmitSignaturesPrivateKey     string `toml:"-" envconfig:"PROTOCOL_MANAGER_SUBMIT_SIGNATURES_PRIVATE_KEY"`
}

type Finalizer

type Finalizer struct {
	StartingRewardEpoch int64  `toml:"starting_reward_epoch"`
	StartingVotingRound uint32 `toml:"starting_voting_round"`

	// How far in the past we start fetching reward epochs from the indexer at the start of the finalizer client.
	// Default is 7 days.
	StartOffset time.Duration `toml:"start_offset"`

	VoterThresholdBIPS uint16 `toml:"voter_threshold_bips"`

	// Offset from the start of the voting round.
	GracePeriodEndOffset time.Duration `toml:"grace_period_end_offset"`
}

type Gas

type Gas struct {
	TxType uint8 `toml:"tx_type"` // 0 for legacy, 2 for eip-1559

	GasLimit int `toml:"gas_limit"`

	// type 0
	GasPriceMultiplier float32  `toml:"gas_price_multiplier"`
	GasPriceFixed      *big.Int `toml:"gas_price_fixed"`

	// type 2
	MaxPriorityFeePerGas *big.Int `toml:"max_priority_fee_per_gas"`
	BaseFeePerGasCap     *big.Int `toml:"base_fee_per_gas_cap"`
}

type Identity

type Identity struct {
	Address common.Address `toml:"address"`
}

type Metrics

type Metrics struct {
	PrometheusAddress string `toml:"prometheus_address" envconfig:"PROMETHEUS_ADDRESS"`
}

type ProtocolConfig

type ProtocolConfig struct {
	ID          uint8  `toml:"id"`
	APIUrl      string `toml:"api_url"`
	APIEndpoint string `toml:"api_endpoint"` // temporary to avoid a breaking change
	Type        uint8  `toml:"type"`
}

func (ProtocolConfig) XApiKey

func (cfg ProtocolConfig) XApiKey() string

type RewardsConfig

type RewardsConfig struct {
	UrlPrefix string `toml:"url_prefix"`

	MinRewardWei *big.Int `toml:"min_reward"`
	MaxRewardWei *big.Int `toml:"max_reward"`

	Retries       int           `toml:"retries"`
	RetryInterval time.Duration `toml:"retry_interval"`
}

type Submit

type Submit struct {
	Enabled          bool          `toml:"enabled"`
	StartOffset      time.Duration `toml:"start_offset"` // offset from the start of the epoch
	TxSubmitRetries  int           `toml:"tx_submit_retries"`
	TxSubmitTimeout  time.Duration `toml:"tx_submit_timeout"`
	DataFetchRetries int           `toml:"data_fetch_retries"`
	DataFetchTimeout time.Duration `toml:"data_fetch_timeout"`
}

type SubmitSignatures

type SubmitSignatures struct {
	Submit

	Deadline time.Duration `toml:"deadline"` // from the start of the epoch, recommended to be before the end of the grace period

	MaxCycles     int           `toml:"max_cycles"`     // maximal number of query cycles after the deadline
	CycleDuration time.Duration `toml:"cycle_duration"` // minimal duration of a cycle after the deadline
}

Jump to

Keyboard shortcuts

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