stader

package
v1.2.0-dev Latest Latest
Warning

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

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

Documentation

Overview

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.0.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.0.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.0.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.0.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.0.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.0.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.0.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.0.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.0.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	InstallerURL = "https://staderlabs.com/eth/releases" + shared.BinaryBucket + "/%s/install.sh"

	LegacyBackupFolder       string = "old_config_backup"
	SettingsFile             string = "user-settings.yml"
	BackupSettingsFile       string = "user-settings-backup.yml"
	LegacyConfigFile         string = "config.yml"
	LegacySettingsFile       string = "settings.yml"
	PrometheusConfigTemplate string = "prometheus.tmpl"
	PrometheusFile           string = "prometheus.yml"

	APIContainerSuffix string = "_api"
	APIBinPath         string = "/go/bin/stader"

	DebugColor = color.FgYellow
)

Config

View Source
const (
	LegacyGlobalConfigFile    = "config.yml"
	LegacyUserConfigFile      = "settings.yml"
	LegacyComposeFile         = "docker-compose.yml"
	LegacyMetricsComposeFile  = "docker-compose-metrics.yml"
	LegacyFallbackComposeFile = "docker-compose-fallback.yml"
)

Config

View Source
const (
	FileMode fs.FileMode = 0644
)

Config

View Source
const MerkleProofAggregateGetterApi = "https://stage-ethx-offchain.staderlabs.click/merklesForElRewards/proofs/%s"
View Source
const PreSignCheckApi = "https://stage-ethx-offchain.staderlabs.click/msgSubmitted"
View Source
const PreSignSendApi = "https://stage-ethx-offchain.staderlabs.click/presign"
View Source
const PublicKeyApi = "https://stage-ethx-offchain.staderlabs.click/publicKey"

Variables

This section is empty.

Functions

func CheckFeeRecipientFile

func CheckFeeRecipientFile(feeRecipient common.Address, cfg *config.StaderConfig) (bool, bool, error)

Checks if the fee recipient file exists and has the correct distributor address in it. The first return value is for file existence, the second is for validation of the fee recipient address inside.

func UpdateFeeRecipientFile

func UpdateFeeRecipientFile(feeRecipient common.Address, cfg *config.StaderConfig) error

Writes the given address to the fee recipient file. The VC should be restarted to pick up the new file.

Types

type Client

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

Stader client

func NewClient

func NewClient(configPath string, daemonPath string, maxFee float64, maxPrioFee float64, gasLimit uint64, customNonce string, debug bool) (*Client, error)

Create new Stader client

func NewClientFromCtx

func NewClientFromCtx(c *cli.Context) (*Client, error)

Create new Stader client from CLI context

func (*Client) AssignGasSettings

func (c *Client) AssignGasSettings(maxFee float64, maxPrioFee float64, gasLimit uint64)

Get the gas fees

func (*Client) CanClaimRewards

func (c *Client) CanClaimRewards() (api.CanClaimRewards, error)

func (*Client) CanClaimSpRewards

func (c *Client) CanClaimSpRewards() (api.CanClaimSpRewardsResponse, error)

func (*Client) CanDownloadSpMerkleProofs

func (c *Client) CanDownloadSpMerkleProofs() (api.CanDownloadSpMerkleProofsResponse, error)

func (*Client) CanExitValidator

func (c *Client) CanExitValidator(validatorPubKey types.ValidatorPubkey) (api.CanExitValidatorResponse, error)

func (*Client) CanNodeDeposit

func (c *Client) CanNodeDeposit(amountWei *big.Int, numValidators *big.Int, reloadKeys bool) (api.CanNodeDepositResponse, error)

Check whether the node can make a deposit

func (*Client) CanNodeDepositSd

func (c *Client) CanNodeDepositSd(amountWei *big.Int) (api.CanNodeDepositSdResponse, error)

Check whether the node can deposit SD

func (*Client) CanNodeSend

func (c *Client) CanNodeSend(amountWei *big.Int, token string) (api.CanNodeSendResponse, error)

Check whether the node can send tokens

func (*Client) CanRegisterNode

func (c *Client) CanRegisterNode(operatorName string, operatorRewardAddress common.Address, socializeMev bool) (api.CanRegisterNodeResponse, error)

Check whether the node can be registered

func (*Client) CanSendClRewards

func (c *Client) CanSendClRewards(validatorPubKey types.ValidatorPubkey) (api.CanSendClRewardsResponse, error)

func (*Client) CanSendElRewards

