config

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: AGPL-3.0 Imports: 17 Imported by: 14

Documentation

Index

Constants

View Source
const (
	// The NodeSet dev network on Holesky
	Network_HoleskyDev config.Network = "holesky-dev"

	// Local test network for development
	Network_LocalTest config.Network = "local-test"
)
View Source
const (
	ModulesName         string = "modules"
	ValidatorsDirectory string = "validators"
)
View Source
const (
	// The nodeset.io URL for production usage
	NodesetUrlProd string = "https://nodeset.io/api"

	// The nodeset.io URL for development / staging
	NodesetUrlStaging string = "https://staging.nodeset.io/api"
)
View Source
const (
	EventLogInterval         int    = 1000
	HyperdriveDaemonRoute    string = "hyperdrive"
	HyperdriveApiVersion     string = "1"
	HyperdriveApiClientRoute string = HyperdriveDaemonRoute + "/api/v" + HyperdriveApiVersion
	ConfigFilename           string = "user-settings.yml"
	DefaultApiPort           uint16 = 8080

	// Wallet
	UserAddressFilename    string = "address"
	UserWalletDataFilename string = "wallet"
	UserPasswordFilename   string = "password"

	// Scripts
	EcStartScript       string = "start-ec.sh"
	BnStartScript       string = "start-bn.sh"
	VcStartScript       string = "start-vc.sh"
	MevBoostStartScript string = "start-mev-boost.sh"

	// Volumes
	ExecutionClientDataVolume string = "ecdata"
	BeaconNodeDataVolume      string = "bndata"

	// Logging
	LogDir       string = "logs"
	ApiLogName   string = "api.log"
	TasksLogName string = "tasks.log"

	// API Keys
	SecretsDir        string = "secrets"
	DaemonKeyFilename string = "daemon.key"
)

Variables

This section is empty.

Functions

func NewMetricsConfig

func NewMetricsConfig() *config.MetricsConfig

Generates a new metrics config

Types

type HyperdriveConfig

type HyperdriveConfig struct {
	// General settings
	Network                  config.Parameter[config.Network]
	ClientMode               config.Parameter[config.ClientMode]
	EnableIPv6               config.Parameter[bool]
	ProjectName              config.Parameter[string]
	ApiPort                  config.Parameter[uint16]
	UserDataPath             config.Parameter[string]
	AutoTxMaxFee             config.Parameter[float64]
	MaxPriorityFee           config.Parameter[float64]
	AutoTxGasThreshold       config.Parameter[float64]
	AdditionalDockerNetworks config.Parameter[string]
	ClientTimeout            config.Parameter[uint16]

	// The Docker Hub tag for the daemon container
	ContainerTag config.Parameter[string]

	// Logging
	Logging *config.LoggerConfig

	// Execution client settings
	LocalExecutionClient    *config.LocalExecutionConfig
	ExternalExecutionClient *config.ExternalExecutionConfig

	// Beacon node settings
	LocalBeaconClient    *config.LocalBeaconConfig
	ExternalBeaconClient *config.ExternalBeaconConfig

	// Fallback clients
	Fallback *config.FallbackConfig

	// Metrics
	Metrics *config.MetricsConfig

	// MEV-Boost
	MevBoost *MevBoostConfig

	// Modules
	Modules map[string]any

	// Internal fields
	Version string
	// contains filtered or unexported fields
}

The master configuration struct

func LoadFromFile

func LoadFromFile(path string, networks []*HyperdriveSettings) (*HyperdriveConfig, error)

Load configuration settings from a file

func NewHyperdriveConfig

func NewHyperdriveConfig(hdDir string, networks []*HyperdriveSettings) (*HyperdriveConfig, error)

Creates a new Hyperdrive configuration instance

func NewHyperdriveConfigForNetwork

func NewHyperdriveConfigForNetwork(hdDir string, networks []*HyperdriveSettings, selectedNetwork config.Network) (*HyperdriveConfig, error)

Creates a new Hyperdrive configuration instance for a specific network

func (*HyperdriveConfig) AutoTxGasThresholdInt

func (cfg *HyperdriveConfig) AutoTxGasThresholdInt() uint64

func (*HyperdriveConfig) AutoTxMaxFeeInt

func (cfg *HyperdriveConfig) AutoTxMaxFeeInt() uint64

