diff --git a/services/api/grpc/handlers/receiver/abort.go b/services/api/grpc/handlers/receiver/abort.go index d0464e0..3e4bdd1 100644 --- a/services/api/grpc/handlers/receiver/abort.go +++ b/services/api/grpc/handlers/receiver/abort.go @@ -1,4 +1,4 @@ -// Copyright © 2020 Attestant Limited. +// Copyright © 2020, 2024 Attestant Limited. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -17,13 +17,13 @@ import ( context "context" "github.com/attestantio/dirk/services/api/grpc/interceptors" - "github.com/golang/protobuf/ptypes/empty" "github.com/pkg/errors" pb "github.com/wealdtech/eth2-signer-api/pb/v1" + "google.golang.org/protobuf/types/known/emptypb" ) // Abort handles the Abort() grpc call. -func (h *Handler) Abort(ctx context.Context, req *pb.AbortRequest) (*empty.Empty, error) { +func (h *Handler) Abort(ctx context.Context, req *pb.AbortRequest) (*emptypb.Empty, error) { senderID := h.senderID(ctx) if senderID == 0 { log.Warn().Interface("client", ctx.Value(&interceptors.ClientName{})).Msg("Failed to obtain participant ID of sender") @@ -37,5 +37,5 @@ func (h *Handler) Abort(ctx context.Context, req *pb.AbortRequest) (*empty.Empty } log.Trace().Msg("Completed abort successfully") - return &empty.Empty{}, nil + return &emptypb.Empty{}, nil } diff --git a/services/api/grpc/handlers/receiver/execute.go b/services/api/grpc/handlers/receiver/execute.go index 26c2bf6..b0b3365 100644 --- a/services/api/grpc/handlers/receiver/execute.go +++ b/services/api/grpc/handlers/receiver/execute.go @@ -1,4 +1,4 @@ -// Copyright © 2020 Attestant Limited. +// Copyright © 2020, 2024 Attestant Limited. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -17,13 +17,13 @@ import ( context "context" "github.com/attestantio/dirk/services/api/grpc/interceptors" - "github.com/golang/protobuf/ptypes/empty" "github.com/pkg/errors" pb "github.com/wealdtech/eth2-signer-api/pb/v1" + "google.golang.org/protobuf/types/known/emptypb" ) // Execute handles the Execute() grpc call. -func (h *Handler) Execute(ctx context.Context, req *pb.ExecuteRequest) (*empty.Empty, error) { +func (h *Handler) Execute(ctx context.Context, req *pb.ExecuteRequest) (*emptypb.Empty, error) { senderID := h.senderID(ctx) if senderID == 0 { log.Warn().Interface("client", ctx.Value(&interceptors.ClientName{})).Msg("Failed to obtain participant ID of sender") @@ -38,5 +38,5 @@ func (h *Handler) Execute(ctx context.Context, req *pb.ExecuteRequest) (*empty.E } log.Trace().Msg("Completed execution successfully") - return &empty.Empty{}, nil + return &emptypb.Empty{}, nil } diff --git a/services/api/grpc/handlers/receiver/prepare.go b/services/api/grpc/handlers/receiver/prepare.go index eae6890..ffe8267 100644 --- a/services/api/grpc/handlers/receiver/prepare.go +++ b/services/api/grpc/handlers/receiver/prepare.go @@ -1,4 +1,4 @@ -// Copyright © 2020 Attestant Limited. +// Copyright © 2020, 2024 Attestant Limited. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -19,13 +19,13 @@ import ( "github.com/attestantio/dirk/core" "github.com/attestantio/dirk/services/api/grpc/interceptors" - "github.com/golang/protobuf/ptypes/empty" "github.com/pkg/errors" pb "github.com/wealdtech/eth2-signer-api/pb/v1" + "google.golang.org/protobuf/types/known/emptypb" ) // Prepare handles the Prepare() grpc call. -func (h *Handler) Prepare(ctx context.Context, req *pb.PrepareRequest) (*empty.Empty, error) { +func (h *Handler) Prepare(ctx context.Context, req *pb.PrepareRequest) (*emptypb.Empty, error) { senderID := h.senderID(ctx) if senderID == 0 { log.Warn().Interface("client", ctx.Value(&interceptors.ClientName{})).Msg("Failed to obtain participant ID of sender") @@ -48,5 +48,5 @@ func (h *Handler) Prepare(ctx context.Context, req *pb.PrepareRequest) (*empty.E } log.Trace().Msg("Completed preparation successfully") - return &empty.Empty{}, nil + return &emptypb.Empty{}, nil } diff --git a/services/api/grpc/interceptors/clientinfo.go b/services/api/grpc/interceptors/clientinfo.go index 104a92d..d316e2a 100644 --- a/services/api/grpc/interceptors/clientinfo.go +++ b/services/api/grpc/interceptors/clientinfo.go @@ -28,7 +28,7 @@ type ClientName struct{} // ClientInfoInterceptor adds the client certificate common name to incoming requests. func ClientInfoInterceptor() grpc.UnaryServerInterceptor { - return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { + return func(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { grpcPeer, ok := peer.FromContext(ctx) if !ok { return nil, status.Error(codes.Internal, "Failure") diff --git a/services/api/grpc/interceptors/reqid.go b/services/api/grpc/interceptors/reqid.go index 09b0c06..bc47a34 100644 --- a/services/api/grpc/interceptors/reqid.go +++ b/services/api/grpc/interceptors/reqid.go @@ -26,7 +26,7 @@ type RequestID struct{} // RequestIDInterceptor adds a request ID to incoming requests. func RequestIDInterceptor() grpc.UnaryServerInterceptor { - return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { + return func(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { // #nosec G404 newCtx := context.WithValue(ctx, &RequestID{}, fmt.Sprintf("%02x", rand.Int31())) return handler(newCtx, req) diff --git a/services/api/grpc/interceptors/sourceip.go b/services/api/grpc/interceptors/sourceip.go index ea0af67..fd52df8 100644 --- a/services/api/grpc/interceptors/sourceip.go +++ b/services/api/grpc/interceptors/sourceip.go @@ -28,7 +28,7 @@ type ExternalIP struct{} // SourceIPInterceptor adds the source IP address to incoming requests. func SourceIPInterceptor() grpc.UnaryServerInterceptor { - return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { + return func(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { grpcPeer, ok := peer.FromContext(ctx) if !ok { return nil, status.Error(codes.Internal, "Failure") diff --git a/services/sender/grpc/service.go b/services/sender/grpc/service.go index bd9a314..c394b93 100644 --- a/services/sender/grpc/service.go +++ b/services/sender/grpc/service.go @@ -222,7 +222,7 @@ func (s *Service) obtainConnection(_ context.Context, address string) (*puddle.R s.connectionPoolsMutex.Lock() pool, exists := s.connectionPools[address] if !exists { - constructor := func(ctx context.Context) (interface{}, error) { + constructor := func(_ context.Context) (interface{}, error) { return grpc.Dial(address, []grpc.DialOption{ grpc.WithTransportCredentials(s.credentials), }...)