config

package
v0.6.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenesisForkVersionMainnet = "0x00000000"
	GenesisForkVersionRopsten = "0x80000069"
	GenesisForkVersionSepolia = "0x90000069"
	GenesisForkVersionGoerli  = "0x00001020" // https://github.com/eth-clients/merge-testnets/blob/main/goerli-shadow-fork-5/config.yaml#L11

	BellatrixForkVersionMainnet = "0x02000000"
	BellatrixForkVersionRopsten = "0x80000071"
	BellatrixForkVersionSepolia = "0x90000071"
	BellatrixForkVersionGoerli  = "0x02001020"

	CapellaForkVersionRopsten = "0x03001020"
	CapellaForkVersionSepolia = "0x90000072"
	CapellaForkVersionGoerli  = "0x03001020"
	CapellaForkVersionMainnet = "0x03000000"

	GenesisValidatorsRootMainnet = "0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"
	GenesisValidatorsRootRopsten = "0x44f1e56283ca88b35c789f7f449e52339bc1fefe3a45913a43a6d16edcd33cf1"
	GenesisValidatorsRootSepolia = "0xd8ea171f3c94aea21ebc42a1ed61052acf3f9209c00e4efbaaddac09ed9b8078"
	GenesisValidatorsRootGoerli  = "0x043db0d9a83813551ee2f33450d23797757d430911a9320530ad8a0eabc43efb"
)

Variables

View Source
var DefaultApiConfig = &ApiConfig{
	SubmissionLimitRate:  2,
	SubmissionLimitBurst: 2,
	LimitterCacheSize:    1_000,
	DataLimit:            450,
}
View Source
var DefaultBadgerDBConfig = &BadgerDBConfig{
	TTL: 24 * time.Hour,
}
View Source
var DefaultBeaconConfig = &BeaconConfig{
	PayloadAttributesSubscription: true,
	EventRestart:                  5,
	EventTimeout:                  16 * time.Second,
	QueryTimeout:                  20 * time.Second,
}
View Source
var DefaultBlockSimulation = &BlockSimulationConfig{
	WS: &BlockSimulationWSConfig{
		Retry: true,
	},
	RPC:  &BlockSimulationRPCConfig{},
	HTTP: &BlockSimulationHTTPConfig{},
}
View Source
var DefaultDataAPIConfig = &DataAPIConfig{
	DB:     *DefaultSQLConfig,
	Badger: *DefaultBadgerDBConfig,
}
View Source
var DefaultDistributedConfig = &DistributedConfig{
	Redis: &RedisStreamConfig{
		Topic: "relay",
	},
	WorkerNumber:     100,
	StreamQueueSize:  100,
	StreamServedBids: true,
}
View Source
var DefaultHTTPConfig = &HTTPConfig{
	ReadTimeout:  5 * time.Second,
	WriteTimeout: 5 * time.Second,
	IdleTimeout:  5 * time.Second,
}
View Source
var DefaultPayloadConfig = &PayloadConfig{
	Badger:    *DefaultBadgerDBConfig,
	TTL:       24 * time.Hour,
	CacheSize: 1_000,
	Redis:     *DefaultRedisDBConfig,
}
View Source
var DefaultRedisDBConfig = &RedisDBConfig{
	Read:  &RedisConfig{},
	Write: &RedisConfig{},
}
View Source
var DefaultRedisStreamConfig = &RedisStreamConfig{
	Topic: "relay",
}
View Source
var DefaultRelayConfig = &RelayConfig{
	PublishBlock:               true,
	GetPayloadResponseDelay:    800 * time.Millisecond,
	GetPayloadRequestTimeLimit: 4 * time.Second,
}
View Source
var DefaultSQLConfig = &SQLConfig{
	MaxOpenConns:    15,
	MaxIdleConns:    10,
	ConnMaxIdleTime: 15 * time.Second,
}
View Source
var DefaultValidatorsConfig = &ValidatorsConfig{
	DB:                         DefaultSQLConfig,
	Badger:                     *DefaultBadgerDBConfig,
	QueueSize:                  100_000,
	StoreWorkersNum:            400,
	RegistrationsCacheSize:     600_000,
	RegistrationsReadCacheTTL:  time.Hour,
	RegistrationsWriteCacheTTL: 12 * time.Hour,
}
View Source
var DefaultVerifyConfig = &VerifyConfig{
	WorkersNum: 2000,
	QueueSize:  100_000,
}
View Source
var DefaultWarehouseConfig = &WarehouseConfig{
	Directory:    "/data/relay/warehouse",
	WorkerNumber: 32,
	Buffer:       1_000,
}

Functions

This section is empty.

Types

type ApiConfig added in v0.6.0

