types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RocketPoolValidatorPath    string = "m/12381/3600/%d/0/0"
	StakewiseValidatorPath     string = "m/12381/3600/%d/1/0"
	ConstellationValidatorPath string = "m/12381/3600/%d/2/0"
	SoloValidatorPath          string = "m/12381/3600/%d/3/0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AttestationInfo

type AttestationInfo struct {
	AggregationBits bitfield.Bitlist
	SlotIndex       uint64
	CommitteeIndex  uint64
}

type BeaconBlock

type BeaconBlock struct {
	Slot                 uint64
	ProposerIndex        string
	HasExecutionPayload  bool
	Attestations         []AttestationInfo
	FeeRecipient         common.Address
	ExecutionBlockNumber uint64
}

type BeaconHead

type BeaconHead struct {
	Epoch                  uint64
	FinalizedEpoch         uint64
	JustifiedEpoch         uint64
	PreviousJustifiedEpoch uint64
}

type BeaconNode

type BeaconNode string

A Beacon Node (Beacon Node)

const (
	// Unknown
	BeaconNode_Unknown BeaconNode = ""

	// Lighthouse
	BeaconNode_Lighthouse BeaconNode = "lighthouse"

	// Lodestar
	BeaconNode_Lodestar BeaconNode = "lodestar"

	// Nimbus
	BeaconNode_Nimbus BeaconNode = "nimbus"

	// Prysm
	BeaconNode_Prysm BeaconNode = "prysm"

	// Teku
	BeaconNode_Teku BeaconNode = "teku"
)

Enum to describe the Beacon Nodes

type ByteArray

type ByteArray []byte

Byte array type

func (ByteArray) MarshalJSON

func (b ByteArray) MarshalJSON() ([]byte, error)

func (*ByteArray) UnmarshalJSON

func (b *ByteArray) UnmarshalJSON(data []byte) error

type ChangedSection

type ChangedSection struct {
	// The name of the section
	Name string

	// The list of parameters within this section that have changed
	Settings []*ChangedSetting

	// The list of subsections that may or may not have changes
	Subsections []*ChangedSection
}

A configuration section with one or more changes

type ChangedSetting

type ChangedSetting struct {
	// The setting name
	Name string

	// The current (old) value of the parameter
	OldValue string

	// The new (pending) value of the parameter
	NewValue string

	// A list of containers affected by this change, which will require restarting them
	AffectedContainers []ContainerID
}

A configuration setting that has been changed

type ClientMode

type ClientMode string

A client ownership mode

const (
	// Unknown
	ClientMode_Unknown ClientMode = ""

	// Locally-owned clients (managed by Hyperdrive)
	ClientMode_Local ClientMode = "local"

	// Externally-managed clients (managed by the user)
	ClientMode_External ClientMode = "external"
)

Enum to describe client modes

type ContainerID

type ContainerID string

A Docker container name

const (
	// Unknown
	ContainerID_Unknown ContainerID = ""

	// The daemon
	ContainerID_Daemon ContainerID = "daemon"

	// The Execution client
	ContainerID_ExecutionClient ContainerID = "ec"

	// The Beacon node (Beacon Node)
	ContainerID_BeaconNode ContainerID = "bn"

	// The Validator clients owned by Hyperdrive
	ContainerID_ValidatorClients ContainerID = "vcs"

	// MEV-Boost
	ContainerID_MevBoost ContainerID = "mev-boost"

	// The Node Exporter
	ContainerID_Exporter ContainerID = "exporter"

	// Prometheus
	ContainerID_Prometheus ContainerID = "prometheus"

	// Grafana
	ContainerID_Grafana ContainerID = "grafana"
)

Enum to describe the names of Hyperdrive containers

type DerivationPath

type DerivationPath string
const (
	DerivationPath_Default    DerivationPath = ""
	DerivationPath_LedgerLive DerivationPath = "ledger-live"
	DerivationPath_Mew        DerivationPath = "mew"
)

type Eth1Data

type Eth1Data struct {
	DepositRoot  common.Hash
	DepositCount uint64
	BlockHash    common.Hash
}

type Eth2Config

type Eth2Config struct {
	GenesisForkVersion           []byte
	GenesisValidatorsRoot        []byte
	GenesisEpoch                 uint64
	GenesisTime                  uint64
	SecondsPerSlot               uint64
	SlotsPerEpoch                uint64
	SecondsPerEpoch              uint64
	EpochsPerSyncCommitteePeriod uint64
}