func (*HyperdriveConfig) BeaconNodeContainerName

func (c *HyperdriveConfig) BeaconNodeContainerName() string

func (*HyperdriveConfig) BeaconNodeDataVolume

func (c *HyperdriveConfig) BeaconNodeDataVolume() string

func (*HyperdriveConfig) BnHttpUrl

func (cfg *HyperdriveConfig) BnHttpUrl() (string, error)

func (*HyperdriveConfig) BnRpcUrl

func (cfg *HyperdriveConfig) BnRpcUrl() (string, error)

func (*HyperdriveConfig) ChangeNetwork

func (cfg *HyperdriveConfig) ChangeNetwork(newNetwork config.Network)

Changes the current network, propagating new parameter settings if they are affected

func (*HyperdriveConfig) Clone

func (cfg *HyperdriveConfig) Clone() *HyperdriveConfig

Creates a copy of the configuration

func (*HyperdriveConfig) DaemonContainerName

func (c *HyperdriveConfig) DaemonContainerName() string

func (*HyperdriveConfig) Deserialize

func (cfg *HyperdriveConfig) Deserialize(masterMap map[string]any) error

Deserializes a settings file into this config

func (*HyperdriveConfig) ExecutionClientContainerName

func (c *HyperdriveConfig) ExecutionClientContainerName() string

func (*HyperdriveConfig) ExecutionClientDataVolume

func (c *HyperdriveConfig) ExecutionClientDataVolume() string

func (*HyperdriveConfig) ExporterContainerName

func (c *HyperdriveConfig) ExporterContainerName() string

func (*HyperdriveConfig) FallbackBnHttpUrl

func (cfg *HyperdriveConfig) FallbackBnHttpUrl() string

func (*HyperdriveConfig) FallbackBnRpcUrl

func (cfg *HyperdriveConfig) FallbackBnRpcUrl() string

func (*HyperdriveConfig) GetAdditionalDockerNetworks

func (cfg *HyperdriveConfig) GetAdditionalDockerNetworks() []string

func (*HyperdriveConfig) GetApiLogFilePath

func (cfg *HyperdriveConfig) GetApiLogFilePath() string

func (*HyperdriveConfig) GetBeaconHostname

func (cfg *HyperdriveConfig) GetBeaconHostname() (string, error)

Gets the hostname portion of the Beacon Node's URI. Used by text/template to format prometheus.yml.

func (*HyperdriveConfig) GetBeaconNodeUrls

func (cfg *HyperdriveConfig) GetBeaconNodeUrls() (string, string)

func (*HyperdriveConfig) GetBnAdditionalFlags

func (cfg *HyperdriveConfig) GetBnAdditionalFlags() (string, error)

Used by text/template to format bn.yml

func (*HyperdriveConfig) GetBnContainerTag

func (cfg *HyperdriveConfig) GetBnContainerTag() (string, error)

Gets the tag of the bn container Used by text/template to format bn.yml

func (*HyperdriveConfig) GetBnHttpEndpoint

func (cfg *HyperdriveConfig) GetBnHttpEndpoint() string

Get the HTTP API endpoint for the provided BN

func (*HyperdriveConfig) GetBnHttpEndpointsWithFallback

func (cfg *HyperdriveConfig) GetBnHttpEndpointsWithFallback() string

Get the endpoints of the BN, including the fallback if applicable

func (*HyperdriveConfig) GetBnMaxPeers

func (cfg *HyperdriveConfig) GetBnMaxPeers() (uint16, error)

Gets the max peers of the bn container Used by text/template to format bn.yml

func (*HyperdriveConfig) GetBnOpenPorts

func (cfg *HyperdriveConfig) GetBnOpenPorts() []string

Used by text/template to format bn.yml

func (*HyperdriveConfig) GetBnStartScript

func (cfg *HyperdriveConfig) GetBnStartScript() string

Gets the name of the Beacon Node start script

func (*HyperdriveConfig) GetDaemonContainerTag

func (cfg *HyperdriveConfig) GetDaemonContainerTag() string

Container tag for the daemon

func (*HyperdriveConfig) GetDockerArtifactName

func (cfg *HyperdriveConfig) GetDockerArtifactName(entity string) string

Gets the full name of the Docker container or volume with the provided suffix (name minus the project ID prefix)

