gorums icon indicating copy to clipboard operation
gorums copied to clipboard

chore: proofread generated rpc call comments

Open abjeni opened this issue 11 months ago • 4 comments

I found the comments describing the unicast rpc call is the same as the comment for the quorum call, which doesn't make sense. It would be nice to have correct comments for all of the different rpc options.

// Unicast is a quorum call invoked on all nodes in configuration c,
// with the same argument in, and returns a combined result.
func (n *Node) Unicast(ctx context.Context, in *Request, opts ...gorums.CallOption) {
	cd := gorums.CallData{
		Message: in,
		Method:  "dev.ZorumsService.Unicast",
	}

	n.RawNode.Unicast(ctx, cd, opts...)
}

abjeni avatar Mar 26 '25 13:03 abjeni

Another example is the NewServer function, there is no generated NewServer function.

// NewServer returns a new instance of GorumsServer.
// This function is intended for internal Gorums use.
// You should call `NewServer` in the generated code instead.
func NewServer(opts ...ServerOption) *Server {
	var serverOpts serverOptions
	for _, opt := range opts {
		opt(&serverOpts)
	}
	s := &Server{
		srv:        newOrderingServer(&serverOpts),
		grpcServer: grpc.NewServer(serverOpts.grpcOpts...),
	}
	ordering.RegisterGorumsServer(s.grpcServer, s.srv)
	return s
}

abjeni avatar Apr 01 '25 12:04 abjeni

The second comment is duplicate of #172.

meling avatar Apr 01 '25 13:04 meling

May also be a duplicate, but the comment for ZorumsService GRPCCall is also confusing, gorums does not ignore the rpc.

service ZorumsService {
    // GRPCCall plain gRPC call; testing that Gorums can ignore these, but that
    // they are added to the _grpc.pb.go generated file.
    rpc GRPCCall(Request) returns (Response) {}
    ...
}

abjeni avatar Jun 08 '25 19:06 abjeni

This can be fixed by adding appropriate comments in the different templates.

For example, the template_rpc.go file uses this:

var rpcCall = commonVariables +
	rpcVar +
	quorumCallComment +
	rpcSignature +
	rpcBody

Where an appropriate RPC comment should be used instead of quorumCallComment.

template_multicast.go and template_unicast.go also uses quorumCallComment

JosteinLindhom avatar Jun 27 '25 06:06 JosteinLindhom