type ApiConfig struct {
	Subscriber

	// comma separated list of allowed builder pubkeys"
	AllowedBuilders []string `config:"allowed_builders,allow_dynamic"` // map[[48]byte]struct{}

	// submission request limit - rate per second
	SubmissionLimitRate int `config:"submission_limit_rate,allow_dynamic"`

	// submission request limit - burst value
	SubmissionLimitBurst int `config:"submission_limit_burst,allow_dynamic"`

	// rate limitter cache entries size
	LimitterCacheSize int `config:"limitter_cache_size"`

	// limit of data returned in one response
	DataLimit int `config:"datalimit,allow_dynamic"`

	// this flag set to allows to return errors when endpoint is disabled
	ErrorsOnDisable bool `config:"errors_on_disable,allow_dynamic"`
}

type BadgerDBConfig added in v0.6.0

type BadgerDBConfig struct {
	TTL time.Duration `config:"ttl"`
}

type BeaconConfig added in v0.6.0

type BeaconConfig struct {
	Subscriber

	// comma separate list of urls to beacon endpoints
	Addresses []string `config:"addresses,allow_dynamic"`

	// comma separate list of urls to beacon endpoints
	PublishAddresses []string `config:"publish_addresses,allow_dynamic"`

	// should payload attributes be enabled
	PayloadAttributesSubscription bool `config:"payload_attributes_subscription,allow_dynamic"`

	//
	EventTimeout time.Duration `config:"event_timeout"`

	//
	EventRestart int `config:"event_restart"`

	// timeout of beacon queries
	QueryTimeout time.Duration `config:"query_timeout"`
}

type BlockSimulationConfig added in v0.6.0

type BlockSimulationConfig struct {
	RPC  *BlockSimulationRPCConfig  `config:"rpc"`
	WS   *BlockSimulationWSConfig   `config:"ws"`
	HTTP *BlockSimulationHTTPConfig `config:"http"`
}

type BlockSimulationHTTPConfig added in v0.6.0

type BlockSimulationHTTPConfig struct {
	Subscriber
	Address string `config:"address"`
}

type BlockSimulationRPCConfig added in v0.6.0

type BlockSimulationRPCConfig struct {
	// block validation rawurl (eg. ipc path)
	Address string `config:"address"`
}

type BlockSimulationWSConfig added in v0.6.0

type BlockSimulationWSConfig struct {
	Subscriber
	//  block validation endpoint address (comma separated list)
	Address []string `config:"address,allow_dynamic"`
	// retry to other websocket connections on failure"
	Retry bool `config:"retry,allow_dynamic"`
}

type ChainConfig added in v0.6.0

type ChainConfig struct {
	GenesisForkVersion    string
	BellatrixForkVersion  string
	CapellaForkVersion    string
	GenesisValidatorsRoot string
}

ChainConfig provides all available options for the default BeaconClient and Relay

func NewChainConfig added in v0.6.0

func NewChainConfig() *ChainConfig

func (*ChainConfig) LoadNetwork added in v0.6.0

func (c *ChainConfig) LoadNetwork(network string)

func (*ChainConfig) ReadNetworkConfig added in v0.6.0

func (c *ChainConfig) ReadNetworkConfig(datadir, network string) (err error)

type Config

type Config struct {

	// http server on which relay serves external connections
	ExternalHttp *HTTPConfig `config:"external_http"`

	// internal port for metrics profiling and management
	InternalHttp *HTTPConfig `config:"internal_http"`

	//
	Api *ApiConfig `config:"api"`

	//
	Relay *RelayConfig `config:"relay"`

	// configuration of beacon nodes
	Beacon *BeaconConfig `config:"beacon"`

	//
	Verify *VerifyConfig `config:"verify"`

	//
	Validators *ValidatorsConfig `config:"validators"`

	//
	BlockSimulation *BlockSimulationConfig `config:"block_simulation"`

	//
	Payload *PayloadConfig `config:"payload"`

	//
	DataAPI *DataAPIConfig `config:"dataapi"`

	//
	Warehouse *WarehouseConfig `config:"warehouse"`

	//
	Distributed *DistributedConfig `config:"distributed"`
}

func DefaultConfig added in v0.6.0

func DefaultConfig() Config

type ConfigManager added in v0.6.0

type ConfigManager struct {
	*Config
	// contains filtered or unexported fields
}

func NewConfigManager added in v0.6.0

func NewConfigManager(s Source) *ConfigManager

func (*ConfigManager) GetConfigJSON added in v0.6.0

func (cm *ConfigManager) GetConfigJSON() ([]byte, error)

func (*ConfigManager) Load added in v0.6.0

func (cm *ConfigManager) Load() error

func (*ConfigManager) Reload added in v0.6.0

func (cm *ConfigManager) Reload() error

type DataAPIConfig added in v0.6.0

type DataAPIConfig struct {
	// Address of postgress database for validator registrations, if empty - default, badger will be used",
	DB SQLConfig `config:"db"`
	// BadgerDB config if sql is not used
	Badger BadgerDBConfig `config:"badger"`
}

type DistributedConfig added in v0.6.0

type DistributedConfig struct {
	Redis *RedisStreamConfig `config:"redis"`

	InstanceID string `config:"id"`

	// Number of workers for storing data in warehouse, if 0, then data is not exported
	WorkerNumber int `config:"workers"`

	// Stream internal channel size
	StreamQueueSize int `config:"stream_queue_size"`

	// stream entire block for every bid that is served in GetHeader requests.
	StreamServedBids bool `config:"stream_served_bids"`
}