func (c *Client) CanSendElRewards() (api.CanSendElRewardsResponse, error)

func (*Client) CanUpdateOperatorName

func (c *Client) CanUpdateOperatorName(operatorName string) (api.CanUpdateOperatorName, error)

func (*Client) CanUpdateOperatorRewardAddress

func (c *Client) CanUpdateOperatorRewardAddress(operatorRewardAddress common.Address) (api.CanUpdateOperatorRewardAddress, error)

func (*Client) CanUpdateSocializeEl

func (c *Client) CanUpdateSocializeEl(socializeEl bool) (api.CanUpdateSocializeElResponse, error)

func (*Client) CanWithdrawSd

func (c *Client) CanWithdrawSd(amount *big.Int) (api.CanWithdrawSdResponse, error)

func (*Client) ClaimRewards

func (c *Client) ClaimRewards() (api.ClaimRewards, error)

func (*Client) ClaimSpRewards

func (c *Client) ClaimSpRewards(cycles []*big.Int) (api.ClaimSpRewardsResponse, error)

func (*Client) Close

func (c *Client) Close()

Close client remote connection

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(volume string) (string, error)

Deletes a container

func (*Client) DownloadSpMerkleProofs

func (c *Client) DownloadSpMerkleProofs() (api.DownloadSpMerkleProofsResponse, error)

func (*Client) EstimateClaimSpRewardsGas

func (c *Client) EstimateClaimSpRewardsGas(cycles []*big.Int) (api.EstimateClaimSpRewardsGasResponse, error)

func (*Client) EstimateGasSetEnsName

func (c *Client) EstimateGasSetEnsName(name string) (api.SetEnsNameResponse, error)

Estimate the gas required to set an ENS reverse record to a name

func (*Client) ExitValidator

func (c *Client) ExitValidator(validatorPubKey types.ValidatorPubkey) (api.ExitValidatorResponse, error)

func (*Client) ExportWallet

func (c *Client) ExportWallet() (api.ExportWalletResponse, error)

Export wallet

func (*Client) GetClientStatus

func (c *Client) GetClientStatus() (api.ClientStatusResponse, error)

Gets the status of the configured Execution and Beacon clients

func (*Client) GetClientVolumeName

func (c *Client) GetClientVolumeName(container string, volumeTarget string) (string, error)

Gets the name of the client volume

func (*Client) GetClientVolumeSource

func (c *Client) GetClientVolumeSource(container string, volumeTarget string) (string, error)

Gets the absolute file path of the client volume

func (*Client) GetContractsInfo

func (c *Client) GetContractsInfo() (api.ContractsInfoResponse, error)

func (*Client) GetDetailedCyclesInfo

func (c *Client) GetDetailedCyclesInfo(cycles []*big.Int) (api.CyclesDetailedInfo, error)

func (*Client) GetDirSizeViaEcMigrator

func (c *Client) GetDirSizeViaEcMigrator(container string, targetDir string, image string) (uint64, error)

Gets the size of the target directory via the EC migrator for importing, which should have the same permissions as exporting

func (*Client) GetDockerContainerShutdownTime

func (c *Client) GetDockerContainerShutdownTime(container string) (time.Time, error)

Get the time that the given container shut down

func (*Client) GetDockerImage

func (c *Client) GetDockerImage(container string) (string, error)

Get the current Docker image used by the given container

func (*Client) GetDockerStatus

func (c *Client) GetDockerStatus(container string) (string, error)

Get the current Docker image used by the given container

func (*Client) GetGasSettings

func (c *Client) GetGasSettings() (float64, float64, uint64)

Get the gas settings

func (*Client) GetNodeDepositSdAllowance

func (c *Client) GetNodeDepositSdAllowance() (api.NodeDepositSdAllowanceResponse, error)

Get the node's SD allowance

func (*Client) GetServiceVersion

func (c *Client) GetServiceVersion() (string, error)

Get the Stader service version

func (*Client) GetVolumeSize

func (c *Client) GetVolumeSize(volumeName string) (string, error)

Gets the disk usage of the given volume

func (*Client) IncrementCustomNonce

func (c *Client) IncrementCustomNonce()

Increments the custom nonce parameter. This is used for calls that involve multiple transactions, so they don't all have the same nonce.

func (*Client) InitWallet

func (c *Client) InitWallet(derivationPath string) (api.InitWalletResponse, error)

Initialize wallet

func (*Client) InstallService

func (c *Client) InstallService(verbose, noDeps bool, network, version, path string, dataPath string) error

