Browse Source

privval: fix ping message encoding (#5441)

Fixes #5371.
pull/5451/head
Erik Grinaker 4 years ago
committed by GitHub
parent
commit
08708046a7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions
  1. +3
    -1
      CHANGELOG_PENDING.md
  2. +3
    -3
      privval/msgs.go
  3. +2
    -2
      privval/msgs_test.go

+ 3
- 1
CHANGELOG_PENDING.md View File

@ -22,9 +22,11 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
### IMPROVEMENTS
- [privval] `NewSignerDialerEndpoint` can now be given `SignerServiceEndpointOption` (@erikgrinaker)
- [privval] \#5434 `NewSignerDialerEndpoint` can now be given `SignerServiceEndpointOption` (@erikgrinaker)
- [config] \#5433 `statesync.rpc_servers` is now properly set when writing the configuration file (@erikgrinaker)
### BUG FIXES
- [privval] \#5441 Fix faulty ping message encoding causing nil message errors in logs (@erikgrinaker)

+ 3
- 3
privval/msgs.go View File

@ -29,11 +29,11 @@ func mustWrapMsg(pb proto.Message) privvalproto.Message {
case *privvalproto.SignProposalRequest:
msg.Sum = &privvalproto.Message_SignProposalRequest{SignProposalRequest: pb}
case *privvalproto.PingRequest:
msg.Sum = &privvalproto.Message_PingRequest{}
msg.Sum = &privvalproto.Message_PingRequest{PingRequest: pb}
case *privvalproto.PingResponse:
msg.Sum = &privvalproto.Message_PingResponse{}
msg.Sum = &privvalproto.Message_PingResponse{PingResponse: pb}
default:
panic(fmt.Errorf("unknown message type %T", msg))
panic(fmt.Errorf("unknown message type %T", pb))
}
return msg


+ 2
- 2
privval/msgs_test.go View File

@ -78,8 +78,8 @@ func TestPrivvalVectors(t *testing.T) {
msg proto.Message
expBytes string
}{
{"ping request", &privproto.PingRequest{}, ""},
{"ping response", &privproto.PingResponse{}, ""},
{"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"},


Loading…
Cancel
Save