func (*HyperdriveConfig) GetEcAdditionalFlags

func (cfg *HyperdriveConfig) GetEcAdditionalFlags() (string, error)

Used by text/template to format ec.yml

func (*HyperdriveConfig) GetEcContainerTag

func (cfg *HyperdriveConfig) GetEcContainerTag() (string, error)

Gets the tag of the ec container Used by text/template to format ec.yml

func (*HyperdriveConfig) GetEcHttpEndpoint

func (cfg *HyperdriveConfig) GetEcHttpEndpoint() string

Used by text/template to format bn.yml

func (*HyperdriveConfig) GetEcHttpEndpointsWithFallback

func (cfg *HyperdriveConfig) GetEcHttpEndpointsWithFallback() string

Get the endpoints of the EC, including the fallback if applicable

func (*HyperdriveConfig) GetEcMaxPeers

func (cfg *HyperdriveConfig) GetEcMaxPeers() (uint16, error)

Gets the max peers of the ec container Used by text/template to format ec.yml

func (*HyperdriveConfig) GetEcOpenApiPorts

func (cfg *HyperdriveConfig) GetEcOpenApiPorts() string

Gets the port mapping of the ec container Used by text/template to format ec.yml

func (*HyperdriveConfig) GetEcStartScript

func (cfg *HyperdriveConfig) GetEcStartScript() string

Gets the name of the Execution Client start script

func (*HyperdriveConfig) GetEcWsEndpoint

func (cfg *HyperdriveConfig) GetEcWsEndpoint() string

Used by text/template to format bn.yml

func (*HyperdriveConfig) GetEthNetworkName added in v1.1.0

func (cfg *HyperdriveConfig) GetEthNetworkName() string

Get the Eth network name of the selected network

func (*HyperdriveConfig) GetExecutionClientUrls

func (cfg *HyperdriveConfig) GetExecutionClientUrls() (string, string)

func (*HyperdriveConfig) GetExecutionHostname

func (cfg *HyperdriveConfig) GetExecutionHostname() (string, error)

Gets the hostname portion of the Execution Client's URI. Used by text/template to format prometheus.yml.

func (*HyperdriveConfig) GetExporterAdditionalFlags

func (cfg *HyperdriveConfig) GetExporterAdditionalFlags() []string

Used by text/template to format exporter.yml

func (*HyperdriveConfig) GetLoggerOptions

func (cfg *HyperdriveConfig) GetLoggerOptions() log.LoggerOptions

func (*HyperdriveConfig) GetMevBoostOpenPorts

func (cfg *HyperdriveConfig) GetMevBoostOpenPorts() string

Used by text/template to format mev-boost.yml

func (*HyperdriveConfig) GetMevBoostStartScript

func (cfg *HyperdriveConfig) GetMevBoostStartScript() string

Gets the name of the MEV-Boost start script

func (*HyperdriveConfig) GetModuleLogFilePath

func (cfg *HyperdriveConfig) GetModuleLogFilePath(moduleName string, moduleLogName string) string

func (*HyperdriveConfig) GetNetworkSettings added in v1.1.0

func (cfg *HyperdriveConfig) GetNetworkSettings() []*HyperdriveSettings

Get all loaded network settings

func (*HyperdriveConfig) GetNodeAddressFilePath

func (cfg *HyperdriveConfig) GetNodeAddressFilePath() string

func (*HyperdriveConfig) GetParameters

func (cfg *HyperdriveConfig) GetParameters() []config.IParameter

Get the config.Parameters for this config

func (*HyperdriveConfig) GetPasswordFilePath

func (cfg *HyperdriveConfig) GetPasswordFilePath() string

func (*HyperdriveConfig) GetPrometheusAdditionalFlags

func (cfg *HyperdriveConfig) GetPrometheusAdditionalFlags() []string

Used by text/template to format prometheus.yml

func (*HyperdriveConfig) GetPrometheusOpenPorts

func (cfg *HyperdriveConfig) GetPrometheusOpenPorts() string

Used by text/template to format prometheus.yml

func (*HyperdriveConfig) GetSelectedBeaconNode

func (cfg *HyperdriveConfig) GetSelectedBeaconNode() config.BeaconNode

Get the selected Beacon Node

func (*HyperdriveConfig) GetSelectedExecutionClient

func (cfg *HyperdriveConfig) GetSelectedExecutionClient() config.ExecutionClient

