mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Prysm V4 - Deprecate web UI endpoints (#12025)
* wip adding deprecation to web api endpoints * wip adding more deprecation notices * adding in a few more deprecation markers * updating order of comments
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
// ListAccounts allows retrieval of validating keys and their petnames
|
||||
// for a user's wallet via RPC.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) ListAccounts(ctx context.Context, req *pb.ListAccountsRequest) (*pb.ListAccountsResponse, error) {
|
||||
if s.validatorService == nil {
|
||||
return nil, status.Error(codes.FailedPrecondition, "Validator service not yet initialized")
|
||||
@@ -75,6 +76,7 @@ func (s *Server) ListAccounts(ctx context.Context, req *pb.ListAccountsRequest)
|
||||
|
||||
// BackupAccounts creates a zip file containing EIP-2335 keystores for the user's
|
||||
// specified public keys by encrypting them with the specified password.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) BackupAccounts(
|
||||
ctx context.Context, req *pb.BackupAccountsRequest,
|
||||
) (*pb.BackupAccountsResponse, error) {
|
||||
@@ -157,6 +159,7 @@ func (s *Server) BackupAccounts(
|
||||
}
|
||||
|
||||
// VoluntaryExit performs a voluntary exit for the validator keys specified in a request.
|
||||
// DEPRECATE: Prysm Web UI and associated endpoints will be fully removed in a future hard fork. There is a similar endpoint that is still used /eth/v1alpha1/validator/exit.
|
||||
func (s *Server) VoluntaryExit(
|
||||
ctx context.Context, req *pb.VoluntaryExitRequest,
|
||||
) (*pb.VoluntaryExitResponse, error) {
|
||||
|
||||
@@ -29,6 +29,8 @@ const (
|
||||
)
|
||||
|
||||
// Initialize returns metadata regarding whether the caller has authenticated and has a wallet.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork. Web APIs won't require JWT in the future.
|
||||
// Still used by Keymanager API until web ui is fully removed.
|
||||
func (s *Server) Initialize(_ context.Context, _ *emptypb.Empty) (*pb.InitializeAuthResponse, error) {
|
||||
walletExists, err := wallet.Exists(s.walletDir)
|
||||
if err != nil {
|
||||
@@ -44,6 +46,7 @@ func (s *Server) Initialize(_ context.Context, _ *emptypb.Empty) (*pb.Initialize
|
||||
// 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.
|
||||
// DEPRECATED: associated to Initialize Web UI API
|
||||
func CreateAuthToken(walletDirPath, validatorWebAddr string) error {
|
||||
jwtKey, err := createRandomJWTSecret()
|
||||
if err != nil {
|
||||
@@ -67,6 +70,7 @@ func CreateAuthToken(walletDirPath, validatorWebAddr string) error {
|
||||
// user via stdout and the validator client should then attempt to open the default
|
||||
// browser. The web interface authenticates by looking for this token in the query parameters
|
||||
// of the URL. This token is then used as the bearer token for jwt auth.
|
||||
// DEPRECATED: associated to Initialize Web UI API
|
||||
func (s *Server) initializeAuthToken(walletDir string) (string, error) {
|
||||
authTokenFile := filepath.Join(walletDir, authTokenFileName)
|
||||
if file.FileExists(authTokenFile) {
|
||||
@@ -102,6 +106,7 @@ func (s *Server) initializeAuthToken(walletDir string) (string, error) {
|
||||
return token, nil
|
||||
}
|
||||
|
||||
// DEPRECATED: associated to Initialize Web UI API
|
||||
func (s *Server) refreshAuthTokenFromFileChanges(ctx context.Context, authTokenPath string) {
|
||||
watcher, err := fsnotify.NewWatcher()
|
||||
if err != nil {
|
||||
@@ -137,6 +142,7 @@ func (s *Server) refreshAuthTokenFromFileChanges(ctx context.Context, authTokenP
|
||||
}
|
||||
}
|
||||
|
||||
// DEPRECATED: associated to Initialize Web UI API
|
||||
func logValidatorWebAuth(validatorWebAddr, token string, tokenPath string) {
|
||||
webAuthURLTemplate := "http://%s/initialize?token=%s"
|
||||
webAuthURL := fmt.Sprintf(
|
||||
@@ -152,6 +158,7 @@ func logValidatorWebAuth(validatorWebAddr, token string, tokenPath string) {
|
||||
log.Infof("Validator CLient JWT for RPC and REST authentication set at:%s", tokenPath)
|
||||
}
|
||||
|
||||
// DEPRECATED: associated to Initialize Web UI API
|
||||
func saveAuthToken(walletDirPath string, jwtKey []byte, token string) error {
|
||||
hashFilePath := filepath.Join(walletDirPath, authTokenFileName)
|
||||
bytesBuf := new(bytes.Buffer)
|
||||
@@ -170,6 +177,7 @@ func saveAuthToken(walletDirPath string, jwtKey []byte, token string) error {
|
||||
return file.WriteFile(hashFilePath, bytesBuf.Bytes())
|
||||
}
|
||||
|
||||
// DEPRECATED: associated to Initialize Web UI API
|
||||
func readAuthTokenFile(r io.Reader) (secret []byte, token string, err error) {
|
||||
br := bufio.NewReader(r)
|
||||
var jwtKeyHex string
|
||||
@@ -190,6 +198,7 @@ func readAuthTokenFile(r io.Reader) (secret []byte, token string, err error) {
|
||||
}
|
||||
|
||||
// Creates a JWT token string using the JWT key.
|
||||
// DEPRECATED: associated to Initialize Web UI API
|
||||
func createTokenString(jwtKey []byte) (string, error) {
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.RegisteredClaims{})
|
||||
// Sign and get the complete encoded token as a string using the secret
|
||||
@@ -200,6 +209,7 @@ func createTokenString(jwtKey []byte) (string, error) {
|
||||
return tokenString, nil
|
||||
}
|
||||
|
||||
// DEPRECATED: associated to Initialize Web UI API
|
||||
func createRandomJWTSecret() ([]byte, error) {
|
||||
r := rand.NewGenerator()
|
||||
jwtKey := make([]byte, 32)
|
||||
|
||||
@@ -64,6 +64,7 @@ func (s *Server) registerBeaconClient() 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.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) GetBeaconStatus(ctx context.Context, _ *empty.Empty) (*validatorpb.BeaconStatusResponse, error) {
|
||||
syncStatus, err := s.beaconNodeClient.GetSyncStatus(ctx, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
@@ -94,6 +95,7 @@ func (s *Server) GetBeaconStatus(ctx context.Context, _ *empty.Empty) (*validato
|
||||
}
|
||||
|
||||
// GetValidatorParticipation is a wrapper around the /eth/v1alpha1 endpoint of the same name.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) GetValidatorParticipation(
|
||||
ctx context.Context, req *ethpb.GetValidatorParticipationRequest,
|
||||
) (*ethpb.ValidatorParticipationResponse, error) {
|
||||
@@ -101,6 +103,7 @@ func (s *Server) GetValidatorParticipation(
|
||||
}
|
||||
|
||||
// GetValidatorPerformance is a wrapper around the /eth/v1alpha1 endpoint of the same name.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) GetValidatorPerformance(
|
||||
ctx context.Context, req *ethpb.ValidatorPerformanceRequest,
|
||||
) (*ethpb.ValidatorPerformanceResponse, error) {
|
||||
@@ -108,6 +111,7 @@ func (s *Server) GetValidatorPerformance(
|
||||
}
|
||||
|
||||
// GetValidatorBalances is a wrapper around the /eth/v1alpha1 endpoint of the same name.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) GetValidatorBalances(
|
||||
ctx context.Context, req *ethpb.ListValidatorBalancesRequest,
|
||||
) (*ethpb.ValidatorBalances, error) {
|
||||
@@ -115,6 +119,7 @@ func (s *Server) GetValidatorBalances(
|
||||
}
|
||||
|
||||
// GetValidators is a wrapper around the /eth/v1alpha1 endpoint of the same name.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) GetValidators(
|
||||
ctx context.Context, req *ethpb.ListValidatorsRequest,
|
||||
) (*ethpb.Validators, error) {
|
||||
@@ -122,6 +127,7 @@ func (s *Server) GetValidators(
|
||||
}
|
||||
|
||||
// GetValidatorQueue is a wrapper around the /eth/v1alpha1 endpoint of the same name.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) GetValidatorQueue(
|
||||
ctx context.Context, _ *empty.Empty,
|
||||
) (*ethpb.ValidatorQueue, error) {
|
||||
@@ -129,6 +135,7 @@ func (s *Server) GetValidatorQueue(
|
||||
}
|
||||
|
||||
// GetPeers is a wrapper around the /eth/v1alpha1 endpoint of the same name.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) GetPeers(
|
||||
ctx context.Context, _ *empty.Empty,
|
||||
) (*ethpb.Peers, error) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
|
||||
// GetBeaconNodeConnection retrieves the current beacon node connection
|
||||
// information, as well as its sync status.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *emptypb.Empty) (*validatorpb.NodeConnectionResponse, error) {
|
||||
syncStatus, err := s.syncChecker.Syncing(ctx)
|
||||
if err != nil || s.validatorService.Status() != nil {
|
||||
@@ -39,11 +40,13 @@ func (s *Server) GetBeaconNodeConnection(ctx context.Context, _ *emptypb.Empty)
|
||||
}
|
||||
|
||||
// GetLogsEndpoints for the beacon and validator client.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (*Server) GetLogsEndpoints(_ context.Context, _ *emptypb.Empty) (*validatorpb.LogsEndpointResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "unimplemented")
|
||||
}
|
||||
|
||||
// GetVersion --
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) GetVersion(ctx context.Context, _ *emptypb.Empty) (*validatorpb.VersionResponse, error) {
|
||||
beacon, err := s.beaconNodeClient.GetVersion(ctx, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
@@ -57,6 +60,7 @@ func (s *Server) GetVersion(ctx context.Context, _ *emptypb.Empty) (*validatorpb
|
||||
}
|
||||
|
||||
// StreamBeaconLogs from the beacon node via a gRPC server-side stream.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) StreamBeaconLogs(req *emptypb.Empty, stream validatorpb.Health_StreamBeaconLogsServer) error {
|
||||
// Wrap service context with a cancel in order to propagate the exiting of
|
||||
// this method properly to the beacon node server.
|
||||
@@ -88,6 +92,7 @@ func (s *Server) StreamBeaconLogs(req *emptypb.Empty, stream validatorpb.Health_
|
||||
}
|
||||
|
||||
// StreamValidatorLogs from the validator client via a gRPC server-side stream.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) StreamValidatorLogs(_ *emptypb.Empty, stream validatorpb.Health_StreamValidatorLogsServer) error {
|
||||
ch := make(chan []byte, s.streamLogsBufferSize)
|
||||
sub := s.logsStreamer.LogsFeed().Subscribe(ch)
|
||||
|
||||
@@ -22,6 +22,8 @@ import (
|
||||
// 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.
|
||||
//
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork. Use the Keymanager APIs if an API is required.
|
||||
func (s *Server) ExportSlashingProtection(ctx context.Context, _ *empty.Empty) (*pb.ExportSlashingProtectionResponse, error) {
|
||||
if s.valDB == nil {
|
||||
return nil, errors.New("err finding validator database at path")
|
||||
@@ -47,7 +49,8 @@ func (s *Server) ExportSlashingProtection(ctx context.Context, _ *empty.Empty) (
|
||||
// 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.
|
||||
// which actually imports the data from the JSON file into our database. Use the Keymanager APIs if an API is required.
|
||||
// DEPRECATED: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) ImportSlashingProtection(ctx context.Context, req *pb.ImportSlashingProtectionRequest) (*emptypb.Empty, error) {
|
||||
if s.valDB == nil {
|
||||
return nil, errors.New("err finding validator database at path")
|
||||
|
||||
@@ -32,6 +32,7 @@ const (
|
||||
|
||||
// CreateWallet via an API request, allowing a user to save a new
|
||||
// imported wallet via RPC.
|
||||
// DEPRECATE: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) CreateWallet(ctx context.Context, req *pb.CreateWalletRequest) (*pb.CreateWalletResponse, error) {
|
||||
walletDir := s.walletDir
|
||||
exists, err := wallet.Exists(walletDir)
|
||||
@@ -100,6 +101,7 @@ func (s *Server) CreateWallet(ctx context.Context, req *pb.CreateWalletRequest)
|
||||
}
|
||||
|
||||
// WalletConfig returns the wallet's configuration. If no wallet exists, we return an empty response.
|
||||
// DEPRECATE: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) WalletConfig(_ context.Context, _ *empty.Empty) (*pb.WalletResponse, error) {
|
||||
exists, err := wallet.Exists(s.walletDir)
|
||||
if err != nil {
|
||||
@@ -147,6 +149,7 @@ func (s *Server) WalletConfig(_ context.Context, _ *empty.Empty) (*pb.WalletResp
|
||||
// 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.
|
||||
// DEPRECATE: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) RecoverWallet(ctx context.Context, req *pb.RecoverWalletRequest) (*pb.CreateWalletResponse, error) {
|
||||
numAccounts := int(req.NumAccounts)
|
||||
if numAccounts == 0 {
|
||||
@@ -226,6 +229,7 @@ func (s *Server) RecoverWallet(ctx context.Context, req *pb.RecoverWalletRequest
|
||||
// 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.
|
||||
// DEPRECATE: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (*Server) ValidateKeystores(
|
||||
_ context.Context, req *pb.ValidateKeystoresRequest,
|
||||
) (*emptypb.Empty, error) {
|
||||
@@ -262,6 +266,7 @@ func (*Server) ValidateKeystores(
|
||||
}
|
||||
|
||||
// Initialize a wallet and send it over a global feed.
|
||||
// DEPRECATE: Prysm Web UI and associated endpoints will be fully removed in a future hard fork.
|
||||
func (s *Server) initializeWallet(ctx context.Context, cfg *wallet.Config) error {
|
||||
// We first ensure the user has a wallet.
|
||||
exists, err := wallet.Exists(cfg.WalletDir)
|
||||
|
||||
Reference in New Issue
Block a user