rpc

package
v3.0.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: GPL-3.0 Imports: 66 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAuthToken

func CreateAuthToken(walletDirPath, validatorWebAddr string) error

CreateAuthToken generates a new jwt key, token and writes them to a file in the specified directory. Also, it logs out a prepared URL for the user to navigate to and authenticate with the Prysm web interface.

Types

type Config

type Config struct {
	ValidatorGatewayHost     string
	ValidatorGatewayPort     int
	ValidatorMonitoringHost  string
	ValidatorMonitoringPort  int
	BeaconClientEndpoint     string
	ClientMaxCallRecvMsgSize int
	ClientGrpcRetries        uint
	ClientGrpcRetryDelay     time.Duration
	ClientGrpcHeaders        []string
	ClientWithCert           string
	Host                     string
	Port                     string
	CertFlag                 string
	KeyFlag                  string
	ValDB                    db.Database
	WalletDir                string
	ValidatorService         *client.ValidatorService
	SyncChecker              client.SyncChecker
	GenesisFetcher           client.GenesisFetcher
	WalletInitializedFeed    *event.Feed
	NodeGatewayEndpoint      string
	Wallet                   *wallet.Wallet
}

Config options for the gRPC server.

type Server

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

Server defining a gRPC server for the remote signer API.

func NewServer

func NewServer(ctx context.Context, cfg *Config) *Server

NewServer instantiates a new gRPC server.

func (*Server) BackupAccounts

func (s *Server) BackupAccounts(
	ctx context.Context, req *pb.BackupAccountsRequest,
) (*pb.BackupAccountsResponse, error)

BackupAccounts creates a zip file containing EIP-2335 keystores for the user's specified public keys by encrypting them with the specified password.

func (*Server) CreateWallet

func (s *Server) CreateWallet(ctx context.Context, req *pb.CreateWalletRequest) (*pb.CreateWalletResponse, error)

CreateWallet via an API request, allowing a user to save a new imported wallet via RPC.

func (*Server) DeleteFeeRecipientByPubkey

func (s *Server) DeleteFeeRecipientByPubkey(ctx context.Context, req *ethpbservice.PubkeyRequest) (*empty.Empty, error)

DeleteFeeRecipientByPubkey updates the eth address mapped to the public key to the default fee recipient listed

func (*Server) DeleteKeystores

DeleteKeystores allows for deleting specified public keys from Prysm.

func (*Server) DeleteRemoteKeys

DeleteRemoteKeys deletes a list of public keys defined for web3signer keymanager type.

func (*Server) ExportSlashingProtection

func (s *Server) ExportSlashingProtection(ctx context.Context, _ *empty.Empty) (*pb.ExportSlashingProtectionResponse, error)

ExportSlashingProtection handles the rpc call returning the json slashing history. The format of the export follows the EIP-3076 standard which makes it easy to migrate machines or Ethereum consensus clients.

Steps:

  1. Call the function which exports the data from the validator's db into an EIP standard slashing protection format.
  2. Format and send JSON in the response.

func (*Server) GetBeaconNodeConnection

func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *emptypb.Empty) (*validatorpb.NodeConnectionResponse, error)

GetBeaconNodeConnection retrieves the current beacon node connection information, as well as its sync status.

func (*Server) GetBeaconStatus

func (s *Server) GetBeaconStatus(ctx context.Context, _ *empty.Empty) (*validatorpb.BeaconStatusResponse, error)

GetBeaconStatus retrieves information about the beacon node gRPC connection and certain chain metadata, such as the genesis time, the chain head, and the deposit contract address.

func (*Server) GetLogsEndpoints

func (_ *Server) GetLogsEndpoints(_ context.Context, _ *emptypb.Empty) (*validatorpb.LogsEndpointResponse, error)

GetLogsEndpoints for the beacon and validator client.

func (*Server) GetPeers

func (s *Server) GetPeers(
	ctx context.Context, _ *empty.Empty,
) (*ethpb.Peers, error)

GetPeers is a wrapper around the /eth/v1alpha1 endpoint of the same name.

func (*Server) GetValidatorBalances

func (s *Server) GetValidatorBalances(
	ctx context.Context, req *ethpb.ListValidatorBalancesRequest,
) (*ethpb.ValidatorBalances, error)

GetValidatorBalances is a wrapper around the /eth/v1alpha1 endpoint of the same name.

func (*Server) GetValidatorParticipation

GetValidatorParticipation is a wrapper around the /eth/v1alpha1 endpoint of the same name.

func (*Server) GetValidatorPerformance

func (s *Server) GetValidatorPerformance(
	ctx context.Context, req *ethpb.ValidatorPerformanceRequest,
) (*ethpb.ValidatorPerformanceResponse, error)

GetValidatorPerformance is a wrapper around the /eth/v1alpha1 endpoint of the same name.

func (*Server) GetValidatorQueue

func (s *Server) GetValidatorQueue(
	ctx context.Context, _ *empty.Empty,
) (*ethpb.ValidatorQueue, error)

GetValidatorQueue is a wrapper around the /eth/v1alpha1 endpoint of the same name.

