swcommon

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Stakewise validators deposit a full 32 ETH
	StakewiseDepositAmount uint64 = 32e9
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DepositDataManager

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

DepositDataManager manages the aggregated deposit data file that Stakewise uses

func NewDepositDataManager

func NewDepositDataManager(sp *StakewiseServiceProvider) (*DepositDataManager, error)

Creates a new manager

func (*DepositDataManager) ComputeMerkleRoot added in v0.2.3

func (m *DepositDataManager) ComputeMerkleRoot(data []types.ExtendedDepositData) (common.Hash, error)

Compute the Merkle root of the aggregated deposit data using the Stakewise rules NOTE: reverse engineered from https://github.com/stakewise/v3-operator/blob/fa4ac2673a64a486ced51098005376e56e2ddd19/src/validators/utils.py#L207

func (*DepositDataManager) GenerateDepositData

func (m *DepositDataManager) GenerateDepositData(keys []*eth2types.BLSPrivateKey) ([]*types.ExtendedDepositData, error)

Generates deposit data for the provided keys

func (*DepositDataManager) GetDepositData

func (m *DepositDataManager) GetDepositData() ([]byte, error)

Read the deposit data file

func (*DepositDataManager) UpdateDepositData

func (m *DepositDataManager) UpdateDepositData(data []types.ExtendedDepositData) error

Save the deposit data file

type DepositDataMetaResponse

type DepositDataMetaResponse struct {
	Version int `json:"version"`
}

api/deposit-data/meta

type DepositDataResponse

type DepositDataResponse struct {
	Version int                         `json:"version"`
	Data    []types.ExtendedDepositData `json:"data"`
}

api/deposit-data

type NodesetClient

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

Client for interacting with the Nodeset server

func NewNodesetClient

func NewNodesetClient(sp *StakewiseServiceProvider) *NodesetClient

Creates a new Nodeset client

func (*NodesetClient) EnsureAuthSignatureExists

func (c *NodesetClient) EnsureAuthSignatureExists() error

Checks if the NodeSet authorization signature has been set, and if not, creates it by getting a signed message from the node wallet

func (*NodesetClient) GetRegisteredValidators

func (c *NodesetClient) GetRegisteredValidators() ([]beacon.ValidatorPubkey, error)

Get a list of all of the pubkeys that have already been registered with NodeSet for this node

func (*NodesetClient) GetServerDepositData

func (c *NodesetClient) GetServerDepositData() (int, []types.ExtendedDepositData, error)

Get the aggregated deposit data from the server

func (*NodesetClient) GetServerDepositDataVersion

func (c *NodesetClient) GetServerDepositDataVersion() (int, error)

Get the current version of the aggregated deposit data on the server

func (*NodesetClient) UploadDepositData

func (c *NodesetClient) UploadDepositData(depositData []byte) ([]byte, error)

Uploads deposit data to Nodeset

type StakewiseServiceProvider

type StakewiseServiceProvider struct {
	*services.ServiceProvider[*swconfig.StakewiseConfig]
	// contains filtered or unexported fields
}

func NewStakewiseServiceProvider

func NewStakewiseServiceProvider(sp *services.ServiceProvider[*swconfig.StakewiseConfig]) (*StakewiseServiceProvider, error)

Create a new service provider with Stakewise daemon-specific features

func (*StakewiseServiceProvider) GetDepositDataManager

func (s *StakewiseServiceProvider) GetDepositDataManager() *DepositDataManager

func (*StakewiseServiceProvider) GetNodesetClient

func (s *StakewiseServiceProvider) GetNodesetClient() *NodesetClient

func (*StakewiseServiceProvider) GetResources

func (*StakewiseServiceProvider) GetWallet

func (s *StakewiseServiceProvider) GetWallet() *Wallet

type StakewiseVault added in v0.2.3

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

Binding for Stakewise vaults

func NewStakewiseVault added in v0.2.3

func NewStakewiseVault(address common.Address, ec eth.IExecutionClient, txMgr *eth.TransactionManager) (*StakewiseVault, error)

Create a new Stakewise vault instance

func (*StakewiseVault) GetValidatorsRoot added in v0.2.3

func (c *StakewiseVault) GetValidatorsRoot(mc *batch.MultiCaller, out *common.Hash)

Get the current validators root in the contracts

func (*StakewiseVault) SetDepositDataRoot added in v0.2.3

func (c *StakewiseVault) SetDepositDataRoot(dataRoot common.Hash, opts *bind.TransactOpts) (*eth.TransactionInfo, error)

Set the validator deposit data root for the vault

type ValidatorsResponse

type ValidatorsResponse struct {
	Data []beacon.ValidatorPubkey `json:"data"`
}

api/validators

type Wallet

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

Wallet manager for the Stakewise daemon

func NewWallet

Create a new wallet

func (*Wallet) DerivePubKeys added in v0.2.3

func (w *Wallet) DerivePubKeys(privateKeys []*eth2types.BLSPrivateKey) ([]beacon.ValidatorPubkey, error)

Get the private validator key with the corresponding pubkey

func (*Wallet) GenerateNewValidatorKey

func (w *Wallet) GenerateNewValidatorKey() (*eth2types.BLSPrivateKey, error)

Generate a new validator key and save it

func (*Wallet) GetAllPrivateKeys

func (w *Wallet) GetAllPrivateKeys() ([]*eth2types.BLSPrivateKey, error)

Gets all of the validator private keys that are stored in the Stakewise keystore folder

func (*Wallet) GetLatestDepositDataVersion

func (w *Wallet) GetLatestDepositDataVersion() int

Get the version of the aggregated deposit data from the NodeSet server that's stored on disk

func (*Wallet) GetPrivateKeyForPubkey added in v0.2.3

func (w *Wallet) GetPrivateKeyForPubkey(pubkey beacon.ValidatorPubkey) (*eth2types.BLSPrivateKey, error)

Get the private validator key with the corresponding pubkey

func (*Wallet) SetLatestDepositDataVersion

func (w *Wallet) SetLatestDepositDataVersion(version int) error

Set the latest deposit data version and save the wallet data

Jump to

Keyboard shortcuts

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