Get the selected Beacon Node

func (*HyperdriveConfig) GetSubconfigs

func (cfg *HyperdriveConfig) GetSubconfigs() map[string]config.IConfigSection

Get the subconfigurations for this config

func (*HyperdriveConfig) GetTasksLogFilePath

func (cfg *HyperdriveConfig) GetTasksLogFilePath() string

func (*HyperdriveConfig) GetTitle

func (cfg *HyperdriveConfig) GetTitle() string

Get the title for this config

func (*HyperdriveConfig) GetUserDirectory

func (cfg *HyperdriveConfig) GetUserDirectory() string

func (*HyperdriveConfig) GetVcStartScript

func (cfg *HyperdriveConfig) GetVcStartScript() string

Gets the name of the Validator Client start script

func (*HyperdriveConfig) GetWalletFilePath

func (cfg *HyperdriveConfig) GetWalletFilePath() string

func (*HyperdriveConfig) GrafanaContainerName

func (c *HyperdriveConfig) GrafanaContainerName() string

func (*HyperdriveConfig) GraffitiPrefix

func (cfg *HyperdriveConfig) GraffitiPrefix() string

Used by text/template to format validator.yml Only returns the the prefix

func (*HyperdriveConfig) IsLocalMode

func (cfg *HyperdriveConfig) IsLocalMode() bool

Used by text/template to format bn.yml

func (*HyperdriveConfig) MevBoostContainerName

func (c *HyperdriveConfig) MevBoostContainerName() string

func (*HyperdriveConfig) MevBoostUrl

func (cfg *HyperdriveConfig) MevBoostUrl() string

Used by text/template to format validator.yml

func (*HyperdriveConfig) PrometheusContainerName

func (c *HyperdriveConfig) PrometheusContainerName() string

func (*HyperdriveConfig) Serialize

func (cfg *HyperdriveConfig) Serialize(modules []IModuleConfig, includeUserDir bool) map[string]any

Serializes the configuration into a map of maps, compatible with a settings file

type HyperdriveResources added in v1.1.0

type HyperdriveResources struct {
	// The URL for the NodeSet API server
	NodeSetApiUrl string `yaml:"nodeSetApiUrl" json:"nodeSetApiUrl"`

	// The pubkey used to encrypt messages to nodeset.io
	EncryptionPubkey string `yaml:"encryptionPubkey" json:"encryptionPubkey"`
}

A collection of network-specific resources and getters for them

var (
	// Mainnet resources for reference in testing
	MainnetResourcesReference *HyperdriveResources = &HyperdriveResources{
		NodeSetApiUrl: NodesetUrlProd,
	}

	// Holesky resources for reference in testing
	HoleskyResourcesReference *HyperdriveResources = &HyperdriveResources{
		NodeSetApiUrl: NodesetUrlProd,
	}

	// Devnet resources for reference in testing
	HoleskyDevResourcesReference *HyperdriveResources = &HyperdriveResources{
		NodeSetApiUrl: NodesetUrlStaging,
	}
)

type HyperdriveSettings added in v1.1.0

type HyperdriveSettings struct {
	*config.NetworkSettings `yaml:",inline"`

	// Hyperdrive resources for the network
	HyperdriveResources *HyperdriveResources `yaml:"hyperdriveResources" json:"hyperdriveResources"`
}

Network settings with a field for Hyperdrive-specific settings

func LoadSettingsFiles added in v1.1.0

func LoadSettingsFiles(sourceDir string) ([]*HyperdriveSettings, error)

Load network settings from a folder

type IModuleConfig

