Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Remove unused params #6173

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion activation/nipost.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func withConditionalTimeout(ctx context.Context, timeout time.Duration) (context
return ctx, func() {}
}

// Submit the challenge to a single PoET.
// Submit the challenge (register) to a single PoET.
func (nb *NIPostBuilder) submitPoetChallenge(
ctx context.Context,
nodeID types.NodeID,
Expand Down
1 change: 0 additions & 1 deletion activation/poetdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func (db *PoetDb) Validate(
return fmt.Errorf("failed to validate poet proof for poetID %x round %s: %w", shortID, roundID, err)
}
// TODO(noamnelke): validate signature (or extract public key and use for salting merkle hashes)

fasmat marked this conversation as resolved.
Show resolved Hide resolved
return nil
}

Expand Down
16 changes: 8 additions & 8 deletions api/grpcserver/admin_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,20 @@
}

// RegisterService registers this service with a grpc server instance.
func (a AdminService) RegisterService(server *grpc.Server) {
func (a *AdminService) RegisterService(server *grpc.Server) {
pb.RegisterAdminServiceServer(server, a)
}

func (s AdminService) RegisterHandlerService(mux *runtime.ServeMux) error {
return pb.RegisterAdminServiceHandlerServer(context.Background(), mux, s)
func (a *AdminService) RegisterHandlerService(mux *runtime.ServeMux) error {
return pb.RegisterAdminServiceHandlerServer(context.Background(), mux, a)

Check warning on line 65 in api/grpcserver/admin_service.go

View check run for this annotation

Codecov / codecov/patch

api/grpcserver/admin_service.go#L64-L65

Added lines #L64 - L65 were not covered by tests
}

// String returns the name of this service.
func (a AdminService) String() string {
func (a *AdminService) String() string {

Check warning on line 69 in api/grpcserver/admin_service.go

View check run for this annotation

Codecov / codecov/patch

api/grpcserver/admin_service.go#L69

Added line #L69 was not covered by tests
return "AdminService"
}

func (a AdminService) CheckpointStream(
func (a *AdminService) CheckpointStream(
req *pb.CheckpointStreamRequest,
stream pb.AdminService_CheckpointStreamServer,
) error {
Expand Down Expand Up @@ -118,13 +118,13 @@
}
}

func (a AdminService) Recover(ctx context.Context, _ *pb.RecoverRequest) (*emptypb.Empty, error) {
func (a *AdminService) Recover(ctx context.Context, _ *pb.RecoverRequest) (*emptypb.Empty, error) {
ctxzap.Info(ctx, "going to recover from checkpoint")
a.recover()
return &emptypb.Empty{}, nil
}

func (a AdminService) EventsStream(req *pb.EventStreamRequest, stream pb.AdminService_EventsStreamServer) error {
func (a *AdminService) EventsStream(_ *pb.EventStreamRequest, stream pb.AdminService_EventsStreamServer) error {
sub, buf, err := events.SubscribeUserEvents(events.WithBuffer(1000))
if err != nil {
return status.Errorf(codes.FailedPrecondition, err.Error())
Expand Down Expand Up @@ -156,7 +156,7 @@
}
}

func (a AdminService) PeerInfoStream(_ *emptypb.Empty, stream pb.AdminService_PeerInfoStreamServer) error {
func (a *AdminService) PeerInfoStream(_ *emptypb.Empty, stream pb.AdminService_PeerInfoStreamServer) error {
for _, p := range a.p.GetPeers() {
select {
case <-stream.Context().Done():
Expand Down
8 changes: 4 additions & 4 deletions api/grpcserver/admin_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestAdminService_Checkpoint(t *testing.T) {

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := dialGrpc(ctx, t, cfg)
conn := dialGrpc(t, cfg)
c := pb.NewAdminServiceClient(conn)

stream, err := c.CheckpointStream(ctx, &pb.CheckpointStreamRequest{SnapshotLayer: snapshot})
Expand Down Expand Up @@ -101,7 +101,7 @@ func TestAdminService_CheckpointError(t *testing.T) {

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := dialGrpc(ctx, t, cfg)
conn := dialGrpc(t, cfg)
c := pb.NewAdminServiceClient(conn)

stream, err := c.CheckpointStream(ctx, &pb.CheckpointStreamRequest{SnapshotLayer: snapshot})
Expand All @@ -121,7 +121,7 @@ func TestAdminService_Recovery(t *testing.T) {

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := dialGrpc(ctx, t, cfg)
conn := dialGrpc(t, cfg)
c := pb.NewAdminServiceClient(conn)

_, err := c.Recover(ctx, &pb.RecoverRequest{})
Expand All @@ -141,7 +141,7 @@ func TestAdminService_PeerInfo(t *testing.T) {

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := dialGrpc(ctx, t, cfg)
conn := dialGrpc(t, cfg)
c := pb.NewAdminServiceClient(conn)

p1 := p2p.Peer("p1")
Expand Down
18 changes: 9 additions & 9 deletions api/grpcserver/debug_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
}

// RegisterService registers this service with a grpc server instance.
func (d DebugService) RegisterService(server *grpc.Server) {
func (d *DebugService) RegisterService(server *grpc.Server) {
pb.RegisterDebugServiceServer(server, d)
}

func (s DebugService) RegisterHandlerService(mux *runtime.ServeMux) error {
return pb.RegisterDebugServiceHandlerServer(context.Background(), mux, s)
func (d *DebugService) RegisterHandlerService(mux *runtime.ServeMux) error {
return pb.RegisterDebugServiceHandlerServer(context.Background(), mux, d)

Check warning on line 40 in api/grpcserver/debug_service.go

View check run for this annotation

Codecov / codecov/patch

api/grpcserver/debug_service.go#L39-L40

Added lines #L39 - L40 were not covered by tests
}

// String returns the name of this service.
func (d DebugService) String() string {
func (d *DebugService) String() string {

Check warning on line 44 in api/grpcserver/debug_service.go

View check run for this annotation

Codecov / codecov/patch

api/grpcserver/debug_service.go#L44

Added line #L44 was not covered by tests
return "DebugService"
}

Expand All @@ -59,7 +59,7 @@
}

// Accounts returns current counter and balance for all accounts.
func (d DebugService) Accounts(ctx context.Context, in *pb.AccountsRequest) (*pb.AccountsResponse, error) {
func (d *DebugService) Accounts(ctx context.Context, in *pb.AccountsRequest) (*pb.AccountsResponse, error) {
var (
accts []*types.Account
err error
Expand Down Expand Up @@ -96,7 +96,7 @@
}

// NetworkInfo query provides NetworkInfoResponse.
func (d DebugService) NetworkInfo(ctx context.Context, _ *emptypb.Empty) (*pb.NetworkInfoResponse, error) {
func (d *DebugService) NetworkInfo(ctx context.Context, _ *emptypb.Empty) (*pb.NetworkInfoResponse, error) {
resp := &pb.NetworkInfoResponse{Id: d.netInfo.ID().String()}
for _, a := range d.netInfo.ListenAddresses() {
resp.ListenAddresses = append(resp.ListenAddresses, a.String())
Expand Down Expand Up @@ -139,7 +139,7 @@
}

// ActiveSet query provides hare active set for the specified epoch.
func (d DebugService) ActiveSet(ctx context.Context, req *pb.ActiveSetRequest) (*pb.ActiveSetResponse, error) {
func (d *DebugService) ActiveSet(ctx context.Context, req *pb.ActiveSetRequest) (*pb.ActiveSetResponse, error) {
actives, err := d.oracle.ActiveSet(ctx, types.EpochID(req.Epoch))
if err != nil {
return nil, status.Errorf(codes.Internal, fmt.Sprintf("active set for epoch %d: %s", req.Epoch, err.Error()))
Expand All @@ -152,7 +152,7 @@
}

// ProposalsStream streams all proposals confirmed by hare.
func (d DebugService) ProposalsStream(_ *emptypb.Empty, stream pb.DebugService_ProposalsStreamServer) error {
func (d *DebugService) ProposalsStream(_ *emptypb.Empty, stream pb.DebugService_ProposalsStreamServer) error {
sub := events.SubscribeProposals()
if sub == nil {
return status.Errorf(codes.FailedPrecondition, "event reporting is not enabled")
Expand All @@ -177,7 +177,7 @@
}
}

func (d DebugService) ChangeLogLevel(ctx context.Context, req *pb.ChangeLogLevelRequest) (*emptypb.Empty, error) {
func (d *DebugService) ChangeLogLevel(ctx context.Context, req *pb.ChangeLogLevelRequest) (*emptypb.Empty, error) {
level, err := zap.ParseAtomicLevel(req.GetLevel())
if err != nil {
return nil, fmt.Errorf("parse level: %w", err)
Expand Down
24 changes: 12 additions & 12 deletions api/grpcserver/globalstate_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
}

// RegisterService registers this service with a grpc server instance.
func (s GlobalStateService) RegisterService(server *grpc.Server) {
func (s *GlobalStateService) RegisterService(server *grpc.Server) {
pb.RegisterGlobalStateServiceServer(server, s)
}

func (s GlobalStateService) RegisterHandlerService(mux *runtime.ServeMux) error {
func (s *GlobalStateService) RegisterHandlerService(mux *runtime.ServeMux) error {
return pb.RegisterGlobalStateServiceHandlerServer(context.Background(), mux, s)
}

// String returns the name of the service.
func (s GlobalStateService) String() string {
func (s *GlobalStateService) String() string {

Check warning on line 36 in api/grpcserver/globalstate_service.go

View check run for this annotation

Codecov / codecov/patch

api/grpcserver/globalstate_service.go#L36

Added line #L36 was not covered by tests
return "GlobalStateService"
}

Expand All @@ -46,7 +46,7 @@
}

// GlobalStateHash returns the latest layer and its computed global state hash.
func (s GlobalStateService) GlobalStateHash(
func (s *GlobalStateService) GlobalStateHash(
context.Context,
*pb.GlobalStateHashRequest,
) (*pb.GlobalStateHashResponse, error) {
Expand All @@ -60,7 +60,7 @@
}}, nil
}

func (s GlobalStateService) getAccount(addr types.Address) (acct *pb.Account, err error) {
func (s *GlobalStateService) getAccount(addr types.Address) (acct *pb.Account, err error) {
balanceActual, err := s.conState.GetBalance(addr)
if err != nil {
return nil, err
Expand All @@ -84,7 +84,7 @@
}

// Account returns current and projected counter and balance for one account.
func (s GlobalStateService) Account(ctx context.Context, in *pb.AccountRequest) (*pb.AccountResponse, error) {
func (s *GlobalStateService) Account(ctx context.Context, in *pb.AccountRequest) (*pb.AccountResponse, error) {
if in.AccountId == nil {
return nil, status.Errorf(codes.InvalidArgument, "`AccountId` must be provided")
}
Expand Down Expand Up @@ -112,7 +112,7 @@
}

// AccountDataQuery returns historical account data such as rewards and receipts.
func (s GlobalStateService) AccountDataQuery(
func (s *GlobalStateService) AccountDataQuery(
ctx context.Context,
in *pb.AccountDataQueryRequest,
) (*pb.AccountDataQueryResponse, error) {
Expand Down Expand Up @@ -200,7 +200,7 @@
}

// SmesherDataQuery returns historical info on smesher rewards.
func (s GlobalStateService) SmesherDataQuery(
func (s *GlobalStateService) SmesherDataQuery(
_ context.Context,
in *pb.SmesherDataQueryRequest,
) (*pb.SmesherDataQueryResponse, error) {
Expand All @@ -210,7 +210,7 @@
// STREAMS

// AccountDataStream exposes a stream of account-related data.
func (s GlobalStateService) AccountDataStream(
func (s *GlobalStateService) AccountDataStream(
in *pb.AccountDataStreamRequest,
stream pb.GlobalStateService_AccountDataStreamServer,
) error {
Expand Down Expand Up @@ -328,15 +328,15 @@
}

// SmesherRewardStream exposes a stream of smesher rewards.
func (s GlobalStateService) SmesherRewardStream(
func (s *GlobalStateService) SmesherRewardStream(
in *pb.SmesherRewardStreamRequest,
stream pb.GlobalStateService_SmesherRewardStreamServer,
) error {
return status.Errorf(codes.Unimplemented, "DEPRECATED")
}

// AppEventStream exposes a stream of emitted app events.
func (s GlobalStateService) AppEventStream(
func (s *GlobalStateService) AppEventStream(
*pb.AppEventStreamRequest,
pb.GlobalStateService_AppEventStreamServer,
) error {
Expand All @@ -347,7 +347,7 @@
}

// GlobalStateStream exposes a stream of global data data items: rewards, receipts, account info, global state hash.
func (s GlobalStateService) GlobalStateStream(
func (s *GlobalStateService) GlobalStateStream(
in *pb.GlobalStateStreamRequest,
stream pb.GlobalStateService_GlobalStateStreamServer,
) error {
Expand Down
5 changes: 1 addition & 4 deletions api/grpcserver/globalstate_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"math"
"testing"
"time"

pb "github.com/spacemeshos/api/release/go/spacemesh/v1"
"github.com/stretchr/testify/require"
Expand All @@ -30,9 +29,7 @@ func setupGlobalStateService(t *testing.T) (*globalStateServiceConn, context.Con
cfg, cleanup := launchServer(t, svc)
t.Cleanup(cleanup)

grpcCtx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
conn := dialGrpc(grpcCtx, t, cfg)
conn := dialGrpc(t, cfg)
client := pb.NewGlobalStateServiceClient(conn)

return &globalStateServiceConn{
Expand Down
Loading
Loading