Browse Source

privval: add chainID to requests (#5239)

## Description

Add chainid to requests to privval. This is a non-breaking change and hardware devices can opt to ignore the field.
 
Closes: #4503 

Took the approach of passing chainID to the client instead of modifying `GetPubKey` because it would lead to a larger change throughout the codebase and in some places it could get tricky to get chainID.
pull/5255/head
Marko 4 years ago
committed by GitHub
parent
commit
8cdaa7f515
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 252 additions and 62 deletions
  1. +2
    -0
      CHANGELOG_PENDING.md
  2. +7
    -1
      UPGRADING.md
  3. +4
    -3
      node/node.go
  4. +8
    -5
      privval/signer_client.go
  5. +1
    -1
      privval/signer_client_test.go
  6. +22
    -0
      privval/signer_requestHandler.go
  7. +201
    -48
      proto/tendermint/privval/types.pb.go
  8. +6
    -3
      proto/tendermint/privval/types.proto
  9. +1
    -1
      tools/tm-signer-harness/internal/test_harness.go

+ 2
- 0
CHANGELOG_PENDING.md View File

@ -8,6 +8,8 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
### FEATURES: ### FEATURES:
- [privval] \#5239 Add `chainID` to requests from client.
### IMPROVEMENTS: ### IMPROVEMENTS:
### BUG FIXES: ### BUG FIXES:


+ 7
- 1
UPGRADING.md View File

@ -136,9 +136,15 @@ RPC client can be found in `/rpc` directory. HTTP(S) proxy is located in
### State ### State
A field `State.InitialHeight` has been added to record the initial chain height, which must be `1` A field `State.InitialHeight` has been added to record the initial chain height, which must be `1`
(not `0`) if starting from height `1`. This can be configured via the genesis field
(not `0`) if starting from height `1`. This can be configured via the genesis field
`initial_height`. `initial_height`.
### Privval
All requests are now accompanied by the chainID from the network.
This is a optional field and can be ignored by key management systems. It
is recommended to check the chainID if using the same key management system for multiple chains.
## v0.33.4 ## v0.33.4
### Go API ### Go API


+ 4
- 3
node/node.go View File

@ -655,7 +655,7 @@ func NewNode(config *cfg.Config,
// external signing process. // external signing process.
if config.PrivValidatorListenAddr != "" { if config.PrivValidatorListenAddr != "" {
// FIXME: we should start services inside OnStart // FIXME: we should start services inside OnStart
privValidator, err = createAndStartPrivValidatorSocketClient(config.PrivValidatorListenAddr, logger)
privValidator, err = createAndStartPrivValidatorSocketClient(config.PrivValidatorListenAddr, genDoc.ChainID, logger)
if err != nil { if err != nil {
return nil, fmt.Errorf("error with private validator socket client: %w", err) return nil, fmt.Errorf("error with private validator socket client: %w", err)
} }
@ -1312,7 +1312,8 @@ func saveGenesisDoc(db dbm.DB, genDoc *types.GenesisDoc) error {
} }
func createAndStartPrivValidatorSocketClient( func createAndStartPrivValidatorSocketClient(
listenAddr string,
listenAddr,
chainID string,
logger log.Logger, logger log.Logger,
) (types.PrivValidator, error) { ) (types.PrivValidator, error) {
pve, err := privval.NewSignerListener(listenAddr, logger) pve, err := privval.NewSignerListener(listenAddr, logger)
@ -1320,7 +1321,7 @@ func createAndStartPrivValidatorSocketClient(
return nil, fmt.Errorf("failed to start private validator: %w", err) return nil, fmt.Errorf("failed to start private validator: %w", err)
} }
pvsc, err := privval.NewSignerClient(pve)
pvsc, err := privval.NewSignerClient(pve, chainID)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to start private validator: %w", err) return nil, fmt.Errorf("failed to start private validator: %w", err)
} }


+ 8
- 5
privval/signer_client.go View File

@ -15,20 +15,21 @@ import (
// Handles remote validator connections that provide signing services // Handles remote validator connections that provide signing services
type SignerClient struct { type SignerClient struct {
endpoint *SignerListenerEndpoint endpoint *SignerListenerEndpoint
chainID string
} }
var _ types.PrivValidator = (*SignerClient)(nil) var _ types.PrivValidator = (*SignerClient)(nil)
// NewSignerClient returns an instance of SignerClient. // NewSignerClient returns an instance of SignerClient.
// it will start the endpoint (if not already started) // it will start the endpoint (if not already started)
func NewSignerClient(endpoint *SignerListenerEndpoint) (*SignerClient, error) {
func NewSignerClient(endpoint *SignerListenerEndpoint, chainID string) (*SignerClient, error) {
if !endpoint.IsRunning() { if !endpoint.IsRunning() {
if err := endpoint.Start(); err != nil { if err := endpoint.Start(); err != nil {
return nil, fmt.Errorf("failed to start listener endpoint: %w", err) return nil, fmt.Errorf("failed to start listener endpoint: %w", err)
} }
} }
return &SignerClient{endpoint: endpoint}, nil
return &SignerClient{endpoint: endpoint, chainID: chainID}, nil
} }
// Close closes the underlying connection // Close closes the underlying connection
@ -68,7 +69,7 @@ func (sc *SignerClient) Ping() error {
// GetPubKey retrieves a public key from a remote signer // GetPubKey retrieves a public key from a remote signer
// returns an error if client is not able to provide the key // returns an error if client is not able to provide the key
func (sc *SignerClient) GetPubKey() (crypto.PubKey, error) { func (sc *SignerClient) GetPubKey() (crypto.PubKey, error) {
response, err := sc.endpoint.SendRequest(mustWrapMsg(&privvalproto.PubKeyRequest{}))
response, err := sc.endpoint.SendRequest(mustWrapMsg(&privvalproto.PubKeyRequest{ChainId: sc.chainID}))
if err != nil { if err != nil {
return nil, fmt.Errorf("send: %w", err) return nil, fmt.Errorf("send: %w", err)
} }
@ -91,7 +92,7 @@ func (sc *SignerClient) GetPubKey() (crypto.PubKey, error) {
// SignVote requests a remote signer to sign a vote // SignVote requests a remote signer to sign a vote
func (sc *SignerClient) SignVote(chainID string, vote *tmproto.Vote) error { func (sc *SignerClient) SignVote(chainID string, vote *tmproto.Vote) error {
response, err := sc.endpoint.SendRequest(mustWrapMsg(&privvalproto.SignVoteRequest{Vote: vote}))
response, err := sc.endpoint.SendRequest(mustWrapMsg(&privvalproto.SignVoteRequest{Vote: vote, ChainId: chainID}))
if err != nil { if err != nil {
return err return err
} }
@ -111,7 +112,9 @@ func (sc *SignerClient) SignVote(chainID string, vote *tmproto.Vote) error {
// SignProposal requests a remote signer to sign a proposal // SignProposal requests a remote signer to sign a proposal
func (sc *SignerClient) SignProposal(chainID string, proposal *tmproto.Proposal) error { func (sc *SignerClient) SignProposal(chainID string, proposal *tmproto.Proposal) error {
response, err := sc.endpoint.SendRequest(mustWrapMsg(&privvalproto.SignProposalRequest{Proposal: proposal}))
response, err := sc.endpoint.SendRequest(mustWrapMsg(
&privvalproto.SignProposalRequest{Proposal: proposal, ChainId: chainID},
))
if err != nil { if err != nil {
return err return err
} }


+ 1
- 1
privval/signer_client_test.go View File

@ -33,7 +33,7 @@ func getSignerTestCases(t *testing.T) []signerTestCase {
// get a pair of signer listener, signer dialer endpoints // get a pair of signer listener, signer dialer endpoints
sl, sd := getMockEndpoints(t, dtc.addr, dtc.dialer) sl, sd := getMockEndpoints(t, dtc.addr, dtc.dialer)
sc, err := NewSignerClient(sl)
sc, err := NewSignerClient(sl, chainID)
require.NoError(t, err) require.NoError(t, err)
ss := NewSignerServer(sd, chainID, mockPV) ss := NewSignerServer(sd, chainID, mockPV)


+ 22
- 0
privval/signer_requestHandler.go View File

@ -21,6 +21,13 @@ func DefaultValidationRequestHandler(
switch r := req.Sum.(type) { switch r := req.Sum.(type) {
case *privvalproto.Message_PubKeyRequest: case *privvalproto.Message_PubKeyRequest:
if r.PubKeyRequest.GetChainId() != chainID {
res = mustWrapMsg(&privvalproto.SignedVoteResponse{
Vote: nil, Error: &privvalproto.RemoteSignerError{
Code: 0, Description: "unable to provide pubkey"}})
return res, fmt.Errorf("want chainID: %s, got chainID: %s", r.PubKeyRequest.GetChainId(), chainID)
}
var pubKey crypto.PubKey var pubKey crypto.PubKey
pubKey, err = privVal.GetPubKey() pubKey, err = privVal.GetPubKey()
pk, err := cryptoenc.PubKeyToProto(pubKey) pk, err := cryptoenc.PubKeyToProto(pubKey)
@ -36,6 +43,13 @@ func DefaultValidationRequestHandler(
} }
case *privvalproto.Message_SignVoteRequest: case *privvalproto.Message_SignVoteRequest:
if r.SignVoteRequest.ChainId != chainID {
res = mustWrapMsg(&privvalproto.SignedVoteResponse{
Vote: nil, Error: &privvalproto.RemoteSignerError{
Code: 0, Description: "unable to sign vote"}})
return res, fmt.Errorf("want chainID: %s, got chainID: %s", r.SignVoteRequest.GetChainId(), chainID)
}
vote := r.SignVoteRequest.Vote vote := r.SignVoteRequest.Vote
err = privVal.SignVote(chainID, vote) err = privVal.SignVote(chainID, vote)
@ -47,6 +61,14 @@ func DefaultValidationRequestHandler(
} }
case *privvalproto.Message_SignProposalRequest: case *privvalproto.Message_SignProposalRequest:
if r.SignProposalRequest.GetChainId() != chainID {
res = mustWrapMsg(&privvalproto.SignedVoteResponse{
Vote: nil, Error: &privvalproto.RemoteSignerError{
Code: 0,
Description: "unable to sign proposal"}})
return res, fmt.Errorf("want chainID: %s, got chainID: %s", r.SignProposalRequest.GetChainId(), chainID)
}
proposal := r.SignProposalRequest.Proposal proposal := r.SignProposalRequest.Proposal
err = privVal.SignProposal(chainID, proposal) err = privVal.SignProposal(chainID, proposal)


+ 201
- 48
proto/tendermint/privval/types.pb.go View File

@ -5,7 +5,6 @@ package privval
import ( import (
fmt "fmt" fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
crypto "github.com/tendermint/tendermint/proto/tendermint/crypto" crypto "github.com/tendermint/tendermint/proto/tendermint/crypto"
types "github.com/tendermint/tendermint/proto/tendermint/types" types "github.com/tendermint/tendermint/proto/tendermint/types"
@ -116,6 +115,7 @@ func (m *RemoteSignerError) GetDescription() string {
// PubKeyRequest requests the consensus public key from the remote signer. // PubKeyRequest requests the consensus public key from the remote signer.
type PubKeyRequest struct { type PubKeyRequest struct {
ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
} }
func (m *PubKeyRequest) Reset() { *m = PubKeyRequest{} } func (m *PubKeyRequest) Reset() { *m = PubKeyRequest{} }
@ -151,6 +151,13 @@ func (m *PubKeyRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_PubKeyRequest proto.InternalMessageInfo var xxx_messageInfo_PubKeyRequest proto.InternalMessageInfo
func (m *PubKeyRequest) GetChainId() string {
if m != nil {
return m.ChainId
}
return ""
}
// PubKeyResponse is a response message containing the public key. // PubKeyResponse is a response message containing the public key.
type PubKeyResponse struct { 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,omitempty"`
@ -206,7 +213,8 @@ func (m *PubKeyResponse) GetError() *RemoteSignerError {
// SignVoteRequest is a request to sign a vote // SignVoteRequest is a request to sign a vote
type SignVoteRequest struct { type SignVoteRequest 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,omitempty"`
ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
} }
func (m *SignVoteRequest) Reset() { *m = SignVoteRequest{} } func (m *SignVoteRequest) Reset() { *m = SignVoteRequest{} }
@ -249,6 +257,13 @@ func (m *SignVoteRequest) GetVote() *types.Vote {
return nil return nil
} }
func (m *SignVoteRequest) GetChainId() string {
if m != nil {
return m.ChainId
}
return ""
}
// SignedVoteResponse is a response containing a signed vote or an error // SignedVoteResponse is a response containing a signed vote or an error
type SignedVoteResponse struct { 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,omitempty"`
@ -305,6 +320,7 @@ func (m *SignedVoteResponse) GetError() *RemoteSignerError {
// SignProposalRequest is a request to sign a proposal // SignProposalRequest is a request to sign a proposal
type SignProposalRequest struct { type SignProposalRequest 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,omitempty"`
ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
} }
func (m *SignProposalRequest) Reset() { *m = SignProposalRequest{} } func (m *SignProposalRequest) Reset() { *m = SignProposalRequest{} }
@ -347,6 +363,13 @@ func (m *SignProposalRequest) GetProposal() *types.Proposal {
return nil return nil
} }
func (m *SignProposalRequest) GetChainId() string {
if m != nil {
return m.ChainId
}
return ""
}
// SignedProposalResponse is response containing a signed proposal or an error // SignedProposalResponse is response containing a signed proposal or an error
type SignedProposalResponse struct { 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,omitempty"`
@ -654,52 +677,53 @@ func init() {
func init() { proto.RegisterFile("tendermint/privval/types.proto", fileDescriptor_cb4e437a5328cf9c) } func init() { proto.RegisterFile("tendermint/privval/types.proto", fileDescriptor_cb4e437a5328cf9c) }
var fileDescriptor_cb4e437a5328cf9c = []byte{ var fileDescriptor_cb4e437a5328cf9c = []byte{
// 711 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0xcf, 0x6e, 0xd3, 0x4a,
0x14, 0xc6, 0xed, 0x36, 0x49, 0x7b, 0x4f, 0x9a, 0x3f, 0x9d, 0xf6, 0xf6, 0xe6, 0x46, 0xbd, 0xbe,
0xc1, 0x08, 0xa8, 0xba, 0x48, 0xa4, 0x22, 0x90, 0x10, 0x62, 0x41, 0x5b, 0x8b, 0x44, 0x55, 0xed,
0x30, 0x49, 0x29, 0xaa, 0x84, 0xac, 0x26, 0x19, 0x8c, 0xd5, 0xc6, 0x33, 0x78, 0x9c, 0x4a, 0x59,
0xb0, 0x63, 0x8b, 0xc4, 0x63, 0xb0, 0xe6, 0x29, 0x58, 0x76, 0xc9, 0x12, 0xb5, 0x2f, 0x82, 0x3c,
0x9e, 0x38, 0x6e, 0xfe, 0x20, 0x41, 0x77, 0x9e, 0xf3, 0xcd, 0xfc, 0xce, 0x77, 0x3c, 0x9f, 0x34,
0xa0, 0x05, 0xc4, 0xeb, 0x11, 0xbf, 0xef, 0x7a, 0x41, 0x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, 0x69, 0xea, 0xe7, 0x6b, 0x4d, 0xb9, 0xbc, 0xd6, 0x94, 0xef, 0xd7, 0x9a, 0x72, 0xf2,
0xc4, 0x71, 0x83, 0x77, 0x83, 0x4e, 0xb5, 0x4b, 0xfb, 0xb5, 0xe4, 0x0b, 0x92, 0x7c, 0xb4, 0xc2,
0x77, 0x68, 0xfa, 0x15, 0xeb, 0x64, 0x84, 0xf2, 0xf0, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbe,
0xc8, 0xae, 0x83, 0xe2, 0x06, 0x00, 0x00,
// 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, 0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0x8b, 0xae, 0xed,
0x5d, 0xf4, 0x5b, 0xa5, 0x36, 0xed, 0x95, 0xc3, 0x4f, 0x52, 0xf8, 0xbd, 0xa3, 0x1e, 0x2d, 0x4f,
0x3f, 0x80, 0xad, 0x84, 0x40, 0x9e, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xb0, 0xa7, 0xec,
0x1d, 0x07, 0x00, 0x00,
} }
func (m *RemoteSignerError) Marshal() (dAtA []byte, err error) { func (m *RemoteSignerError) Marshal() (dAtA []byte, err error) {
@ -757,6 +781,13 @@ func (m *PubKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ChainId) > 0 {
i -= len(m.ChainId)
copy(dAtA[i:], m.ChainId)
i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainId)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -827,6 +858,13 @@ func (m *SignVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ChainId) > 0 {
i -= len(m.ChainId)
copy(dAtA[i:], m.ChainId)
i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainId)))
i--
dAtA[i] = 0x12
}
if m.Vote != nil { if m.Vote != nil {
{ {
size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i])
@ -909,6 +947,13 @@ func (m *SignProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ChainId) > 0 {
i -= len(m.ChainId)
copy(dAtA[i:], m.ChainId)
i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainId)))
i--
dAtA[i] = 0x12
}
if m.Proposal != nil { if m.Proposal != nil {
{ {
size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i])
@ -1250,6 +1295,10 @@ func (m *PubKeyRequest) Size() (n int) {
} }
var l int var l int
_ = l _ = l
l = len(m.ChainId)
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
return n return n
} }
@ -1280,6 +1329,10 @@ func (m *SignVoteRequest) Size() (n int) {
l = m.Vote.Size() l = m.Vote.Size()
n += 1 + l + sovTypes(uint64(l)) n += 1 + l + sovTypes(uint64(l))
} }
l = len(m.ChainId)
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
return n return n
} }
@ -1310,6 +1363,10 @@ func (m *SignProposalRequest) Size() (n int) {
l = m.Proposal.Size() l = m.Proposal.Size()
n += 1 + l + sovTypes(uint64(l)) n += 1 + l + sovTypes(uint64(l))
} }
l = len(m.ChainId)
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
return n return n
} }
@ -1596,6 +1653,38 @@ func (m *PubKeyRequest) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: PubKeyRequest: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: PubKeyRequest: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ChainId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:]) skippy, err := skipTypes(dAtA[iNdEx:])
@ -1810,6 +1899,38 @@ func (m *SignVoteRequest) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ChainId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:]) skippy, err := skipTypes(dAtA[iNdEx:])
@ -2024,6 +2145,38 @@ func (m *SignProposalRequest) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ChainId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:]) skippy, err := skipTypes(dAtA[iNdEx:])


+ 6
- 3
proto/tendermint/privval/types.proto View File

@ -1,7 +1,6 @@
syntax = "proto3"; syntax = "proto3";
package tendermint.privval; package tendermint.privval;
import "gogoproto/gogo.proto";
import "tendermint/crypto/keys.proto"; import "tendermint/crypto/keys.proto";
import "tendermint/types/types.proto"; import "tendermint/types/types.proto";
@ -22,7 +21,9 @@ message RemoteSignerError {
} }
// PubKeyRequest requests the consensus public key from the remote signer. // PubKeyRequest requests the consensus public key from the remote signer.
message PubKeyRequest {}
message PubKeyRequest {
string chain_id = 1;
}
// PubKeyResponse is a response message containing the public key. // PubKeyResponse is a response message containing the public key.
message PubKeyResponse { message PubKeyResponse {
@ -32,7 +33,8 @@ message PubKeyResponse {
// SignVoteRequest is a request to sign a vote // SignVoteRequest is a request to sign a vote
message SignVoteRequest { message SignVoteRequest {
tendermint.types.Vote vote = 1;
tendermint.types.Vote vote = 1;
string chain_id = 2;
} }
// SignedVoteResponse is a response containing a signed vote or an error // SignedVoteResponse is a response containing a signed vote or an error
@ -44,6 +46,7 @@ message SignedVoteResponse {
// SignProposalRequest is a request to sign a proposal // SignProposalRequest is a request to sign a proposal
message SignProposalRequest { message SignProposalRequest {
tendermint.types.Proposal proposal = 1; tendermint.types.Proposal proposal = 1;
string chain_id = 2;
} }
// SignedProposalResponse is response containing a signed proposal or an error // SignedProposalResponse is response containing a signed proposal or an error


+ 1
- 1
tools/tm-signer-harness/internal/test_harness.go View File

@ -109,7 +109,7 @@ func NewTestHarness(logger log.Logger, cfg TestHarnessConfig) (*TestHarness, err
return nil, newTestHarnessError(ErrFailedToCreateListener, err, "") return nil, newTestHarnessError(ErrFailedToCreateListener, err, "")
} }
signerClient, err := privval.NewSignerClient(spv)
signerClient, err := privval.NewSignerClient(spv, st.ChainID)
if err != nil { if err != nil {
return nil, newTestHarnessError(ErrFailedToCreateListener, err, "") return nil, newTestHarnessError(ErrFailedToCreateListener, err, "")
} }


Loading…
Cancel
Save