Install the Stader service

func (*Client) IsFirstRun

func (c *Client) IsFirstRun() (bool, error)

Returns whether or not this is the first run of the configurator since a previous installation

func (*Client) LoadBackupConfig

func (c *Client) LoadBackupConfig() (*config.StaderConfig, error)

Load the backup config

func (*Client) LoadConfig

func (c *Client) LoadConfig() (*config.StaderConfig, bool, error)

Load the config

func (*Client) LoadGlobalConfig_Legacy

func (c *Client) LoadGlobalConfig_Legacy(globalConfigPath string) (config.LegacyStaderConfig, error)

Load the global config

func (*Client) LoadLegacyConfigFromBackup

func (c *Client) LoadLegacyConfigFromBackup() (*config.StaderConfig, error)

Load the legacy config if one exists

func (*Client) LoadMergedConfig_Legacy

func (c *Client) LoadMergedConfig_Legacy(globalConfigPath string, userConfigPath string) (config.LegacyStaderConfig, error)

Load the merged global & user config

func (*Client) LoadUserConfig_Legacy

func (c *Client) LoadUserConfig_Legacy(userConfigPath string) (config.LegacyStaderConfig, error)

Load/save the user config

func (*Client) MigrateLegacyConfig

func (c *Client) MigrateLegacyConfig(legacyConfigFilePath string, legacySettingsFilePath string) (*config.StaderConfig, error)

Migrate a legacy configuration (pre-v1.3) to a modern post-v1.3 one

func (*Client) NodeDeposit

func (c *Client) NodeDeposit(amountWei *big.Int, numValidators *big.Int, reloadKeys bool) (api.NodeDepositResponse, error)

Make a node deposit

func (*Client) NodeDepositSd

func (c *Client) NodeDepositSd(amountWei *big.Int) (api.NodeDepositSdResponse, error)

Deposit SD as collateral

func (*Client) NodeDepositSdApprovalGas

func (c *Client) NodeDepositSdApprovalGas(amountWei *big.Int) (api.NodeDepositSdApproveGasResponse, error)

Get the gas estimate for approving new SD interaction

func (*Client) NodeDepositSdApprove

func (c *Client) NodeDepositSdApprove(amountWei *big.Int) (api.NodeDepositSdApproveResponse, error)

Approve SD for depositing as collateral

func (*Client) NodeSend

func (c *Client) NodeSend(amountWei *big.Int, token string, toAddress common.Address) (api.NodeSendResponse, error)

Send tokens from the node to an address

func (*Client) NodeStatus

func (c *Client) NodeStatus() (api.NodeStatusResponse, error)

Get node status

func (*Client) NodeSync

func (c *Client) NodeSync() (api.NodeSyncProgressResponse, error)

Get node sync progress

func (*Client) PauseService

func (c *Client) PauseService(composeFiles []string) error

Pause the Stader service

func (*Client) PrintMultiTxWarning

func (sd *Client) PrintMultiTxWarning()

Print a warning about the gas estimate for operations that have multiple transactions

func (*Client) PrintServiceCompose

func (c *Client) PrintServiceCompose(composeFiles []string) error

Print the Stader service compose config

func (*Client) PrintServiceLogs

func (c *Client) PrintServiceLogs(composeFiles []string, tail string, serviceNames ...string) error

Print the Stader service logs

func (*Client) PrintServiceStats

func (c *Client) PrintServiceStats(composeFiles []string) error

Print the Stader service stats

func (*Client) PrintServiceStatus

func (c *Client) PrintServiceStatus(composeFiles []string) error

Print the Stader service status

func (*Client) Purge

func (c *Client) Purge() (api.PurgeResponse, error)

Purge the node wallet and validator keys

func (*Client) PurgeAllKeys

func (c *Client) PurgeAllKeys(composeFiles []string) error

Deletes the node wallet and all validator keys, and restarts the Docker containers

func (*Client) RebuildWallet

func (c *Client) RebuildWallet() (api.RebuildWalletResponse, error)

Rebuild wallet

func (*Client) RecoverWallet

func (c *Client) RecoverWallet(mnemonic string, skipValidatorKeyRecovery bool, derivationPath string, walletIndex uint) (api.RecoverWalletResponse, error)

Recover wallet

func (*Client) RegisterNode

func (c *Client) RegisterNode(operatorName string, operatorRewardAddress common.Address, socializeMev bool) (api.RegisterNodeResponse, error)

Register the node

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(container string) (string, error)

Deletes a container