type Eth2DepositContract

type Eth2DepositContract struct {
	ChainID uint64
	Address common.Address
}

type ExecutionClient

type ExecutionClient string

An Execution client

const (
	// Unknown
	ExecutionClient_Unknown ExecutionClient = ""

	// Geth
	ExecutionClient_Geth ExecutionClient = "geth"

	// Nethermind
	ExecutionClient_Nethermind ExecutionClient = "nethermind"

	// Besu
	ExecutionClient_Besu ExecutionClient = "besu"
)

Enum to describe the Execution clients

type ExtendedDepositData

type ExtendedDepositData struct {
	PublicKey             ByteArray `json:"pubkey"`
	WithdrawalCredentials ByteArray `json:"withdrawal_credentials"`
	Amount                uint64    `json:"amount"`
	Signature             ByteArray `json:"signature"`
	DepositMessageRoot    ByteArray `json:"deposit_message_root"`
	DepositDataRoot       ByteArray `json:"deposit_data_root"`
	ForkVersion           ByteArray `json:"fork_version"`
	NetworkName           string    `json:"network_name"`
	HyperdriveVersion     string    `json:"hyperdrive_version,omitempty"`
}

Extended deposit data beyond what is required in an actual deposit message to Beacon, emulating what the deposit CLI produces

type HardwareWalletData

type HardwareWalletData struct {
}

Placeholder for hardware wallets

type IBeaconClient

type IBeaconClient interface {
	GetSyncStatus() (SyncStatus, error)
	GetEth2Config() (Eth2Config, error)
	GetEth2DepositContract() (Eth2DepositContract, error)
	GetAttestations(blockId string) ([]AttestationInfo, bool, error)
	GetBeaconBlock(blockId string) (BeaconBlock, bool, error)
	GetBeaconHead() (BeaconHead, error)
	GetValidatorStatusByIndex(index string, opts *ValidatorStatusOptions) (ValidatorStatus, error)
	GetValidatorStatus(pubkey beacon.ValidatorPubkey, opts *ValidatorStatusOptions) (ValidatorStatus, error)
	GetValidatorStatuses(pubkeys []beacon.ValidatorPubkey, opts *ValidatorStatusOptions) (map[beacon.ValidatorPubkey]ValidatorStatus, error)
	GetValidatorIndex(pubkey beacon.ValidatorPubkey) (string, error)
	GetValidatorSyncDuties(indices []string, epoch uint64) (map[string]bool, error)
	GetValidatorProposerDuties(indices []string, epoch uint64) (map[string]uint64, error)
	GetDomainData(domainType []byte, epoch uint64, useGenesisFork bool) ([]byte, error)
	ExitValidator(validatorIndex string, epoch uint64, signature beacon.ValidatorSignature) error
	Close() error
	GetEth1DataForEth2Block(blockId string) (Eth1Data, bool, error)
	ChangeWithdrawalCredentials(validatorIndex string, fromBlsPubkey beacon.ValidatorPubkey, toExecutionAddress common.Address, signature beacon.ValidatorSignature) error
}

Beacon client interface

type IConfigSection

type IConfigSection interface {
	// Get the name of the section (for display purposes)
	GetTitle() string

	// Get the list of parameters directly belonging to this section
	GetParameters() []IParameter

	// Get the sections underneath this one
	GetSubconfigs() map[string]IConfigSection
}

Interface for describing config sections

type IParameter

type IParameter interface {
	// Get the parameter's common fields
	GetCommon() *ParameterCommon

	// Get the common fields from each ParameterOption (returns nil if this isn't a choice parameter)
	GetOptions() []IParameterOption

	// Set the parameter to the default value
	SetToDefault(network Network)

	// Get the parameter's value
	GetValueAsAny() any

	// Get the parameter's value as a string
	String() string

	// Get the parameter's default value for the supplied network as a string
	GetDefaultAsAny(network Network) any

	// Deserializes a string into this parameter's value
	Deserialize(serializedParam string, network Network) error

	// Set the parameter's value explicitly; panics if it's the wrong type
	SetValue(value any)

	// Change the current network
	ChangeNetwork(oldNetwork Network, newNetwork Network)
}

An interface for typed Parameter structs, to get common fields from them

type IParameterOption

type IParameterOption interface {
	// Get the parameter option's common fields
	Common() *ParameterOptionCommon

	// Get the option's value
	GetValueAsAny() any

	// Ge the option's value as a string
	String() string
}

An interface for typed ParameterOption structs, to get common fields from them

