common

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Log keys
	PrimarySyncProgressKey  string = "primarySyncProgress"
	FallbackSyncProgressKey string = "fallbackSyncProgress"
	SyncProgressKey         string = "syncProgress"
	PrimaryErrorKey         string = "primaryError"
	FallbackErrorKey        string = "fallbackError"
)

Settings

Variables

View Source
var (
	//lint:ignore ST1005 These are printed to the user and need to be in proper grammatical format
	ErrNodeAddressNotSet error = errors.New("The node currently does not have an address set. Please run 'hyperdrive wallet restore-address' or 'hyperdrive wallet masquerade' and try again.")

	//lint:ignore ST1005 These are printed to the user and need to be in proper grammatical format
	ErrNeedPassword error = errors.New("The node has a node wallet on disk but does not have the password for it loaded. Please run `hyperdrive wallet set-password` to load it.")

	//lint:ignore ST1005 These are printed to the user and need to be in proper grammatical format
	ErrCantLoadWallet error = errors.New("The node has a node wallet and a password on disk but there was an error loading it - perhaps the password is incorrect? Please check the daemon logs for more information.")

	//lint:ignore ST1005 These are printed to the user and need to be in proper grammatical format
	ErrNoKeystore error = errors.New("The node currently does not have a node wallet keystore. Please run 'hyperdrive wallet init' or 'hyperdrive wallet recover' and try again.")

	//lint:ignore ST1005 These are printed to the user and need to be in proper grammatical format
	ErrNoAddress error = errors.New("The node currently does not have an address set. Please run 'hyperdrive wallet restore-address' or 'hyperdrive wallet masquerade' and try again.")

	//lint:ignore ST1005 These are printed to the user and need to be in proper grammatical format
	ErrAddressMismatch error = errors.New("The node's wallet keystore does not match the node address. This node is currently in read-only mode.")

	//lint:ignore ST1005 These are printed to the user and need to be in proper grammatical format
	ErrExecutionClientNotSynced error = errors.New("The Execution client is currently syncing. Please try again later.")

	//lint:ignore ST1005 These are printed to the user and need to be in proper grammatical format
	ErrBeaconNodeNotSynced error = errors.New("The Beacon node is currently syncing. Please try again later.")

	//lint:ignore ST1005 These are printed to the user and need to be in proper grammatical format
	ErrNotRegisteredWithNodeSet error = errors.New("The node is not registered with the Node Set. Please run 'hyperdrive nodeset register-node' and try again.")

	//lint:ignore ST1005 These are printed to the user and need to be in proper grammatical format
	ErrWalletNotReady error = errors.New("The node does not have a wallet ready yet. Please run 'hyperdrive wallet status' to learn more first.")
)

Functions

func CheckIfWalletReady added in v1.1.0

func CheckIfWalletReady(status wallet.WalletStatus) error

Types

type IHyperdriveConfigProvider added in v1.1.0

type IHyperdriveConfigProvider interface {
	// Gets Hyperdrive's configuration
	GetConfig() *hdconfig.HyperdriveConfig

	// Gets Hyperdrive's list of resources
	GetResources() *hdconfig.MergedResources
}

Provides Hyperdrive's configuration

type IHyperdriveServiceProvider added in v1.1.0

Provides access to all of Hyperdrive's services

func NewHyperdriveServiceProvider added in v1.1.0

func NewHyperdriveServiceProvider(userDir string, resourcesDir string) (IHyperdriveServiceProvider, error)

Creates a new IHyperdriveServiceProvider instance by loading the Hyperdrive config in the provided directory

func NewHyperdriveServiceProviderFromConfig added in v1.1.0

func NewHyperdriveServiceProviderFromConfig(cfg *hdconfig.HyperdriveConfig, resources *hdconfig.MergedResources) (IHyperdriveServiceProvider, error)

Creates a new IHyperdriveServiceProvider instance directly from a Hyperdrive config and resources list instead of loading them from the filesystem

func NewHyperdriveServiceProviderFromCustomServices added in v1.1.0

func NewHyperdriveServiceProviderFromCustomServices(cfg *hdconfig.HyperdriveConfig, resources *hdconfig.MergedResources, ecManager *services.ExecutionClientManager, bnManager *services.BeaconClientManager, docker client.APIClient) (IHyperdriveServiceProvider, error)

Creates a new IHyperdriveServiceProvider instance from custom services and artifacts

type INodeSetManagerProvider added in v1.1.0

type INodeSetManagerProvider interface {
	// Gets the NodeSetServiceManager
	GetNodeSetServiceManager() *NodeSetServiceManager
}

Provides a manager for nodeset.io communications

type IRequirementsProvider added in v1.1.0

