mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
* Add log capitalization analyzer and apply fixes across codebase Implements a new nogo analyzer to enforce proper log message capitalization and applies the fixes to all affected log statements throughout the beacon chain, validator, and supporting components. Co-Authored-By: Claude <noreply@anthropic.com> * Radek's feedback --------- Co-authored-by: Claude <noreply@anthropic.com>
50 lines
1.3 KiB
Go
50 lines
1.3 KiB
Go
package grpc_api
|
|
|
|
import (
|
|
"context"
|
|
|
|
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
|
"github.com/OffchainLabs/prysm/v6/validator/client/iface"
|
|
"github.com/golang/protobuf/ptypes/empty"
|
|
log "github.com/sirupsen/logrus"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
var (
|
|
_ = iface.NodeClient(&grpcNodeClient{})
|
|
)
|
|
|
|
type grpcNodeClient struct {
|
|
nodeClient ethpb.NodeClient
|
|
}
|
|
|
|
func (c *grpcNodeClient) SyncStatus(ctx context.Context, in *empty.Empty) (*ethpb.SyncStatus, error) {
|
|
return c.nodeClient.GetSyncStatus(ctx, in)
|
|
}
|
|
|
|
func (c *grpcNodeClient) Genesis(ctx context.Context, in *empty.Empty) (*ethpb.Genesis, error) {
|
|
return c.nodeClient.GetGenesis(ctx, in)
|
|
}
|
|
|
|
func (c *grpcNodeClient) Version(ctx context.Context, in *empty.Empty) (*ethpb.Version, error) {
|
|
return c.nodeClient.GetVersion(ctx, in)
|
|
}
|
|
|
|
func (c *grpcNodeClient) Peers(ctx context.Context, in *empty.Empty) (*ethpb.Peers, error) {
|
|
return c.nodeClient.ListPeers(ctx, in)
|
|
}
|
|
|
|
func (c *grpcNodeClient) IsHealthy(ctx context.Context) bool {
|
|
_, err := c.nodeClient.GetHealth(ctx, ðpb.HealthRequest{})
|
|
if err != nil {
|
|
log.WithError(err).Error("Failed to get health of node")
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func NewNodeClient(cc grpc.ClientConnInterface) iface.NodeClient {
|
|
g := &grpcNodeClient{nodeClient: ethpb.NewNodeClient(cc)}
|
|
return g
|
|
}
|