type LocalWalletData

type LocalWalletData struct {
	// Encrypted seed information
	Crypto map[string]interface{} `json:"crypto"`

	// Name of the encryptor used to generate the keystore
	Name string `json:"name"`

	// Version of the encryptor used to generate the keystore
	Version uint `json:"version"`

	// Unique ID for this keystore
	UUID uuid.UUID `json:"uuid"`

	// The path that should be used to derive the target key; assumes there's only one index that can be iterated on
	DerivationPath string `json:"derivationPath,omitempty"`

	// The index of the target wallet, used to format DerivationPath
	WalletIndex uint `json:"walletIndex,omitempty"`
}

Keystore for local node wallets - note that this is NOT an EIP-2335 keystore.

type Network

type Network string

The network that this installation is configured to run on

const (
	// Unknown
	Network_Unknown Network = ""

	// All networks (used for parameter defaults)
	Network_All Network = "all"

	// The Holesky test network
	Network_Holesky Network = "holesky"

	// The NodeSet dev network on Holesky
	Network_HoleskyDev Network = "holesky-dev"

	// The Ethereum mainnet
	Network_Mainnet Network = "mainnet"
)

Enum to describe the various network values

type Parameter

type Parameter[Type comparable] struct {
	*ParameterCommon
	Default map[Network]Type
	Value   Type
	Options []*ParameterOption[Type]
}

A parameter that can be configured by the user

func (*Parameter[_]) ChangeNetwork

func (p *Parameter[_]) ChangeNetwork(oldNetwork Network, newNetwork Network)

Apply a network change to a parameter

func (*Parameter[_]) Deserialize

func (p *Parameter[_]) Deserialize(serializedParam string, network Network) error

Deserializes a string into this parameter's value

func (*Parameter[_]) GetCommon

func (p *Parameter[_]) GetCommon() *ParameterCommon

Get the parameter's common fields

func (*Parameter[Type]) GetDefault

func (p *Parameter[Type]) GetDefault(network Network) Type

Get the default value for the provided network

func (*Parameter[_]) GetDefaultAsAny

func (p *Parameter[_]) GetDefaultAsAny(network Network) any

Get the default value for the provided network

func (*Parameter[_]) GetOptions

func (p *Parameter[_]) GetOptions() []IParameterOption