func (*Server) GetValidators

func (s *Server) GetValidators(
	ctx context.Context, req *ethpb.ListValidatorsRequest,
) (*ethpb.Validators, error)

GetValidators is a wrapper around the /eth/v1alpha1 endpoint of the same name.

func (*Server) GetVersion

func (s *Server) GetVersion(ctx context.Context, _ *emptypb.Empty) (*validatorpb.VersionResponse, error)

GetVersion --

func (*Server) ImportKeystores

ImportKeystores allows for importing keystores into Prysm with their slashing protection history.

func (*Server) ImportRemoteKeys

ImportRemoteKeys imports a list of public keys defined for web3signer keymanager type.

func (*Server) ImportSlashingProtection

func (s *Server) ImportSlashingProtection(ctx context.Context, req *pb.ImportSlashingProtectionRequest) (*emptypb.Empty, error)

ImportSlashingProtection reads an input slashing protection EIP-3076 standard JSON string and inserts the data into validator DB.

Read the JSON string passed through rpc, then call the func which actually imports the data from the JSON file into our database.

func (*Server) Initialize

func (s *Server) Initialize(_ context.Context, _ *emptypb.Empty) (*pb.InitializeAuthResponse, error)

Initialize returns metadata regarding whether the caller has authenticated and has a wallet.

func (*Server) JWTInterceptor

func (s *Server) JWTInterceptor() grpc.UnaryServerInterceptor

JWTInterceptor is a gRPC unary interceptor to authorize incoming requests.

func (*Server) ListAccounts

func (s *Server) ListAccounts(ctx context.Context, req *pb.ListAccountsRequest) (*pb.ListAccountsResponse, error)

ListAccounts allows retrieval of validating keys and their petnames for a user's wallet via RPC.

func (*Server) ListFeeRecipientByPubkey

ListFeeRecipientByPubkey returns the public key to eth address mapping object to the end user.

func (*Server) ListKeystores

func (s *Server) ListKeystores(
	ctx context.Context, _ *empty.Empty,
) (*ethpbservice.ListKeystoresResponse, error)

ListKeystores implements the standard validator key management API.

func (*Server) ListRemoteKeys

func (s *Server) ListRemoteKeys(ctx context.Context, _ *empty.Empty) (*ethpbservice.ListRemoteKeysResponse, error)

ListRemoteKeys returns a list of all public keys defined for web3signer keymanager type.

func (*Server) RecoverWallet

func (s *Server) RecoverWallet(ctx context.Context, req *pb.RecoverWalletRequest) (*pb.CreateWalletResponse, error)

RecoverWallet via an API request, allowing a user to recover a derived. Generate the seed from the mnemonic + language + 25th passphrase(optional). Create N validator keystores from the seed specified by req.NumAccounts. Set the wallet password to req.WalletPassword, then create the wallet from the provided Mnemonic and return CreateWalletResponse.

func (*Server) SetFeeRecipientByPubkey

func (s *Server) SetFeeRecipientByPubkey(ctx context.Context, req *ethpbservice.SetFeeRecipientByPubkeyRequest) (*empty.Empty, error)

SetFeeRecipientByPubkey updates the eth address mapped to the public key.

func (*Server) SetGasLimit

func (s *Server) SetGasLimit(ctx context.Context, req *ethpbservice.SetGasLimitRequest) (*empty.Empty, error)

SetGasLimit updates GasLimt of the public key.

func (*Server) Start

func (s *Server) Start()

Start the gRPC server.

func (*Server) Status

func (s *Server) Status() error

Status returns nil or credentialError.

func (*Server) Stop

func (s *Server) Stop() error

Stop the gRPC server.

func (*Server) StreamBeaconLogs

func (s *Server) StreamBeaconLogs(req *emptypb.Empty, stream validatorpb.Health_StreamBeaconLogsServer) error

StreamBeaconLogs from the beacon node via a gRPC server-side stream.

func (*Server) StreamValidatorLogs

func (s *Server) StreamValidatorLogs(_ *emptypb.Empty, stream validatorpb.Health_StreamValidatorLogsServer) error

StreamValidatorLogs from the validator client via a gRPC server-side stream.

func (*Server) ValidateKeystores

func (_ *Server) ValidateKeystores(
	_ context.Context, req *pb.ValidateKeystoresRequest,
) (*emptypb.Empty, error)

ValidateKeystores checks whether a set of EIP-2335 keystores in the request can indeed be decrypted using a password in the request. If there is no issue, we return an empty response with no error. If the password is incorrect for a single keystore, we return an appropriate error.

func (*Server) VoluntaryExit

func (s *Server) VoluntaryExit(
	ctx context.Context, req *pb.VoluntaryExitRequest,
) (*pb.VoluntaryExitResponse, error)

VoluntaryExit performs a voluntary exit for the validator keys specified in a request.

func (*Server) WalletConfig

func (s *Server) WalletConfig(_ context.Context, _ *empty.Empty) (*pb.WalletResponse, error)

WalletConfig returns the wallet's configuration. If no wallet exists, we return an empty response.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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