[stream] added commit sig in sync stream protobuf.

pull/3582/head
Jacky Wang 4 years ago
parent 2bcd319d5c
commit c34f744c0a
No known key found for this signature in database
GPG Key ID: 1085CE5F4FF5842C
  1. 14
      p2p/stream/protocols/sync/message/compose.go
  2. 45
      p2p/stream/protocols/sync/message/msg.pb.go
  3. 2
      p2p/stream/protocols/sync/message/msg.proto

@ -112,36 +112,38 @@ func MakeGetBlockHashesResponse(rid uint64, hs []common.Hash) *Response {
} }
// MakeGetBlocksByNumResponseMessage makes the GetBlocksByNumResponse of Message type // MakeGetBlocksByNumResponseMessage makes the GetBlocksByNumResponse of Message type
func MakeGetBlocksByNumResponseMessage(rid uint64, blocksBytes [][]byte) *Message { func MakeGetBlocksByNumResponseMessage(rid uint64, blocksBytes, sigs [][]byte) *Message {
resp := MakeGetBlocksByNumResponse(rid, blocksBytes) resp := MakeGetBlocksByNumResponse(rid, blocksBytes, sigs)
return makeMessageFromResponse(resp) return makeMessageFromResponse(resp)
} }
// MakeGetBlocksByNumResponseMessage make the GetBlocksByNumResponse of Response type // MakeGetBlocksByNumResponseMessage make the GetBlocksByNumResponse of Response type
func MakeGetBlocksByNumResponse(rid uint64, blocksBytes [][]byte) *Response { func MakeGetBlocksByNumResponse(rid uint64, blocksBytes, sigs [][]byte) *Response {
return &Response{ return &Response{
ReqId: rid, ReqId: rid,
Response: &Response_GetBlocksByNumResponse{ Response: &Response_GetBlocksByNumResponse{
GetBlocksByNumResponse: &GetBlocksByNumResponse{ GetBlocksByNumResponse: &GetBlocksByNumResponse{
BlocksBytes: blocksBytes, BlocksBytes: blocksBytes,
CommitSig: sigs,
}, },
}, },
} }
} }
// MakeGetBlocksByHashesResponseMessage makes the GetBlocksByHashesResponse of Message type // MakeGetBlocksByHashesResponseMessage makes the GetBlocksByHashesResponse of Message type
func MakeGetBlocksByHashesResponseMessage(rid uint64, blocksBytes [][]byte) *Message { func MakeGetBlocksByHashesResponseMessage(rid uint64, blocksBytes, sigs [][]byte) *Message {
resp := MakeGetBlocksByHashesResponse(rid, blocksBytes) resp := MakeGetBlocksByHashesResponse(rid, blocksBytes, sigs)
return makeMessageFromResponse(resp) return makeMessageFromResponse(resp)
} }
// MakeGetBlocksByHashesResponse make the GetBlocksByHashesResponse of Response type // MakeGetBlocksByHashesResponse make the GetBlocksByHashesResponse of Response type
func MakeGetBlocksByHashesResponse(rid uint64, blocksBytes [][]byte) *Response { func MakeGetBlocksByHashesResponse(rid uint64, blocksBytes [][]byte, sigs [][]byte) *Response {
return &Response{ return &Response{
ReqId: rid, ReqId: rid,
Response: &Response_GetBlocksByHashesResponse{ Response: &Response_GetBlocksByHashesResponse{
GetBlocksByHashesResponse: &GetBlocksByHashesResponse{ GetBlocksByHashesResponse: &GetBlocksByHashesResponse{
BlocksBytes: blocksBytes, BlocksBytes: blocksBytes,
CommitSig: sigs,
}, },
}, },
} }

@ -752,6 +752,7 @@ type GetBlocksByNumResponse struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
BlocksBytes [][]byte `protobuf:"bytes,1,rep,name=blocks_bytes,json=blocksBytes,proto3" json:"blocks_bytes,omitempty"` BlocksBytes [][]byte `protobuf:"bytes,1,rep,name=blocks_bytes,json=blocksBytes,proto3" json:"blocks_bytes,omitempty"`
CommitSig [][]byte `protobuf:"bytes,2,rep,name=commit_sig,json=commitSig,proto3" json:"commit_sig,omitempty"`
} }
func (x *GetBlocksByNumResponse) Reset() { func (x *GetBlocksByNumResponse) Reset() {
@ -793,12 +794,20 @@ func (x *GetBlocksByNumResponse) GetBlocksBytes() [][]byte {
return nil return nil
} }
func (x *GetBlocksByNumResponse) GetCommitSig() [][]byte {
if x != nil {
return x.CommitSig
}
return nil
}
type GetBlocksByHashesResponse struct { type GetBlocksByHashesResponse struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
BlocksBytes [][]byte `protobuf:"bytes,1,rep,name=blocks_bytes,json=blocksBytes,proto3" json:"blocks_bytes,omitempty"` BlocksBytes [][]byte `protobuf:"bytes,1,rep,name=blocks_bytes,json=blocksBytes,proto3" json:"blocks_bytes,omitempty"`
CommitSig [][]byte `protobuf:"bytes,2,rep,name=commit_sig,json=commitSig,proto3" json:"commit_sig,omitempty"`
} }
func (x *GetBlocksByHashesResponse) Reset() { func (x *GetBlocksByHashesResponse) Reset() {
@ -840,6 +849,13 @@ func (x *GetBlocksByHashesResponse) GetBlocksBytes() [][]byte {
return nil return nil
} }
func (x *GetBlocksByHashesResponse) GetCommitSig() [][]byte {
if x != nil {
return x.CommitSig
}
return nil
}
type GetEpochStateResponse struct { type GetEpochStateResponse struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -1015,22 +1031,25 @@ var file_msg_proto_rawDesc = []byte{
0x62, 0x65, 0x72, 0x22, 0x30, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x62, 0x65, 0x72, 0x22, 0x30, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48,
0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a,
0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x68,
0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0x3b, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0x5a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63,
0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x74, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x74,
0x65, 0x73, 0x22, 0x3e, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x69, 0x67,
0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x69,
0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x67, 0x22, 0x5d, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79,
0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x74, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21,
0x65, 0x73, 0x22, 0x5b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x53, 0x74, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01,
0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x74, 0x65,
0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x69, 0x67, 0x18,
0x0c, 0x52, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1f, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x69, 0x67,
0x0a, 0x0b, 0x73, 0x68, 0x61, 0x72, 0x64, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x22, 0x5b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74,
0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x68, 0x61, 0x72, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x65, 0x61,
0x09, 0x5a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52,
0x6f, 0x33, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b,
0x73, 0x68, 0x61, 0x72, 0x64, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x0a, 0x73, 0x68, 0x61, 0x72, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x09, 0x5a,
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

@ -65,10 +65,12 @@ message GetBlockHashesResponse {
message GetBlocksByNumResponse { message GetBlocksByNumResponse {
repeated bytes blocks_bytes = 1; repeated bytes blocks_bytes = 1;
repeated bytes commit_sig = 2;
} }
message GetBlocksByHashesResponse { message GetBlocksByHashesResponse {
repeated bytes blocks_bytes = 1; repeated bytes blocks_bytes = 1;
repeated bytes commit_sig = 2;
} }
message GetEpochStateResponse { message GetEpochStateResponse {

Loading…
Cancel
Save