func (*Client) RemoveUpgradeFlagFile

func (c *Client) RemoveUpgradeFlagFile() error

Remove the upgrade flag file

func (*Client) RestartContainer

func (c *Client) RestartContainer(container string) (string, error)

Restart a container

func (*Client) RunEcMigrator

func (c *Client) RunEcMigrator(container string, volume string, targetDir string, mode string, image string) error

Runs the EC migrator

func (*Client) RunNethermindPruneStarter

func (c *Client) RunNethermindPruneStarter(container string) error

Runs the prune provisioner

func (*Client) RunPruneProvisioner

func (c *Client) RunPruneProvisioner(container string, volume string, image string) error

Runs the prune provisioner

func (*Client) SaveConfig

func (c *Client) SaveConfig(cfg *config.StaderConfig) error

Save the config

func (*Client) SearchAndRecoverWallet

func (c *Client) SearchAndRecoverWallet(mnemonic string, address common.Address, skipValidatorKeyRecovery bool) (api.SearchAndRecoverWalletResponse, error)

Search and recover wallet

func (*Client) SendClRewards

func (c *Client) SendClRewards(validatorPubKey types.ValidatorPubkey) (api.SendClRewardsResponse, error)

func (*Client) SendElRewards

func (c *Client) SendElRewards() (api.SendElRewardsResponse, error)

func (*Client) SetClientStatusFlags

func (c *Client) SetClientStatusFlags(ignoreSyncCheck bool, forceFallbacks bool)

Set the flags for ignoring EC and CC sync checks and forcing fallbacks to prevent unnecessary duplication of effort by the API during CLI commands

func (*Client) SetEnsName

func (c *Client) SetEnsName(name string) (api.SetEnsNameResponse, error)

Set an ENS reverse record to a name

func (*Client) SetPassword

func (c *Client) SetPassword(password string) (api.SetPasswordResponse, error)

Set wallet password

func (*Client) SignMessage

func (c *Client) SignMessage(message string) (api.NodeSignResponse, error)

Use the node private key to sign an arbitrary message

func (*Client) StartContainer

func (c *Client) StartContainer(container string) (string, error)

Start a container

func (*Client) StartService

func (c *Client) StartService(composeFiles []string) error

Start the Stader service

func (*Client) StopContainer

func (c *Client) StopContainer(container string) (string, error)

Shut down a container

func (*Client) StopService

func (c *Client) StopService(composeFiles []string) error

Stop the Stader service

func (*Client) TerminateDataFolder

func (c *Client) TerminateDataFolder() (api.TerminateDataFolderResponse, error)

Deletes the data folder including the wallet file, password file, and all validator keys. Don't use this unless you have a very good reason to do it (such as switching from Prater to Mainnet).

func (*Client) TerminateService

func (c *Client) TerminateService(composeFiles []string, configPath string) error

Stop the Stader service and remove the config folder

func (*Client) TestRecoverWallet

func (c *Client) TestRecoverWallet(mnemonic string, skipValidatorKeyRecovery bool, derivationPath string, walletIndex uint) (api.RecoverWalletResponse, error)

Recover wallet

func (*Client) TestSearchAndRecoverWallet

func (c *Client) TestSearchAndRecoverWallet(mnemonic string, address common.Address, skipValidatorKeyRecovery bool) (api.SearchAndRecoverWalletResponse, error)

Search and recover wallet

func (*Client) UpdateOperatorName

func (c *Client) UpdateOperatorName(operatorName string) (api.UpdateOperatorName, error)

func (*Client) UpdateOperatorRewardAddress

func (c *Client) UpdateOperatorRewardAddress(operatorRewardAddress common.Address) (api.UpdateOperatorRewardAddress, error)

func (*Client) UpdatePrometheusConfiguration

func (c *Client) UpdatePrometheusConfiguration(settings map[string]string) error

Load the Prometheus template, do an environment variable substitution, and save it

func (*Client) UpdateSocializeEl

func (c *Client) UpdateSocializeEl(socializeEl bool) (api.UpdateSocializeElResponse, error)

func (*Client) WaitForTransaction

func (c *Client) WaitForTransaction(txHash common.Hash) (api.APIResponse, error)

Wait for a transaction

func (*Client) WalletStatus

func (c *Client) WalletStatus() (api.WalletStatusResponse, error)

Get wallet status

func (*Client) WithdrawSd

func (c *Client) WithdrawSd(amount *big.Int) (api.WithdrawSdResponse, error)

Jump to

Keyboard shortcuts

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