type HTTPConfig added in v0.6.0

type HTTPConfig struct {
	// address (ip+port) on which http should be served
	Address      string        `config:"address"`
	ReadTimeout  time.Duration `config:"read_timeout"`  //time.Second * 2,
	IdleTimeout  time.Duration `config:"idle_timeout"`  //time.Second * 2,
	WriteTimeout time.Duration `config:"write_timeout"` //time.Second * 2,
}

type Listener added in v0.6.0

type Listener interface {
	OnConfigChange(change structs.OldNew) error
}

type Network

type Network struct {
	GenesisForkVersion    string `json:"GenesisForkVersion"`
	GenesisValidatorsRoot string `json:"GenesisValidatorsRoot"`
	BellatrixForkVersion  string `json:"BellatrixForkVersion"`
	CapellaForkVersion    string `json:"CapellaForkVersion"`
}

type PayloadConfig added in v0.6.0

type PayloadConfig struct {
	// BadgerDB config
	Badger BadgerDBConfig `config:"badger"`

	CacheSize int `config:"cache_size"`

	// Redis config
	Redis RedisDBConfig `config:"redis"`

	// TTL of payload data
	TTL time.Duration `config:"ttl,allow_dynamic"`
}

type Propagator added in v0.6.0

type Propagator interface {
	Propagate(change structs.OldNew)
}

type RedisConfig added in v0.6.0

type RedisConfig struct {
	Address string `config:"address"`
}

type RedisDBConfig added in v0.6.0

type RedisDBConfig struct {
	Read  *RedisConfig `config:"read"`
	Write *RedisConfig `config:"write"`
}

type RedisStreamConfig added in v0.6.0

type RedisStreamConfig struct {
	Topic   string `config:"topic"`
	Address string `config:"address"`
}

type RelayConfig added in v0.6.0

type RelayConfig struct {
	Subscriber

	// name of the network in which relay oparates
	Network string `config:"network"` // mainnet

	// secret key used to sign messages
	SecretKey string `config:"secret_key"`

	// for publishing payloads to beacon nodes after a delivery
	PublishBlock bool `config:"publish_block"`

	// block publish delay
	GetPayloadResponseDelay time.Duration `config:"get_payload_response_delay,allow_dynamic"`

	// deadline for calling get Payload
	GetPayloadRequestTimeLimit time.Duration `config:"get_payload_request_time_limit,allow_dynamic"`

	// comma separated list of allowed builder pubkeys"
	AllowedBuilders []string `config:"allowed_builders,allow_dynamic"` // map[[48]byte]struct{}
}

type SQLConfig added in v0.6.0

type SQLConfig struct {
	// database connection query string
	URL string `config:"url"`

	MaxOpenConns    int           `config:"max_open_conns"`
	MaxIdleConns    int           `config:"max_idle_conns"`
	ConnMaxIdleTime time.Duration `config:"conn_max_idle_time"`
}

type Source added in v0.6.0

type Source interface {
	Load(cfg *Config, initial bool) error
}

type Subscriber added in v0.6.0

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

func (Subscriber) Propagate added in v0.6.0

func (s Subscriber) Propagate(change structs.OldNew)

func (*Subscriber) SubscribeForUpdates added in v0.6.0

func (s *Subscriber) SubscribeForUpdates(l Listener)

type ValidatorsConfig added in v0.6.0

type ValidatorsConfig struct {
	// Address of postgress database for validator registrations, if empty - default, badger will be used",
	DB *SQLConfig `config:"db"`
	// BadgerDB config if sql is not used
	Badger BadgerDBConfig `config:"badger"`
	// The size of response queue, should be set to expected number of validators in one request
	QueueSize uint `config:"queue_size"`
	// Number of workers storing validators in parallel
	StoreWorkersNum uint `config:"store_workers"`
	// Registrations cache size
	RegistrationsCacheSize int `config:"registrations_cache_size"`
	// Registrations cache ttl
	RegistrationsReadCacheTTL time.Duration `config:"registrations_cache_ttl"`
	// Registrations cache ttl
	RegistrationsWriteCacheTTL time.Duration `config:"registrations_write_cache_ttl"`
}

type VerifyConfig added in v0.6.0

type VerifyConfig struct {
	// Number of workers running verify in parallel
	WorkersNum uint64 `config:"workers"`
	//size of verify queue
	QueueSize uint `config:"queue_size"`
}

type WarehouseConfig added in v0.6.0

type WarehouseConfig struct {
	// Data directory where the data is stored in the warehouse
	Directory string `config:"directory"`

	// Number of workers for storing data in warehouse, if 0, then data is not exported
	WorkerNumber int `config:"workers"`

	// Size of the buffer for processing requests
	Buffer int `config:"buffer"`
}

Directories

Path Synopsis
source

Jump to

Keyboard shortcuts

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