From ad4f54e9b211fff86a1113ea6a0e44ae12ce106b Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 28 Oct 2020 16:16:38 +0100 Subject: [PATCH] privval: make response values non nullable (#5583) make response values non nullable in privval Does this need a changelog for master? Closes: #5581 cc @tarcieri --- CHANGELOG_PENDING.md | 1 + privval/msgs_test.go | 13 +- privval/signer_client.go | 6 +- privval/signer_client_test.go | 7 +- privval/signer_requestHandler.go | 20 +-- proto/tendermint/privval/types.pb.go | 195 ++++++++++++--------------- proto/tendermint/privval/types.proto | 7 +- 7 files changed, 118 insertions(+), 131 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index fbf3a7fd1..32cff9bda 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -32,3 +32,4 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi - [consensus/wal] Fix WAL autorepair by opening target WAL in read/write mode (@erikgrinaker) - [block] \#5567 Fix MaxCommitSigBytes (@cmwaters) - [evidence] \#5574 Fix bug where node sends committed evidence to peer (@cmwaters) +- [privval] \#5583 Make `Vote`, `Proposal` & `PubKey` non-nullable in Responses (@marbar3778) diff --git a/privval/msgs_test.go b/privval/msgs_test.go index f6f1681db..bf532bd7b 100644 --- a/privval/msgs_test.go +++ b/privval/msgs_test.go @@ -12,6 +12,7 @@ import ( "github.com/tendermint/tendermint/crypto/ed25519" cryptoenc "github.com/tendermint/tendermint/crypto/encoding" "github.com/tendermint/tendermint/crypto/tmhash" + cryptoproto "github.com/tendermint/tendermint/proto/tendermint/crypto" privproto "github.com/tendermint/tendermint/proto/tendermint/privval" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/types" @@ -81,14 +82,14 @@ func TestPrivvalVectors(t *testing.T) { {"ping request", &privproto.PingRequest{}, "3a00"}, {"ping response", &privproto.PingResponse{}, "4200"}, {"pubKey request", &privproto.PubKeyRequest{}, "0a00"}, - {"pubKey response", &privproto.PubKeyResponse{PubKey: &ppk, Error: nil}, "12240a220a20556a436f1218d30942efe798420f51dc9b6a311b929c578257457d05c5fcf230"}, - {"pubKey response with error", &privproto.PubKeyResponse{PubKey: nil, Error: remoteError}, "121212100801120c697427732061206572726f72"}, + {"pubKey response", &privproto.PubKeyResponse{PubKey: ppk, Error: nil}, "12240a220a20556a436f1218d30942efe798420f51dc9b6a311b929c578257457d05c5fcf230"}, + {"pubKey response with error", &privproto.PubKeyResponse{PubKey: cryptoproto.PublicKey{}, Error: remoteError}, "12140a0012100801120c697427732061206572726f72"}, {"Vote Request", &privproto.SignVoteRequest{Vote: votepb}, "1a760a74080110031802224a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a2a0608f49a8ded0532146af1f4111082efb388211bc72c55bcd61e9ac3d538d5bb03"}, - {"Vote Response", &privproto.SignedVoteResponse{Vote: votepb, Error: nil}, "22760a74080110031802224a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a2a0608f49a8ded0532146af1f4111082efb388211bc72c55bcd61e9ac3d538d5bb03"}, - {"Vote Response with error", &privproto.SignedVoteResponse{Vote: nil, Error: remoteError}, "221212100801120c697427732061206572726f72"}, + {"Vote Response", &privproto.SignedVoteResponse{Vote: *votepb, Error: nil}, "22760a74080110031802224a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a2a0608f49a8ded0532146af1f4111082efb388211bc72c55bcd61e9ac3d538d5bb03"}, + {"Vote Response with error", &privproto.SignedVoteResponse{Vote: tmproto.Vote{}, Error: remoteError}, "22250a11220212002a0b088092b8c398feffffff0112100801120c697427732061206572726f72"}, {"Proposal Request", &privproto.SignProposalRequest{Proposal: proposalpb}, "2a700a6e08011003180220022a4a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a320608f49a8ded053a10697427732061207369676e6174757265"}, - {"Proposal Response", &privproto.SignedProposalResponse{Proposal: proposalpb, Error: nil}, "32700a6e08011003180220022a4a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a320608f49a8ded053a10697427732061207369676e6174757265"}, - {"Proposal Response with error", &privproto.SignedProposalResponse{Proposal: nil, Error: remoteError}, "321212100801120c697427732061206572726f72"}, + {"Proposal Response", &privproto.SignedProposalResponse{Proposal: *proposalpb, Error: nil}, "32700a6e08011003180220022a4a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a320608f49a8ded053a10697427732061207369676e6174757265"}, + {"Proposal Response with error", &privproto.SignedProposalResponse{Proposal: tmproto.Proposal{}, Error: remoteError}, "32250a112a021200320b088092b8c398feffffff0112100801120c697427732061206572726f72"}, } for _, tc := range testCases { diff --git a/privval/signer_client.go b/privval/signer_client.go index 50c462da1..aecb0381e 100644 --- a/privval/signer_client.go +++ b/privval/signer_client.go @@ -82,7 +82,7 @@ func (sc *SignerClient) GetPubKey() (crypto.PubKey, error) { return nil, &RemoteSignerError{Code: int(resp.Error.Code), Description: resp.Error.Description} } - pk, err := cryptoenc.PubKeyFromProto(*resp.PubKey) + pk, err := cryptoenc.PubKeyFromProto(resp.PubKey) if err != nil { return nil, err } @@ -105,7 +105,7 @@ func (sc *SignerClient) SignVote(chainID string, vote *tmproto.Vote) error { return &RemoteSignerError{Code: int(resp.Error.Code), Description: resp.Error.Description} } - *vote = *resp.Vote + *vote = resp.Vote return nil } @@ -127,7 +127,7 @@ func (sc *SignerClient) SignProposal(chainID string, proposal *tmproto.Proposal) return &RemoteSignerError{Code: int(resp.Error.Code), Description: resp.Error.Description} } - *proposal = *resp.Proposal + *proposal = resp.Proposal return nil } diff --git a/privval/signer_client_test.go b/privval/signer_client_test.go index d169a875a..019fd2c96 100644 --- a/privval/signer_client_test.go +++ b/privval/signer_client_test.go @@ -11,6 +11,7 @@ import ( "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/tmhash" tmrand "github.com/tendermint/tendermint/libs/rand" + cryptoproto "github.com/tendermint/tendermint/proto/tendermint/crypto" privvalproto "github.com/tendermint/tendermint/proto/tendermint/privval" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/types" @@ -396,11 +397,11 @@ func brokenHandler(privVal types.PrivValidator, request privvalproto.Message, switch r := request.Sum.(type) { // This is broken and will answer most requests with a pubkey response case *privvalproto.Message_PubKeyRequest: - res = mustWrapMsg(&privvalproto.PubKeyResponse{PubKey: nil, Error: nil}) + res = mustWrapMsg(&privvalproto.PubKeyResponse{PubKey: cryptoproto.PublicKey{}, Error: nil}) case *privvalproto.Message_SignVoteRequest: - res = mustWrapMsg(&privvalproto.PubKeyResponse{PubKey: nil, Error: nil}) + res = mustWrapMsg(&privvalproto.PubKeyResponse{PubKey: cryptoproto.PublicKey{}, Error: nil}) case *privvalproto.Message_SignProposalRequest: - res = mustWrapMsg(&privvalproto.PubKeyResponse{PubKey: nil, Error: nil}) + res = mustWrapMsg(&privvalproto.PubKeyResponse{PubKey: cryptoproto.PublicKey{}, Error: nil}) case *privvalproto.Message_PingRequest: err, res = nil, mustWrapMsg(&privvalproto.PingResponse{}) default: diff --git a/privval/signer_requestHandler.go b/privval/signer_requestHandler.go index 075193541..ea020b682 100644 --- a/privval/signer_requestHandler.go +++ b/privval/signer_requestHandler.go @@ -5,7 +5,9 @@ import ( "github.com/tendermint/tendermint/crypto" cryptoenc "github.com/tendermint/tendermint/crypto/encoding" + cryptoproto "github.com/tendermint/tendermint/proto/tendermint/crypto" privvalproto "github.com/tendermint/tendermint/proto/tendermint/privval" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/tendermint/tendermint/types" ) @@ -23,7 +25,7 @@ func DefaultValidationRequestHandler( case *privvalproto.Message_PubKeyRequest: if r.PubKeyRequest.GetChainId() != chainID { res = mustWrapMsg(&privvalproto.SignedVoteResponse{ - Vote: nil, Error: &privvalproto.RemoteSignerError{ + Vote: tmproto.Vote{}, Error: &privvalproto.RemoteSignerError{ Code: 0, Description: "unable to provide pubkey"}}) return res, fmt.Errorf("want chainID: %s, got chainID: %s", r.PubKeyRequest.GetChainId(), chainID) } @@ -37,15 +39,15 @@ func DefaultValidationRequestHandler( if err != nil { res = mustWrapMsg(&privvalproto.PubKeyResponse{ - PubKey: nil, Error: &privvalproto.RemoteSignerError{Code: 0, Description: err.Error()}}) + PubKey: cryptoproto.PublicKey{}, Error: &privvalproto.RemoteSignerError{Code: 0, Description: err.Error()}}) } else { - res = mustWrapMsg(&privvalproto.PubKeyResponse{PubKey: &pk, Error: nil}) + res = mustWrapMsg(&privvalproto.PubKeyResponse{PubKey: pk, Error: nil}) } case *privvalproto.Message_SignVoteRequest: if r.SignVoteRequest.ChainId != chainID { res = mustWrapMsg(&privvalproto.SignedVoteResponse{ - Vote: nil, Error: &privvalproto.RemoteSignerError{ + Vote: tmproto.Vote{}, Error: &privvalproto.RemoteSignerError{ Code: 0, Description: "unable to sign vote"}}) return res, fmt.Errorf("want chainID: %s, got chainID: %s", r.SignVoteRequest.GetChainId(), chainID) } @@ -55,15 +57,15 @@ func DefaultValidationRequestHandler( err = privVal.SignVote(chainID, vote) if err != nil { res = mustWrapMsg(&privvalproto.SignedVoteResponse{ - Vote: nil, Error: &privvalproto.RemoteSignerError{Code: 0, Description: err.Error()}}) + Vote: tmproto.Vote{}, Error: &privvalproto.RemoteSignerError{Code: 0, Description: err.Error()}}) } else { - res = mustWrapMsg(&privvalproto.SignedVoteResponse{Vote: vote, Error: nil}) + res = mustWrapMsg(&privvalproto.SignedVoteResponse{Vote: *vote, Error: nil}) } case *privvalproto.Message_SignProposalRequest: if r.SignProposalRequest.GetChainId() != chainID { res = mustWrapMsg(&privvalproto.SignedVoteResponse{ - Vote: nil, Error: &privvalproto.RemoteSignerError{ + Vote: tmproto.Vote{}, Error: &privvalproto.RemoteSignerError{ Code: 0, Description: "unable to sign proposal"}}) return res, fmt.Errorf("want chainID: %s, got chainID: %s", r.SignProposalRequest.GetChainId(), chainID) @@ -74,9 +76,9 @@ func DefaultValidationRequestHandler( err = privVal.SignProposal(chainID, proposal) if err != nil { res = mustWrapMsg(&privvalproto.SignedProposalResponse{ - Proposal: nil, Error: &privvalproto.RemoteSignerError{Code: 0, Description: err.Error()}}) + Proposal: tmproto.Proposal{}, Error: &privvalproto.RemoteSignerError{Code: 0, Description: err.Error()}}) } else { - res = mustWrapMsg(&privvalproto.SignedProposalResponse{Proposal: proposal, Error: nil}) + res = mustWrapMsg(&privvalproto.SignedProposalResponse{Proposal: *proposal, Error: nil}) } case *privvalproto.Message_PingRequest: err, res = nil, mustWrapMsg(&privvalproto.PingResponse{}) diff --git a/proto/tendermint/privval/types.pb.go b/proto/tendermint/privval/types.pb.go index f376d168f..cab9975b1 100644 --- a/proto/tendermint/privval/types.pb.go +++ b/proto/tendermint/privval/types.pb.go @@ -5,6 +5,7 @@ package privval import ( fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" crypto "github.com/tendermint/tendermint/proto/tendermint/crypto" types "github.com/tendermint/tendermint/proto/tendermint/types" @@ -160,7 +161,7 @@ func (m *PubKeyRequest) GetChainId() string { // PubKeyResponse is a response message containing the public key. type PubKeyResponse struct { - PubKey *crypto.PublicKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` + PubKey crypto.PublicKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"` Error *RemoteSignerError `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` } @@ -197,11 +198,11 @@ func (m *PubKeyResponse) XXX_DiscardUnknown() { var xxx_messageInfo_PubKeyResponse proto.InternalMessageInfo -func (m *PubKeyResponse) GetPubKey() *crypto.PublicKey { +func (m *PubKeyResponse) GetPubKey() crypto.PublicKey { if m != nil { return m.PubKey } - return nil + return crypto.PublicKey{} } func (m *PubKeyResponse) GetError() *RemoteSignerError { @@ -266,7 +267,7 @@ func (m *SignVoteRequest) GetChainId() string { // SignedVoteResponse is a response containing a signed vote or an error type SignedVoteResponse struct { - Vote *types.Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote,omitempty"` + Vote types.Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote"` Error *RemoteSignerError `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` } @@ -303,11 +304,11 @@ func (m *SignedVoteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_SignedVoteResponse proto.InternalMessageInfo -func (m *SignedVoteResponse) GetVote() *types.Vote { +func (m *SignedVoteResponse) GetVote() types.Vote { if m != nil { return m.Vote } - return nil + return types.Vote{} } func (m *SignedVoteResponse) GetError() *RemoteSignerError { @@ -372,7 +373,7 @@ func (m *SignProposalRequest) GetChainId() string { // SignedProposalResponse is response containing a signed proposal or an error type SignedProposalResponse struct { - Proposal *types.Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal,omitempty"` + Proposal types.Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"` Error *RemoteSignerError `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` } @@ -409,11 +410,11 @@ func (m *SignedProposalResponse) XXX_DiscardUnknown() { var xxx_messageInfo_SignedProposalResponse proto.InternalMessageInfo -func (m *SignedProposalResponse) GetProposal() *types.Proposal { +func (m *SignedProposalResponse) GetProposal() types.Proposal { if m != nil { return m.Proposal } - return nil + return types.Proposal{} } func (m *SignedProposalResponse) GetError() *RemoteSignerError { @@ -677,53 +678,54 @@ func init() { func init() { proto.RegisterFile("tendermint/privval/types.proto", fileDescriptor_cb4e437a5328cf9c) } var fileDescriptor_cb4e437a5328cf9c = []byte{ - // 724 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x4f, 0xdb, 0x4a, - 0x14, 0xb5, 0x21, 0x1f, 0x70, 0x43, 0x42, 0x18, 0x78, 0xbc, 0x80, 0x78, 0x7e, 0x79, 0x79, 0x6a, - 0x8b, 0xb2, 0x48, 0x24, 0xaa, 0x56, 0xaa, 0xba, 0x2a, 0x60, 0x35, 0x11, 0xc2, 0x4e, 0x27, 0xa1, - 0x20, 0xa4, 0xca, 0xca, 0xc7, 0x34, 0x58, 0x10, 0xcf, 0xd4, 0xe3, 0x20, 0x65, 0xd1, 0x5d, 0xb7, - 0x95, 0xfa, 0x33, 0xba, 0xee, 0xaf, 0xe8, 0x92, 0x65, 0x97, 0x15, 0xfc, 0x91, 0x2a, 0xe3, 0x89, - 0x63, 0xe7, 0x03, 0xa9, 0x65, 0x97, 0xb9, 0xe7, 0xde, 0x73, 0xcf, 0xf1, 0x9c, 0x68, 0x40, 0xf3, - 0x88, 0xd3, 0x21, 0x6e, 0xcf, 0x76, 0xbc, 0x32, 0x73, 0xed, 0xeb, 0xeb, 0xe6, 0x55, 0xd9, 0x1b, - 0x30, 0xc2, 0x4b, 0xcc, 0xa5, 0x1e, 0x45, 0x68, 0x8c, 0x97, 0x24, 0xbe, 0xbd, 0x13, 0x9a, 0x69, - 0xbb, 0x03, 0xe6, 0xd1, 0xf2, 0x25, 0x19, 0xc8, 0x89, 0x08, 0x2a, 0x98, 0xc2, 0x7c, 0x85, 0x2a, - 0xac, 0x61, 0xd2, 0xa3, 0x1e, 0xa9, 0xdb, 0x5d, 0x87, 0xb8, 0xba, 0xeb, 0x52, 0x17, 0x21, 0x88, - 0xb5, 0x69, 0x87, 0xe4, 0xd4, 0xbc, 0xba, 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b, 0xb0, 0xa7, 0xec, - 0x1d, 0x07, 0x00, 0x00, + // 750 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x4f, 0x13, 0x41, + 0x18, 0xde, 0x85, 0x7e, 0xc0, 0x5b, 0x5a, 0xca, 0x80, 0x58, 0x1a, 0x5c, 0x6a, 0x8d, 0x4a, 0x7a, + 0x68, 0x0d, 0x26, 0x26, 0x06, 0x2f, 0x02, 0x1b, 0xdb, 0x34, 0x6c, 0xeb, 0xb4, 0x08, 0x21, 0x31, + 0x9b, 0x7e, 0x8c, 0xcb, 0x06, 0xba, 0x3b, 0xee, 0x6c, 0x49, 0x7a, 0xf6, 0xe6, 0xc9, 0xc4, 0x3f, + 0xe1, 0xd9, 0x5f, 0xc1, 0x91, 0xa3, 0x27, 0x63, 0xe0, 0x8f, 0x98, 0xce, 0x4e, 0xb7, 0xdb, 0x2f, + 0xa2, 0xe1, 0xb6, 0xf3, 0xbe, 0xef, 0x3c, 0x1f, 0x33, 0xcf, 0x66, 0x40, 0x71, 0x89, 0xd5, 0x26, + 0x4e, 0xc7, 0xb4, 0xdc, 0x02, 0x75, 0xcc, 0xcb, 0xcb, 0xc6, 0x45, 0xc1, 0xed, 0x51, 0xc2, 0xf2, + 0xd4, 0xb1, 0x5d, 0x1b, 0xa1, 0x61, 0x3f, 0x2f, 0xfa, 0xe9, 0xcd, 0xc0, 0x9e, 0x96, 0xd3, 0xa3, + 0xae, 0x5d, 0x38, 0x27, 0x3d, 0xb1, 0x63, 0xa4, 0xcb, 0x91, 0x82, 0x78, 0xe9, 0x35, 0xc3, 0x36, + 0x6c, 0xfe, 0x59, 0xe8, 0x7f, 0x79, 0xd5, 0x6c, 0x09, 0x56, 0x30, 0xe9, 0xd8, 0x2e, 0xa9, 0x99, + 0x86, 0x45, 0x1c, 0xd5, 0x71, 0x6c, 0x07, 0x21, 0x08, 0xb5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0x7c, 0xcb, 0xee, + 0x14, 0x82, 0x6f, 0x57, 0xf0, 0x61, 0xec, 0xbf, 0x57, 0x93, 0x2f, 0x65, 0x33, 0xc2, 0x3b, 0x2f, + 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xa5, 0x2a, 0xe5, 0x4a, 0x46, 0x07, 0x00, 0x00, } func (m *RemoteSignerError) Marshal() (dAtA []byte, err error) { @@ -823,18 +825,16 @@ func (m *PubKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if m.PubKey != nil { - { - size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -912,18 +912,16 @@ func (m *SignedVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if m.Vote != nil { - { - size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) + { + size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1001,18 +999,16 @@ func (m *SignedProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x12 } - if m.Proposal != nil { - { - size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) + { + size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1308,10 +1304,8 @@ func (m *PubKeyResponse) Size() (n int) { } var l int _ = l - if m.PubKey != nil { - l = m.PubKey.Size() - n += 1 + l + sovTypes(uint64(l)) - } + l = m.PubKey.Size() + n += 1 + l + sovTypes(uint64(l)) if m.Error != nil { l = m.Error.Size() n += 1 + l + sovTypes(uint64(l)) @@ -1342,10 +1336,8 @@ func (m *SignedVoteResponse) Size() (n int) { } var l int _ = l - if m.Vote != nil { - l = m.Vote.Size() - n += 1 + l + sovTypes(uint64(l)) - } + l = m.Vote.Size() + n += 1 + l + sovTypes(uint64(l)) if m.Error != nil { l = m.Error.Size() n += 1 + l + sovTypes(uint64(l)) @@ -1376,10 +1368,8 @@ func (m *SignedProposalResponse) Size() (n int) { } var l int _ = l - if m.Proposal != nil { - l = m.Proposal.Size() - n += 1 + l + sovTypes(uint64(l)) - } + l = m.Proposal.Size() + n += 1 + l + sovTypes(uint64(l)) if m.Error != nil { l = m.Error.Size() n += 1 + l + sovTypes(uint64(l)) @@ -1767,9 +1757,6 @@ func (m *PubKeyResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PubKey == nil { - m.PubKey = &crypto.PublicKey{} - } if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2013,9 +2000,6 @@ func (m *SignedVoteResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Vote == nil { - m.Vote = &types.Vote{} - } if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2259,9 +2243,6 @@ func (m *SignedProposalResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Proposal == nil { - m.Proposal = &types.Proposal{} - } if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/proto/tendermint/privval/types.proto b/proto/tendermint/privval/types.proto index a0bba297d..0fc8b61dc 100644 --- a/proto/tendermint/privval/types.proto +++ b/proto/tendermint/privval/types.proto @@ -3,6 +3,7 @@ package tendermint.privval; import "tendermint/crypto/keys.proto"; import "tendermint/types/types.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/tendermint/tendermint/proto/tendermint/privval"; @@ -27,7 +28,7 @@ message PubKeyRequest { // PubKeyResponse is a response message containing the public key. message PubKeyResponse { - tendermint.crypto.PublicKey pub_key = 1; + tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; RemoteSignerError error = 2; } @@ -39,7 +40,7 @@ message SignVoteRequest { // SignedVoteResponse is a response containing a signed vote or an error message SignedVoteResponse { - tendermint.types.Vote vote = 1; + tendermint.types.Vote vote = 1 [(gogoproto.nullable) = false]; RemoteSignerError error = 2; } @@ -51,7 +52,7 @@ message SignProposalRequest { // SignedProposalResponse is response containing a signed proposal or an error message SignedProposalResponse { - tendermint.types.Proposal proposal = 1; + tendermint.types.Proposal proposal = 1 [(gogoproto.nullable) = false]; RemoteSignerError error = 2; }