type IModuleConfig interface {
	config.IConfigSection

	// Get the name of the module
	GetModuleName() string

	// Get the short name of the module, for things like prefixing
	GetShortName() string

	// The name to use for the Hyperdrive Client log file
	GetHdClientLogFileName() string

	// The name to use for the API log file
	GetApiLogFileName() string

	// The name to use for the tasks log file
	GetTasksLogFileName() string

	// Get the list of all log file names used by the module
	GetLogNames() []string

	// A map of the Validator Client IDs to their container tags
	GetValidatorContainerTagInfo() map[config.ContainerID]string

	// Return if doppelganger detection is enabled for any of the VCs
	IsDoppelgangerEnabled() bool

	// True if the module is enabled
	IsEnabled() bool

	// Get the list of containers that should be deployed
	GetContainersToDeploy() []config.ContainerID

	// Handle a network change, for example by updating the default parameters
	ChangeNetwork(oldNetwork config.Network, newNetwork config.Network)

	// Create a copy of this config
	Clone() IModuleConfig

	// Update the default parameters based on the Hyperdrive config's current network value
	UpdateDefaults(network config.Network)

	// Verify the current settings and publish a list of errors that must be resolved before saving
	Validate() []string

	// Serialize the module config to a map
	Serialize() map[string]any

	// Deserialize the module config from a map
	Deserialize(configMap map[string]any, network config.Network) error

	// Get the version of the module config
	GetVersion() string
}

type MergedResources added in v1.1.0

type MergedResources struct {
	// Base network resources
	*config.NetworkResources

	// Hyperdrive resources
	*HyperdriveResources
}

An aggregated collection of resources for the selected network, including Hyperdrive resources

type MevBoostConfig

type MevBoostConfig struct {
	// Toggle to enable / disable
	Enable config.Parameter[bool]

	// Ownership mode
	Mode config.Parameter[config.ClientMode]

	// The mode for relay selection
	SelectionMode config.Parameter[MevSelectionMode]

	// Flashbots relay
	FlashbotsRelay config.Parameter[bool]

	// bloXroute max profit relay
	BloxRouteMaxProfitRelay config.Parameter[bool]

	// bloXroute regulated relay
	BloxRouteRegulatedRelay config.Parameter[bool]

	// Titan regional relay
	TitanRegionalRelay config.Parameter[bool]

	// Custom relays provided by the user
	CustomRelays config.Parameter[string]

	// The RPC port
	Port config.Parameter[uint16]

	// Toggle for forwarding the HTTP port outside of Docker
	OpenRpcPort config.Parameter[config.RpcPortMode]

	// The Docker Hub tag for MEV-Boost
	ContainerTag config.Parameter[string]

	// Custom command line flags
	AdditionalFlags config.Parameter[string]

	// The URL of an external MEV-Boost client
	ExternalUrl config.Parameter[string]
	// contains filtered or unexported fields
}

Configuration for MEV-Boost

func NewMevBoostConfig

func NewMevBoostConfig(parent *HyperdriveConfig) *MevBoostConfig

Generates a new MEV-Boost configuration

func (*MevBoostConfig) GetAvailableRelays

func (cfg *MevBoostConfig) GetAvailableRelays() []MevRelay

Get the relays that are available for the current network

func (*MevBoostConfig) GetEnabledMevRelays

func (cfg *MevBoostConfig) GetEnabledMevRelays() []MevRelay

Get which MEV-boost relays are enabled

func (*MevBoostConfig) GetParameters

func (cfg *MevBoostConfig) GetParameters() []config.IParameter

Get the Parameters for this config

func (*MevBoostConfig) GetRelayString

func (cfg *MevBoostConfig) GetRelayString() string

func (*MevBoostConfig) GetSubconfigs

func (cfg *MevBoostConfig) GetSubconfigs() map[string]config.IConfigSection

Get the sections underneath this one

func (*MevBoostConfig) GetTitle

func (cfg *MevBoostConfig) GetTitle() string

The title for the config

func (*MevBoostConfig) HasRelays

func (cfg *MevBoostConfig) HasRelays() bool

Checks if any relays are available for the current network

type MevRelay

type MevRelay struct {
	ID          MevRelayID
	Name        string
	Description string
	Urls        map[string]string
}

A MEV relay

type MevRelayID

type MevRelayID string
const (
	MevRelayID_Unknown            MevRelayID = ""
	MevRelayID_Flashbots          MevRelayID = "flashbots"
	MevRelayID_BloxrouteMaxProfit MevRelayID = "bloxrouteMaxProfit"
	MevRelayID_BloxrouteRegulated MevRelayID = "bloxrouteRegulated"
	MevRelayID_TitanRegional      MevRelayID = "titanRegional"
)

Enum to identify MEV-boost relays

type MevSelectionMode

type MevSelectionMode string
const (
	MevSelectionMode_All    MevSelectionMode = "all"
	MevSelectionMode_Manual MevSelectionMode = "manual"
)

Enum to describe MEV-Boost relay selection mode

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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