type IRequirementsProvider interface {
	// Require Hyperdrive has a node address set
	RequireNodeAddress() error

	// Require Hyperdrive has a wallet that's loaded and ready for transactions
	RequireWalletReady() error

	// Require that the Ethereum client is synced
	RequireEthClientSynced(ctx context.Context) error

	// Require that the Beacon chain client is synced
	RequireBeaconClientSynced(ctx context.Context) error

	// Require the node has been registered with a nodeset.io account
	RequireRegisteredWithNodeSet(ctx context.Context) error

	// Wait for the Ethereum client to be synced
	WaitEthClientSynced(ctx context.Context, verbose bool) error

	// Wait for the Beacon chain client to be synced
	WaitBeaconClientSynced(ctx context.Context, verbose bool) error

	// Wait for the node to have a wallet loaded and ready for transactions
	WaitForWallet(ctx context.Context) error

	// Wait for the node to be registered with a nodeset.io account
	WaitForNodeSetRegistration(ctx context.Context) bool
}

Provides methods for requiring or waiting for various conditions to be met

type NodeSetServiceManager added in v1.1.0

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

NodeSetServiceManager is a manager for interactions with the NodeSet service

func NewNodeSetServiceManager added in v1.1.0

func NewNodeSetServiceManager(sp IHyperdriveServiceProvider) *NodeSetServiceManager

Creates a new NodeSet service manager

func (*NodeSetServiceManager) Constellation_GetDepositSignature added in v1.1.0

func (m *NodeSetServiceManager) Constellation_GetDepositSignature(ctx context.Context, deployment string, minipoolAddress common.Address, salt *big.Int) ([]byte, error)

Gets the deposit signature for a minipool from the Constellation contracts

func (*NodeSetServiceManager) Constellation_GetRegisteredAddress added in v1.1.0

func (m *NodeSetServiceManager) Constellation_GetRegisteredAddress(ctx context.Context, deployment string) (*common.Address, error)

Gets the address that has been registered by the node's user for Constellation. Returns nil if the user hasn't registered with NodeSet for Constellation usage yet.

func (*NodeSetServiceManager) Constellation_GetRegistrationSignature added in v1.1.0

func (m *NodeSetServiceManager) Constellation_GetRegistrationSignature(ctx context.Context, deployment string) ([]byte, error)

Gets a signature for registering / whitelisting the node with the Constellation contracts

func (*NodeSetServiceManager) Constellation_GetValidators added in v1.1.0

func (m *NodeSetServiceManager) Constellation_GetValidators(ctx context.Context, deployment string) ([]v2constellation.ValidatorStatus, error)

Get the validators that NodeSet has on record for this node

func (*NodeSetServiceManager) Constellation_UploadSignedExitMessages added in v1.1.0

func (m *NodeSetServiceManager) Constellation_UploadSignedExitMessages(ctx context.Context, deployment string, exitMessages []nscommon.EncryptedExitData) error

Upload signed exit messages for Constellation minipools to the NodeSet service

func (*NodeSetServiceManager) GetRegistrationStatus added in v1.1.0

func (m *NodeSetServiceManager) GetRegistrationStatus(ctx context.Context) (api.NodeSetRegistrationStatus, error)

Get the registration status of the node

func (*NodeSetServiceManager) Login added in v1.1.0

Log in to the NodeSet server

func (*NodeSetServiceManager) RegisterNode added in v1.1.0

func (m *NodeSetServiceManager) RegisterNode(ctx context.Context, email string) (RegistrationResult, error)

Register the node with the NodeSet server

func (*NodeSetServiceManager) StakeWise_GetRegisteredValidators added in v1.1.0

func (m *NodeSetServiceManager) StakeWise_GetRegisteredValidators(ctx context.Context, deployment string, vault common.Address) ([]stakewise.ValidatorStatus, error)

Get the version of the latest deposit data set from the server

func (*NodeSetServiceManager) StakeWise_GetServerDepositData added in v1.1.0

func (m *NodeSetServiceManager) StakeWise_GetServerDepositData(ctx context.Context, deployment string, vault common.Address) (int, []beacon.ExtendedDepositData, error)

Get the deposit data set from the server

func (*NodeSetServiceManager) StakeWise_GetServerDepositDataVersion added in v1.1.0

func (m *NodeSetServiceManager) StakeWise_GetServerDepositDataVersion(ctx context.Context, deployment string, vault common.Address) (int, error)

Get the version of the latest deposit data set from the server

func (*NodeSetServiceManager) StakeWise_UploadDepositData added in v1.1.0

func (m *NodeSetServiceManager) StakeWise_UploadDepositData(ctx context.Context, deployment string, vault common.Address, depositData []beacon.ExtendedDepositData) error

Uploads local deposit data set to the server

func (*NodeSetServiceManager) StakeWise_UploadSignedExitMessages added in v1.1.0

func (m *NodeSetServiceManager) StakeWise_UploadSignedExitMessages(ctx context.Context, deployment string, vault common.Address, exitData []nscommon.EncryptedExitData) error

Uploads signed exit messages set to the server

type RegistrationResult added in v1.1.0

type RegistrationResult int

Result of RegisterNode

const (
	RegistrationResult_Unknown RegistrationResult = iota
	RegistrationResult_Success
	RegistrationResult_AlreadyRegistered
	RegistrationResult_NotWhitelisted
)

Jump to

Keyboard shortcuts

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