initial version of client with required state sync functionalities

pull/4452/head
“GheisMohammadi” 1 year ago
parent 9df6215ab2
commit 2ca061c800
No known key found for this signature in database
GPG Key ID: 15073AED3829FE90
  1. 21
      consensus/engine/consensus_engine.go
  2. 15
      core/blockchain.go
  3. 18
      core/blockchain_impl.go
  4. 12
      core/blockchain_stub.go
  5. 4
      hmy/downloader/adapter_test.go
  6. 4
      internal/chain/engine_test.go
  7. 53
      p2p/stream/protocols/sync/chain.go
  8. 41
      p2p/stream/protocols/sync/chain_test.go
  9. 156
      p2p/stream/protocols/sync/client.go
  10. 8
      p2p/stream/protocols/sync/const.go
  11. 58
      p2p/stream/protocols/sync/message/compose.go
  12. 575
      p2p/stream/protocols/sync/message/msg.pb.go
  13. 19
      p2p/stream/protocols/sync/message/msg.proto
  14. 74
      p2p/stream/protocols/sync/stream.go
  15. 4
      test/chain/chain/chain_makers.go

@ -23,6 +23,27 @@ type ChainReader interface {
// Config retrieves the blockchain's chain configuration.
Config() *params.ChainConfig
// TrieNode retrieves a blob of data associated with a trie node
// either from ephemeral in-memory cache, or from persistent storage.
TrieNode(hash common.Hash) ([]byte, error)
// ContractCode retrieves a blob of data associated with a contract
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
ContractCode(hash common.Hash) ([]byte, error)
// ValidatorCode retrieves a blob of data associated with a validator
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
ValidatorCode(hash common.Hash) ([]byte, error)
// GetReceiptsByHash retrieves the receipts for all transactions in a given block.
GetReceiptsByHash(hash common.Hash) types.Receipts
// CurrentHeader retrieves the current header from the local chain.
CurrentHeader() *block.Header

@ -80,6 +80,21 @@ type BlockChain interface {
GetBlockByNumber(number uint64) *types.Block
// GetReceiptsByHash retrieves the receipts for all transactions in a given block.
GetReceiptsByHash(hash common.Hash) types.Receipts
// TrieNode retrieves a blob of data associated with a trie node
// either from ephemeral in-memory cache, or from persistent storage.
TrieNode(hash common.Hash) ([]byte, error)
// ContractCode retrieves a blob of data associated with a contract
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
ContractCode(hash common.Hash) ([]byte, error)
// ValidatorCode retrieves a blob of data associated with a validator
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
ValidatorCode(hash common.Hash) ([]byte, error)
// Stop stops the blockchain service. If any imports are currently in progress
// it will abort them using the procInterrupt.
Stop()

@ -1098,6 +1098,24 @@ func (bc *BlockChainImpl) GetBlocksFromHash(hash common.Hash, n int) (blocks []*
return
}
// ContractCode retrieves a blob of data associated with a contract
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
func (bc *BlockChainImpl) ContractCode(hash common.Hash) ([]byte, error) {
return bc.stateCache.ContractCode(common.Hash{}, hash)
}
// ValidatorCode retrieves a blob of data associated with a validator
// hash either from ephemeral in-memory cache, or from persistent storage.
//
// If the code doesn't exist in the in-memory cache, check the storage with
// new code scheme.
func (bc *BlockChainImpl) ValidatorCode(hash common.Hash) ([]byte, error) {
return bc.stateCache.ValidatorCode(common.Hash{}, hash)
}
func (bc *BlockChainImpl) GetUnclesInChain(b *types.Block, length int) []*block.Header {
uncles := []*block.Header{}
for i := 0; b != nil && i < length; i++ {

@ -62,6 +62,10 @@ func (a Stub) StateAt(common.Hash) (*state.DB, error) {
return nil, errors.Errorf("method StateAt not implemented for %s", a.Name)
}
func (a Stub) TrieNode(hash common.Hash) ([]byte, error) {
return []byte{}, errors.Errorf("method TrieNode not implemented for %s", a.Name)
}
func (a Stub) HasBlock(hash common.Hash, number uint64) bool {
return false
}
@ -90,6 +94,14 @@ func (a Stub) GetReceiptsByHash(hash common.Hash) types.Receipts {
return nil
}
func (a Stub) ContractCode(hash common.Hash) ([]byte, error) {
return []byte{}, nil
}
func (a Stub) ValidatorCode(hash common.Hash) ([]byte, error) {
return []byte{}, nil
}
func (a Stub) Stop() {
}

@ -88,12 +88,16 @@ func (bc *testBlockChain) changeBlockNumber(val uint64) {
func (bc *testBlockChain) ShardID() uint32 { return 0 }
func (bc *testBlockChain) ReadShardState(epoch *big.Int) (*shard.State, error) { return nil, nil }
func (bc *testBlockChain) TrieNode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *testBlockChain) Config() *params.ChainConfig { return nil }
func (bc *testBlockChain) WriteCommitSig(blockNum uint64, lastCommits []byte) error { return nil }
func (bc *testBlockChain) GetHeader(hash common.Hash, number uint64) *block.Header { return nil }
func (bc *testBlockChain) GetHeaderByNumber(number uint64) *block.Header { return nil }
func (bc *testBlockChain) GetHeaderByHash(hash common.Hash) *block.Header { return nil }
func (bc *testBlockChain) GetBlock(hash common.Hash, number uint64) *types.Block { return nil }
func (bc *testBlockChain) GetReceiptsByHash(hash common.Hash) types.Receipts { return nil }
func (bc *testBlockChain) ContractCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *testBlockChain) ValidatorCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *testBlockChain) ReadValidatorList() ([]common.Address, error) { return nil, nil }
func (bc *testBlockChain) ReadCommitSig(blockNum uint64) ([]byte, error) { return nil, nil }
func (bc *testBlockChain) ReadBlockRewardAccumulator(uint64) (*big.Int, error) { return nil, nil }

@ -323,8 +323,12 @@ func (bc *fakeBlockChain) CurrentHeader() *block.Header {
func (bc *fakeBlockChain) GetBlock(hash common.Hash, number uint64) *types.Block { return nil }
func (bc *fakeBlockChain) GetHeader(hash common.Hash, number uint64) *block.Header { return nil }
func (bc *fakeBlockChain) GetHeaderByHash(hash common.Hash) *block.Header { return nil }
func (bc *fakeBlockChain) GetReceiptsByHash(hash common.Hash) types.Receipts { return nil }
func (bc *fakeBlockChain) ContractCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *fakeBlockChain) ValidatorCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *fakeBlockChain) ShardID() uint32 { return 0 }
func (bc *fakeBlockChain) ReadShardState(epoch *big.Int) (*shard.State, error) { return nil, nil }
func (bc *fakeBlockChain) TrieNode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (bc *fakeBlockChain) WriteCommitSig(blockNum uint64, lastCommits []byte) error { return nil }
func (bc *fakeBlockChain) GetHeaderByNumber(number uint64) *block.Header { return nil }
func (bc *fakeBlockChain) ReadValidatorList() ([]common.Address, error) { return nil, nil }

@ -2,10 +2,12 @@ package sync
import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rlp"
"github.com/harmony-one/harmony/block"
"github.com/harmony-one/harmony/consensus/engine"
"github.com/harmony-one/harmony/core/types"
shardingconfig "github.com/harmony-one/harmony/internal/configs/sharding"
"github.com/harmony-one/harmony/internal/utils"
"github.com/harmony-one/harmony/internal/utils/keylocker"
"github.com/pkg/errors"
)
@ -16,6 +18,8 @@ type chainHelper interface {
getBlockHashes(bns []uint64) []common.Hash
getBlocksByNumber(bns []uint64) ([]*types.Block, error)
getBlocksByHashes(hs []common.Hash) ([]*types.Block, error)
getNodeData(hs []common.Hash) ([][]byte, error)
getReceipts(hs []common.Hash) ([][]byte, error)
}
type chainHelperImpl struct {
@ -139,3 +143,52 @@ func (ch *chainHelperImpl) getBlockSigFromNextBlock(header *block.Header) []byte
func (ch *chainHelperImpl) getBlockSigFromDB(header *block.Header) ([]byte, error) {
return ch.chain.ReadCommitSig(header.Number().Uint64())
}
// getNodeData assembles the response to a node data query.
func (ch *chainHelperImpl) getNodeData(hs []common.Hash) ([][]byte, error) {
var (
bytes int
nodes [][]byte
)
for _, hash := range hs {
// Retrieve the requested state entry
entry, err := ch.chain.TrieNode(hash)
if len(entry) == 0 || err != nil {
// Read the contract/validator code with prefix only to save unnecessary lookups.
entry, err = ch.chain.ContractCode(hash)
if len(entry) == 0 || err != nil {
entry, err = ch.chain.ValidatorCode(hash)
}
}
if err == nil && len(entry) > 0 {
nodes = append(nodes, entry)
bytes += len(entry)
}
}
return nodes, nil
}
// getReceipts assembles the response to a receipt query.
func (ch *chainHelperImpl) getReceipts(hs []common.Hash) ([][]byte, error) {
var (
bytes int
receipts [][]byte
)
for _, hash := range hs {
// Retrieve the requested block's receipts
results := ch.chain.GetReceiptsByHash(hash)
if results == nil {
if header := ch.chain.GetHeaderByHash(hash); header == nil || header.ReceiptHash() != types.EmptyRootHash {
continue
}
}
// If known, encode and queue for response packet
if encoded, err := rlp.EncodeToBytes(results); err != nil {
utils.Logger().Err(err).Msg("Failed to encode receipt")
} else {
receipts = append(receipts, encoded)
bytes += len(encoded)
}
}
return receipts, nil
}

@ -46,6 +46,21 @@ func (tch *testChainHelper) getBlocksByHashes(hs []common.Hash) ([]*types.Block,
return bs, nil
}
func (tch *testChainHelper) getNodeData(hs []common.Hash) ([][]byte, error) {
data := makeTestNodeData(len(hs))
return data, nil
}
func (tch *testChainHelper) getReceipts(hs []common.Hash) ([][]byte, error) {
testReceipts := makeTestReceipts(len(hs), 3)
receipts := make([][]byte, 0, len(hs)*3)
for _, r := range testReceipts {
receiptByes, _ := rlp.EncodeToBytes(r)
receipts = append(receipts, receiptByes)
}
return receipts, nil
}
func numberToHash(bn uint64) common.Hash {
var h common.Hash
binary.LittleEndian.PutUint64(h[:], bn)
@ -90,6 +105,32 @@ func makeTestBlock(bn uint64) *types.Block {
return types.NewBlockWithHeader(&block.Header{Header: header})
}
// makeTestReceipts creates fake node data
func makeTestNodeData(n int) [][]byte {
testData := make([][]byte, n)
for i := 0; i < n; i++ {
testData[i] = types.EmptyRootHash.Bytes()
}
return testData
}
// makeTestReceipts creates fake receipts
func makeTestReceipts(n int, nPerBlock int) []types.Receipts {
receipts := make([]*types.Receipt, nPerBlock)
for i := 0; i < nPerBlock; i++ {
receipts[i] = &types.Receipt{
Status: types.ReceiptStatusSuccessful,
CumulativeGasUsed: 0x888888888,
Logs: make([]*types.Log, 5),
}
}
allReceipts := make([]types.Receipts, n)
for i := 0; i < n; i++ {
allReceipts[i] = receipts
}
return allReceipts
}
func decodeBlocksBytes(bbs [][]byte) ([]*types.Block, error) {
blocks := make([]*types.Block, 0, len(bbs))

@ -15,6 +15,34 @@ import (
"github.com/pkg/errors"
)
// FetchNodeData do fetch node data through sync stream protocol.
// Return the state node data as result, and error
func (p *Protocol) FetchNodeData(ctx context.Context, hashes []common.Hash, opts ...Option) (data [][]byte, stid sttypes.StreamID, err error) {
timer := p.doMetricClientRequest("fetchNodeData")
defer p.doMetricPostClientRequest("fetchNodeData", err, timer)
if len(hashes) == 0 {
err = fmt.Errorf("zero hashes array requested")
return
}
if len(hashes) > GetNodeDataCap {
err = fmt.Errorf("number of node data hashes cap of %v", GetNodeDataCap)
return
}
req := newGetNodeDataRequest(hashes)
resp, stid, err := p.rm.DoRequest(ctx, req, opts...)
if err != nil {
// At this point, error can be context canceled, context timed out, or waiting queue
// is already full.
return
}
// Parse and return blocks
data, err = req.getNodeDataResponse(resp)
return
}
// GetBlocksByNumber do getBlocksByNumberRequest through sync stream protocol.
// Return the block as result, target stream id, and error
func (p *Protocol) GetBlocksByNumber(ctx context.Context, bns []uint64, opts ...Option) (blocks []*types.Block, stid sttypes.StreamID, err error) {
@ -387,3 +415,131 @@ func (req *getBlocksByHashesRequest) getBlocksFromResponse(resp sttypes.Response
}
return blocks, nil
}
// getNodeDataRequest is the request for get node data which implements
// sttypes.Request interface
type getNodeDataRequest struct {
hashes []common.Hash
pbReq *syncpb.Request
}
func newGetNodeDataRequest(hashes []common.Hash) *getNodeDataRequest {
pbReq := syncpb.MakeGetNodeDataRequest(hashes)
return &getNodeDataRequest{
hashes: hashes,
pbReq: pbReq,
}
}
func (req *getNodeDataRequest) ReqID() uint64 {
return req.pbReq.GetReqId()
}
func (req *getNodeDataRequest) SetReqID(val uint64) {
req.pbReq.ReqId = val
}
func (req *getNodeDataRequest) String() string {
ss := make([]string, 0, len(req.hashes))
for _, h := range req.hashes {
ss = append(ss, h.String())
}
hsStr := strings.Join(ss, ",")
return fmt.Sprintf("REQUEST [GetNodeData: %s]", hsStr)
}
func (req *getNodeDataRequest) IsSupportedByProto(target sttypes.ProtoSpec) bool {
return target.Version.GreaterThanOrEqual(MinVersion)
}
func (req *getNodeDataRequest) Encode() ([]byte, error) {
msg := syncpb.MakeMessageFromRequest(req.pbReq)
return protobuf.Marshal(msg)
}
func (req *getNodeDataRequest) getNodeDataResponse(resp sttypes.Response) ([][]byte, error) {
sResp, ok := resp.(*syncResponse)
if !ok || sResp == nil {
return nil, errors.New("not sync response for node data")
}
dataBytes, err := req.parseNodeDataBytes(sResp)
if err != nil {
return nil, err
}
return dataBytes, nil
}
func (req *getNodeDataRequest) parseNodeDataBytes(resp *syncResponse) ([][]byte, error) {
if errResp := resp.pb.GetErrorResponse(); errResp != nil {
return nil, errors.New(errResp.Error)
}
gbResp := resp.pb.GetGetNodeDataResponse()
if gbResp == nil {
return nil, errors.New("The response is not for GetNodeData")
}
return gbResp.DataBytes, nil
}
// getReceiptsRequest is the request for get receipts which implements
// sttypes.Request interface
type getReceiptsRequest struct {
hashes []common.Hash
pbReq *syncpb.Request
}
func newGetReceiptsRequest(hashes []common.Hash) *getReceiptsRequest {
pbReq := syncpb.MakeGetReceiptsRequest(hashes)
return &getReceiptsRequest{
hashes: hashes,
pbReq: pbReq,
}
}
func (req *getReceiptsRequest) ReqID() uint64 {
return req.pbReq.GetReqId()
}
func (req *getReceiptsRequest) SetReqID(val uint64) {
req.pbReq.ReqId = val
}
func (req *getReceiptsRequest) String() string {
ss := make([]string, 0, len(req.hashes))
for _, h := range req.hashes {
ss = append(ss, h.String())
}
hsStr := strings.Join(ss, ",")
return fmt.Sprintf("REQUEST [GetReceipts: %s]", hsStr)
}
func (req *getReceiptsRequest) IsSupportedByProto(target sttypes.ProtoSpec) bool {
return target.Version.GreaterThanOrEqual(MinVersion)
}
func (req *getReceiptsRequest) Encode() ([]byte, error) {
msg := syncpb.MakeMessageFromRequest(req.pbReq)
return protobuf.Marshal(msg)
}
func (req *getReceiptsRequest) getReceiptsResponse(resp sttypes.Response) ([][]byte, error) {
sResp, ok := resp.(*syncResponse)
if !ok || sResp == nil {
return nil, errors.New("not sync response for receipts")
}
receiptsBytes, err := req.parseGetReceiptsBytes(sResp)
if err != nil {
return nil, err
}
return receiptsBytes, nil
}
func (req *getReceiptsRequest) parseGetReceiptsBytes(resp *syncResponse) ([][]byte, error) {
if errResp := resp.pb.GetErrorResponse(); errResp != nil {
return nil, errors.New(errResp.Error)
}
gbResp := resp.pb.GetGetReceiptsResponse()
if gbResp == nil {
return nil, errors.New("The response is not for GetReceipts")
}
return gbResp.ReceiptsBytes, nil
}

@ -17,6 +17,14 @@ const (
// See comments for GetBlocksByNumAmountCap.
GetBlocksByHashesAmountCap = 10
// GetNodeDataCap is the cap of request of single GetNodeData request
// This number has an effect on maxMsgBytes as 20MB defined in github.com/harmony-one/harmony/p2p/stream/types.
GetNodeDataCap = 10
// GetReceiptsCap is the cap of request of single GetReceipts request
// This number has an effect on maxMsgBytes as 20MB defined in github.com/harmony-one/harmony/p2p/stream/types.
GetReceiptsCap = 10
// MaxStreamFailures is the maximum allowed failures before stream gets removed
MaxStreamFailures = 3

@ -46,6 +46,28 @@ func MakeGetBlocksByHashesRequest(hashes []common.Hash) *Request {
}
}
// MakeGetNodeDataRequest makes the GetNodeData request
func MakeGetNodeDataRequest(hashes []common.Hash) *Request {
return &Request{
Request: &Request_GetNodeDataRequest{
GetNodeDataRequest: &GetNodeDataRequest{
NodeHashes: hashesToBytes(hashes),
},
},
}
}
// MakeGetReceiptsRequest makes the GetReceipts request
func MakeGetReceiptsRequest(hashes []common.Hash) *Request {
return &Request{
Request: &Request_GetReceiptsRequest{
GetReceiptsRequest: &GetReceiptsRequest{
BlockHashes: hashesToBytes(hashes),
},
},
}
}
// MakeErrorResponse makes the error response
func MakeErrorResponseMessage(rid uint64, err error) *Message {
resp := MakeErrorResponse(rid, err)
@ -138,6 +160,42 @@ func MakeGetBlocksByHashesResponse(rid uint64, blocksBytes [][]byte, sigs [][]by
}
}
// MakeGetNodeDataResponseMessage makes the GetNodeDataResponse of Message type
func MakeGetNodeDataResponseMessage(rid uint64, nodeData [][]byte) *Message {
resp := MakeGetNodeDataResponse(rid, nodeData)
return makeMessageFromResponse(resp)
}
// MakeGetNodeDataResponse make the GetNodeDataResponse of Response type
func MakeGetNodeDataResponse(rid uint64, nodeData [][]byte) *Response {
return &Response{
ReqId: rid,
Response: &Response_GetNodeDataResponse{
GetNodeDataResponse: &GetNodeDataResponse{
DataBytes: nodeData,
},
},
}
}
// MakeGetReceiptsResponseMessage makes the GetReceiptsResponse of Message type
func MakeGetReceiptsResponseMessage(rid uint64, receiptsBytes [][]byte) *Message {
resp := MakeGetReceiptsResponse(rid, receiptsBytes)
return makeMessageFromResponse(resp)
}
// MakeGetReceiptsResponse make the GetReceiptsResponse of Response type
func MakeGetReceiptsResponse(rid uint64, receiptsBytes [][]byte) *Response {
return &Response{
ReqId: rid,
Response: &Response_GetReceiptsResponse{
GetReceiptsResponse: &GetReceiptsResponse{
ReceiptsBytes: receiptsBytes,
},
},
}
}
// MakeMessageFromRequest makes a message from the request
func MakeMessageFromRequest(req *Request) *Message {
return &Message{

@ -7,10 +7,11 @@
package message
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
@ -113,6 +114,8 @@ type Request struct {
// *Request_GetBlockHashesRequest
// *Request_GetBlocksByNumRequest
// *Request_GetBlocksByHashesRequest
// *Request_GetNodeDataRequest
// *Request_GetReceiptsRequest
Request isRequest_Request `protobuf_oneof:"request"`
}
@ -190,6 +193,20 @@ func (x *Request) GetGetBlocksByHashesRequest() *GetBlocksByHashesRequest {
return nil
}
func (x *Request) GetGetNodeDataRequest() *GetNodeDataRequest {
if x, ok := x.GetRequest().(*Request_GetNodeDataRequest); ok {
return x.GetNodeDataRequest
}
return nil
}
func (x *Request) GetGetReceiptsRequest() *GetReceiptsRequest {
if x, ok := x.GetRequest().(*Request_GetReceiptsRequest); ok {
return x.GetReceiptsRequest
}
return nil
}
type isRequest_Request interface {
isRequest_Request()
}
@ -210,6 +227,14 @@ type Request_GetBlocksByHashesRequest struct {
GetBlocksByHashesRequest *GetBlocksByHashesRequest `protobuf:"bytes,5,opt,name=get_blocks_by_hashes_request,json=getBlocksByHashesRequest,proto3,oneof"`
}
type Request_GetNodeDataRequest struct {
GetNodeDataRequest *GetNodeDataRequest `protobuf:"bytes,6,opt,name=get_node_data_request,json=getNodeDataRequest,proto3,oneof"`
}
type Request_GetReceiptsRequest struct {
GetReceiptsRequest *GetReceiptsRequest `protobuf:"bytes,7,opt,name=get_receipts_request,json=getReceiptsRequest,proto3,oneof"`
}
func (*Request_GetBlockNumberRequest) isRequest_Request() {}
func (*Request_GetBlockHashesRequest) isRequest_Request() {}
@ -218,6 +243,10 @@ func (*Request_GetBlocksByNumRequest) isRequest_Request() {}
func (*Request_GetBlocksByHashesRequest) isRequest_Request() {}
func (*Request_GetNodeDataRequest) isRequest_Request() {}
func (*Request_GetReceiptsRequest) isRequest_Request() {}
type GetBlockNumberRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -397,6 +426,100 @@ func (x *GetBlocksByHashesRequest) GetBlockHashes() [][]byte {
return nil
}
type GetNodeDataRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
NodeHashes [][]byte `protobuf:"bytes,1,rep,name=node_hashes,json=nodeHashes,proto3" json:"node_hashes,omitempty"`
}
func (x *GetNodeDataRequest) Reset() {
*x = GetNodeDataRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetNodeDataRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetNodeDataRequest) ProtoMessage() {}
func (x *GetNodeDataRequest) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetNodeDataRequest.ProtoReflect.Descriptor instead.
func (*GetNodeDataRequest) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{6}
}
func (x *GetNodeDataRequest) GetNodeHashes() [][]byte {
if x != nil {
return x.NodeHashes
}
return nil
}
type GetReceiptsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
BlockHashes [][]byte `protobuf:"bytes,1,rep,name=block_hashes,json=blockHashes,proto3" json:"block_hashes,omitempty"`
}
func (x *GetReceiptsRequest) Reset() {
*x = GetReceiptsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetReceiptsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetReceiptsRequest) ProtoMessage() {}
func (x *GetReceiptsRequest) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetReceiptsRequest.ProtoReflect.Descriptor instead.
func (*GetReceiptsRequest) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{7}
}
func (x *GetReceiptsRequest) GetBlockHashes() [][]byte {
if x != nil {
return x.BlockHashes
}
return nil
}
type Response struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -410,13 +533,15 @@ type Response struct {
// *Response_GetBlockHashesResponse
// *Response_GetBlocksByNumResponse
// *Response_GetBlocksByHashesResponse
// *Response_GetNodeDataResponse
// *Response_GetReceiptsResponse
Response isResponse_Response `protobuf_oneof:"response"`
}
func (x *Response) Reset() {
*x = Response{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[6]
mi := &file_msg_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -429,7 +554,7 @@ func (x *Response) String() string {
func (*Response) ProtoMessage() {}
func (x *Response) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[6]
mi := &file_msg_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -442,7 +567,7 @@ func (x *Response) ProtoReflect() protoreflect.Message {
// Deprecated: Use Response.ProtoReflect.Descriptor instead.
func (*Response) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{6}
return file_msg_proto_rawDescGZIP(), []int{8}
}
func (x *Response) GetReqId() uint64 {
@ -494,6 +619,20 @@ func (x *Response) GetGetBlocksByHashesResponse() *GetBlocksByHashesResponse {
return nil
}
func (x *Response) GetGetNodeDataResponse() *GetNodeDataResponse {
if x, ok := x.GetResponse().(*Response_GetNodeDataResponse); ok {
return x.GetNodeDataResponse
}
return nil
}
func (x *Response) GetGetReceiptsResponse() *GetReceiptsResponse {
if x, ok := x.GetResponse().(*Response_GetReceiptsResponse); ok {
return x.GetReceiptsResponse
}
return nil
}
type isResponse_Response interface {
isResponse_Response()
}
@ -518,6 +657,14 @@ type Response_GetBlocksByHashesResponse struct {
GetBlocksByHashesResponse *GetBlocksByHashesResponse `protobuf:"bytes,6,opt,name=get_blocks_by_hashes_response,json=getBlocksByHashesResponse,proto3,oneof"`
}
type Response_GetNodeDataResponse struct {
GetNodeDataResponse *GetNodeDataResponse `protobuf:"bytes,7,opt,name=get_node_data_response,json=getNodeDataResponse,proto3,oneof"`
}
type Response_GetReceiptsResponse struct {
GetReceiptsResponse *GetReceiptsResponse `protobuf:"bytes,8,opt,name=get_receipts_response,json=getReceiptsResponse,proto3,oneof"`
}
func (*Response_ErrorResponse) isResponse_Response() {}
func (*Response_GetBlockNumberResponse) isResponse_Response() {}
@ -528,6 +675,10 @@ func (*Response_GetBlocksByNumResponse) isResponse_Response() {}
func (*Response_GetBlocksByHashesResponse) isResponse_Response() {}
func (*Response_GetNodeDataResponse) isResponse_Response() {}
func (*Response_GetReceiptsResponse) isResponse_Response() {}
type ErrorResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -539,7 +690,7 @@ type ErrorResponse struct {
func (x *ErrorResponse) Reset() {
*x = ErrorResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[7]
mi := &file_msg_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -552,7 +703,7 @@ func (x *ErrorResponse) String() string {
func (*ErrorResponse) ProtoMessage() {}
func (x *ErrorResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[7]
mi := &file_msg_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -565,7 +716,7 @@ func (x *ErrorResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ErrorResponse.ProtoReflect.Descriptor instead.
func (*ErrorResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{7}
return file_msg_proto_rawDescGZIP(), []int{9}
}
func (x *ErrorResponse) GetError() string {
@ -586,7 +737,7 @@ type GetBlockNumberResponse struct {
func (x *GetBlockNumberResponse) Reset() {
*x = GetBlockNumberResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[8]
mi := &file_msg_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -599,7 +750,7 @@ func (x *GetBlockNumberResponse) String() string {
func (*GetBlockNumberResponse) ProtoMessage() {}
func (x *GetBlockNumberResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[8]
mi := &file_msg_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -612,7 +763,7 @@ func (x *GetBlockNumberResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetBlockNumberResponse.ProtoReflect.Descriptor instead.
func (*GetBlockNumberResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{8}
return file_msg_proto_rawDescGZIP(), []int{10}
}
func (x *GetBlockNumberResponse) GetNumber() uint64 {
@ -633,7 +784,7 @@ type GetBlockHashesResponse struct {
func (x *GetBlockHashesResponse) Reset() {
*x = GetBlockHashesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[9]
mi := &file_msg_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -646,7 +797,7 @@ func (x *GetBlockHashesResponse) String() string {
func (*GetBlockHashesResponse) ProtoMessage() {}
func (x *GetBlockHashesResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[9]
mi := &file_msg_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -659,7 +810,7 @@ func (x *GetBlockHashesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetBlockHashesResponse.ProtoReflect.Descriptor instead.
func (*GetBlockHashesResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{9}
return file_msg_proto_rawDescGZIP(), []int{11}
}
func (x *GetBlockHashesResponse) GetHashes() [][]byte {
@ -681,7 +832,7 @@ type GetBlocksByNumResponse struct {
func (x *GetBlocksByNumResponse) Reset() {
*x = GetBlocksByNumResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[10]
mi := &file_msg_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -694,7 +845,7 @@ func (x *GetBlocksByNumResponse) String() string {
func (*GetBlocksByNumResponse) ProtoMessage() {}
func (x *GetBlocksByNumResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[10]
mi := &file_msg_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -707,7 +858,7 @@ func (x *GetBlocksByNumResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetBlocksByNumResponse.ProtoReflect.Descriptor instead.
func (*GetBlocksByNumResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{10}
return file_msg_proto_rawDescGZIP(), []int{12}
}
func (x *GetBlocksByNumResponse) GetBlocksBytes() [][]byte {
@ -736,7 +887,7 @@ type GetBlocksByHashesResponse struct {
func (x *GetBlocksByHashesResponse) Reset() {
*x = GetBlocksByHashesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[11]
mi := &file_msg_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -749,7 +900,7 @@ func (x *GetBlocksByHashesResponse) String() string {
func (*GetBlocksByHashesResponse) ProtoMessage() {}
func (x *GetBlocksByHashesResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[11]
mi := &file_msg_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -762,7 +913,7 @@ func (x *GetBlocksByHashesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetBlocksByHashesResponse.ProtoReflect.Descriptor instead.
func (*GetBlocksByHashesResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{11}
return file_msg_proto_rawDescGZIP(), []int{13}
}
func (x *GetBlocksByHashesResponse) GetBlocksBytes() [][]byte {
@ -779,6 +930,100 @@ func (x *GetBlocksByHashesResponse) GetCommitSig() [][]byte {
return nil
}
type GetNodeDataResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
DataBytes [][]byte `protobuf:"bytes,1,rep,name=data_bytes,json=dataBytes,proto3" json:"data_bytes,omitempty"`
}
func (x *GetNodeDataResponse) Reset() {
*x = GetNodeDataResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetNodeDataResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetNodeDataResponse) ProtoMessage() {}
func (x *GetNodeDataResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetNodeDataResponse.ProtoReflect.Descriptor instead.
func (*GetNodeDataResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{14}
}
func (x *GetNodeDataResponse) GetDataBytes() [][]byte {
if x != nil {
return x.DataBytes
}
return nil
}
type GetReceiptsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ReceiptsBytes [][]byte `protobuf:"bytes,1,rep,name=receipts_bytes,json=receiptsBytes,proto3" json:"receipts_bytes,omitempty"`
}
func (x *GetReceiptsResponse) Reset() {
*x = GetReceiptsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_msg_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetReceiptsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetReceiptsResponse) ProtoMessage() {}
func (x *GetReceiptsResponse) ProtoReflect() protoreflect.Message {
mi := &file_msg_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetReceiptsResponse.ProtoReflect.Descriptor instead.
func (*GetReceiptsResponse) Descriptor() ([]byte, []int) {
return file_msg_proto_rawDescGZIP(), []int{15}
}
func (x *GetReceiptsResponse) GetReceiptsBytes() [][]byte {
if x != nil {
return x.ReceiptsBytes
}
return nil
}
var File_msg_proto protoreflect.FileDescriptor
var file_msg_proto_rawDesc = []byte{
@ -793,7 +1038,7 @@ var file_msg_proto_rawDesc = []byte{
0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79,
0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x04, 0x72, 0x65, 0x73, 0x70, 0x42, 0x0d, 0x0a, 0x0b, 0x72,
0x65, 0x71, 0x5f, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x22, 0xf2, 0x03, 0x0a, 0x07, 0x52,
0x65, 0x71, 0x5f, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x22, 0xbd, 0x05, 0x0a, 0x07, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x71, 0x5f, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x65, 0x71, 0x49, 0x64, 0x12, 0x6d, 0x0a,
0x18, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65,
@ -824,77 +1069,117 @@ var file_msg_proto_rawDesc = []byte{
0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x18, 0x67, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22,
0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65,
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x2f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x16, 0x0a, 0x04, 0x6e, 0x75, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x42,
0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x75, 0x6d, 0x73, 0x22, 0x2f, 0x0a, 0x15, 0x47, 0x65, 0x74,
0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x16, 0x0a, 0x04, 0x6e, 0x75, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04,
0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x75, 0x6d, 0x73, 0x22, 0x3d, 0x0a, 0x18, 0x47, 0x65,
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f,
0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c,
0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0xd5, 0x04, 0x0a, 0x08, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x71, 0x5f, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x65, 0x71, 0x49, 0x64, 0x12, 0x53, 0x0a,
0x0e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e,
0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x48, 0x00, 0x52, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x70, 0x0a, 0x19, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f,
0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e,
0x75, 0x65, 0x73, 0x74, 0x12, 0x64, 0x0a, 0x15, 0x67, 0x65, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65,
0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x12, 0x67, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44,
0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x63, 0x0a, 0x14, 0x67, 0x65,
0x74, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f,
0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70,
0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x12, 0x67, 0x65, 0x74,
0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42,
0x09, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65,
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x22, 0x2f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48,
0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x04,
0x6e, 0x75, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04,
0x6e, 0x75, 0x6d, 0x73, 0x22, 0x2f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b,
0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a,
0x04, 0x6e, 0x75, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x01, 0x52,
0x04, 0x6e, 0x75, 0x6d, 0x73, 0x22, 0x3d, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63,
0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61,
0x73, 0x68, 0x65, 0x73, 0x22, 0x35, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44,
0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x6f,
0x64, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52,
0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0x37, 0x0a, 0x12, 0x47,
0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61,
0x73, 0x68, 0x65, 0x73, 0x22, 0xa6, 0x06, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x71, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x04, 0x52, 0x05, 0x72, 0x65, 0x71, 0x49, 0x64, 0x12, 0x53, 0x0a, 0x0e, 0x65, 0x72, 0x72, 0x6f,
0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x2a, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x45,
0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x0d,
0x65, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a,
0x19, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65,
0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x33, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47,
0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x16, 0x67, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63,
0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x70, 0x0a, 0x19, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73,
0x68, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x33, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72,
0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x16, 0x67, 0x65, 0x74, 0x42, 0x6c,
0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x71, 0x0a, 0x1a, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f,
0x62, 0x79, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18,
0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e,
0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62,
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x16, 0x67, 0x65,
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, 0x19, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63,
0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e,
0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61,
0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x16,
0x67, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x1a, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c,
0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x68, 0x61, 0x72,
0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63,
0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63,
0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48,
0x00, 0x52, 0x16, 0x67, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75,
0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7a, 0x0a, 0x1d, 0x67, 0x65, 0x74,
0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65,
0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x36, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61,
0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x4e,
0x75, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x16, 0x67, 0x65,
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7a, 0x0a, 0x1d, 0x67, 0x65, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63,
0x6b, 0x73, 0x5f, 0x62, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x68, 0x61,
0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e,
0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f,
0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x19, 0x67, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73,
0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x67, 0x0a, 0x16, 0x67, 0x65, 0x74, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x64, 0x61, 0x74,
0x61, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x30, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47,
0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x19, 0x67, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x25, 0x0a, 0x0d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x30, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 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, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01,
0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x68, 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, 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, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d,
0x6d, 0x69, 0x74, 0x5f, 0x73, 0x69, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x63,
0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x53, 0x69, 0x67, 0x22, 0x5d, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x42,
0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 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, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f,
0x63, 0x6b, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
0x69, 0x74, 0x5f, 0x73, 0x69, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f,
0x6d, 0x6d, 0x69, 0x74, 0x53, 0x69, 0x67, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x2f, 0x3b, 0x6d, 0x65,
0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x48, 0x00, 0x52, 0x13, 0x67, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44, 0x61, 0x74,
0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x15, 0x67, 0x65, 0x74,
0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x68, 0x61, 0x72, 0x6d, 0x6f,
0x6e, 0x79, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70,
0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x13, 0x67, 0x65,
0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x0a,
0x0d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14,
0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65,
0x72, 0x72, 0x6f, 0x72, 0x22, 0x30, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b,
0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16,
0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06,
0x6e, 0x75, 0x6d, 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, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c,
0x52, 0x06, 0x68, 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, 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, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f,
0x73, 0x69, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69,
0x74, 0x53, 0x69, 0x67, 0x22, 0x5d, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b,
0x73, 0x42, 0x79, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 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, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x42,
0x79, 0x74, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x73,
0x69, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x53, 0x69, 0x67, 0x22, 0x34, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x44, 0x61,
0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x61,
0x74, 0x61, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09,
0x64, 0x61, 0x74, 0x61, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x3c, 0x0a, 0x13, 0x47, 0x65, 0x74,
0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x73, 0x5f, 0x62, 0x79, 0x74,
0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0d, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70,
0x74, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x2f, 0x3b, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
@ -910,7 +1195,7 @@ func file_msg_proto_rawDescGZIP() []byte {
return file_msg_proto_rawDescData
}
var file_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
var file_msg_proto_goTypes = []interface{}{
(*Message)(nil), // 0: harmony.stream.sync.message.Message
(*Request)(nil), // 1: harmony.stream.sync.message.Request
@ -918,30 +1203,38 @@ var file_msg_proto_goTypes = []interface{}{
(*GetBlockHashesRequest)(nil), // 3: harmony.stream.sync.message.GetBlockHashesRequest
(*GetBlocksByNumRequest)(nil), // 4: harmony.stream.sync.message.GetBlocksByNumRequest
(*GetBlocksByHashesRequest)(nil), // 5: harmony.stream.sync.message.GetBlocksByHashesRequest
(*Response)(nil), // 6: harmony.stream.sync.message.Response
(*ErrorResponse)(nil), // 7: harmony.stream.sync.message.ErrorResponse
(*GetBlockNumberResponse)(nil), // 8: harmony.stream.sync.message.GetBlockNumberResponse
(*GetBlockHashesResponse)(nil), // 9: harmony.stream.sync.message.GetBlockHashesResponse
(*GetBlocksByNumResponse)(nil), // 10: harmony.stream.sync.message.GetBlocksByNumResponse
(*GetBlocksByHashesResponse)(nil), // 11: harmony.stream.sync.message.GetBlocksByHashesResponse
(*GetNodeDataRequest)(nil), // 6: harmony.stream.sync.message.GetNodeDataRequest
(*GetReceiptsRequest)(nil), // 7: harmony.stream.sync.message.GetReceiptsRequest
(*Response)(nil), // 8: harmony.stream.sync.message.Response
(*ErrorResponse)(nil), // 9: harmony.stream.sync.message.ErrorResponse
(*GetBlockNumberResponse)(nil), // 10: harmony.stream.sync.message.GetBlockNumberResponse
(*GetBlockHashesResponse)(nil), // 11: harmony.stream.sync.message.GetBlockHashesResponse
(*GetBlocksByNumResponse)(nil), // 12: harmony.stream.sync.message.GetBlocksByNumResponse
(*GetBlocksByHashesResponse)(nil), // 13: harmony.stream.sync.message.GetBlocksByHashesResponse
(*GetNodeDataResponse)(nil), // 14: harmony.stream.sync.message.GetNodeDataResponse
(*GetReceiptsResponse)(nil), // 15: harmony.stream.sync.message.GetReceiptsResponse
}
var file_msg_proto_depIdxs = []int32{
1, // 0: harmony.stream.sync.message.Message.req:type_name -> harmony.stream.sync.message.Request
6, // 1: harmony.stream.sync.message.Message.resp:type_name -> harmony.stream.sync.message.Response
8, // 1: harmony.stream.sync.message.Message.resp:type_name -> harmony.stream.sync.message.Response
2, // 2: harmony.stream.sync.message.Request.get_block_number_request:type_name -> harmony.stream.sync.message.GetBlockNumberRequest
3, // 3: harmony.stream.sync.message.Request.get_block_hashes_request:type_name -> harmony.stream.sync.message.GetBlockHashesRequest
4, // 4: harmony.stream.sync.message.Request.get_blocks_by_num_request:type_name -> harmony.stream.sync.message.GetBlocksByNumRequest
5, // 5: harmony.stream.sync.message.Request.get_blocks_by_hashes_request:type_name -> harmony.stream.sync.message.GetBlocksByHashesRequest
7, // 6: harmony.stream.sync.message.Response.error_response:type_name -> harmony.stream.sync.message.ErrorResponse
8, // 7: harmony.stream.sync.message.Response.get_block_number_response:type_name -> harmony.stream.sync.message.GetBlockNumberResponse
9, // 8: harmony.stream.sync.message.Response.get_block_hashes_response:type_name -> harmony.stream.sync.message.GetBlockHashesResponse
10, // 9: harmony.stream.sync.message.Response.get_blocks_by_num_response:type_name -> harmony.stream.sync.message.GetBlocksByNumResponse
11, // 10: harmony.stream.sync.message.Response.get_blocks_by_hashes_response:type_name -> harmony.stream.sync.message.GetBlocksByHashesResponse
11, // [11:11] is the sub-list for method output_type
11, // [11:11] is the sub-list for method input_type
11, // [11:11] is the sub-list for extension type_name
11, // [11:11] is the sub-list for extension extendee
0, // [0:11] is the sub-list for field type_name
6, // 6: harmony.stream.sync.message.Request.get_node_data_request:type_name -> harmony.stream.sync.message.GetNodeDataRequest
7, // 7: harmony.stream.sync.message.Request.get_receipts_request:type_name -> harmony.stream.sync.message.GetReceiptsRequest
9, // 8: harmony.stream.sync.message.Response.error_response:type_name -> harmony.stream.sync.message.ErrorResponse
10, // 9: harmony.stream.sync.message.Response.get_block_number_response:type_name -> harmony.stream.sync.message.GetBlockNumberResponse
11, // 10: harmony.stream.sync.message.Response.get_block_hashes_response:type_name -> harmony.stream.sync.message.GetBlockHashesResponse
12, // 11: harmony.stream.sync.message.Response.get_blocks_by_num_response:type_name -> harmony.stream.sync.message.GetBlocksByNumResponse
13, // 12: harmony.stream.sync.message.Response.get_blocks_by_hashes_response:type_name -> harmony.stream.sync.message.GetBlocksByHashesResponse
14, // 13: harmony.stream.sync.message.Response.get_node_data_response:type_name -> harmony.stream.sync.message.GetNodeDataResponse
15, // 14: harmony.stream.sync.message.Response.get_receipts_response:type_name -> harmony.stream.sync.message.GetReceiptsResponse
15, // [15:15] is the sub-list for method output_type
15, // [15:15] is the sub-list for method input_type
15, // [15:15] is the sub-list for extension type_name
15, // [15:15] is the sub-list for extension extendee
0, // [0:15] is the sub-list for field type_name
}
func init() { file_msg_proto_init() }
@ -1023,7 +1316,7 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Response); i {
switch v := v.(*GetNodeDataRequest); i {
case 0:
return &v.state
case 1:
@ -1035,7 +1328,7 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ErrorResponse); i {
switch v := v.(*GetReceiptsRequest); i {
case 0:
return &v.state
case 1:
@ -1047,7 +1340,7 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlockNumberResponse); i {
switch v := v.(*Response); i {
case 0:
return &v.state
case 1:
@ -1059,7 +1352,7 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlockHashesResponse); i {
switch v := v.(*ErrorResponse); i {
case 0:
return &v.state
case 1:
@ -1071,7 +1364,7 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlocksByNumResponse); i {
switch v := v.(*GetBlockNumberResponse); i {
case 0:
return &v.state
case 1:
@ -1083,6 +1376,30 @@ func file_msg_proto_init() {
}
}
file_msg_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlockHashesResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_msg_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlocksByNumResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_msg_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBlocksByHashesResponse); i {
case 0:
return &v.state
@ -1094,6 +1411,30 @@ func file_msg_proto_init() {
return nil
}
}
file_msg_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetNodeDataResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_msg_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetReceiptsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_msg_proto_msgTypes[0].OneofWrappers = []interface{}{
(*Message_Req)(nil),
@ -1104,13 +1445,17 @@ func file_msg_proto_init() {
(*Request_GetBlockHashesRequest)(nil),
(*Request_GetBlocksByNumRequest)(nil),
(*Request_GetBlocksByHashesRequest)(nil),
(*Request_GetNodeDataRequest)(nil),
(*Request_GetReceiptsRequest)(nil),
}
file_msg_proto_msgTypes[6].OneofWrappers = []interface{}{
file_msg_proto_msgTypes[8].OneofWrappers = []interface{}{
(*Response_ErrorResponse)(nil),
(*Response_GetBlockNumberResponse)(nil),
(*Response_GetBlockHashesResponse)(nil),
(*Response_GetBlocksByNumResponse)(nil),
(*Response_GetBlocksByHashesResponse)(nil),
(*Response_GetNodeDataResponse)(nil),
(*Response_GetReceiptsResponse)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -1118,7 +1463,7 @@ func file_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 12,
NumMessages: 16,
NumExtensions: 0,
NumServices: 0,
},

@ -17,6 +17,8 @@ message Request {
GetBlockHashesRequest get_block_hashes_request = 3;
GetBlocksByNumRequest get_blocks_by_num_request = 4;
GetBlocksByHashesRequest get_blocks_by_hashes_request = 5;
GetNodeDataRequest get_node_data_request = 6;
GetReceiptsRequest get_receipts_request = 7;
}
}
@ -34,6 +36,14 @@ message GetBlocksByHashesRequest {
repeated bytes block_hashes = 1;
}
message GetNodeDataRequest {
repeated bytes node_hashes = 1;
}
message GetReceiptsRequest {
repeated bytes block_hashes = 1;
}
message Response {
uint64 req_id = 1;
oneof response {
@ -42,6 +52,8 @@ message Response {
GetBlockHashesResponse get_block_hashes_response = 4;
GetBlocksByNumResponse get_blocks_by_num_response = 5;
GetBlocksByHashesResponse get_blocks_by_hashes_response = 6;
GetNodeDataResponse get_node_data_response = 7;
GetReceiptsResponse get_receipts_response = 8;
}
}
@ -67,5 +79,12 @@ message GetBlocksByHashesResponse {
repeated bytes commit_sig = 2;
}
message GetNodeDataResponse {
repeated bytes data_bytes = 1;
}
message GetReceiptsResponse {
repeated bytes receipts_bytes = 1;
}

@ -182,6 +182,12 @@ func (st *syncStream) handleReq(req *syncpb.Request) error {
if bhReq := req.GetGetBlocksByHashesRequest(); bhReq != nil {
return st.handleGetBlocksByHashesRequest(req.ReqId, bhReq)
}
if ndReq := req.GetGetNodeDataRequest(); ndReq != nil {
return st.handleGetNodeDataRequest(req.ReqId, ndReq)
}
if rReq := req.GetGetReceiptsRequest(); rReq != nil {
return st.handleGetReceiptsRequest(req.ReqId, rReq)
}
// unsupported request type
return st.handleUnknownRequest(req.ReqId)
}
@ -260,6 +266,48 @@ func (st *syncStream) handleGetBlocksByHashesRequest(rid uint64, req *syncpb.Get
return errors.Wrap(err, "[GetBlocksByHashes]")
}
func (st *syncStream) handleGetNodeDataRequest(rid uint64, req *syncpb.GetNodeDataRequest) error {
serverRequestCounterVec.With(prometheus.Labels{
"topic": string(st.ProtoID()),
"request_type": "getNodeData",
}).Inc()
hashes := bytesToHashes(req.NodeHashes)
resp, err := st.computeGetNodeData(rid, hashes)
if resp == nil && err != nil {
resp = syncpb.MakeErrorResponseMessage(rid, err)
}
if writeErr := st.writeMsg(resp); writeErr != nil {
if err == nil {
err = writeErr
} else {
err = fmt.Errorf("%v; [writeMsg] %v", err.Error(), writeErr)
}
}
return errors.Wrap(err, "[GetNodeData]")
}
func (st *syncStream) handleGetReceiptsRequest(rid uint64, req *syncpb.GetReceiptsRequest) error {
serverRequestCounterVec.With(prometheus.Labels{
"topic": string(st.ProtoID()),
"request_type": "getReceipts",
}).Inc()
hashes := bytesToHashes(req.BlockHashes)
resp, err := st.computeGetReceipts(rid, hashes)
if resp == nil && err != nil {
resp = syncpb.MakeErrorResponseMessage(rid, err)
}
if writeErr := st.writeMsg(resp); writeErr != nil {
if err == nil {
err = writeErr
} else {
err = fmt.Errorf("%v; [writeMsg] %v", err.Error(), writeErr)
}
}
return errors.Wrap(err, "[GetReceipts]")
}
func (st *syncStream) handleUnknownRequest(rid uint64) error {
serverRequestCounterVec.With(prometheus.Labels{
"topic": string(st.ProtoID()),
@ -367,6 +415,32 @@ func (st *syncStream) computeRespFromBlockHashes(rid uint64, hs []common.Hash) (
return syncpb.MakeGetBlocksByHashesResponseMessage(rid, blocksBytes, sigs), nil
}
func (st *syncStream) computeGetNodeData(rid uint64, hs []common.Hash) (*syncpb.Message, error) {
if len(hs) > GetNodeDataCap {
err := fmt.Errorf("GetNodeData amount exceed cap: %v > %v", len(hs), GetNodeDataCap)
return nil, err
}
data, err := st.chain.getNodeData(hs)
if err != nil {
return nil, err
}
return syncpb.MakeGetNodeDataResponseMessage(rid, data), nil
}
func (st *syncStream) computeGetReceipts(rid uint64, hs []common.Hash) (*syncpb.Message, error) {
if len(hs) > GetReceiptsCap {
err := fmt.Errorf("GetReceipts amount exceed cap: %v > %v", len(hs), GetReceiptsCap)
return nil, err
}
receipts, err := st.chain.getReceipts(hs)
if err != nil {
return nil, err
}
return syncpb.MakeGetReceiptsResponseMessage(rid, [][]byte(receipts)), nil
}
func bytesToHashes(bs [][]byte) []common.Hash {
hs := make([]common.Hash, 0, len(bs))
for _, b := range bs {

@ -248,7 +248,11 @@ func (cr *fakeChainReader) GetHeaderByNumber(number uint64) *block.Header
func (cr *fakeChainReader) GetHeaderByHash(hash common.Hash) *block.Header { return nil }
func (cr *fakeChainReader) GetHeader(hash common.Hash, number uint64) *block.Header { return nil }
func (cr *fakeChainReader) GetBlock(hash common.Hash, number uint64) *types.Block { return nil }
func (cr *fakeChainReader) GetReceiptsByHash(hash common.Hash) types.Receipts { return nil }
func (cr *fakeChainReader) ContractCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (cr *fakeChainReader) ValidatorCode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (cr *fakeChainReader) ReadShardState(epoch *big.Int) (*shard.State, error) { return nil, nil }
func (cr *fakeChainReader) TrieNode(hash common.Hash) ([]byte, error) { return []byte{}, nil }
func (cr *fakeChainReader) ReadValidatorList() ([]common.Address, error) { return nil, nil }
func (cr *fakeChainReader) ValidatorCandidates() []common.Address { return nil }
func (cr *fakeChainReader) SuperCommitteeForNextEpoch(

Loading…
Cancel
Save