From 1ccd0ce286865b0afad0eeeec90dffe1573de963 Mon Sep 17 00:00:00 2001 From: Richard Pringle Date: Thu, 6 Feb 2025 14:18:43 -0500 Subject: [PATCH] Prefix PoP methods and message with Sign --- proto/pb/signer/signer.pb.go | 29 +++++++++--------- proto/pb/signer/signer_grpc.pb.go | 30 +++++++++---------- proto/signer/signer.proto | 2 +- utils/crypto/bls/signer/rpcsigner/client.go | 2 +- .../bls/signer/rpcsigner/server_test.go | 2 +- 5 files changed, 33 insertions(+), 32 deletions(-) diff --git a/proto/pb/signer/signer.pb.go b/proto/pb/signer/signer.pb.go index 8c610ca654cc..adcf42e4912d 100644 --- a/proto/pb/signer/signer.pb.go +++ b/proto/pb/signer/signer.pb.go @@ -316,7 +316,7 @@ var file_signer_signer_proto_rawDesc = []byte{ 0x50, 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x32, 0xf9, 0x01, 0x0a, 0x06, 0x53, 0x69, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x32, 0xfd, 0x01, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x09, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x73, 0x69, @@ -325,17 +325,18 @@ var file_signer_signer_proto_rawDesc = []byte{ 0x12, 0x18, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6c, 0x0a, 0x11, 0x50, 0x72, 0x6f, 0x6f, 0x66, - 0x4f, 0x66, 0x50, 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x73, - 0x69, 0x67, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x4f, 0x66, 0x50, 0x6f, 0x73, - 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, - 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x4f, 0x66, 0x50, 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x76, 0x61, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x61, 0x76, 0x61, - 0x6c, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, - 0x62, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x70, 0x0a, 0x15, 0x53, 0x69, 0x67, 0x6e, 0x50, + 0x72, 0x6f, 0x6f, 0x66, 0x4f, 0x66, 0x50, 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x29, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x4f, + 0x66, 0x50, 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x73, 0x69, + 0x67, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x4f, 0x66, 0x50, 0x6f, 0x73, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x76, 0x61, 0x2d, 0x6c, 0x61, 0x62, 0x73, + 0x2f, 0x61, 0x76, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -362,10 +363,10 @@ var file_signer_signer_proto_goTypes = []interface{}{ var file_signer_signer_proto_depIdxs = []int32{ 0, // 0: signer.Signer.PublicKey:input_type -> signer.PublicKeyRequest 2, // 1: signer.Signer.Sign:input_type -> signer.SignatureRequest - 4, // 2: signer.Signer.ProofOfPossession:input_type -> signer.ProofOfPossessionSignatureRequest + 4, // 2: signer.Signer.SignProofOfPossession:input_type -> signer.ProofOfPossessionSignatureRequest 1, // 3: signer.Signer.PublicKey:output_type -> signer.PublicKeyResponse 3, // 4: signer.Signer.Sign:output_type -> signer.SignatureResponse - 5, // 5: signer.Signer.ProofOfPossession:output_type -> signer.ProofOfPossessionSignatureResponse + 5, // 5: signer.Signer.SignProofOfPossession:output_type -> signer.ProofOfPossessionSignatureResponse 3, // [3:6] is the sub-list for method output_type 0, // [0:3] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name diff --git a/proto/pb/signer/signer_grpc.pb.go b/proto/pb/signer/signer_grpc.pb.go index 0bc03c3b9d40..680d5d07e928 100644 --- a/proto/pb/signer/signer_grpc.pb.go +++ b/proto/pb/signer/signer_grpc.pb.go @@ -19,9 +19,9 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - Signer_PublicKey_FullMethodName = "/signer.Signer/PublicKey" - Signer_Sign_FullMethodName = "/signer.Signer/Sign" - Signer_ProofOfPossession_FullMethodName = "/signer.Signer/ProofOfPossession" + Signer_PublicKey_FullMethodName = "/signer.Signer/PublicKey" + Signer_Sign_FullMethodName = "/signer.Signer/Sign" + Signer_SignProofOfPossession_FullMethodName = "/signer.Signer/SignProofOfPossession" ) // SignerClient is the client API for Signer service. @@ -30,7 +30,7 @@ const ( type SignerClient interface { PublicKey(ctx context.Context, in *PublicKeyRequest, opts ...grpc.CallOption) (*PublicKeyResponse, error) Sign(ctx context.Context, in *SignatureRequest, opts ...grpc.CallOption) (*SignatureResponse, error) - ProofOfPossession(ctx context.Context, in *ProofOfPossessionSignatureRequest, opts ...grpc.CallOption) (*ProofOfPossessionSignatureResponse, error) + SignProofOfPossession(ctx context.Context, in *ProofOfPossessionSignatureRequest, opts ...grpc.CallOption) (*ProofOfPossessionSignatureResponse, error) } type signerClient struct { @@ -59,9 +59,9 @@ func (c *signerClient) Sign(ctx context.Context, in *SignatureRequest, opts ...g return out, nil } -func (c *signerClient) ProofOfPossession(ctx context.Context, in *ProofOfPossessionSignatureRequest, opts ...grpc.CallOption) (*ProofOfPossessionSignatureResponse, error) { +func (c *signerClient) SignProofOfPossession(ctx context.Context, in *ProofOfPossessionSignatureRequest, opts ...grpc.CallOption) (*ProofOfPossessionSignatureResponse, error) { out := new(ProofOfPossessionSignatureResponse) - err := c.cc.Invoke(ctx, Signer_ProofOfPossession_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signer_SignProofOfPossession_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -74,7 +74,7 @@ func (c *signerClient) ProofOfPossession(ctx context.Context, in *ProofOfPossess type SignerServer interface { PublicKey(context.Context, *PublicKeyRequest) (*PublicKeyResponse, error) Sign(context.Context, *SignatureRequest) (*SignatureResponse, error) - ProofOfPossession(context.Context, *ProofOfPossessionSignatureRequest) (*ProofOfPossessionSignatureResponse, error) + SignProofOfPossession(context.Context, *ProofOfPossessionSignatureRequest) (*ProofOfPossessionSignatureResponse, error) mustEmbedUnimplementedSignerServer() } @@ -88,8 +88,8 @@ func (UnimplementedSignerServer) PublicKey(context.Context, *PublicKeyRequest) ( func (UnimplementedSignerServer) Sign(context.Context, *SignatureRequest) (*SignatureResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Sign not implemented") } -func (UnimplementedSignerServer) ProofOfPossession(context.Context, *ProofOfPossessionSignatureRequest) (*ProofOfPossessionSignatureResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ProofOfPossession not implemented") +func (UnimplementedSignerServer) SignProofOfPossession(context.Context, *ProofOfPossessionSignatureRequest) (*ProofOfPossessionSignatureResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SignProofOfPossession not implemented") } func (UnimplementedSignerServer) mustEmbedUnimplementedSignerServer() {} @@ -140,20 +140,20 @@ func _Signer_Sign_Handler(srv interface{}, ctx context.Context, dec func(interfa return interceptor(ctx, in, info, handler) } -func _Signer_ProofOfPossession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Signer_SignProofOfPossession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ProofOfPossessionSignatureRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SignerServer).ProofOfPossession(ctx, in) + return srv.(SignerServer).SignProofOfPossession(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Signer_ProofOfPossession_FullMethodName, + FullMethod: Signer_SignProofOfPossession_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SignerServer).ProofOfPossession(ctx, req.(*ProofOfPossessionSignatureRequest)) + return srv.(SignerServer).SignProofOfPossession(ctx, req.(*ProofOfPossessionSignatureRequest)) } return interceptor(ctx, in, info, handler) } @@ -174,8 +174,8 @@ var Signer_ServiceDesc = grpc.ServiceDesc{ Handler: _Signer_Sign_Handler, }, { - MethodName: "ProofOfPossession", - Handler: _Signer_ProofOfPossession_Handler, + MethodName: "SignProofOfPossession", + Handler: _Signer_SignProofOfPossession_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/proto/signer/signer.proto b/proto/signer/signer.proto index ce2fae3c2ce2..117624d3b6a4 100644 --- a/proto/signer/signer.proto +++ b/proto/signer/signer.proto @@ -7,7 +7,7 @@ option go_package = "github.com/ava-labs/avalanchego/proto/pb/signer"; service Signer { rpc PublicKey(PublicKeyRequest) returns (PublicKeyResponse) {} rpc Sign(SignatureRequest) returns (SignatureResponse) {} - rpc ProofOfPossession(ProofOfPossessionSignatureRequest) returns (ProofOfPossessionSignatureResponse) {} + rpc SignProofOfPossession(ProofOfPossessionSignatureRequest) returns (ProofOfPossessionSignatureResponse) {} } message PublicKeyRequest {} diff --git a/utils/crypto/bls/signer/rpcsigner/client.go b/utils/crypto/bls/signer/rpcsigner/client.go index db2d2464e079..083ecfe50979 100644 --- a/utils/crypto/bls/signer/rpcsigner/client.go +++ b/utils/crypto/bls/signer/rpcsigner/client.go @@ -78,7 +78,7 @@ func (c *Client) Sign(message []byte) (*bls.Signature, error) { } func (c *Client) SignProofOfPossession(message []byte) (*bls.Signature, error) { - resp, err := c.client.ProofOfPossession(context.Background(), &pb.ProofOfPossessionSignatureRequest{Message: message}) + resp, err := c.client.SignProofOfPossession(context.Background(), &pb.ProofOfPossessionSignatureRequest{Message: message}) if err != nil { return nil, err } diff --git a/utils/crypto/bls/signer/rpcsigner/server_test.go b/utils/crypto/bls/signer/rpcsigner/server_test.go index a7c901923e59..233c4bf65aa0 100644 --- a/utils/crypto/bls/signer/rpcsigner/server_test.go +++ b/utils/crypto/bls/signer/rpcsigner/server_test.go @@ -47,7 +47,7 @@ func (s *server) Sign(_ context.Context, in *signer.SignatureRequest) (*signer.S }, nil } -func (s *server) ProofOfPossession(_ context.Context, in *signer.ProofOfPossessionSignatureRequest) (*signer.ProofOfPossessionSignatureResponse, error) { +func (s *server) SignProofOfPossession(_ context.Context, in *signer.ProofOfPossessionSignatureRequest) (*signer.ProofOfPossessionSignatureResponse, error) { signature, err := s.localSigner.SignProofOfPossession(in.Message) if err != nil { return nil, err