Get the common fields from each ParameterOption (returns nil if this isn't a choice parameter)

func (*Parameter[_]) GetValueAsAny

func (p *Parameter[_]) GetValueAsAny() any

Get the parameter's value

func (*Parameter[Type]) SetToDefault

func (p *Parameter[Type]) SetToDefault(network Network)

Set the value to the default for the provided config's network

func (*Parameter[Type]) SetValue

func (p *Parameter[Type]) SetValue(value any)

Set the parameter's value

func (*Parameter[_]) String

func (p *Parameter[_]) String() string

Get the parameter's value as a string

type ParameterCommon

type ParameterCommon struct {
	// The parameter's ID, used for serialization and deserialization
	ID string

	// The parameter's human-readable name
	Name string

	// A description of this parameter / setting
	Description string

	// The max length of the parameter, in characters, if it's free-form input
	MaxLength int

	// An optional regex used to validate free-form input for the parameter
	Regex string

	// True if this is an advanced parameter and should be hidden unless advanced configuration mode is enabled
	Advanced bool

	// The list of Docker containers affected by changing this parameter
	// (these containers will require a restart for the change to take effect)
	AffectsContainers []ContainerID

	// A list of Docker container environment variables that should be set to this parameter's value
	EnvironmentVariables []string

	// Whether or not the parameter is allowed to be blank
	CanBeBlank bool

	// True to reset the parameter's value to the default option after Hyperdrive is updated
	OverwriteOnUpgrade bool

	// Descriptions of the parameter that change depending on the selected network
	DescriptionsByNetwork map[Network]string
}

Common fields across all Parameter instances

func (*ParameterCommon) UpdateDescription

func (p *ParameterCommon) UpdateDescription(network Network)

Set the network-specific description of the parameter

type ParameterOption

type ParameterOption[Type any] struct {
	*ParameterOptionCommon

	// The underlying value for this option
	Value Type
}

A single option in a choice parameter

func (*ParameterOption[_]) Common

func (p *ParameterOption[_]) Common() *ParameterOptionCommon

Get the parameter option's common fields

func (*ParameterOption[_]) GetValueAsAny

func (p *ParameterOption[_]) GetValueAsAny() any

Get the parameter's value

func (*ParameterOption[_]) String

func (p *ParameterOption[_]) String() string

Get the parameter option's value as a string

type ParameterOptionCommon

type ParameterOptionCommon struct {
	// The option's human-readable name, to be used in config displays
	Name string

	// A description signifying what this option means
	Description string
}

Common fields across all ParameterOption instances

type RpcPortMode

type RpcPortMode string

How to expose the RPC ports

const (
	// Do not allow any connections to the RPC port
	RpcPortMode_Closed RpcPortMode = "closed"

	// Allow connections from the same host
	RpcPortMode_OpenLocalhost RpcPortMode = "localhost"

	// Allow connections from external hosts
	RpcPortMode_OpenExternal RpcPortMode = "external"
)

Enum to describe the mode for the RPC port exposure setting

func (RpcPortMode) DockerPortMapping

func (m RpcPortMode) DockerPortMapping(port uint16) string

Creates the appropriate Docker config string for the provided port, based on the port mode

func (RpcPortMode) IsOpen

func (m RpcPortMode) IsOpen() bool

True if the port is open locally or externally

type SyncStatus

type SyncStatus struct {
	Syncing  bool
	Progress float64
}

API response types

type ValidatorKeystore

type ValidatorKeystore struct {
	Crypto  map[string]interface{} `json:"crypto"`
	Name    string                 `json:"name,omitempty"` // Technically not part of the spec but Prysm needs it
	Version uint                   `json:"version"`
	UUID    uuid.UUID              `json:"uuid"`
	Path    string                 `json:"path"`
	Pubkey  beacon.ValidatorPubkey `json:"pubkey,omitempty"`
}

Encrypted validator keystore following the EIP-2335 standard (https://eips.ethereum.org/EIPS/eip-2335)

type ValidatorState

type ValidatorState string
const (
	ValidatorState_PendingInitialized ValidatorState = "pending_initialized"
	ValidatorState_PendingQueued      ValidatorState = "pending_queued"
	ValidatorState_ActiveOngoing      ValidatorState = "active_ongoing"
	ValidatorState_ActiveExiting      ValidatorState = "active_exiting"
	ValidatorState_ActiveSlashed      ValidatorState = "active_slashed"
	ValidatorState_ExitedUnslashed    ValidatorState = "exited_unslashed"
	ValidatorState_ExitedSlashed      ValidatorState = "exited_slashed"
	ValidatorState_WithdrawalPossible ValidatorState = "withdrawal_possible"
	ValidatorState_WithdrawalDone     ValidatorState = "withdrawal_done"
)

type ValidatorStatus

type ValidatorStatus struct {
	Pubkey                     beacon.ValidatorPubkey
	Index                      string
	WithdrawalCredentials      common.Hash
	Balance                    uint64
	Status                     ValidatorState
	EffectiveBalance           uint64
	Slashed                    bool
	ActivationEligibilityEpoch uint64
	ActivationEpoch            uint64
	ExitEpoch                  uint64
	WithdrawableEpoch          uint64
	Exists                     bool
}

type ValidatorStatusOptions

type ValidatorStatusOptions struct {
	Epoch *uint64
	Slot  *uint64
}

API request options

type WalletData

type WalletData struct {
	// The type of wallet
	Type WalletType `json:"type"`

	// Data about a local wallet
	LocalData LocalWalletData `json:"localData"`

	// Data about a hardware wallet
	HardwareData HardwareWalletData `json:"hardwareData"`
}

Data storage for node wallets

type WalletStatus

type WalletStatus struct {
	Address struct {
		NodeAddress common.Address `json:"nodeAddress"`
		HasAddress  bool           `json:"hasAddress"`
	} `json:"address"`

	Wallet struct {
		Type          WalletType     `json:"type"`
		IsLoaded      bool           `json:"isLoaded"`
		IsOnDisk      bool           `json:"isOnDisk"`
		WalletAddress common.Address `json:"walletAddress"`
	} `json:"wallet"`

	Password struct {
		IsPasswordSaved bool `json:"isPasswordSaved"`
	} `json:"password"`
}

type WalletType

type WalletType string

An enum describing the type of wallet used by the node

const (
	// Unset wallet type
	WalletType_Unknown WalletType = ""

	// Indicator for local wallets that have encrypted keystores saved to disk
	WalletType_Local WalletType = "local"

	// Indicator for hardware wallets that store the private key offline
	WalletType_Hardware WalletType = "hardware"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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